File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,17 +18,23 @@ bool SSD1306Display::begin() {
1818}
1919
2020void 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
2829void 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}
Original file line number Diff line number Diff 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
5859build_src_filter = ${Heltec_lora32_v4.build_src_filter}
You can’t perform that action at this time.
0 commit comments