Browse Source
Merge pull request #1570 from Quency-D/fix-heltec-power-consumption
Fix heltec-v4 power consumption
pull/1642/head
ripplebiz
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
10 additions and
3 deletions
-
src/helpers/ui/SSD1306Display.cpp
-
variants/heltec_v4/platformio.ini
|
|
@ -18,17 +18,23 @@ bool SSD1306Display::begin() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SSD1306Display::turnOn() { |
|
|
void SSD1306Display::turnOn() { |
|
|
display.ssd1306_command(SSD1306_DISPLAYON); |
|
|
|
|
|
if (!_isOn) { |
|
|
if (!_isOn) { |
|
|
if (_peripher_power) _peripher_power->claim(); |
|
|
if (_peripher_power) _peripher_power->claim(); |
|
|
_isOn = true; |
|
|
_isOn = true; // set before begin() to prevent double claim
|
|
|
|
|
|
if (_peripher_power) begin(); // re-init display after power was cut
|
|
|
} |
|
|
} |
|
|
|
|
|
display.ssd1306_command(SSD1306_DISPLAYON); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SSD1306Display::turnOff() { |
|
|
void SSD1306Display::turnOff() { |
|
|
display.ssd1306_command(SSD1306_DISPLAYOFF); |
|
|
display.ssd1306_command(SSD1306_DISPLAYOFF); |
|
|
if (_isOn) { |
|
|
if (_isOn) { |
|
|
if (_peripher_power) _peripher_power->release(); |
|
|
if (_peripher_power) { |
|
|
|
|
|
#if PIN_OLED_RESET >= 0 |
|
|
|
|
|
digitalWrite(PIN_OLED_RESET, LOW); |
|
|
|
|
|
#endif |
|
|
|
|
|
_peripher_power->release(); |
|
|
|
|
|
} |
|
|
_isOn = false; |
|
|
_isOn = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
@ -53,6 +53,7 @@ build_flags = |
|
|
-D HELTEC_LORA_V4_OLED |
|
|
-D HELTEC_LORA_V4_OLED |
|
|
-D PIN_BOARD_SDA=17 |
|
|
-D PIN_BOARD_SDA=17 |
|
|
-D PIN_BOARD_SCL=18 |
|
|
-D PIN_BOARD_SCL=18 |
|
|
|
|
|
-D PIN_OLED_RESET=21 |
|
|
-D ENV_PIN_SDA=4 |
|
|
-D ENV_PIN_SDA=4 |
|
|
-D ENV_PIN_SCL=3 |
|
|
-D ENV_PIN_SCL=3 |
|
|
build_src_filter= ${Heltec_lora32_v4.build_src_filter} |
|
|
build_src_filter= ${Heltec_lora32_v4.build_src_filter} |
|
|
|