stop background after 30s of no data from the heart rate sensor

This commit is contained in:
Patric Gruber 2023-05-25 23:41:26 +02:00
parent f94c074064
commit eeaf5374d4
2 changed files with 6 additions and 1 deletions

View file

@ -154,6 +154,10 @@ void HeartRateTask::HandleSensorData(int* lastBpm) {
state = States::BackgroundWaiting;
StartWaiting();
}
if (bpm == 0 && state == States::BackgroundMeasuring && xTaskGetTickCount() - measurementStart >= DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED) {
state = States::BackgroundWaiting;
StartWaiting();
}
}
int HeartRateTask::CurrentTaskDelay() {

View file

@ -7,7 +7,8 @@
#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED 30 * 1000 // 30 seconds assuming 1 Hz
#define DURATION_BETWEEN_BACKGROUND_MEASUREMENTS 5 * 60 * 1000 // 5 Minutes assuming 1 Hz
#define DURATION_BETWEEN_BACKGROUND_MEASUREMENTS 5 * 60 * 1000 // 5 minutes assuming 1 Hz
#define DURATION_UNTIL_BACKGROUND_MEASURMENT_IS_STOPPED 30 * 1000 // 30 seconds assuming 1 Hz
namespace Pinetime {
namespace Drivers {