The m_time_start should be initialized, so that the time measurement
does not overflow sooner then 49 days after the start. Additionally the
m_time_start is reset in clear() method for the same reason.
The m_size was not adjusted upon creating a new measurement. This means
that no measurement but the last is was saved. This is now fixed.
: m_size{0}
, m_sensor{sensor}
, m_interval_ms{START_INTERVAL_MS}
+ , m_start_time{millis()}
{
}
thin_out();
m_pressure[m_size] = m_sensor.get_pressure();
m_time[m_size] = millis() - m_start_time;
+ ++m_size;
}
void Measurement::thin_out()
void Measurement::clear()
{
m_size = 0;
+ m_start_time = millis();
}
// The function calls get_measurement repeatedly. It uses these measurements to