Commits (2)
......@@ -141,7 +141,12 @@ void loop() {
keepServicesAlive();
// Short press for night mode, Long press for calibration.
checkFlashButton();
// Inactive during calibration.
if (!(sensor::current_state == sensor::PREPARE_CALIBRATION_STABLE ||
sensor::current_state == sensor::PREPARE_CALIBRATION_UNSTABLE))
{
checkFlashButton();
}
checkSerialInput();
......
......@@ -30,21 +30,6 @@ namespace sensor {
char timestamp[23];
int16_t stable_measurements = 0;
/**
* Define sensor states
* BOOTUP -> initial state, until first >0 ppm values are returned
* READY -> sensor does output valid information (> 0 ppm) and no other condition takes place
* NEEDS_CALIBRATION -> sensor measurements are too low (< 250 ppm)
* PREPARE_CALIBRATION_UNSTABLE -> forced calibration was initiated, last measurements were too far apart
* PREPARE_CALIBRATION_STABLE -> forced calibration was initiated, last measurements were close to each others
*/
enum state {
BOOTUP,
READY,
NEEDS_CALIBRATION,
PREPARE_CALIBRATION_UNSTABLE,
PREPARE_CALIBRATION_STABLE
};
const char *state_names[] = {
"BOOTUP",
"READY",
......
......@@ -24,6 +24,24 @@ namespace sensor {
extern float humidity;
extern char timestamp[];
/**
* Define sensor states
* BOOTUP -> initial state, until first >0 ppm values are returned
* READY -> sensor does output valid information (> 0 ppm) and no other condition takes place
* NEEDS_CALIBRATION -> sensor measurements are too low (< 250 ppm)
* PREPARE_CALIBRATION_UNSTABLE -> forced calibration was initiated, last measurements were too far apart
* PREPARE_CALIBRATION_STABLE -> forced calibration was initiated, last measurements were close to each others
*/
enum state {
BOOTUP,
READY,
NEEDS_CALIBRATION,
PREPARE_CALIBRATION_UNSTABLE,
PREPARE_CALIBRATION_STABLE
};
extern state current_state;
void initialize();
bool processData();
void startCalibrationProcess();
......