Merge pull request #73 from iu2frl/master

Fixed OLED startup issue, added timer to html page
pull/74/head refs/heads/master-2021-09-15T184011
Rysiek Labus (SQ9MDD) 2021-09-15 20:39:00 +02:00 zatwierdzone przez GitHub
commit a3873a4110
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
7 zmienionych plików z 70 dodań i 19 usunięć

Wyświetl plik

@ -19,7 +19,7 @@ After connection with APRX based DIGI it can be used as KISS-TNC
## User key functions:
### short press (OLED Enabled):
* if OLED is OFF a short press will wake it up and show current data
* if OLED is OFF a short press will wake it up and show current data (as "Display Timeout" seconds)
* if OLED is ON with GPS-FIX immediate sending of a frame with the position from the GPS
* if OLED is ON without GPS-FIX, immediate sending of the frame with the position saved in the configuration
@ -68,12 +68,38 @@ Wait for the board to reboot, connect to "N0CALL AP" WiFi network, password is:
### WiFi Settings
you can scan for local SSID or manually type in name and password
* Scan WiFi: scan for local WiFi networks
* SSID: name of the AP to connect to
* Password: password of WiFi AP
### APRS Settings
These are main APRS settings such as callsign, SSID and symbol (refer to: http://www.aprs.org/symbols.html). Please remember to turn ON GPS in order to use it as a tracker
These are main APRS settings such as callsign, SSID and symbol (refer to: http://www.aprs.org/symbols.html). Please remember to turn ON GPS in order to use it as a tracker.
* Frequency: frequency of receive and transmit
* Speed: speed of the LoRa APRS packet (default: 300)
* Callsign and SSID: Callsign of the tracker (e.g: N0CALL-10)
* Relay PATH: destination path of APRS packet
* Symbol table & Symbol: custom APRS icon
* Show altitude: allow altitude to be reported
* Show comment: includes comment in APRS packet
* Comment: custom message to send
* Show Battery: includes current battery voltage
* Fixed beacon: enables static beacon transmission
* Fixed beacon interval: beacon interval in seconds (please more than 30 minutes to avoid overflow on the network)
* Latitude & Longitude: fixed beacon position to transmit (in APRS format)
* Min interval: packet are transmitted not less than x second apart
* Max interval: maximum interval between packages
* Speed and course: variables to calculate smart beaconing
* GPS enabled: enables power to GPS module
### Device Settings
These are main device settings, hover the mouse on the checkboxes and explainations will appear Note: as of 09/2021 "Auto Power OFF" is enabled only with TBEAM 1.0, it will turn board off after unplugging USB
These are main device settings, hover the mouse on the checkboxes and explainations will appear.
* OLED Display enabled: Enables OLED functionalities
* Bluetooth enabled: Enables bluetooth functions (such as TNC via APRSDROID)
* LED Signaling: not yet implemented
* Auto Power OFF: activate auto power off when USB is unplugged (only for TBEAM 1.0 or later)
* Auto Power OFF delay: timer to turn off board after USB is unplugged (only if enabled)
* Display show RX Time: when a packet is received display the packet is shown for X seconds
* Display Timeout: display will turn OFF after X seconds for better power save (0 to disable and keep OLED ON)
### Received
Here is the list of recently received stations with some details

Wyświetl plik

@ -25,13 +25,17 @@
<input type="button" value="Scan WiFi" id="scan_wifi_btn" onclick="scanWifi();">
</div>
<div>
<label for="wifi_ssid">SSID</label>
<label for="wifi_ssid">WiFi SSID</label>
<input class="u-full-width" type="text" name="wifi_ssid" placeholder="Your Wifi SSID" id="wifi_ssid">
</div>
<div>
<label for="wifi_password">Password</label>
<label for="wifi_password">WiFi Password</label>
<input class="u-full-width" type="password" name="wifi_password" id="wifi_password">
</div>
<div>
<label for="ap_password">AUTO AP Password</label>
<input class="u-full-width" type="password" name="ap_password" id="ap_password" disabled>
</div>
</div>
<div class="grid-container full">
<input class="button-primary" type="submit" value="Save">
@ -167,7 +171,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 +188,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>

Wyświetl plik

@ -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);

Wyświetl plik

@ -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_i";
#endif

Wyświetl plik

@ -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

Wyświetl plik

@ -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, oled_timeout/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() {
@ -875,6 +883,7 @@ void loop() {
}
if (manBeacon) {
// Manually sending beacon from html page
enableOled();
writedisplaytext("((WEB TX))","","","","","");
sendpacket();
@ -882,7 +891,12 @@ void loop() {
}
// Only wake up OLED when necessary, note that DIM is to turn OFF the backlight
if (enabled_oled) {
display.dim(!tempOled);
if (oled_timeout>0) {
display.dim(!tempOled);
} else {
// If timeout is 0 keep OLED awake
display.dim(false);
}
}
if (tempOled && millis()>= oled_timer) {

Wyświetl plik

@ -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());