Skip to content

Commit 3f33455

Browse files
authored
Merge pull request #1570 from Quency-D/fix-heltec-power-consumption
Fix heltec-v4 power consumption
2 parents 248c310 + 9efb7cb commit 3f33455

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/helpers/ui/SSD1306Display.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ bool SSD1306Display::begin() {
1818
}
1919

2020
void SSD1306Display::turnOn() {
21-
display.ssd1306_command(SSD1306_DISPLAYON);
2221
if (!_isOn) {
2322
if (_peripher_power) _peripher_power->claim();
24-
_isOn = true;
23+
_isOn = true; // set before begin() to prevent double claim
24+
if (_peripher_power) begin(); // re-init display after power was cut
2525
}
26+
display.ssd1306_command(SSD1306_DISPLAYON);
2627
}
2728

2829
void SSD1306Display::turnOff() {
2930
display.ssd1306_command(SSD1306_DISPLAYOFF);
3031
if (_isOn) {
31-
if (_peripher_power) _peripher_power->release();
32+
if (_peripher_power) {
33+
#if PIN_OLED_RESET >= 0
34+
digitalWrite(PIN_OLED_RESET, LOW);
35+
#endif
36+
_peripher_power->release();
37+
}
3238
_isOn = false;
3339
}
3440
}

variants/heltec_v4/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ build_flags =
5353
-D HELTEC_LORA_V4_OLED
5454
-D PIN_BOARD_SDA=17
5555
-D PIN_BOARD_SCL=18
56+
-D PIN_OLED_RESET=21
5657
-D ENV_PIN_SDA=4
5758
-D ENV_PIN_SCL=3
5859
build_src_filter= ${Heltec_lora32_v4.build_src_filter}

0 commit comments

Comments
 (0)