kopia lustrzana https://github.com/SQ9MDD/TTGO-T-Beam-LoRa-APRS
FIX OLED Timeout at startup. Begin OLED Timeout settings in html
rodzic
9ce0f02b05
commit
fdd634eadc
|
@ -167,7 +167,7 @@
|
|||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="oled_enabled">OLED Display enabled</label>
|
||||
<input name="oled_enabled" id="oled_enabled" type="checkbox" value="1" title="ON: Display will turn ON when pushing button. OFF: Stays OFF">
|
||||
<input name="oled_enabled" id="oled_enabled" type="checkbox" value="1" title="Enables or disables OLED">
|
||||
</div>
|
||||
<div>
|
||||
<label for="bt_enabled">Bluetooth enabled</label>
|
||||
|
@ -184,17 +184,18 @@
|
|||
</div>
|
||||
<div class="grid-container quarters">
|
||||
<div>
|
||||
<label for="sh_rxtime">Display show RX time (s)</label>
|
||||
<label for="sh_rxtime">Display show RX time [s]</label>
|
||||
<input name="sh_rxtime" id="sh_rxtime" type="number" min="0" max="45" title="show RX packet for seconds">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<label for="sh_oledtime">Display timeout [s]</label>
|
||||
<input name="sh_oledtime" id="sh_oledtime" type="number" min="0" max="60" title="Turn OFF OLED after X seconds. Set 0 to disable">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<label for="shutdown_dt">Auto power off delay (s)</label>
|
||||
<label for="shutdown_dt">Auto power off delay [s]</label>
|
||||
<input name="shutdown_dt" id="shutdown_dt" type="number" min="3" max="3600" title="auto shutdown delay in seconds">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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());
|
||||
|
|
Ładowanie…
Reference in New Issue