Added display reconditioning function

This commit is contained in:
Mark Qvist 2024-12-31 14:13:52 +01:00
parent 2604b44d64
commit 571e7d7105
4 changed files with 42 additions and 7 deletions

View File

@ -99,6 +99,7 @@ uint32_t display_blanking_timeout = DISPLAY_BLANKING_TIMEOUT;
uint8_t display_unblank_intensity = display_intensity;
bool display_blanked = false;
bool display_tx = false;
bool recondition_display = false;
uint8_t disp_target_fps = 7;
int disp_update_interval = 1000/disp_target_fps;
uint32_t last_page_flip = 0;
@ -707,6 +708,21 @@ void update_disp_area() {
}
}
void display_recondition() {
for (uint8_t iy = 0; iy < disp_area.height(); iy++) {
unsigned char rand_seg [] = {random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF),random(0xFF)};
stat_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
disp_area.drawBitmap(0, iy, rand_seg, 64, 1, SSD1306_WHITE, SSD1306_BLACK);
}
display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
if (disp_mode == DISP_MODE_PORTRAIT) {
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
}
}
void update_display(bool blank = false) {
if (blank == true) {
last_disp_update = millis()-disp_update_interval-1;
@ -754,9 +770,15 @@ void update_display(bool blank = false) {
display.clearDisplay();
#endif
update_stat_area();
update_disp_area();
if (recondition_display) {
disp_target_fps = 30;
disp_update_interval = 1000/disp_target_fps;
display_recondition();
} else {
update_stat_area();
update_disp_area();
}
#if BOARD_MODEL != BOARD_TDECK
display.display();
#endif

View File

@ -57,6 +57,7 @@
#define CMD_DISP_ADDR 0x63
#define CMD_DISP_BLNK 0x64
#define CMD_DISP_ROT 0x67
#define CMD_DISP_RCND 0x68
#define CMD_NP_INT 0x65
#define CMD_BT_CTRL 0x46
#define CMD_BT_PIN 0x62

View File

@ -181,8 +181,8 @@ upload-heltec32_v3:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:heltec_wifi_lora_32_V3
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
#@sleep 3
#python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-tdeck:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3

View File

@ -1098,7 +1098,6 @@ void serialCallback(uint8_t sbyte) {
db_conf_save(sbyte);
display_unblank();
}
#endif
} else if (command == CMD_DISP_ROT) {
#if HAS_DISPLAY
@ -1113,7 +1112,20 @@ void serialCallback(uint8_t sbyte) {
drot_conf_save(sbyte);
display_unblank();
}
#endif
} else if (command == CMD_DISP_RCND) {
#if HAS_DISPLAY
if (sbyte == FESC) {
ESCAPE = true;
} else {
if (ESCAPE) {
if (sbyte == TFEND) sbyte = FEND;
if (sbyte == TFESC) sbyte = FESC;
ESCAPE = false;
}
if (sbyte > 0x00) recondition_display = true;
display_unblank();
}
#endif
} else if (command == CMD_NP_INT) {
#if HAS_NP