diff --git a/data_embed/index.html b/data_embed/index.html
index df8bb67..b1ac838 100644
--- a/data_embed/index.html
+++ b/data_embed/index.html
@@ -167,7 +167,7 @@
-
+
@@ -184,17 +184,18 @@
diff --git a/data_embed/style.css b/data_embed/style.css
index 6f2db9d..8d5b22e 100644
--- a/data_embed/style.css
+++ b/data_embed/style.css
@@ -477,8 +477,8 @@ html {
padding: 20px;
text-align: center;
display: grid;
- grid-gap: 20px;
- gap: 20px;
+ grid-gap: 5px;
+ gap: 5px;
/* by default use min 200px wide columns auto-fit into width */
grid-template-columns: minmax(200px, 1fr);
diff --git a/include/preference_storage.h b/include/preference_storage.h
index 1d539da..d665170 100644
--- a/include/preference_storage.h
+++ b/include/preference_storage.h
@@ -3,7 +3,6 @@
#ifndef PREF_STORAGE
#define PREF_STORAGE
-
#define ENABLE_PREFERENCES
extern Preferences preferences;
@@ -47,7 +46,7 @@ static const char *const PREF_APRS_SB_MAX_SPEED_PRESET_INIT = "sb_max_speed_i";
static const char *const PREF_APRS_SB_ANGLE_PRESET = "sb_angle";
static const char *const PREF_APRS_SB_ANGLE_PRESET_INIT = "sb_angle_i";
-//
+// Device settings
static const char *const PREF_APRS_GPS_EN = "gps_enabled";
static const char *const PREF_APRS_GPS_EN_INIT = "gps_state_init";
static const char *const PREF_APRS_SHOW_CMT = "show_cmt";
@@ -62,6 +61,7 @@ static const char *const PREF_DEV_AUTO_SHUT = "shutdown_act";
static const char *const PREF_DEV_AUTO_SHUT_INIT = "shutdown_actini";
static const char *const PREF_DEV_AUTO_SHUT_PRESET = "shutdown_dt";
static const char *const PREF_DEV_AUTO_SHUT_PRESET_INIT = "shutdown_dtini";
-
+static const char *const PREF_DEV_SHOW_OLED_TIME = "sh_oledtime"; // set OLED timeout
+static const char *const PREF_DEV_SHOW_OLED_TIME_INIT = "sh_oledtime_init";
#endif
diff --git a/platformio.ini b/platformio.ini
index 6bbdc56..789c4e3 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -52,6 +52,7 @@ build_flags =
-D 'MAX_TIME_TO_NEXT_TX=120000L' ; can be set from www interfeace
-D 'FIX_BEACON_INTERVAL=1800000L' ; can be set from www interfeace
-D 'NETWORK_GPS_PORT=10110' ; GPS NMEA Port
+ -D 'SHOW_OLED_TIME=15000' ; OLED Timeout
[env:ttgo-t-beam-v1.0]
platform = espressif32 @ 3.0.0
diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino
index 1ca29f8..9c51af0 100644
--- a/src/TTGO_T-Beam_LoRa_APRS.ino
+++ b/src/TTGO_T-Beam_LoRa_APRS.ino
@@ -184,9 +184,9 @@ boolean shutdown_usb_status_bef = false;
// Variables required to Power Save OLED
// With "Display dimmer enabled" it will turn OLED off after some time
// if the checkbox is disabled the display stays OFF
-uint oled_timeout; // OLED Timeout, same as "Display show RX Time"
+uint oled_timeout = SHOW_OLED_TIME; // OLED Timeout
bool tempOled = true; // Turn ON OLED at first startup
-ulong oled_timer = millis();
+ulong oled_timer;
// Variable to manually send beacon from html page
bool manBeacon = false;
@@ -671,8 +671,13 @@ void setup(){
preferences.putInt(PREF_DEV_SHOW_RX_TIME, showRXTime/1000);
}
showRXTime = preferences.getInt(PREF_DEV_SHOW_RX_TIME) * 1000;
- // Use same timer for OLED timeout
- oled_timeout = showRXTime;
+
+ // Read OLED RX Timer
+ if (!preferences.getBool(PREF_DEV_SHOW_OLED_TIME_INIT)){
+ preferences.putBool(PREF_DEV_SHOW_OLED_TIME_INIT, true);
+ preferences.putInt(PREF_DEV_SHOW_OLED_TIME, showRXTime/1000);
+ }
+ oled_timeout = preferences.getInt(PREF_DEV_SHOW_OLED_TIME) * 1000;
if (!preferences.getBool(PREF_DEV_AUTO_SHUT_PRESET_INIT)){
preferences.putBool(PREF_DEV_AUTO_SHUT_PRESET_INIT, true);
@@ -839,6 +844,9 @@ void setup(){
time_to_refresh = millis() + showRXTime;
displayInvalidGPS();
digitalWrite(TXLED, HIGH);
+
+ // Hold the OLED ON at first boot
+ oled_timer=millis()+oled_timeout;
}
void enableOled() {
@@ -882,7 +890,12 @@ void loop() {
}
// Only wake up OLED when necessary, note that DIM is to turn OFF the backlight
if (enabled_oled) {
+ if (oled_timeout>0) {
display.dim(!tempOled);
+ } else {
+ // If timeout is 0 keep OLED awake
+ display.dim(false);
+ }
}
if (tempOled && millis()>= oled_timer) {
diff --git a/src/taskWebServer.cpp b/src/taskWebServer.cpp
index 5f750ac..1f0b987 100644
--- a/src/taskWebServer.cpp
+++ b/src/taskWebServer.cpp
@@ -185,6 +185,7 @@ void handle_Cfg() {
jsonData += jsonLineFromPreferenceInt(PREF_DEV_SHOW_RX_TIME);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_AUTO_SHUT);
jsonData += jsonLineFromPreferenceInt(PREF_DEV_AUTO_SHUT_PRESET);
+ jsonData += jsonLineFromPreferenceInt(PREF_DEV_SHOW_OLED_TIME);
jsonData += jsonLineFromInt("FreeHeap", ESP.getFreeHeap());
jsonData += jsonLineFromInt("HeapSize", ESP.getHeapSize());
jsonData += jsonLineFromInt("FreeSketchSpace", ESP.getFreeSketchSpace());
@@ -280,6 +281,10 @@ void handle_saveDeviceCfg(){
if (server.hasArg(PREF_DEV_SHOW_RX_TIME)){
preferences.putInt(PREF_DEV_SHOW_RX_TIME, server.arg(PREF_DEV_SHOW_RX_TIME).toInt());
}
+ // Manage OLED Timeout
+ if (server.hasArg(PREF_DEV_SHOW_OLED_TIME)){
+ preferences.putInt(PREF_DEV_SHOW_OLED_TIME, server.arg(PREF_DEV_SHOW_OLED_TIME).toInt());
+ }
preferences.putBool(PREF_DEV_AUTO_SHUT, server.hasArg(PREF_DEV_AUTO_SHUT));
if (server.hasArg(PREF_DEV_AUTO_SHUT_PRESET)){
preferences.putInt(PREF_DEV_AUTO_SHUT_PRESET, server.arg(PREF_DEV_AUTO_SHUT_PRESET).toInt());