uint32_t last_unblank_event = 0;
uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
uint8_t display_unblank_intensity = display_intensity;
+bool display_blanked = false;
uint8_t disp_target_fps = 7;
int disp_update_interval = 1000/disp_target_fps;
uint32_t last_page_flip = 0;
void update_display(bool blank = false) {
if (display_blanking_enabled && millis()-last_unblank_event >= display_blanking_timeout) {
blank = true;
+ display_blanked = true;
if (display_intensity != 0) {
display_unblank_intensity = display_intensity;
}
display_intensity = 0;
} else {
+ display_blanked = false;
if (display_unblank_intensity != 0x00) {
display_intensity = display_unblank_intensity;
display_unblank_intensity = 0x00;
if (!queue_flushing) {
queue_flushing = true;
- display_unblank();
led_tx_on();
uint16_t processed = 0;
fifo16_push(&packet_lengths, l);
current_packet_start = queue_cursor;
- display_unblank();
}
}
} else if (command == CMD_DATA) {
if (bt_state != BT_STATE_CONNECTED) {
cable_state = CABLE_STATE_CONNECTED;
- display_unblank();
}
if (sbyte == FESC) {
ESCAPE = true;
void button_event(uint8_t event, unsigned long duration) {
#if MCU_VARIANT == MCU_ESP32
- display_unblank();
- if (duration > 10000) {
- #if HAS_CONSOLE
+ if (display_blanked) {
+ display_unblank();
+ } else {
+ if (duration > 10000) {
+ #if HAS_CONSOLE
+ #if HAS_BLUETOOTH || HAS_BLE
+ bt_stop();
+ #endif
+ console_active = true;
+ console_start();
+ #endif
+ } else if (duration > 5000) {
#if HAS_BLUETOOTH || HAS_BLE
- bt_stop();
+ if (bt_state != BT_STATE_CONNECTED) { bt_enable_pairing(); }
#endif
- console_active = true;
- console_start();
- #endif
- } else if (duration > 5000) {
- #if HAS_BLUETOOTH || HAS_BLE
- if (bt_state != BT_STATE_CONNECTED) { bt_enable_pairing(); }
- #endif
- } else if (duration > 700) {
- #if HAS_SLEEP
- sleep_now();
- #endif
- } else {
- #if HAS_BLUETOOTH || HAS_BLE
- if (bt_state != BT_STATE_CONNECTED) {
- if (bt_state == BT_STATE_OFF) {
- bt_start();
- bt_conf_save(true);
- } else {
- bt_stop();
- bt_conf_save(false);
+ } else if (duration > 700) {
+ #if HAS_SLEEP
+ sleep_now();
+ #endif
+ } else {
+ #if HAS_BLUETOOTH || HAS_BLE
+ if (bt_state != BT_STATE_CONNECTED) {
+ if (bt_state == BT_STATE_OFF) {
+ bt_start();
+ bt_conf_save(true);
+ } else {
+ bt_stop();
+ bt_conf_save(false);
+ }
}
+ #endif
}
- #endif
}
#endif
}