Skip to content

Commit

Permalink
Fix display brightness initialization in CO2_Gadget.ino. Turns ON dis…
Browse files Browse the repository at this point in the history
…play backlight on first boot even if configured to turn off after some time in "Time to Off"
  • Loading branch information
melkati committed Apr 10, 2024
1 parent 6ad6717 commit 0b58fe4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CO2_Gadget.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ uint16_t batteryFullyChargedMillivolts = 4200; // Voltage of battery when it is

// Variables to control automatic display off to save power
bool workingOnExternalPower = true; // True if working on external power (USB connected)
uint32_t actualDisplayBrightness = 100; // To know if it's on or off
uint32_t actualDisplayBrightness = 0; // To know if it's on or off
bool displayOffOnExternalPower = false;
uint16_t timeToDisplayOff = 0; // Time in seconds to turn off the display to save power.
volatile uint64_t lastTimeButtonPressed = 0; // Last time stamp button up was pressed
Expand Down
1 change: 1 addition & 0 deletions CO2_Gadget_OLED.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void initDisplay() {
} else {
u8g2.setDisplayRotation(U8G2_R0);
}
setDisplayBrightness(DisplayBrightness);
displaySplashScreen();
delay(1000);
}
Expand Down
1 change: 1 addition & 0 deletions CO2_Gadget_TFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ void initDisplay() {
setElementLocations();
tft.setTextSize(2);
initBacklight();
setDisplayBrightness(DisplayBrightness);
displaySplashScreen(); // Display init and splash screen
delay(2000); // Enjoy the splash screen for 2 seconds
spr.setColorDepth(16);
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ build_flags =

-D MQTT_BROKER_SERVER="\"192.168.1.145"\"
-D CO2_GADGET_VERSION="\"0.12."\"
-D CO2_GADGET_REV="\"021"\"
-D CO2_GADGET_REV="\"022"\"
-D CORE_DEBUG_LEVEL=0
-DCACHE_DIR=".pio/build"
-DBUZZER_PIN=2 ; ESP32 pin GPIO13 connected to piezo buzzer
Expand Down

0 comments on commit 0b58fe4

Please sign in to comment.