WiFi power-management as station:  if aprs-is connection is
  established, switch power saving setting from WIFI_PS_MIN_MODEM
  to WIFI_PS_NONE. -> less delay.
- Beauty:
  - Webserver index.html: small change in description
  - getLocalTimeTheBetterWay():
    changed  if (now != ~0 && now) {
    to       if (now && now != ~((time_t ) 0)) {
    ;)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
pull/12/head
Thomas Osterried 2023-08-21 16:23:53 +02:00
rodzic 7dbacac67c
commit 0d06bac161
4 zmienionych plików z 16 dodań i 7 usunięć

Wyświetl plik

@ -832,13 +832,13 @@ Hard readable lengths / too long for our display:
Use with care; resulting longer path consumes a bit more airtime.
</div>
<div class="grid-container full">
<h5 class="u-full-width">TTGO T-Beam middle hardware-button: User key functions:</h5>
<h5 class="u-full-width">TTGO T-Beam <b>middle</b> hardware-button<br>(User key functions):</h5>
</div>
<div>
<h6 class="u-full-width">short press</h6>
If OLED is enabled and OLED is OFF:<br/>
<ul>
<li>a short press will wake it up and show current data (as "Display Timeout" seconds</li>
<li>a short press will wake it up and show current data (as long as your configured "Display Timeout")</li>
</ul>
If OLED is disabled or OLED is ON:<br>
<ul>

Wyświetl plik

@ -526,7 +526,7 @@ volatile boolean sema_lora_chip = false;
bool getLocalTimeTheBetterWay(struct tm * info)
{
time_t now = time(0);
if (now != ~0 && now) {
if (now && now != ~((time_t ) 0)) {
localtime_r(&now, info);
if (info->tm_year > 99)
return true;

Wyświetl plik

@ -6,6 +6,8 @@
SFE_UBLOX_GPS myGPS;
extern uint8_t usb_serial_data_type;
#ifdef ENABLE_WIFI
#include "wifi_clients.h"
#define MAX_GPS_WIFI_CLIENTS 6
@ -57,23 +59,25 @@ bool gpsInitialized = false;
while (gpsSerial.available() > 0) {
char gpsChar = (char)gpsSerial.read();
gps.encode(gpsChar);
#ifdef ENABLE_WIFI
if (gpsChar == '$') {
gpsDataBuffer = String(gpsChar);
} else {
gpsDataBuffer += String(gpsChar);
if (gpsChar == '\n') {
if (usb_serial_data_type == 4)
Serial.println(gpsDataBuffer);
#ifdef ENABLE_WIFI
iterateWifiClients([](WiFiClient *client, int clientIdx, const String *data){
if (client->connected()){
client->print(*data);
client->flush();
}
}, &gpsDataBuffer, gps_clients, MAX_GPS_WIFI_CLIENTS);
#endif
gpsDataBuffer = "";
}
}
#endif
}
vTaskDelay(100 / portTICK_PERIOD_MS);
}

Wyświetl plik

@ -1358,8 +1358,6 @@ void restart_AP_or_STA(void) {
} else if (WiFi.getMode() == WIFI_MODE_STA) {
do_serial_println("WiFi: Status: " + String((int ) WiFi.status()) + ". Will run as mode STA (remote SSID: '" + used_wifi_ModeSTA_SSID + "')");
// Save some battery
//WiFi.setSleep(true);
esp_wifi_set_ps(WIFI_PS_MAX_MODEM);
oled_wifi_SSID_curr = used_wifi_ModeSTA_SSID;
oled_wifi_PASS_curr = used_wifi_ModeSTA_PASS;
@ -1624,6 +1622,9 @@ int connect_to_aprsis(void) {
// avoid sending old data
to_aprsis_data = "";
// WiFi powermanagement. Disable sleep -> better network performance
WiFi.setSleep(false);
return 0;
}
@ -1964,6 +1965,7 @@ void send_to_aprsis()
#elif T_BEAM_V1_2
axp.disableALDO2();
#endif
WiFi.setSleep(false);
Serial.printf("Firmware: Update: %s\r\n", upload.filename.c_str());
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
#if defined(ENABLE_SYSLOG)
@ -2173,6 +2175,7 @@ void send_to_aprsis()
if ((ret = connect_to_aprsis()) < 0) {
log_msg = String("APRS-IS: on_Err: '") + aprsis_status + String("' [") + aprsis_client.remoteIP().toString() + String("], tries ") + String(aprsis_connect_tries);
aprsis_client.stop();
WiFi.setSleep(true);
// Known problems which usually resolve by reboot:
if (ret == -5 /* login denied, until reboot. Reason unknown */ ||
(ret == -1 /* sometimes after boot it can't connect. DNS- or IP-stack Problem? */ && lora_digipeating_mode > 1) /* we are a digi */ ) {
@ -2238,6 +2241,8 @@ void send_to_aprsis()
} else {
WiFi.setSleep(true);
if (aprsis_status != "Error: no internet") {
aprsis_status = "Error: no internet";
// inform about state change