File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
examples/companion_radio/ui-new Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -519,6 +519,14 @@ void UITask::loop() {
519519 c = handleLongPress (KEY_ENTER);
520520 }
521521#endif
522+ #if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)
523+ static int next_btn_check = 0 ;
524+ if (millis () > next_btn_check) {
525+ bool touch_state = digitalRead (PIN_BUTTON2);
526+ digitalWrite (DISP_BACKLIGHT, !touch_state);
527+ next_btn_check = millis () + 300 ;
528+ }
529+ #endif
522530
523531 if (c != 0 && curr) {
524532 curr->handleInput (c);
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ bool GxEPDDisplay::begin() {
1919 display.fillScreen (GxEPD_WHITE);
2020 display.display (true );
2121 #if DISP_BACKLIGHT
22+ digitalWrite (DISP_BACKLIGHT, LOW);
2223 pinMode (DISP_BACKLIGHT, OUTPUT);
2324 #endif
2425 _init = true ;
@@ -27,14 +28,14 @@ bool GxEPDDisplay::begin() {
2728
2829void GxEPDDisplay::turnOn () {
2930 if (!_init) begin ();
30- #if DISP_BACKLIGHT
31+ #if defined( DISP_BACKLIGHT) && !defined(BACLIGHT_BTN)
3132 digitalWrite (DISP_BACKLIGHT, HIGH);
3233#endif
3334 _isOn = true ;
3435}
3536
3637void GxEPDDisplay::turnOff () {
37- #if DISP_BACKLIGHT
38+ #if defined( DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
3839 digitalWrite (DISP_BACKLIGHT, LOW);
3940#endif
4041 _isOn = false ;
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ build_flags =
7878 -D DISPLAY_CLASS =GxEPDDisplay
7979 -D OFFLINE_QUEUE_SIZE =256
8080 -D UI_RECENT_LIST_SIZE =9
81+ -D BACKLIGHT_BTN =PIN_BUTTON2
8182; -D MESH_PACKET_LOGGING=1
8283; -D MESH_DEBUG=1
8384build_src_filter = ${LilyGo_Techo.build_src_filter}
You can’t perform that action at this time.
0 commit comments