mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2025-02-10 20:19:03 -05:00
Updated display blanking/unblanking
This commit is contained in:
parent
0b9f19916e
commit
423098ff30
@ -67,6 +67,7 @@ uint32_t last_disp_update = 0;
|
||||
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;
|
||||
@ -597,11 +598,13 @@ void update_disp_area() {
|
||||
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;
|
||||
|
@ -427,7 +427,6 @@ void flushQueue(void) {
|
||||
if (!queue_flushing) {
|
||||
queue_flushing = true;
|
||||
|
||||
display_unblank();
|
||||
led_tx_on();
|
||||
uint16_t processed = 0;
|
||||
|
||||
@ -588,7 +587,6 @@ void serialCallback(uint8_t sbyte) {
|
||||
fifo16_push(&packet_lengths, l);
|
||||
|
||||
current_packet_start = queue_cursor;
|
||||
display_unblank();
|
||||
}
|
||||
|
||||
}
|
||||
@ -604,7 +602,6 @@ void serialCallback(uint8_t sbyte) {
|
||||
} else if (command == CMD_DATA) {
|
||||
if (bt_state != BT_STATE_CONNECTED) {
|
||||
cable_state = CABLE_STATE_CONNECTED;
|
||||
display_unblank();
|
||||
}
|
||||
if (sbyte == FESC) {
|
||||
ESCAPE = true;
|
||||
@ -1378,35 +1375,38 @@ void sleep_now() {
|
||||
|
||||
void button_event(uint8_t event, unsigned long duration) {
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
display_unblank();
|
||||
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
|
||||
if (bt_state != BT_STATE_CONNECTED) { bt_enable_pairing(); }
|
||||
#endif
|
||||
} else if (duration > 700) {
|
||||
#if HAS_SLEEP
|
||||
sleep_now();
|
||||
#endif
|
||||
if (display_blanked) {
|
||||
display_unblank();
|
||||
} 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);
|
||||
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
|
||||
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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user