You've already forked TEF6686_ESP32
bulk update
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#ifndef TEF6686_H
|
||||
#define TEF6686_H
|
||||
#pragma once
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Tuner_Drv_Lithio.h"
|
||||
@@ -19,7 +18,6 @@ enum RDS_GROUPS {
|
||||
RDS_GROUP_12A, RDS_GROUP_12B, RDS_GROUP_13A, RDS_GROUP_13B, RDS_GROUP_14A, RDS_GROUP_14B, RDS_GROUP_15A, RDS_GROUP_15B
|
||||
};
|
||||
|
||||
// Fixed PI/callsign combinations for Canada
|
||||
static const uint16_t fixedPI[] = {0x4C10, 0x4C11, 0x4C12};
|
||||
|
||||
static const char* const PTY_EU[] {
|
||||
@@ -33,8 +31,8 @@ static const char* const PTY_EU[] {
|
||||
"Culture",
|
||||
"Science",
|
||||
"Varied",
|
||||
"Pop Music",
|
||||
"Rock Music",
|
||||
"Pop",
|
||||
"Rock",
|
||||
"Easy Listening",
|
||||
"Light Classical",
|
||||
"Serious Classical",
|
||||
@@ -47,15 +45,15 @@ static const char* const PTY_EU[] {
|
||||
"Phone-In",
|
||||
"Travel",
|
||||
"Leisure",
|
||||
"Jazz Music",
|
||||
"Country Music",
|
||||
"Jazz",
|
||||
"Country",
|
||||
"National Music",
|
||||
"Oldies Music",
|
||||
"Folk Music",
|
||||
"Oldies",
|
||||
"Folk",
|
||||
"Documentary",
|
||||
"Alarm Test",
|
||||
"Alarm!!!",
|
||||
" "
|
||||
"Receiver fault"
|
||||
};
|
||||
|
||||
static const char* const PTY_USA[] {
|
||||
@@ -86,12 +84,12 @@ static const char* const PTY_USA[] {
|
||||
"Spanish Talk",
|
||||
"Spanish Music",
|
||||
"Hip Hop",
|
||||
" ",
|
||||
" ",
|
||||
"Unknown",
|
||||
"Unknown",
|
||||
"Weather",
|
||||
"Emergency Test",
|
||||
"EMERGENCY!",
|
||||
" "
|
||||
"Receiver fault"
|
||||
};
|
||||
|
||||
static const uint16_t oda_app_ids[] {
|
||||
@@ -105,45 +103,46 @@ static const uint16_t oda_app_ids[] {
|
||||
};
|
||||
|
||||
static const char* const ECCtext[] {
|
||||
"Germany", // 0
|
||||
"Greece", // 1
|
||||
"Morocco", // 2
|
||||
"Moldova", // 3
|
||||
"Algeria", // 4
|
||||
"Cyprus", // 5
|
||||
"Czech R.", // 6
|
||||
"Federal Republic of Germany", // 0
|
||||
"Hellenic Republic (Greece)", // 1
|
||||
"Kingdom of Morroco", // 2
|
||||
"Republic of Moldova", // 3
|
||||
"People's Democratic Republic of Algeria", // 4
|
||||
"Republic of Cyprus", // 5
|
||||
"Czech Republic", // 6
|
||||
"Ireland", // 7
|
||||
"Estonia", // 8
|
||||
"Andorra", // 9
|
||||
"San Marino", // 10
|
||||
"Poland", // 11
|
||||
"Turkey", // 12
|
||||
"Israel", // 13
|
||||
"Switzerl.", // 14
|
||||
"Vatican", // 15
|
||||
"Macedonia", // 16
|
||||
"Italy", // 17
|
||||
"Jordan", // 18
|
||||
"Slovakia", // 19
|
||||
"Belgium", // 20
|
||||
"Finland", // 21
|
||||
"Syria", // 22
|
||||
"Serbia", // 23
|
||||
"Republic of Estonia", // 8
|
||||
"Principality of Andorra", // 9
|
||||
"Republic of San Marino", // 10
|
||||
"Republic of Poland", // 11
|
||||
"Republic of Turkey", // 12
|
||||
"State of Israel", // 13
|
||||
"Swiss Confederation", // 14
|
||||
"Vatican City State", // 15
|
||||
"The former Yugoslav Republic of Macedonia", // 16
|
||||
"Italian Republic", // 17
|
||||
"Hashemite Kingdom of Jordan", // 18
|
||||
"Slovak Republic", // 19
|
||||
"Kingdom of Belgium", // 20
|
||||
"Republic of Finland", // 21
|
||||
"Syrian Arab Republic", // 22
|
||||
"Republic of Serbia", // 23
|
||||
"Ukraine", // 24
|
||||
"Russia", // 25
|
||||
"Luxemb.", // 26
|
||||
"Tunisia", // 27
|
||||
"Palestine", // 28
|
||||
"Bulgaria", // 29
|
||||
"Madeira", // 30
|
||||
"Netherl.", // 31
|
||||
"Portugal", // 32
|
||||
"Albania", // 33
|
||||
"Denmark", // 34
|
||||
"Liechtst.", // 35
|
||||
"Latvia", // 36
|
||||
"Slovenia", // 37
|
||||
"Austria", // 38
|
||||
"Russian Federation", // 25
|
||||
"Grand Duchy of Luxembourg", // 26
|
||||
"Republic of Tunisia", // 27
|
||||
"State of Palestine", // 28
|
||||
"Republic of Bulgaria", // 29
|
||||
"Republic of Portugal (Madeira)", // 30
|
||||
"Kingdom of the Netherlands", // 31
|
||||
"Republic of Portugal", // 32
|
||||
"Republic of Albania", // 33
|
||||
"Kingdom of Denmark", // 34
|
||||
"Principality of Liechtenstein", // 35
|
||||
"Republic of Latvia", // 36
|
||||
"Republic of Slovenia", // 37
|
||||
"Federal Republic of Austria", // 38
|
||||
// TODO after this
|
||||
"Gibraltar", // 39
|
||||
"Iceland", // 40
|
||||
"Lebanon", // 41
|
||||
@@ -653,4 +652,3 @@ class TEF6686 {
|
||||
time_t lastrdstime;
|
||||
int32_t lasttimeoffset;
|
||||
};
|
||||
#endif
|
||||
@@ -5,64 +5,64 @@
|
||||
#define Convert8bto16b(a) ((uint16_t)(((uint16_t)(*(a))) << 8 |((uint16_t)(*(a+1)))))
|
||||
|
||||
typedef enum {
|
||||
TEF_FM = 32,
|
||||
TEF_AM = 33,
|
||||
TEF_AUDIO = 48,
|
||||
TEF_APPL = 64
|
||||
TEF_FM = 32,
|
||||
TEF_AM = 33,
|
||||
TEF_AUDIO = 48,
|
||||
TEF_APPL = 64
|
||||
} TEF_MODULE;
|
||||
|
||||
typedef enum {
|
||||
Cmd_Tune_To = 1,
|
||||
Cmd_Set_Bandwidth = 10,
|
||||
Cmd_Set_RFAGC = 11,
|
||||
Cmd_Set_Antenna = 12,
|
||||
Cmd_Set_CoChannelDet = 14,
|
||||
Cmd_Set_MphSuppression = 20,
|
||||
Cmd_Set_ChannelEqualizer = 22,
|
||||
Cmd_Set_NoiseBlanker = 23,
|
||||
Cmd_Set_NoiseBlanker_Audio = 24,
|
||||
Cmd_Set_Deemphasis = 31,
|
||||
Cmd_Set_StereoImprovement = 32,
|
||||
Cmd_Set_LevelOffset = 39,
|
||||
Cmd_Set_Softmute_Max = 45,
|
||||
Cmd_Set_Highcut_Level = 52,
|
||||
Cmd_Set_Highcut_Noise = 53,
|
||||
Cmd_Set_Highcut_Mph = 54,
|
||||
Cmd_Set_Highcut_Max = 55,
|
||||
Cmd_Set_Stereo_Level = 62,
|
||||
Cmd_Set_Stereo_Noise = 63,
|
||||
Cmd_Set_Stereo_Mph = 64,
|
||||
Cmd_Set_Stereo_Min = 66,
|
||||
Cmd_Set_StHiBlend_Level = 72,
|
||||
Cmd_Set_StHiBlend_Noise = 73,
|
||||
Cmd_Set_StHiBlend_Mph = 74,
|
||||
Cmd_Set_StHiBlend_Max = 75,
|
||||
Cmd_Set_RDS = 81,
|
||||
Cmd_Set_Specials = 85,
|
||||
Cmd_Set_Bandwidth_Options = 86,
|
||||
Cmd_Set_StBandBlend_Time = 90,
|
||||
Cmd_Set_StBandBlend_Gain = 91,
|
||||
Cmd_Set_StBandBlend_Bias = 92,
|
||||
Cmd_Get_Quality_Status = 128,
|
||||
Cmd_Get_Quality_Data = 129,
|
||||
Cmd_Get_RDS_Status = 130,
|
||||
Cmd_Get_RDS_Data = 131,
|
||||
Cmd_Get_Signal_Status = 133,
|
||||
Cmd_Get_Processing_Status = 134
|
||||
Cmd_Tune_To = 1,
|
||||
Cmd_Set_Bandwidth = 10,
|
||||
Cmd_Set_RFAGC = 11,
|
||||
Cmd_Set_Antenna = 12,
|
||||
Cmd_Set_CoChannelDet = 14,
|
||||
Cmd_Set_MphSuppression = 20,
|
||||
Cmd_Set_ChannelEqualizer = 22,
|
||||
Cmd_Set_NoiseBlanker = 23,
|
||||
Cmd_Set_NoiseBlanker_Audio = 24,
|
||||
Cmd_Set_Deemphasis = 31,
|
||||
Cmd_Set_StereoImprovement = 32,
|
||||
Cmd_Set_LevelOffset = 39,
|
||||
Cmd_Set_Softmute_Max = 45,
|
||||
Cmd_Set_Highcut_Level = 52,
|
||||
Cmd_Set_Highcut_Noise = 53,
|
||||
Cmd_Set_Highcut_Mph = 54,
|
||||
Cmd_Set_Highcut_Max = 55,
|
||||
Cmd_Set_Stereo_Level = 62,
|
||||
Cmd_Set_Stereo_Noise = 63,
|
||||
Cmd_Set_Stereo_Mph = 64,
|
||||
Cmd_Set_Stereo_Min = 66,
|
||||
Cmd_Set_StHiBlend_Level = 72,
|
||||
Cmd_Set_StHiBlend_Noise = 73,
|
||||
Cmd_Set_StHiBlend_Mph = 74,
|
||||
Cmd_Set_StHiBlend_Max = 75,
|
||||
Cmd_Set_RDS = 81,
|
||||
Cmd_Set_Specials = 85,
|
||||
Cmd_Set_Bandwidth_Options = 86,
|
||||
Cmd_Set_StBandBlend_Time = 90,
|
||||
Cmd_Set_StBandBlend_Gain = 91,
|
||||
Cmd_Set_StBandBlend_Bias = 92,
|
||||
Cmd_Get_Quality_Status = 128,
|
||||
Cmd_Get_Quality_Data = 129,
|
||||
Cmd_Get_RDS_Status = 130,
|
||||
Cmd_Get_RDS_Data = 131,
|
||||
Cmd_Get_Signal_Status = 133,
|
||||
Cmd_Get_Processing_Status = 134
|
||||
} TEF_RADIO_COMMAND;
|
||||
|
||||
typedef enum {
|
||||
Cmd_Set_Volume = 10,
|
||||
Cmd_Set_Mute = 11,
|
||||
Cmd_Set_Input = 12,
|
||||
Cmd_Set_WaveGen = 24
|
||||
Cmd_Set_Volume = 10,
|
||||
Cmd_Set_Mute = 11,
|
||||
Cmd_Set_Input = 12,
|
||||
Cmd_Set_WaveGen = 24
|
||||
} TEF_AUDIO_COMMAND;
|
||||
|
||||
typedef enum {
|
||||
Cmd_Set_OperationMode = 1,
|
||||
Cmd_Set_GPIO = 3,
|
||||
Cmd_Get_Operation_Status = 128,
|
||||
Cmd_Get_Identification = 130
|
||||
Cmd_Set_OperationMode = 1,
|
||||
Cmd_Set_GPIO = 3,
|
||||
Cmd_Get_Operation_Status = 128,
|
||||
Cmd_Get_Identification = 130
|
||||
} TEF_APPL_COMMAND;
|
||||
|
||||
void devTEF_Set_Cmd(TEF_MODULE module, uint8_t cmd, uint16_t len, ...);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef TUNER_INTERFACE_H
|
||||
#define TUNER_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
void Tuner_I2C_Init();
|
||||
void Tuner_Patch(byte TEF);
|
||||
@@ -7,5 +6,4 @@ void Tuner_Init(const unsigned char *table);
|
||||
bool Tuner_WriteBuffer(unsigned char *buf, uint16_t len);
|
||||
bool Tuner_ReadBuffer(unsigned char *buf, uint16_t len);
|
||||
bool Tuner_Table_Write(const unsigned char *tab);
|
||||
void Tuner_Reset(void);
|
||||
#endif
|
||||
void Tuner_Reset();
|
||||
@@ -1,5 +1,3 @@
|
||||
extern const size_t PatchSize102;
|
||||
extern const unsigned char *pPatchBytes102;
|
||||
static const unsigned char PatchByteValues102[] PROGMEM = {
|
||||
0xF0, 0x00, 0x38, 0x3B, 0xD0, 0x80, 0xF0, 0x00, 0x38, 0x43, 0xD0, 0x80, 0x43, 0xB2, 0x38, 0x46, 0xD0, 0x80, 0xF0, 0x00, 0x70, 0x00, 0xC2, 0xF7,
|
||||
0xF0, 0x00, 0x38, 0x77, 0xD0, 0x80, 0xF0, 0x00, 0x38, 0x7B, 0xDF, 0x80, 0x80, 0xFC, 0x39, 0x0E, 0xD0, 0x80, 0xC2, 0x38, 0x20, 0x11, 0x40, 0xB7,
|
||||
@@ -261,8 +259,6 @@ static const unsigned char PatchByteValues102[] PROGMEM = {
|
||||
const size_t PatchSize102 = sizeof(PatchByteValues102);
|
||||
const unsigned char * pPatchBytes102 = &PatchByteValues102[0];
|
||||
|
||||
extern const size_t LutSize102;
|
||||
extern const unsigned char * pLutBytes102;
|
||||
static const unsigned char LutByteValues102[] PROGMEM = {
|
||||
0x40, 0x13, 0x40, 0x2F, 0x41, 0x68, 0x41, 0xC1,
|
||||
0x42, 0x14, 0x42, 0xA6, 0x44, 0xDE, 0x44, 0xE9,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
extern const size_t PatchSize205;
|
||||
extern const unsigned char *pPatchBytes205;
|
||||
static const unsigned char PatchByteValues205[] PROGMEM = {
|
||||
0xF0, 0x00, 0x60, 0x40, 0xD0, 0x80, 0x20, 0x87, 0x60, 0x4C, 0xD0, 0x80, 0x90, 0x00, 0x60, 0x4E, 0xD0, 0x80, 0x22, 0x02, 0x00, 0x55, 0x60, 0x04,
|
||||
0xF0, 0x00, 0x60, 0x65, 0xDF, 0x80, 0xF0, 0x00, 0x05, 0xBA, 0x60, 0x0E, 0x20, 0x90, 0x60, 0x9B, 0xD0, 0x80, 0x31, 0x40, 0x60, 0x9F, 0xD0, 0x80,
|
||||
@@ -246,8 +244,6 @@ static const unsigned char PatchByteValues205[] PROGMEM = {
|
||||
const size_t PatchSize205 = sizeof(PatchByteValues205);
|
||||
const unsigned char * pPatchBytes205 = &PatchByteValues205[0];
|
||||
|
||||
extern const size_t LutSize205;
|
||||
extern const unsigned char * pLutBytes205;
|
||||
static const unsigned char LutByteValues205[] PROGMEM = {
|
||||
0x80, 0x17, 0x80, 0x45, 0x80, 0x96, 0x81, 0x5B, 0x82, 0xD6, 0x83, 0x76, 0x88, 0x0B, 0x88, 0x10, 0x88, 0xDB, 0x89, 0x48, 0x89, 0xE9, 0x8B, 0x0A,
|
||||
0x8B, 0x12, 0x8B, 0x13, 0x8B, 0x21, 0x8B, 0x26, 0x8C, 0x6F, 0x8F, 0x91, 0x8F, 0xF6, 0x94, 0xD0, 0x95, 0x20, 0x95, 0x33, 0x95, 0x6F, 0x95, 0xA8,
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
/*!
|
||||
* @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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef WC_AP_HTML
|
||||
#define WC_AP_HTML ///< Define to stop re-inclusion
|
||||
/*! \def char AP_HTTP_HEAD[] PROGMEM
|
||||
Start of HTML output
|
||||
*/
|
||||
const char AP_HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/><title>{v}</title>";
|
||||
/*! \def AP_HTTP_STYLE[] PROGMEM
|
||||
Style for our access point
|
||||
*/
|
||||
const char AP_HTTP_STYLE[] PROGMEM = "<style type=\"text/css\">h1 { font-weight: normal; } .msgbox { font-size:1.2rem; line-height: 1.8em; padding: 0.5em; background-color: #ddffff; border-left: 6px solid #ccc; margin-bottom:1em; } .c{text-align:center}div,input{padding:5px;font-size:1em}input{width:95%;margin-top:5px;margin-bottom:10px}body{text-align:center;font-family:verdana;}button{border:0;border-radius:.3rem;background-color:#1fa3ec;color:#fff;line-height:2.6rem;font-size:1.2rem;width:100%}.q{float:right;width:64px;text-align:right}.l{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==) no-repeat left center;background-size:1em;}.cfail,.cok{text-align:center; font-size:1.2rem; line-height: 2em; margin-top: 1em; padding: 0.7em; display:none;} .cfail{color: #FFFFFF;background-color: #ff8433;} .cok{ background-color: #6aff33;}</style>";
|
||||
/** Scripts for our page */
|
||||
const char AP_HTTP_SCRIPT[] PROGMEM = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();}</script>";
|
||||
/** End of the header section and beginning of the body */
|
||||
const char AP_HTTP_HEAD_END[] PROGMEM = "</head><body><div style='text-align:left;display:inline-block;min-width:260px;'>";
|
||||
/** Start of our HTMl configuration Form */
|
||||
const char AP_HTTP_PORTAL_OPTIONS[] PROGMEM = "<div class=\"msgbox\">Connect this device to a WiFi network. Select the option to find a WiFi network.</div><form action=\"/wifi\" method=\"get\"><button>Configure WiFi (Auto Scan)</button></form><br/><form action=\"/0wifi\" method=\"get\"><button style=\"background-color:#bbbbbb;\">Configure WiFi (Manual)</button></form><!--<br/><form action=\"/i\" method=\"get\"><button>Info</button></form><br/></form>-->";
|
||||
/** HTML snippet for wifi scanning */
|
||||
const char AP_HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> <span class='q {i}'>{r}%</span></div>";
|
||||
/** HTML form for saving wifi connection details */
|
||||
const char AP_HTTP_FORM_START[] PROGMEM ="<form method=\"post\" action=\"wifisave\"><label>Enter WiFi Name ('SSID'):</label><input id=\"s\" name=\"s\" length=32 placeholder=\"Example: Home_Network_2002\"><label>Enter WiFi Password:</label><input id=\"p\" name=\"p\" length=64 type=\"password\" placeholder=\"Password123\"><br/>";;
|
||||
/** HTML snippet for our custom parameters */
|
||||
const char AP_HTTP_FORM_PARAM[] PROGMEM = "<br/><input id='{i}' name='{n}' maxlength={l} placeholder='{p}' value='{v}' {c}>";
|
||||
/** The end of our HTML Form */
|
||||
const char AP_HTTP_FORM_END[] PROGMEM = "<br/><button type='submit'>Save and Connect</button></form>";
|
||||
/** HTML snippet to recan for networks */
|
||||
const char AP_HTTP_SCAN_LINK[] PROGMEM = "<br/><div class=\"c\"><a href=\"/wifi\">Re-scan</a></div>";
|
||||
/** HTML snippet for saved confirmation */
|
||||
// https://stackoverflow.com/questions/20760635/why-does-setting-xmlhttprequest-responsetype-before-calling-open-throw
|
||||
// https://esprima.org/demo/validate.html
|
||||
// https://javascript-minifier.com/
|
||||
|
||||
/* Use JavaScript to ping the ESP periodically @ the AP IP address.
|
||||
* If it comes back as an AP again then we know the connection to the WiFi didn't work.
|
||||
* We wait about 30 seconds to determine this outcome. This isn't 100% foolproof, but should be good enough.
|
||||
*/
|
||||
/*
|
||||
<script type="text/javascript">
|
||||
function doPing() {
|
||||
//if ( timeout_count > 20 ) {
|
||||
if ( attempt_count > 20 ) { // wait about a minute
|
||||
window.clearInterval(myPinger), document.getElementById("conn_ok").style.display = "block"
|
||||
}
|
||||
|
||||
var o = new XMLHttpRequest;
|
||||
o.onload = function() {
|
||||
console.log(this.responseText), document.getElementById("conn_fail").style.display = "block", window.clearInterval(myPinger)
|
||||
}, o.ontimeout = function(o) {
|
||||
console.log("Timeout Counter is: " + timeout_count++)
|
||||
}, o.open("GET", "/foo"), o.timeout = 1000, o.send(null), console.log("Ping counter is: " + attempt_count++)
|
||||
}
|
||||
|
||||
attempt_count = 0;
|
||||
timeout_count = 0;
|
||||
var myPinger = window.setInterval(doPing, 3000);
|
||||
|
||||
</script>
|
||||
*/
|
||||
const char AP_HTTP_SAVED[] PROGMEM = "<div>Credentials Saved.<br />Attempting to connect to WiFi network. Please wait.... <br /><script type=\"text/javascript\">function doPing(){attempt_count>20&&(window.clearInterval(myPinger),document.getElementById(\"conn_ok\").style.display=\"block\");var t=new XMLHttpRequest;t.onload=function(){console.log(this.responseText),document.getElementById(\"conn_fail\").style.display=\"block\",window.clearInterval(myPinger)},t.ontimeout=function(t){console.log(\"Timeout Counter is: \"+timeout_count++)},t.open(\"GET\",\"/foo\"),t.timeout=1e3,t.send(null),console.log(\"Ping counter is: \"+attempt_count++)}attempt_count=0,timeout_count=0;var myPinger=window.setInterval(doPing,3e3);</script><div class=\"cok\" id=\"conn_ok\">Connected to {ap} !<br />You may now close this window. </div><div class=\"cfail\" id=\"conn_fail\">Failed to connect to {ap}!<br /><a href=\"/\">Click here</a> to try again.</div></div>";
|
||||
/** End of the HTML page */
|
||||
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
|
||||
@@ -1,189 +0,0 @@
|
||||
/*!
|
||||
@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
|
||||
#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);
|
||||
|
||||
void addParameter(WiFiConnectParam *p);
|
||||
|
||||
void setAPName(const char* apName);
|
||||
const char* getAPName();
|
||||
|
||||
void resetSettings();
|
||||
|
||||
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) );
|
||||
|
||||
void setDebug(boolean isDebug);
|
||||
|
||||
void setRetryAttempts(int attempts);
|
||||
void setConnectionTimeoutSecs(int timeout);
|
||||
void setAPModeTimeoutMins(int mins);
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
char _apName[33] ; ///< Holder for the access point name
|
||||
char _apPassword[65] ; ///< Holder for the access point password
|
||||
|
||||
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)(void) = NULL;
|
||||
|
||||
|
||||
|
||||
void handleRoot();
|
||||
void handleParamRoot();
|
||||
void handleParams();
|
||||
void handleWifi(boolean scan);
|
||||
void handleWifiSave();
|
||||
void handleInfo();
|
||||
void handleReset();
|
||||
void handle204();
|
||||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
/*!
|
||||
@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
|
||||
|
||||
#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);
|
||||
WiFiConnectParam(const char *id, const char *placeholder, const char *defaultValue, int length);
|
||||
WiFiConnectParam(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom);
|
||||
|
||||
const char *getID();
|
||||
const char *getValue();
|
||||
const char *getPlaceholder();
|
||||
int getValueLength();
|
||||
const char *getCustomHTML();
|
||||
void setValue(const char *newValue);
|
||||
private:
|
||||
const char *_id;
|
||||
const char *_placeholder;
|
||||
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,7 +1,4 @@
|
||||
#ifndef LANGUAGE_H
|
||||
#define LANGUAGE_H
|
||||
|
||||
// [number of languages][number of texts]
|
||||
#pragma once
|
||||
|
||||
static const char* const myLanguage[22][301] PROGMEM = {
|
||||
{ "English", // English
|
||||
@@ -6669,5 +6666,4 @@ static const char* const myLanguage[22][301] PROGMEM = {
|
||||
"Loggboken har mer än 130 poster, vilket visaren inte kan hantera. Ladda ner CSV för behandling.", // 299
|
||||
"Kanada" // 300
|
||||
}
|
||||
};
|
||||
#endif
|
||||
};
|
||||
@@ -142,7 +142,6 @@ extern TFT_eSprite PSSprite;
|
||||
|
||||
void ShowAdvancedRDS();
|
||||
void readRds();
|
||||
void showECC();
|
||||
void doAF();
|
||||
void showPI();
|
||||
void showPTY();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef TOUCH_H
|
||||
#define TOUCH_H
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <TFT_eSPI.h>
|
||||
@@ -8,26 +7,15 @@
|
||||
extern TFT_eSPI tft;
|
||||
extern TEF6686 radio;
|
||||
|
||||
extern bool advancedRDS;
|
||||
extern bool afpage;
|
||||
extern bool afscreen;
|
||||
extern bool bwtouchtune;
|
||||
extern bool BWtune;
|
||||
extern bool leave;
|
||||
extern bool menu;
|
||||
extern bool menuopen;
|
||||
extern bool scandxmode;
|
||||
extern bool seek;
|
||||
extern bool touchrepeat;
|
||||
extern bool XDRGTKTCP;
|
||||
extern bool XDRGTKUSB;
|
||||
extern bool advancedRDS, afpage, afscreen;
|
||||
extern bool bwtouchtune, BWtune, leave;
|
||||
extern bool menu, menuopen, scandxmode;
|
||||
extern bool seek, touchrepeat;
|
||||
extern bool XDRGTKTCP, XDRGTKUSB;
|
||||
extern byte afpagenr;
|
||||
extern byte band;
|
||||
extern byte BWset;
|
||||
extern byte BWtemp;
|
||||
extern byte EQset;
|
||||
extern byte iMSEQ;
|
||||
extern byte iMSset;
|
||||
extern byte BWset, BWtemp;
|
||||
extern byte EQset, iMSEQ, iMSset;
|
||||
extern byte menuitem;
|
||||
extern byte items[10];
|
||||
extern byte menupage;
|
||||
@@ -35,7 +23,6 @@ extern int menuoption;
|
||||
|
||||
void doTouchEvent(uint16_t x, uint16_t y);
|
||||
|
||||
//extern void ScreensaverTimerReopen();
|
||||
extern void BuildDisplay();
|
||||
extern void BuildBWSelector();
|
||||
extern void SelectBand();
|
||||
@@ -58,5 +45,3 @@ extern void updateEQ();
|
||||
extern void DataPrint(String string);
|
||||
extern void BuildAFScreen();
|
||||
extern void ShowFreq(int mode);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user