mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
techo: display backlight behavior
This commit is contained in:
parent
1a41da6bf2
commit
3cdf2f9b4d
3 changed files with 12 additions and 2 deletions
|
|
@ -519,6 +519,14 @@ void UITask::loop() {
|
||||||
c = handleLongPress(KEY_ENTER);
|
c = handleLongPress(KEY_ENTER);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)
|
||||||
|
static int next_btn_check = 0;
|
||||||
|
if (millis() > next_btn_check) {
|
||||||
|
bool touch_state = digitalRead(PIN_BUTTON2);
|
||||||
|
digitalWrite(DISP_BACKLIGHT, !touch_state);
|
||||||
|
next_btn_check = millis() + 300;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (c != 0 && curr) {
|
if (c != 0 && curr) {
|
||||||
curr->handleInput(c);
|
curr->handleInput(c);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ bool GxEPDDisplay::begin() {
|
||||||
display.fillScreen(GxEPD_WHITE);
|
display.fillScreen(GxEPD_WHITE);
|
||||||
display.display(true);
|
display.display(true);
|
||||||
#if DISP_BACKLIGHT
|
#if DISP_BACKLIGHT
|
||||||
|
digitalWrite(DISP_BACKLIGHT, LOW);
|
||||||
pinMode(DISP_BACKLIGHT, OUTPUT);
|
pinMode(DISP_BACKLIGHT, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
_init = true;
|
_init = true;
|
||||||
|
|
@ -27,14 +28,14 @@ bool GxEPDDisplay::begin() {
|
||||||
|
|
||||||
void GxEPDDisplay::turnOn() {
|
void GxEPDDisplay::turnOn() {
|
||||||
if (!_init) begin();
|
if (!_init) begin();
|
||||||
#if DISP_BACKLIGHT
|
#if defined(DISP_BACKLIGHT) && !defined(BACLIGHT_BTN)
|
||||||
digitalWrite(DISP_BACKLIGHT, HIGH);
|
digitalWrite(DISP_BACKLIGHT, HIGH);
|
||||||
#endif
|
#endif
|
||||||
_isOn = true;
|
_isOn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxEPDDisplay::turnOff() {
|
void GxEPDDisplay::turnOff() {
|
||||||
#if DISP_BACKLIGHT
|
#if defined(DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
|
||||||
digitalWrite(DISP_BACKLIGHT, LOW);
|
digitalWrite(DISP_BACKLIGHT, LOW);
|
||||||
#endif
|
#endif
|
||||||
_isOn = false;
|
_isOn = false;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ build_flags =
|
||||||
-D DISPLAY_CLASS=GxEPDDisplay
|
-D DISPLAY_CLASS=GxEPDDisplay
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
-D UI_RECENT_LIST_SIZE=9
|
-D UI_RECENT_LIST_SIZE=9
|
||||||
|
-D BACKLIGHT_BTN=PIN_BUTTON2
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${LilyGo_Techo.build_src_filter}
|
build_src_filter = ${LilyGo_Techo.build_src_filter}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue