@@ -16,14 +16,14 @@ void BoschSensortec::begin()
1616 auto ret = bhy2_init (BHY2_SPI_INTERFACE, bhy2_spi_read, bhy2_spi_write, bhy2_delay_us, MAX_READ_WRITE_LEN, NULL , &_bhy2);
1717 if (_debug) _debug->println (get_api_error (ret));
1818
19+ // Print bhi status
1920 uint8_t stat;
2021 ret = bhy2_get_boot_status (&stat, &_bhy2);
2122 if (_debug) {
2223 _debug->println (get_api_error (ret));
2324 _debug->print (" Boot status: " );
2425 _debug->println (stat, HEX);
2526 }
26-
2727 ret = bhy2_get_host_interrupt_ctrl (&stat, &_bhy2);
2828 if (_debug) {
2929 _debug->println (get_api_error (ret));
@@ -44,6 +44,7 @@ void BoschSensortec::begin()
4444 ret = bhy2_get_and_process_fifo (_workBuffer, WORK_BUFFER_SIZE, &_bhy2);
4545 if (_debug) _debug->println (get_api_error (ret));
4646
47+ // All sensors' data are handled in the same generic way
4748 for (uint8_t i = 1 ; i < BHY2_SENSOR_ID_MAX; i++) {
4849 bhy2_register_fifo_parse_callback (i, BoschParser::parseData, NULL , &_bhy2);
4950 }
@@ -69,11 +70,9 @@ bool BoschSensortec::readSensorData(SensorDataPacket &data)
6970
7071void BoschSensortec::addSensorData (const SensorDataPacket &sensorData)
7172{
72- if (!_sensorQueue.full ()) {
73- _sensorQueue.push (sensorData);
74- } else {
75- // handle the queue by storing it in flash if full
76- }
73+ // Overwrites oldest data when fifo is full
74+ _sensorQueue.push (sensorData);
75+ // Alternative: handle the full queue by storing it in flash
7776}
7877
7978void BoschSensortec::update ()
0 commit comments