application_state.mode_changed = false;
- delay_ms(250);
- application_state.debounce_wait = false;
-
return true;
}
}
void cb_mode_pressed() {
- if (application_state.debounce_wait) return;
- application_state.debounce_wait = true;
-
application_state.mode = (application_state.mode + 1) % NUM_MODES;
application_state.mode_changed = true;
application_state.mode_ticks = 300;
}
void cb_light_pressed() {
- if (application_state.debounce_wait) return;
- application_state.debounce_wait = true;
-
switch (application_state.mode) {
case MODE_PREFS:
prefs_mode_handle_secondary_button();
}
void cb_alarm_pressed() {
- if (application_state.debounce_wait) return;
- application_state.debounce_wait = true;
-
switch (application_state.mode) {
case MODE_LOG:
log_mode_handle_primary_button();
bool led_on; // Indicates that the LED is on
uint8_t page; // Tracks the current page in log, prefs or settings.
bool is_fahrenheit; // User preference, C or F
- bool debounce_wait; // For debouncing button inputs
// Data logging
SensorReading logged_data[MAX_DATA_POINTS];