mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-03-30 19:15:49 +00:00
thinknode_m5: manage baclight
This commit is contained in:
@@ -716,10 +716,14 @@ void UITask::loop() {
|
||||
_analogue_pin_read_millis = millis();
|
||||
}
|
||||
#endif
|
||||
#if defined(DISP_BACKLIGHT) && defined(BACKLIGHT_BTN)
|
||||
#if defined(BACKLIGHT_BTN)
|
||||
if (millis() > next_backlight_btn_check) {
|
||||
bool touch_state = digitalRead(PIN_BUTTON2);
|
||||
#if defined(DISP_BACKLIGHT)
|
||||
digitalWrite(DISP_BACKLIGHT, !touch_state);
|
||||
#elif defined(EXP_PIN_BACKLIGHT)
|
||||
expander.digitalWrite(EXP_PIN_BACKLIGHT, !touch_state);
|
||||
#endif
|
||||
next_backlight_btn_check = millis() + 300;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
|
||||
#include "GxEPDDisplay.h"
|
||||
|
||||
#ifdef EXP_PIN_BACKLIGHT
|
||||
#include <PCA9557.h>
|
||||
extern PCA9557 expander;
|
||||
#endif
|
||||
|
||||
#ifndef DISPLAY_ROTATION
|
||||
#define DISPLAY_ROTATION 3
|
||||
#endif
|
||||
@@ -35,6 +40,8 @@ void GxEPDDisplay::turnOn() {
|
||||
if (!_init) begin();
|
||||
#if defined(DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
|
||||
digitalWrite(DISP_BACKLIGHT, HIGH);
|
||||
#elif defined(EXP_PIN_BACKLIGHT) && !defined(BACKLIGHT_BTN)
|
||||
expander.digitalWrite(EXP_PIN_BACKLIGHT, HIGH);
|
||||
#endif
|
||||
_isOn = true;
|
||||
}
|
||||
@@ -42,6 +49,8 @@ void GxEPDDisplay::turnOn() {
|
||||
void GxEPDDisplay::turnOff() {
|
||||
#if defined(DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
|
||||
digitalWrite(DISP_BACKLIGHT, LOW);
|
||||
#elif defined(EXP_PIN_BACKLIGHT) && !defined(BACKLIGHT_BTN)
|
||||
expander.digitalWrite(EXP_PIN_BACKLIGHT, LOW);
|
||||
#endif
|
||||
_isOn = false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
PCA9557 expander (0x18, &Wire1);
|
||||
|
||||
void ThinknodeM5Board::begin() {
|
||||
// Start expander
|
||||
// Start expander and configure pins
|
||||
Wire1.begin(48, 47);
|
||||
expander.pinMode(EXP_PIN_POWER, OUTPUT); // eink
|
||||
expander.pinMode(EXP_PIN_BACKLIGHT, OUTPUT); // peripherals
|
||||
@@ -11,7 +11,6 @@ void ThinknodeM5Board::begin() {
|
||||
expander.digitalWrite(EXP_PIN_POWER, HIGH);
|
||||
expander.digitalWrite(EXP_PIN_BACKLIGHT, LOW);
|
||||
expander.digitalWrite(EXP_PIN_LED, LOW);
|
||||
|
||||
ESP32Board::begin();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ build_flags = ${esp32_base.build_flags}
|
||||
-D P_LORA_MISO=7
|
||||
-D P_LORA_MOSI=15
|
||||
-D PIN_USER_BTN=21
|
||||
-D PIN_BUTTON2=14
|
||||
-D EXP_PIN_LED=1
|
||||
# -D PIN_STATUS_LED=1 ; leds are on PCA !!!
|
||||
# -D LED_STATE_ON=HIGH
|
||||
@@ -29,6 +30,8 @@ build_flags = ${esp32_base.build_flags}
|
||||
-D EINK_SCALE_Y=1.5625f
|
||||
-D EINK_X_OFFSET=0
|
||||
-D EINK_Y_OFFSET=10
|
||||
-D BACKLIGHT_BTN=PIN_BUTTON2
|
||||
-D AUTO_OFF_MILLIS=0
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=3.3
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
|
||||
@@ -24,8 +24,6 @@ SensorManager sensors;
|
||||
bool radio_init() {
|
||||
fallback_clock.begin();
|
||||
rtc_clock.begin(Wire);
|
||||
// pinMode(21, INPUT);
|
||||
// pinMode(48, OUTPUT);
|
||||
pinMode(P_LORA_EN, OUTPUT);
|
||||
digitalWrite(P_LORA_EN, HIGH);
|
||||
#if defined(P_LORA_SCLK)
|
||||
|
||||
Reference in New Issue
Block a user