diff --git a/src/heartratetask/HeartRateTask.cpp b/src/heartratetask/HeartRateTask.cpp index f79ff6cc..fc28bb6e 100644 --- a/src/heartratetask/HeartRateTask.cpp +++ b/src/heartratetask/HeartRateTask.cpp @@ -64,10 +64,18 @@ void HeartRateTask::Work() { } } - if (state == States::BackgroundWaiting) { - HandleBackgroundWaiting(); - } else if (state == States::BackgroundMeasuring || state == States::Measuring) { - HandleSensorData(&lastBpm); + switch (state) { + case States::BackgroundWaiting: + HandleBackgroundWaiting(); + break; + case States::BackgroundMeasuring: + case States::Measuring: + HandleSensorData(&lastBpm); + break; + case States::Idle: + case States::Running: + // nothing to do -> ignore + break; } } }