mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-05-25 09:40:51 -04:00
Updated display blanking/unblanking
This commit is contained in:
parent
0b9f19916e
commit
423098ff30
2 changed files with 32 additions and 29 deletions
|
@ -67,6 +67,7 @@ uint32_t last_disp_update = 0;
|
||||||
uint32_t last_unblank_event = 0;
|
uint32_t last_unblank_event = 0;
|
||||||
uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
|
uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
|
||||||
uint8_t display_unblank_intensity = display_intensity;
|
uint8_t display_unblank_intensity = display_intensity;
|
||||||
|
bool display_blanked = false;
|
||||||
uint8_t disp_target_fps = 7;
|
uint8_t disp_target_fps = 7;
|
||||||
int disp_update_interval = 1000/disp_target_fps;
|
int disp_update_interval = 1000/disp_target_fps;
|
||||||
uint32_t last_page_flip = 0;
|
uint32_t last_page_flip = 0;
|
||||||
|
@ -597,11 +598,13 @@ void update_disp_area() {
|
||||||
void update_display(bool blank = false) {
|
void update_display(bool blank = false) {
|
||||||
if (display_blanking_enabled && millis()-last_unblank_event >= display_blanking_timeout) {
|
if (display_blanking_enabled && millis()-last_unblank_event >= display_blanking_timeout) {
|
||||||
blank = true;
|
blank = true;
|
||||||
|
display_blanked = true;
|
||||||
if (display_intensity != 0) {
|
if (display_intensity != 0) {
|
||||||
display_unblank_intensity = display_intensity;
|
display_unblank_intensity = display_intensity;
|
||||||
}
|
}
|
||||||
display_intensity = 0;
|
display_intensity = 0;
|
||||||
} else {
|
} else {
|
||||||
|
display_blanked = false;
|
||||||
if (display_unblank_intensity != 0x00) {
|
if (display_unblank_intensity != 0x00) {
|
||||||
display_intensity = display_unblank_intensity;
|
display_intensity = display_unblank_intensity;
|
||||||
display_unblank_intensity = 0x00;
|
display_unblank_intensity = 0x00;
|
||||||
|
|
|
@ -427,7 +427,6 @@ void flushQueue(void) {
|
||||||
if (!queue_flushing) {
|
if (!queue_flushing) {
|
||||||
queue_flushing = true;
|
queue_flushing = true;
|
||||||
|
|
||||||
display_unblank();
|
|
||||||
led_tx_on();
|
led_tx_on();
|
||||||
uint16_t processed = 0;
|
uint16_t processed = 0;
|
||||||
|
|
||||||
|
@ -588,7 +587,6 @@ void serialCallback(uint8_t sbyte) {
|
||||||
fifo16_push(&packet_lengths, l);
|
fifo16_push(&packet_lengths, l);
|
||||||
|
|
||||||
current_packet_start = queue_cursor;
|
current_packet_start = queue_cursor;
|
||||||
display_unblank();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -604,7 +602,6 @@ void serialCallback(uint8_t sbyte) {
|
||||||
} else if (command == CMD_DATA) {
|
} else if (command == CMD_DATA) {
|
||||||
if (bt_state != BT_STATE_CONNECTED) {
|
if (bt_state != BT_STATE_CONNECTED) {
|
||||||
cable_state = CABLE_STATE_CONNECTED;
|
cable_state = CABLE_STATE_CONNECTED;
|
||||||
display_unblank();
|
|
||||||
}
|
}
|
||||||
if (sbyte == FESC) {
|
if (sbyte == FESC) {
|
||||||
ESCAPE = true;
|
ESCAPE = true;
|
||||||
|
@ -1378,35 +1375,38 @@ void sleep_now() {
|
||||||
|
|
||||||
void button_event(uint8_t event, unsigned long duration) {
|
void button_event(uint8_t event, unsigned long duration) {
|
||||||
#if MCU_VARIANT == MCU_ESP32
|
#if MCU_VARIANT == MCU_ESP32
|
||||||
display_unblank();
|
if (display_blanked) {
|
||||||
if (duration > 10000) {
|
display_unblank();
|
||||||
#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
|
|
||||||
if (bt_state != BT_STATE_CONNECTED) { bt_enable_pairing(); }
|
|
||||||
#endif
|
|
||||||
} else if (duration > 700) {
|
|
||||||
#if HAS_SLEEP
|
|
||||||
sleep_now();
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#if HAS_BLUETOOTH || HAS_BLE
|
if (duration > 10000) {
|
||||||
if (bt_state != BT_STATE_CONNECTED) {
|
#if HAS_CONSOLE
|
||||||
if (bt_state == BT_STATE_OFF) {
|
#if HAS_BLUETOOTH || HAS_BLE
|
||||||
bt_start();
|
bt_stop();
|
||||||
bt_conf_save(true);
|
#endif
|
||||||
} else {
|
console_active = true;
|
||||||
bt_stop();
|
console_start();
|
||||||
bt_conf_save(false);
|
#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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue