Clean ups, and more features

This commit is contained in:
2026-02-18 16:28:52 +01:00
parent 9e6cf2bd72
commit d1294914ce
22 changed files with 228 additions and 1138 deletions
+4 -4
View File
@@ -100,7 +100,7 @@ static const uint16_t oda_app_ids[] {
static const char* const ECCtext[] {
"Bundesrepublik Deutschland", // 0
"Ελληνική Δημοκρατία / (Hellenic Republic)", // 1
"Ελληνική Δημοκρατία [Hellenic Republic]", // 1
"Kingdom of Morroco", // 2
"Republica Moldova", // 3
"People's Democratic Republic of Algeria", // 4
@@ -297,8 +297,8 @@ static const char* const ECCtext[] {
"Islamic Republic of Iran", // 195
"Japan", // 196
"Republic of Kiribati", // 197
"Democratic People's Republic of Korea (North Korea)", // 198
"Republic of Korea (South Korea)", // 199
"Democratic People's Republic of Korea [North Korea]", // 198
"Republic of Korea [South Korea]", // 199
"Lao People's Democratic Republic", // 200
"中华人民共和国(澳门) [PRC, M]", // 201
"Malaysia", // 202
@@ -316,7 +316,7 @@ static const char* const ECCtext[] {
"Republic of Singapore", // 214
"Solomon Islands", // 215
"Democratic Socialist Republic of Sri Lanka", // 216
"Republic of China (Taiwan)", // 217
"Republic of China [Taiwan]", // 217
"Kingdom of Thailand", // 218
"Kingdom of Tonga", // 219
"Republic of Vanuatu", // 220
+43 -43
View File
@@ -265,17 +265,17 @@
#define ITEM10 210
// EEPROM index defines
#define EE_PRESETS_CNT 99 // When set > 99 change the complete EEPROM adressing!
#define EE_CHECKBYTE_VALUE 20 // 0 ~ 255,add new entry, change for new value
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
#define EE_TOTAL_CNT 2287 // Total occupied eeprom bytes
#define EE_PRESETS_CNT 99 // When set > 99 change the complete EEPROM adressing!
#define EE_CHECKBYTE_VALUE 20 // 0 ~ 255,add new entry, change for new value
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
#define EE_TOTAL_CNT 2287 // Total occupied eeprom bytes
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte
#define EE_PRESET_BW_START 99 // 99 * 1 byte
#define EE_PRESET_MS_START 198 // 99 * 1 byte
#define EE_PRESETS_FREQUENCY_START 297 // 99 * 4 bytes
#define EE_PRESETS_RDSPI_START 693 // 99 * 5 bytes
#define EE_PRESETS_RDSPS_START 1188 // 99 * 9 bytes
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte
#define EE_PRESET_BW_START 99 // 99 * 1 byte
#define EE_PRESET_MS_START 198 // 99 * 1 byte
#define EE_PRESETS_FREQUENCY_START 297 // 99 * 4 bytes
#define EE_PRESETS_RDSPI_START 693 // 99 * 5 bytes
#define EE_PRESETS_RDSPS_START 1188 // 99 * 9 bytes
#define EE_UINT16_FREQUENCY_FM 2079
#define EE_BYTE_VOLSET 2083
@@ -356,40 +356,40 @@
#define EE_BYTE_FMSCANSENS 2201
#define EE_BYTE_FREQFONT 2202
// Empty space, this was not used
#define EE_BYTE_XDRGTKMUTE 2204
#define EE_BYTE_FMAGC 2205
#define EE_BYTE_AMAGC 2206
#define EE_BYTE_FMSI 2207
#define EE_BYTE_SCANSTART 2208
#define EE_BYTE_SCANSTOP 2209
#define EE_BYTE_SCANHOLD 2210
#define EE_BYTE_SCANMEM 2211
#define EE_BYTE_SCANCANCEL 2212
#define EE_BYTE_SCANMUTE 2213
#define EE_BYTE_AUTOSQUELCH 2214
#define EE_BYTE_LONGBANDPRESS 2215
#define EE_BYTE_SHOWCLOCK 2216
#define EE_BYTE_SHOWLONGPS 2217
#define EE_UINT16_MEMSTARTFREQ 2218
#define EE_UINT16_MEMSTOPFREQ 2222
#define EE_BYTE_MEMSTARTPOS 2226
#define EE_BYTE_MEMSTOPPOS 2227
#define EE_BYTE_MEMPIONLY 2228
#define EE_BYTE_MEMDOUBLEPI 2229
#define EE_BYTE_XDRGTKMUTE 2204
#define EE_BYTE_FMAGC 2205
#define EE_BYTE_AMAGC 2206
#define EE_BYTE_FMSI 2207
#define EE_BYTE_SCANSTART 2208
#define EE_BYTE_SCANSTOP 2209
#define EE_BYTE_SCANHOLD 2210
#define EE_BYTE_SCANMEM 2211
#define EE_BYTE_SCANCANCEL 2212
#define EE_BYTE_SCANMUTE 2213
#define EE_BYTE_AUTOSQUELCH 2214
#define EE_BYTE_LONGBANDPRESS 2215
#define EE_BYTE_SHOWCLOCK 2216
#define EE_BYTE_SHOWLONGPS 2217
#define EE_UINT16_MEMSTARTFREQ 2218
#define EE_UINT16_MEMSTOPFREQ 2222
#define EE_BYTE_MEMSTARTPOS 2226
#define EE_BYTE_MEMSTOPPOS 2227
#define EE_BYTE_MEMPIONLY 2228
#define EE_BYTE_MEMDOUBLEPI 2229
// blank space
#define EE_BYTE_WAITONLYONSIGNAL 2253
#define EE_UINT16_CALTOUCH1 2254
#define EE_UINT16_CALTOUCH2 2258
#define EE_UINT16_CALTOUCH3 2262
#define EE_UINT16_CALTOUCH4 2266
#define EE_UINT16_CALTOUCH5 2270
#define EE_BYTE_INVERTDISPLAY 2274
#define EE_BYTE_NTPOFFSET 2275
#define EE_BYTE_AUTOLOG 2276
#define EE_BYTE_AUTODST 2277
#define EE_BYTE_CLOCKAMPM 2278
#define EE_UINT16_LOGCOUNTER 2279
#define EE_UINT16_PICTLOCK 2283
#define EE_BYTE_WAITONLYONSIGNAL 2253
#define EE_UINT16_CALTOUCH1 2254
#define EE_UINT16_CALTOUCH2 2258
#define EE_UINT16_CALTOUCH3 2262
#define EE_UINT16_CALTOUCH4 2266
#define EE_UINT16_CALTOUCH5 2270
#define EE_BYTE_INVERTDISPLAY 2274
#define EE_BYTE_TIMEZONE 2275
#define EE_BYTE_AUTOLOG 2276
#define EE_BYTE_AUTODST 2277
#define EE_BYTE_CLOCKAMPM 2278
#define EE_UINT16_LOGCOUNTER 2279
#define EE_UINT16_PICTLOCK 2283
// End of EEPROM index defines
// Memory channel database
+1 -1
View File
@@ -229,7 +229,7 @@ extern int8_t MPold;
extern int8_t USold;
extern int8_t LevelOffset;
extern int8_t LowLevelSet;
extern int8_t NTPoffset;
extern int8_t Timezone;
extern int8_t CN;
extern int8_t CNold;
extern int8_t VolSet;
+22 -22
View File
@@ -319,7 +319,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Can't add entry!\nLogbook is full!", // 291
"Autologger", // 292
"Auto DST on NTP time", // 293
"Set NTP time offset", // 294
"Set time zone", // 294
"The logbook contains over 130 entries, which the viewer cannot process. Please download the CSV file to process it.", // 295
"Canada" // 296
},
@@ -618,7 +618,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Toevoegen mislukt!\nLogboek is vol!", // 291
"Automatisch loggen", // 292
"Auto zomertijd\nop NTP tijd", // 293
"NTP tijdverschil\ninstellen", // 294
"Tijdzone", // 294
"Het logboek bevat meer dan 130 items, die de viewer niet kan verwerken. Download alstublieft het CSV-bestand om het te bekijken.", // 295
"Canada" // 296
},
@@ -917,7 +917,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Wykaz pełny!", // 291
"Autologowanie stacji", // 292
"Auto czas letni wg NTP", // 293
"Ustaw odchyl. czasu NTP", // 294
"Strefa czasowa", // 294
"Wykaz zawiera ponad 130 wpisów, których przeglądarka nie może pokazać. Pobierz plik CSV, aby je przetworzyć.", // 295
"Kanada" // 296
},
@@ -1216,7 +1216,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Ne mogu dodati unos!\nDnevnik je pun!", // 291
"Autologger", // 292
"Auto DST na NTP vremenu", // 293
"Postavi NTP pomak vremena", // 294
"postaviti pomak vremenske zone", // 294
"Dnevnik sadrži preko 130 unosa, koje preglednik ne može obraditi. Preuzmite CSV datoteku za obradu.", // 295
"Canada" // 296
},
@@ -1515,7 +1515,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Αδυναμία προσθήκης!\nΒιβλίο γεμάτο!", // 291
"Αυτόματη καταγραφή", // 292
"Αυτόματο DST\nσε ώρα NTP", // 293
"Ολίσθηση ώρας NTP", // 294
"Ορισμός ζώνης ώρας", // 294
"Το βιβλίο περιέχει πάνω από 130 καταγραφές, και είναι αδύνατη η επεξεργασία τους από το χρήστη. Κάντε λήψη του αρχείου CSV για να το επεξεργαστείτε.", // 295
"Καναδάς" // 296
},
@@ -1814,7 +1814,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Nu se poate adăuga!\nJurnalul este plin!", // 291
"Autologger", // 292
"Auto DST pe ora NTP", // 293
"Setează offsetul pentru ora NTP", // 294
"Setați fusul orar", // 294
"Jurnalul conține peste 130 de intrări, pe care vizualizatorul nu le poate procesa. Te rog descarcă fișierul CSV pentru a le procesa.", // 295
"Canada" // 296
},
@@ -2113,7 +2113,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Logbucheintrag nicht möglich\nLogbuch ist voll!", // 291
"Automatisch loggen", // 292
"Auto-Sommerzeit\nüber NTP", // 293
"NTP-Zeitversatz\neinstellen", // 294
"Zeitzone einstellen", // 294
"Das Logbuch enthält mehr als 130 Einträge, was das Anzeigeprogramm nicht verarbeiten kann. Bitte lade die CSV-Datei zum Verarbeiten herunter.", // 295
"Kanada" // 296
},
@@ -2412,7 +2412,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Nelze přidat položku!\nLogbook je plný!", // 291
"Automatický logger", // 292
"Auto DST u NTP času", // 293
"Nastavte časový posun NTP", // 294
"Nastavit časové pásmo", // 294
"Logbook obsahuje více než 130 položek, které prohlížeč nedokáže zpracovat. Pro zpracování všech položek si stáhněte CSV soubor.", // 295
"Canada" // 296
},
@@ -2711,7 +2711,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Nem adható hozzá!\nLogbook megtelt!", // 291
"Auto logoló", // 292
"Auto nyári idő(DST)\nNTP idő szerint", // 293
"NTP időeltolás beállítása", // 294
"Állítsa be az időzónát", // 294
"A napló több mint 130 bejegyzést tartalmaz, amelyeket a megtekintő nem tud feldolgozni. Kérlek, töltsd le a CSV fájlt a megtekintéshez.", // 295
"Kanada" // 296
},
@@ -3010,7 +3010,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Impossible d'ajouter l'entrée!\nJournal de bord plein!", // 291
"Log automatique", // 292
"DST automatique\nsur l'heure NTP", // 293
"calage horaire NTP", // 294
"finir le fuseau horaire", // 294
"Le journal de bord contient plus de 130 entrées que la liste ne peut pas afficher. Veuillez télécharger le fichier CSV.", // 295
"Canada" // 296
},
@@ -3309,7 +3309,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Не може да се добави запис!\nДневникът е пълен!", // 291
"Автоматичен дневник", // 292
"Автоматично лятно\nвреме по NTP", // 293
"Отместване на NTP", // 294
"Задаване на часова зона", // 294
"Дневникът съдържа над 130 записа, които не могат да бъдат обработени. Моля, изтеглете CSV файла за обработка.", // 295
"Канада" // 296
},
@@ -3608,7 +3608,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Смещение времени NTP", // 291
"Автологгер", // 292
"Автоматическое летнее время по NTP", // 293
"Смещение времени NTP", // 294
"Установить часовой пояс", // 294
"В логе более 130 записей, которые программа просмотра не может обработать. Загрузите файл CSV для его обработки.", // 295
"Канада" // 296
},
@@ -3907,7 +3907,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Твій журнал повний!", // 291
"Автореєстратор", // 292
"Автоматичний літній\nчас за NTP", // 293
"Встановити зміщення\nчасу NTP", // 294
"Встановити часовий пояс", // 294
"Журнал містить понад 130 записів, які оглядач не може обробити. Будь ласка, завантажте файл CSV, щоб обробити його.", // 295
"Канада" // 296
},
@@ -4206,7 +4206,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Impossibile aggiungere voce!\nRegistro dei log pieno!", // 291
"Autologger", // 292
"Auto DST su tempo NTP", // 293
"Imposta offset orario NTP", // 294
"Imposta il fuso orario", // 294
"Registro dei log con + di 130 voci, il visualizzatore non può gestirle. Scarica il file CSV per gestirlo.", // 295
"Canada" // 296
},
@@ -4505,7 +4505,7 @@ static const char* const Languages[22][297] PROGMEM = {
"log记录已满!", // 291
"自动记录日志", // 292
"联网自动同步本机时间", // 293
"设置NTP时区", // 294
"设置时区", // 294
"该日志包含超过130个条目,观看者无法处理。请下载CSV文件进行处理。", // 295
"加拿大" // 296
},
@@ -4804,7 +4804,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Kan ikke lagre!\nLoggbok er full!", // 291
"Autologger", // 292
"Auto sommertid med NTP", // 293
"Angi NTP-tidsforskyvning", // 294
"Angi tidssone", // 294
"Loggbok har over 130 oppføringer.\nLast ned CSV for behandling.", // 295
"Canada" // 296
},
@@ -5103,7 +5103,7 @@ static const char* const Languages[22][297] PROGMEM = {
"¡Registro lleno!\nNo se puede añadir", // 291
"Autoregistro", // 292
"DST automático (NTP)", // 293
"Ajustar\ndesplazamiento NTP", // 294
"Establecer zona horaria", // 294
"El registro tiene +130 entradas.\nDescargue el CSV.", // 295
"Canadá" // 296
},
@@ -5402,7 +5402,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Não é possível adicionar!\nO livro está cheio!", // 291
"Registrador automático", // 292
"DST automático\nno horário NTP", // 293
"Definir deslocamento\nde tempo NTP", // 294
"Definir fuso horário", // 294
"O diário de bordo contém mais de 130 entradas que o espectador não consegue processar. Descarregue o ficheiro CSV para processá-lo.", // 295
"Canadá" // 296
},
@@ -5701,7 +5701,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Ne može se dodati!\nDnevnik je pun!", // 291
"Automatski logger", // 292
"Auto DST na\nNTP vremenu", // 293
"Postavite NTP\nvremenski offset", // 294
"Podesite vremensku zonu", // 294
"Dnevnik sadrži više od 130 unosa, što viewer ne može obraditi. Preuzmite CSV fajl za obradu.", // 295
"Canada" // 296
},
@@ -6000,7 +6000,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Ei voida lisätä merkintää!\nLokikirja on täynnä!", // 291
"Autolokikirja", // 292
"Auto DST\nNTP-ajassa", // 293
"Aseta\nNTP-aikasiirto", // 294
"Aseta aikavyöhyke", // 294
"Lokikirja sisältää yli 130 merkintää, joita katselija ei pysty käsittelemään. Lataa CSV-tiedosto sen käsittelemiseksi.", // 295
"Kanada" // 296
},
@@ -6299,7 +6299,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Kan ikke tilføje!\nLogbogen er fuld!", // 291
"Autologger", // 292
"Auto DST på\nNTP-tid", // 293
"Indstil NTP-tidsforskel", // 294
"Indstil tidszone", // 294
"Logbogen indeholder over 130 poster, som fremviseren ikke kan behandle. Download CSV-filen for at behandle den.", // 295
"Canada" // 296
},
@@ -6598,7 +6598,7 @@ static const char* const Languages[22][297] PROGMEM = {
"Kan inte spara!\nLoggboken är full!", // 291
"Autologgning", // 292
"Auto NTP sommartid", // 293
"Ange NTP tidszon", // 294
"Ställ in tidszon", // 294
"Loggboken har mer än 130 poster, vilket visaren inte kan hantera. Ladda ner CSV för behandling.", // 295
"Kanada" // 296
}
+1 -1
View File
@@ -12,4 +12,4 @@ extern ESP32Time rtc;
extern bool rx_rtc_avail;
bool init_rtc();
void set_time(time_t time);
void set_time(time_t time, int8_t offset);
+1 -7
View File
@@ -1,28 +1,22 @@
#pragma once
#include "globals.h"
#include "core.h"
void doTouchEvent(uint16_t x, uint16_t y);
extern void BuildDisplay();
extern void BuildBWSelector();
extern void SelectBand();
extern void BuildAdvancedRDS();
extern void doBandToggle();
extern void doTuneMode();
extern void doStereoToggle();
extern void cancelDXScan();
extern void doBW();
extern void drawButton(const char* text, byte button_number, bool active, bool selected);
extern void KeyDown();
extern void KeyUp();
extern void ButtonPress();
extern void DoMenu();
extern void ModeButtonPress();
extern void toggleiMSEQ();
extern void showBWSelector();
extern void updateiMS();
extern void updateEQ();
extern void DataPrint(String string);
extern void BuildAFScreen();
extern void ShowFreq(int mode);
+3 -3
View File
@@ -44,7 +44,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len) {
SPI_BUSY_CHECK;
uint32_t i = 0;
if (rem) { // len was not multiple of 32
if(rem) { // len was not multiple of 32
for (i = 0; i < rem; i += 2) *spi_w++ = color32;
*_spi_mosi_dlen = (rem << 4) - 1; // << 4 = * 16
*_spi_cmd = SPI_USR;
@@ -343,11 +343,11 @@ void TFT_eSPI::init() {
gpio_set_level((gpio_num_t)TFT_RST, 1);
delay(3);
gpio_set_level((gpio_num_t)TFT_RST, 0);
delay(12);
delay(10);
gpio_set_level((gpio_num_t)TFT_RST, 1);
}
delay(34); // Wait for reset to complete
delay(25); // Wait for reset to complete
begin_tft_write();
+2 -15
View File
@@ -1,16 +1,5 @@
/*!
* @file WC_AP_HTML.h
*
* HTML snippets to build the Access Point portal and the Parameters Portal.
*
* Written by Stuart Blair
*
* GNU General Public License v3.0 licence, all text here must be included in any redistribution and you should receive a copy of the license file.
*
*/
#pragma once
#ifndef WC_AP_HTML
#define WC_AP_HTML ///< Define to stop re-inclusion
/*! \def char AP_HTTP_HEAD[] PROGMEM
Start of HTML output
*/
@@ -72,6 +61,4 @@ const char AP_HTTP_END[] PROGMEM = "</div></body></html>";
/** HTML snippet for our custom parameters portal form */
const char AP_HTTP_PORTAL_PARAM_OPTIONS[] PROGMEM = "<form action=\"/params\" method=\"get\"><button>Configure Parameters</button></form><br/><form action=\"/i\" method=\"get\"><button>Info</button></form><br/>";
/** HTML snippet for our custom parameters save */
const char AP_HTTP_FORM_PARAM_START[] PROGMEM ="<form method=\"get\" action=\"wifisave\">";
#endif
const char AP_HTTP_FORM_PARAM_START[] PROGMEM ="<form method=\"get\" action=\"wifisave\">";
File diff suppressed because it is too large Load Diff
+29 -131
View File
@@ -1,85 +1,28 @@
/*!
@file WiFiConnect.h
This is the documentation for WiFiConnect for the Arduino platform.
It is a WiFi connection manager for use with the popular ESP8266 and ESP32 chips.
It contains a captive portal to allow easy connection and changing of WiFi netwoks
via a web based interface and allows for additional user parameters.
You can view the project at <a href="https://github.com/smurf0969/WiFiConnect">https://github.com/smurf0969/WiFiConnect</a>.
Further information is also available in the project <a href="https://github.com/smurf0969/WiFiConnect/wiki">Wiki</a>.
This is a heavily customised version from the origional <a href="https://github.com/tzapu/WiFiManager">WiFiManager</a>
developed by https://github.com/tzapu .
This library depends on <a href="https://github.com/esp8266/Arduino">
ESP8266 Arduino Core</a> and <a href="https://github.com/espressif/arduino-esp32">ESP32 Arduino Core</a> being present on your system.
Please make sure you have installed the latest version before using this library.
Written by Stuart Blair.
GNU General Public License v3.0 licence, all text here must be included in any redistribution and you should receive a copy of the license file.
*/
#ifndef WiFiConnect_h
#define WiFiConnect_h
#pragma once
#include <Arduino.h>
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#else
#include <WiFi.h>
#include <FS.h>
using fs::FS;
#include <WebServer.h>
#endif
#include <DNSServer.h>
#include <memory>
#if defined(ESP8266)
extern "C" {
#include "user_interface.h"
}
#define ESP_getChipId() (ESP.getChipId()) ///< Gets an ID from the chip
#else
#include <esp_wifi.h>
#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac())///< Gets an ID from the chip
#endif
#include "WC_AP_HTML.h"
#include "WiFiConnectParam.h"
/** Options for how a access point should continue if no WiFi connected */
enum AP_Continue {
AP_NONE, ///< No action, continues to run code
AP_LOOP, ///< Stalls execution with an infinate loop
AP_RESTART, ///< Restarts the chip, allowing it to try to setup again. Handy for sensors when wifi is lost.
AP_RESET, ///< Same as AP_RESTART
AP_WAIT // Keep the AP and webserver running, sit quietly and be patient.
};
/**************************************************************************/
/*!
@brief Class that helps to connect to WiFi networks, that also has
captive portal web interface for configuration.
This is the base class for WiFiConntectOLED which displays
information on a OLED display.
*/
/**************************************************************************/
class WiFiConnect {
public:
/// Create WiFiConnect class
WiFiConnect();
boolean startConfigurationPortal();
boolean startConfigurationPortal(AP_Continue apcontinue);
boolean startConfigurationPortal(AP_Continue apcontinue, const char* apName, const char* apPassword = NULL, bool paramsMode = false);
boolean startParamsPortal();
boolean startParamsPortal(AP_Continue apcontinue);
boolean startParamsPortal(AP_Continue apcontinue, const char* apName, const char* apPassword = NULL);
boolean startConfigurationPortal(const char* apName, const char* apPassword = NULL, bool paramsMode = false);
void addParameter(WiFiConnectParam *p);
void setAPName(const char* apName);
void setAPName(const char* apName);
const char* getAPName();
void resetSettings();
@@ -87,83 +30,46 @@ class WiFiConnect {
boolean autoConnect();
boolean autoConnect(const char* ssidName, const char* ssidPassword = NULL, WiFiMode_t acWiFiMode = WIFI_STA);
//sets a custom ip /gateway /subnet configuration
void setAPStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
//sets config for a static IP
void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
//called when AP mode and config portal is started
void setAPCallback( void (*func)(WiFiConnect*) );
//called when settings have been changed and connection was successful
void setSaveConfigCallback( void (*func)() );
void setDebug(boolean isDebug);
void setAPStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
void setRetryAttempts(int attempts);
void setConnectionTimeoutSecs(int timeout);
void setAPModeTimeoutMins(int mins);
boolean captivePortal();
boolean captivePortal();
//helpers
const char* statusToString(int state);
int getRSSIasQuality(int RSSI);
boolean isIp(String str);
String toStringIp(IPAddress ip);
virtual void displayTurnOFF(int ms = 5000); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayLoop(); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayON(); ///< Virtual method overriden in WiFiConnectOLED
protected:
boolean _debug = false; ///< Flag to determine wheter to output mesages or not
template <typename Generic>
void DEBUG_WC(Generic text);
virtual void displayConnecting(int attempt, int totalAttempts); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayConnected(); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayAP(); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayParams(); ///< Virtual method overriden in WiFiConnectOLED
virtual void displayManualReset(); ///< Virtual method overriden in WiFiConnectOLED
int getRSSIasQuality(int RSSI);
boolean isIp(String str);
String toStringIp(IPAddress ip);
private:
int _retryAttempts = 3; ///< Number of attempts when trying to connect to WiFi network
int _connectionTimeoutSecs = 10; ///< How log to wait for the connection to succeed or fail
int _apTimeoutMins = 3; ///< The amount of minutes of inactivity before the access point exits it routine
// DNS server
const byte DNS_PORT = 53; ///< Standard DNS Port number
long _lastAPPage = 0; ///< The last time a page was accessed in the portal. Used for the inactivity timeout.
boolean _removeDuplicateAPs = true; ///< Flag to remove duplicate networks from scan results.
int _minimumQuality = 8; ///< The minimum netqork quality to be included in scan results.
int _paramsCount = 0; ///< The amount of custom parameters added via addParameter
boolean _readyToConnect = false; ///< Flag used in access point to determine if it should try to connect to the network.
String _ssid = " "; ///< Tempory holder for the network ssid
String _password = " "; ///< Tempory holder for the network password
long _lastAPPage = 0;
int _minimumQuality = 8;
int _paramsCount = 0;
boolean _readyToConnect = false;
String _ssid = " ";
String _password = " ";
WiFiConnectParam* _params[WiFiConnect_MAX_PARAMS]; ///< Array to hold custom parameters
std::unique_ptr<DNSServer> dnsServer; ///< DNS Server for captive portal to redirect to Access Point
#ifdef ESP8266
std::unique_ptr<ESP8266WebServer> server; ///< Web server for serving access point pages
#else
std::unique_ptr<WebServer> server; ///< Web server for serving access point pages
#endif
std::unique_ptr<DNSServer> dnsServer;
std::unique_ptr<WebServer> server;
char _apName[33] ; ///< Holder for the access point name
char _apPassword[65] ; ///< Holder for the access point password
char _apName[33];
char _apPassword[65];
IPAddress _ap_static_ip; ///< Variable for holding Static IP Address for the access point
IPAddress _ap_static_gw; ///< Variable for holding Static Gateway IP Address for the access point
IPAddress _ap_static_sn; ///< Variable for holding Static Subnet Mask IP Address for the access point
IPAddress _sta_static_ip; ///< Variable for holding Static IP Address for the network connection
IPAddress _sta_static_gw; ///< Variable for holding Static Gateway IP Address for the network connection
IPAddress _sta_static_sn; ///< Variable for holding Static Subnet Mask IP Address for the network connection
void (*_apcallback)(WiFiConnect*) = NULL;
void (*_savecallback)() = NULL;
IPAddress _ap_static_ip; ///< Variable for holding Static IP Address for the access point
IPAddress _ap_static_gw; ///< Variable for holding Static Gateway IP Address for the access point
IPAddress _ap_static_sn; ///< Variable for holding Static Subnet Mask IP Address for the access point
IPAddress _sta_static_ip; ///< Variable for holding Static IP Address for the network connection
IPAddress _sta_static_gw; ///< Variable for holding Static Gateway IP Address for the network connection
IPAddress _sta_static_sn; ///< Variable for holding Static Subnet Mask IP Address for the network connection
void handleRoot();
void handleParamRoot();
@@ -176,14 +82,6 @@ class WiFiConnect {
void handleNotFound();
template <class T>
auto optionalIPFromString(T *obj, const char *s) -> decltype( obj->fromString(s) ) {
return obj->fromString(s);
}
auto optionalIPFromString(...) -> bool {
DEBUG_WC("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work.");
return false;
}
auto optionalIPFromString(T *obj, const char *s) -> decltype(obj->fromString(s)) { return obj->fromString(s); }
bool optionalIPFromString(...) {return false;}
};
#endif
+14 -125
View File
@@ -1,41 +1,5 @@
/*!
@file WiFiConnectParam.cpp
WiFi Connection Manager with Captive Portal
Introduction
This is the documentation for WiFiConnect for the Arduino platform.
It is a WiFi connection manager for use with the popular ESP8266 and ESP32 chips.
It contains a captive portal to allow easy connection and changing of WiFi netwoks
via a web based interface and allows for additional user parameters.
It can also display messages via a OLED screen see WiFiConnectOLED class.
This is a heavily customised version from the original <a href="https://github.com/tzapu/WiFiManager">WiFiManager</a>
developed by https://github.com/tzapu .
Dependencies
This library depends on <a href="https://github.com/esp8266/Arduino">
ESP8266 Arduino Core</a> and <a href="https://github.com/espressif/arduino-esp32">ESP32 Arduino Core</a> being present on your system.
Please make sure you have installed the latest version before using this library.
Written by Stuart Blair.
License
GNU General Public License v3.0 licence, all text here must be included in any redistribution and you should receive a copy of the license file.
*/
#include "WiFiConnectParam.h"
/**************************************************************************/
/*!
@brief Class object initialiser
@param custom
Custom HTML to be displayed in the access point for this item.
*/
/**************************************************************************/
WiFiConnectParam::WiFiConnectParam(const char *custom) {
_id = NULL;
_placeholder = NULL;
@@ -44,55 +8,14 @@ WiFiConnectParam::WiFiConnectParam(const char *custom) {
_customHTML = custom;
}
/**************************************************************************/
/*!
@brief Class object initialiser
@param id
The unique ID for the html input box markup for this item
@param placeholder
Text to be displayed as the input box placeholder for this item
@param defaultValue
Default text to be displayed in the input box for this item
@param length
The maximum input text length for this item
*/
/**************************************************************************/
WiFiConnectParam::WiFiConnectParam(const char *id, const char *placeholder, const char *defaultValue, int length) {
init(id, placeholder, defaultValue, length, "");
}
/**************************************************************************/
/*!
@brief Class object initialiser
@param id
The unique ID for the html input box markup for this item
@param placeholder
Text to be displayed as the input box placeholder for this item
@param defaultValue
Default text to be displayed in the input box for this item
@param length
The maximum input text length for this item
@param custom
Custom HTML to be displayed in the access point for this item.
*/
/**************************************************************************/
WiFiConnectParam::WiFiConnectParam(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom) {
init(id, placeholder, defaultValue, length, custom);
}
/**************************************************************************/
/*!
@brief Initialiser method
@param id
The unique ID for the html input box markup for this item
@param placeholder
Text to be displayed as the input box placeholder for this item
@param defaultValue
Default text to be displayed in the input box for this item
@param length
The maximum input text length for this item
@param custom
Custom HTML to be displayed in the access point for this item.
*/
/**************************************************************************/
void WiFiConnectParam::init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom) {
_id = id;
_placeholder = placeholder;
@@ -101,66 +24,32 @@ void WiFiConnectParam::init(const char *id, const char *placeholder, const char
_customHTML = custom;
}
/**************************************************************************/
/*!
@brief Method to change the current value of the item
@param newValue
The new string value for the item
*/
/**************************************************************************/
void WiFiConnectParam::setValue(const char *newValue){
if(_length>0){
_value = new char[_length + 1];
for (int i = 0; i < _length; i++) {
_value[i] = 0;
}
if (newValue != NULL) {
strncpy(_value, newValue, _length);
}
if(_length > 0) {
// you know what was here in upstream
_value = new char[_length + 1];
for (int i = 0; i < _length; i++) _value[i] = 0;
if (newValue != NULL) strncpy(_value, newValue, _length);
}
}
/**************************************************************************/
/*!
@brief Function to get the current value of the item
@return The current value
*/
/**************************************************************************/
const char* WiFiConnectParam::getValue() {
return _value;
}
/**************************************************************************/
/*!
@brief Function to get the current id of the item
@return The current id
*/
/**************************************************************************/
const char* WiFiConnectParam::getID() {
return _id;
}
/**************************************************************************/
/*!
@brief Function to get the current placeholder text of the item
@return The current placeholder text
*/
/**************************************************************************/
const char* WiFiConnectParam::getPlaceholder() {
return _placeholder;
}
/**************************************************************************/
/*!
@brief Function to get the maximum length allowed for the value of the item
@return The current maximum value length
*/
/**************************************************************************/
int WiFiConnectParam::getValueLength() {
return _length;
}
/**************************************************************************/
/*!
@brief Function to get the current custom html markup of the item
@return The current custom html markup
*/
/**************************************************************************/
const char* WiFiConnectParam::getCustomHTML() {
return _customHTML;
}
+5 -42
View File
@@ -1,46 +1,11 @@
/*!
@file WiFiConnectParam.h
WiFi Connection Manager with Captive Portal
Introduction
This is the documentation for WiFiConnect for the Arduino platform.
It is a WiFi connection manager for use with the popular ESP8266 and ESP32 chips.
It contains a captive portal to allow easy connection and changing of WiFi netwoks
via a web based interface and allows for additional user parameters.
It can also display messages via a OLED screen see WiFiConnectOLED class.
This is a heavily customised version from the original <a href="https://github.com/tzapu/WiFiManager">WiFiManager</a>
developed by https://github.com/tzapu .
Dependencies
This library depends on <a href="https://github.com/esp8266/Arduino">
ESP8266 Arduino Core</a> and <a href="https://github.com/espressif/arduino-esp32">ESP32 Arduino Core</a> being present on your system.
Please make sure you have installed the latest version before using this library.
Written by Stuart Blair.
License
GNU General Public License v3.0 licence, all text here must be included in any redistribution and you should receive a copy of the license file.
*/
#ifndef WIFI_CONNECT_PARAM
#define WIFI_CONNECT_PARAM
#pragma once
#ifndef WiFiConnect_MAX_PARAMS
#define WiFiConnect_MAX_PARAMS 10 ///< The maximum size of the param array and how many custom parameters we may have
#endif
#include <Arduino.h>
/**************************************************************************/
/*!
@brief Class that stores a custom parameter
*/
/**************************************************************************/
class WiFiConnectParam {
public:
WiFiConnectParam(const char *custom);
@@ -50,19 +15,17 @@ class WiFiConnectParam {
const char *getID();
const char *getValue();
const char *getPlaceholder();
int getValueLength();
int getValueLength();
const char *getCustomHTML();
void setValue(const char *newValue);
private:
const char *_id;
const char *_placeholder;
char *_value;
int _length;
char *_value;
int _length;
const char *_customHTML;
void init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom);
friend class WiFiConnect; ///< Declarion for WiFiConnect class
};
#endif
+1 -1
View File
@@ -50,7 +50,7 @@ void NTPupdate() {
time_t currentTime = getNtpTime();
if (currentTime) {
set_time(currentTime);
set_time(currentTime, Timezone);
rtcset = true;
NTPupdated = true;
radio.rds.ctupdate = false;
+1 -1
View File
@@ -1270,7 +1270,7 @@ void TEF6686::readRDS(byte showrdserrors) {
rds.offset = timeoffset;
rtcset = true;
if (!NTPupdated) set_time(rdstime + timeoffset);
if (!NTPupdated) set_time(rdstime, timeoffset);
} else rds.hasCT = false;
lastrdstime = rdstime;
lasttimeoffset = timeoffset;
+16 -2
View File
@@ -967,7 +967,7 @@ void total_pc_control() {
if(len < 3 + datalen + 1) break; // Validate buffer size
Wire.beginTransmission(addr);
Wire.write(data + 3, len - 3);
Wire.write(data + 3, datalen);
auto out = Wire.endTransmission(false);
uint8_t recvlen = Wire.requestFrom(addr, data[3+datalen]);
@@ -987,7 +987,7 @@ void total_pc_control() {
case 4: { // Version
Serial.write(2);
Serial.write(4);
Serial.write(1);
Serial.write(2);
} break;
case 5: { // Reboot
Serial.write(1);
@@ -1006,6 +1006,20 @@ void total_pc_control() {
Serial.flush();
Serial.updateBaudRate(clock);
} break;
case 7: { // Write to EEPROM
if(len < 4) break;
EEPROM.writeBytes((data[1] << 8) | data[2], data + 3, len - 3);
EEPROM.commit();
Serial.write(1);
Serial.write(7);
} break;
case 8: { // Read from EEPROM
if(len < 4) break;
auto address = (data[1] << 8) | data[2];
Serial.write(data[3] + 1);
Serial.write(8);
for(uint16_t i = 0; i < data[3]; i++) Serial.write(EEPROM.read(address + i));
} break;
case 0xff: { // Another wake command
Serial.write(1);
Serial.write(0xff);
-1
View File
@@ -846,7 +846,6 @@ void endMenu() {
menuitem = 0;
saveData();
if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false;
Serial.end();
if (wifi) remoteip = IPAddress(WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
Serial.flush();
+1 -1
View File
@@ -217,7 +217,7 @@ int8_t MPold = 0;
int8_t USold = 0;
int8_t LevelOffset;
int8_t LowLevelSet;
int8_t NTPoffset;
int8_t Timezone;
int8_t CN;
int8_t CNold;
RTC_DATA_ATTR int8_t VolSet;
+9 -9
View File
@@ -1393,7 +1393,7 @@ void ShowOneLine(byte position, byte item, bool selected) {
FullLineSprite.setTextDatum(TR_DATUM);
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
FullLineSprite.drawString((NTPoffset > -1 ? "+" : "") + String(NTPoffset, DEC), 298, 2);
FullLineSprite.drawString((Timezone > -1 ? "+" : "") + String(Timezone), 298, 2);
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
FullLineSprite.drawString("GMT", 258, 2);
break;
@@ -2491,7 +2491,7 @@ void ShowOneButton(byte position, byte item, bool selected) {
PSSprite.setTextDatum(TL_DATUM);
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
PSSprite.drawString((NTPoffset > -1 ? "+" : "") + String(NTPoffset, DEC), 77, 15);
PSSprite.drawString((Timezone > -1 ? "+" : "") + String(Timezone), 77, 15);
PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
PSSprite.setTextDatum(TR_DATUM);
PSSprite.drawString("GMT", 73, 15);
@@ -4171,11 +4171,11 @@ void MenuUpDown(bool dir) {
case ITEM7:
if (dir) {
NTPoffset++;
if (NTPoffset > 12) NTPoffset = -12;
Timezone++;
if (Timezone > 12) Timezone = -12;
} else {
NTPoffset--;
if (NTPoffset < -12) NTPoffset = 12;
Timezone--;
if (Timezone < -12) Timezone = 12;
}
OneBigLineSprite.setTextDatum(TR_DATUM);
@@ -4183,7 +4183,7 @@ void MenuUpDown(bool dir) {
OneBigLineSprite.drawString("GMT", 135, 0);
OneBigLineSprite.setTextDatum(TL_DATUM);
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString((NTPoffset > -1 ? "+" : "") + String(NTPoffset), 155, 0);
OneBigLineSprite.drawString((Timezone > -1 ? "+" : "") + String(Timezone), 155, 0);
OneBigLineSprite.pushSprite(24, 118);
break;
@@ -5225,7 +5225,7 @@ void DoMenu() {
wc.addParameter(&XDRGTK_key_input);
setWiFiConnectParam = true;
}
wc.startConfigurationPortal(AP_WAIT);
wc.startConfigurationPortal();
XDRGTK_key = XDRGTK_key_input.getValue();
EEPROM.writeString(EE_STRING_XDRGTK_KEY, XDRGTK_key);
EEPROM.commit();
@@ -5269,7 +5269,7 @@ void DoMenu() {
OneBigLineSprite.drawString("GMT", 135, 0);
OneBigLineSprite.setTextDatum(TL_DATUM);
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString((NTPoffset > -1 ? "+" : "") + String(NTPoffset), 155, 0);
OneBigLineSprite.drawString((Timezone > -1 ? "+" : "") + String(Timezone), 155, 0);
OneBigLineSprite.pushSprite(24, 118);
break;
+2 -2
View File
@@ -255,14 +255,14 @@ String getCurrentDateTime(bool inUTC) {
int utcOffsetHours = 0;
if (!inUTC) {
currentEpoch += (NTPupdated ? NTPoffset * 3600 : radio.rds.offset); // Apply GMT offset if NTPupdated, else RDS offset
currentEpoch += (NTPupdated ? Timezone * 3600 : radio.rds.offset); // Apply GMT offset if NTPupdated, else RDS offset
if (NTPupdated && autoDST) {
struct tm tempTimeInfo;
localtime_r(&currentEpoch, &tempTimeInfo);
if (isDST(mktime(&tempTimeInfo))) currentEpoch += 3600;
}
} else utcOffsetHours = (NTPupdated ? NTPoffset : radio.rds.offset / 3600);
} else utcOffsetHours = (NTPupdated ? Timezone : radio.rds.offset / 3600);
localtime_r(&currentEpoch, &timeInfo);
+3 -3
View File
@@ -118,7 +118,7 @@ void saveData() {
EEPROM.writeByte(EE_BYTE_MEMPIONLY, mempionly);
EEPROM.writeByte(EE_BYTE_MEMDOUBLEPI, memdoublepi);
EEPROM.writeByte(EE_BYTE_WAITONLYONSIGNAL, scanholdonsignal);
EEPROM.writeByte(EE_BYTE_NTPOFFSET, NTPoffset);
EEPROM.writeByte(EE_BYTE_TIMEZONE, Timezone);
EEPROM.writeByte(EE_BYTE_AUTOLOG, autolog);
EEPROM.writeByte(EE_BYTE_AUTODST, autoDST);
EEPROM.writeByte(EE_BYTE_CLOCKAMPM, clockampm);
@@ -231,7 +231,7 @@ void loadData() {
TouchCalData[3] = EEPROM.readUInt(EE_UINT16_CALTOUCH4);
TouchCalData[4] = EEPROM.readUInt(EE_UINT16_CALTOUCH5);
invertdisplay = EEPROM.readByte(EE_BYTE_INVERTDISPLAY);
NTPoffset = EEPROM.readByte(EE_BYTE_NTPOFFSET);
Timezone = EEPROM.readByte(EE_BYTE_TIMEZONE);
autolog = EEPROM.readByte(EE_BYTE_AUTOLOG);
autoDST = EEPROM.readByte(EE_BYTE_AUTODST);
clockampm = EEPROM.readByte(EE_BYTE_CLOCKAMPM);
@@ -338,7 +338,7 @@ void DefaultSettings() {
EEPROM.writeUInt(EE_UINT16_CALTOUCH3, 300);
EEPROM.writeUInt(EE_UINT16_CALTOUCH4, 3450);
EEPROM.writeUInt(EE_UINT16_CALTOUCH5, 3);
EEPROM.writeByte(EE_BYTE_NTPOFFSET, 1);
EEPROM.writeByte(EE_BYTE_TIMEZONE, 0);
EEPROM.writeByte(EE_BYTE_AUTOLOG, 1);
EEPROM.writeByte(EE_BYTE_AUTODST, 1);
EEPROM.writeByte(EE_BYTE_CLOCKAMPM, 0);
+1 -1
View File
@@ -490,8 +490,8 @@ void showCT() {
char dateStr[9];
time_t t = rtc.getEpoch();
t += Timezone * 3600; // Convert offset from hours to seconds
if (NTPupdated) {
t += NTPoffset * 3600; // Convert offset from hours to seconds
if (autoDST && isDST(t)) t += 3600;
}
+9 -1
View File
@@ -1,4 +1,6 @@
#include "rtc.hpp"
#include "globals.h"
#include "nonvolatile.h"
// the hardware rtc driver was made with the support of Wh1teRabbitHU's implementation
@@ -120,8 +122,14 @@ bool init_rtc() {
return false;
}
void set_time(time_t time) {
void set_time(time_t time, int8_t offset) {
rtc.setTime(time);
if(Timezone != offset) {
EEPROM.writeByte(EE_BYTE_TIMEZONE, offset);
EEPROM.commit();
Timezone = offset;
}
if(!rx_rtc_avail) return;
struct tm* timeinfo = gmtime(&time);
writeToModule(0x1F, 64);