state-hander: timer for sensors
This commit is contained in:
parent
8212890897
commit
6cf950cc98
@ -116,6 +116,7 @@ private:
|
||||
int saved_set_value[2] = { 0, 0 };
|
||||
int saved_curr_value[2] = { 0, 0 };
|
||||
int sensors_data[4] = { 0 };
|
||||
int sensor_timer = 0;
|
||||
LiquidCrystal *_lcd;
|
||||
Fan *_propeller;
|
||||
PressureWrapper *_pressure;
|
||||
|
||||
@ -19,7 +19,7 @@ enum _global_values
|
||||
{
|
||||
LCD_SIZE = 16,
|
||||
TIMER_GLOBAL_TIMEOUT = 120000,
|
||||
TIMER_SENSORS_TIMEOUT = 5000,
|
||||
TIMER_SENSORS_TIMEOUT = 5,
|
||||
TIMER_PRESSURE_TIMEOUT = 150,
|
||||
TIMER_ERROR_VALUE = -255,
|
||||
};
|
||||
|
||||
@ -217,14 +217,16 @@ StateHandler::handleControlButtons (uint8_t button)
|
||||
void
|
||||
StateHandler::handleTickValue (int value)
|
||||
{
|
||||
if (value % TIMER_SENSORS_TIMEOUT == 0)
|
||||
if (sensor_timer > TIMER_SENSORS_TIMEOUT)
|
||||
{
|
||||
updateSensorValues ();
|
||||
// displaySet (SENSORS);
|
||||
displaySet (SENSORS);
|
||||
sensor_timer = 0;
|
||||
}
|
||||
if (value > TIMER_PRESSURE_TIMEOUT)
|
||||
{
|
||||
SetState (&StateHandler::stateGetPressure);
|
||||
++sensor_timer;
|
||||
state_timer->resetCounter ();
|
||||
}
|
||||
if (value == TIMER_ERROR_VALUE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user