Added configurable AP password as in #51. Improved battery reading on T-Beam 0.7 as in #65. Fixed AP detection in serial printing. Updated readme.md

pull/74/head
Sottosistema W10 2021-09-16 19:54:14 +02:00
rodzic a3873a4110
commit 16aae406b2
5 zmienionych plików z 39 dodań i 12 usunięć

Wyświetl plik

@ -64,13 +64,14 @@ After connection with APRX based DIGI it can be used as KISS-TNC
* In the left column click on the ANT-shaped icon, choose your board and click on "Upload". COM port should be detected automatically Wait for procedure to finish and keep reading
## Configuring parameters
Wait for the board to reboot, connect to "N0CALL AP" WiFi network, password is: xxxxxxxxxx (10 times "x") and point your browser to "192.168.4.1"
Wait for the board to reboot, connect to "N0CALL AP" WiFi network, password is: xxxxxxxxxx (10 times "x") and point your browser to "192.168.4.1". Hover your mouse to textboxes to get useful hints.
### 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
* AUTO AP Password: if configured network is not reachable the AP mode will be enabled, SSID will be your callsign and this will be the password
### 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.

Wyświetl plik

@ -26,15 +26,15 @@
</div>
<div>
<label for="wifi_ssid">WiFi SSID</label>
<input class="u-full-width" type="text" name="wifi_ssid" placeholder="Your Wifi SSID" id="wifi_ssid">
<input class="u-full-width" type="text" name="wifi_ssid" placeholder="Your Wifi SSID" title="Your Wifi SSID" id="wifi_ssid">
</div>
<div>
<label for="wifi_password">WiFi Password</label>
<input class="u-full-width" type="password" name="wifi_password" id="wifi_password">
<input class="u-full-width" type="password" name="wifi_password" id="wifi_password" placeholder="Your WiFi Password" title="Your 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>
<input class="u-full-width" type="password" name="ap_password" id="ap_password" placeholder="AUTO AP Password" title="AUTO AP Password">
</div>
</div>
<div class="grid-container full">

Wyświetl plik

@ -9,6 +9,7 @@ extern Preferences preferences;
// MAX 15 chars for preferenece key!!!
static const char *const PREF_WIFI_SSID = "wifi_ssid";
static const char *const PREF_WIFI_PASSWORD = "wifi_password";
static const char *const PREF_AP_PASSWORD = "ap_password";
// LoRa settings
static const char *const PREF_LORA_FREQ_PRESET_INIT = "lora_freq_i";
static const char *const PREF_LORA_FREQ_PRESET = "lora_freq";

Wyświetl plik

@ -366,9 +366,9 @@ void batt_read(){
BattVolts = axp.getBattVoltage()/1000;
InpVolts = axp.getVbusVoltage()/1000;
#elif T_BEAM_V0_7
BattVolts = ((float)analogRead(35) / 8192.0) * 2.0 * 3.3 * (1100.0 / 1000.0); // fixed thanks to Luca IU2FRL
BattVolts = (((float)analogRead(35) / 8192.0) * 2.0 * 3.3 * (1100.0 / 1000.0))+0.41; // fixed thanks to Luca IU2FRL
#else
BattVolts = analogRead(35)*7.221/4096; // fixed thanks to Luca IU2FRL
BattVolts = analogRead(35)*7.221/4096;
#endif
}

Wyświetl plik

@ -112,15 +112,26 @@ void handle_ScanWifi() {
}
void handle_SaveWifiCfg() {
if (!server.hasArg(PREF_WIFI_SSID) || !server.hasArg(PREF_WIFI_PASSWORD)){
server.send(500, "text/plain", "Invalid request");
if (!server.hasArg(PREF_WIFI_SSID) || !server.hasArg(PREF_WIFI_PASSWORD) || !server.hasArg(PREF_AP_PASSWORD)){
server.send(500, "text/plain", "Invalid request, make sure all fields are set");
}
if (!server.arg(PREF_WIFI_SSID).length()){
server.send(403, "text/plain", "Empty SSID or Password");
server.send(403, "text/plain", "Empty SSID");
}
if (server.arg(PREF_WIFI_PASSWORD)!="*" && server.arg(PREF_AP_PASSWORD).length()<8){
server.send(403, "text/plain", "WiFi Password must be minimum 8 character");
}
if (server.arg(PREF_AP_PASSWORD)!="*" && server.arg(PREF_AP_PASSWORD).length()<8){
server.send(403, "text/plain", "AP Password must be minimum 8 character");
}
preferences.putString(PREF_WIFI_SSID, server.arg(PREF_WIFI_SSID));
preferences.putString(PREF_WIFI_PASSWORD, server.arg(PREF_WIFI_PASSWORD));
if (server.arg(PREF_WIFI_PASSWORD)!="*") {
preferences.putString(PREF_WIFI_PASSWORD, server.arg(PREF_WIFI_PASSWORD));
}
if (server.arg(PREF_AP_PASSWORD)!="*") {
preferences.putString(PREF_AP_PASSWORD, server.arg(PREF_AP_PASSWORD));
}
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
@ -159,6 +170,7 @@ void handle_Restore() {
void handle_Cfg() {
String jsonData = "{";
jsonData += String("\"") + PREF_WIFI_PASSWORD + "\": \"" + jsonEscape((preferences.getString(PREF_WIFI_PASSWORD).isEmpty() ? String("") : "*")) + R"(",)";
jsonData += String("\"") + PREF_AP_PASSWORD + "\": \"" + jsonEscape((preferences.getString(PREF_AP_PASSWORD).isEmpty() ? String("") : "*")) + R"(",)";
jsonData += jsonLineFromPreferenceString(PREF_WIFI_SSID);
jsonData += jsonLineFromPreferenceDouble(PREF_LORA_FREQ_PRESET);
jsonData += jsonLineFromPreferenceInt(PREF_LORA_SPEED_PRESET);
@ -346,6 +358,10 @@ void handle_saveDeviceCfg(){
String wifi_password = preferences.getString(PREF_WIFI_PASSWORD);
String wifi_ssid = preferences.getString(PREF_WIFI_SSID);
if (preferences.getString(PREF_AP_PASSWORD).length() > 8) {
// 8 characters is requirements for WPA2
apPassword = preferences.getString(PREF_AP_PASSWORD);
}
if (!wifi_ssid.length()){
WiFi.softAP(apSSID.c_str(), apPassword.c_str());
} else {
@ -361,15 +377,24 @@ void handle_saveDeviceCfg(){
retryWifi += 1;
if (retryWifi > 60) {
WiFi.softAP(apSSID.c_str(), apPassword.c_str());
//WiFi.softAP(apSSID.c_str(), "password");
Serial.println("Unable to connect to to wifi. Starting AP");
Serial.print("SSID: ");
Serial.print(apSSID.c_str());
Serial.print(" Password: ");
Serial.println(apPassword.c_str());
break;
}
}
if (WiFi.getMode() == wifi_mode_t::WIFI_MODE_AP){
//Serial.print("WiFi Mode: ");
//Serial.println(WiFi.getMode());
if (WiFi.getMode() == 3){
Serial.println("Running AP. IP: " + WiFi.softAPIP().toString());
} else {
} else if (WiFi.getMode() == 1) {
Serial.println("Connected. IP: " + WiFi.localIP().toString());
} else {
Serial.println("WiFi Mode: " + WiFi.getMode());
}
#ifdef ENABLE_SYSLOG