Merge pull request #74 from iu2frl/master

Added #51. Fixed #65. Updated readme.md
pull/76/head
Rysiek Labus (SQ9MDD) 2021-09-16 21:25:59 +02:00 zatwierdzone przez GitHub
commit cff57273dd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 57 dodań i 14 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

@ -24,7 +24,9 @@ std::list <tReceivedPacketData*> receivedPackets;
const int MAX_RECEIVED_LIST_SIZE = 50;
String apSSID = "";
String apPassword = "xxxxxxxxxx";
String apPassword;
String defApPassword = "xxxxxxxxxx";
WebServer server(80);
#ifdef KISS_PROTOCOL
WiFiServer tncServer(NETWORK_TNC_PORT);
@ -112,16 +114,38 @@ 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");
} else {
// Update SSID
preferences.putString(PREF_WIFI_SSID, server.arg(PREF_WIFI_SSID));
Serial.println("Updated SSID: " + server.arg(PREF_WIFI_SSID));
}
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)!="*" && server.arg(PREF_WIFI_PASSWORD).length()>0 && server.arg(PREF_WIFI_PASSWORD).length()<8){
server.send(403, "text/plain", "WiFi Password must be minimum 8 character");
} else {
if (server.arg(PREF_WIFI_PASSWORD)!="*") {
// Update WiFi password
preferences.putString(PREF_WIFI_PASSWORD, server.arg(PREF_WIFI_PASSWORD));
Serial.println("Updated WiFi PASS: " + server.arg(PREF_WIFI_PASSWORD));
}
}
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");
} else {
if (server.arg(PREF_AP_PASSWORD)!="*") {
// Update AP password
preferences.putString(PREF_AP_PASSWORD, server.arg(PREF_AP_PASSWORD));
Serial.println("Updated AP PASS: " + server.arg(PREF_AP_PASSWORD));
}
}
server.sendHeader("Location", "/");
server.send(302,"text/html", "");
}
@ -159,6 +183,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);
@ -198,6 +223,7 @@ void handle_Cfg() {
void handle_ReceivedList() {
PSRAMJsonDocument doc(MAX_RECEIVED_LIST_SIZE * 1000);
//DynamicJsonDocument doc(MAX_RECEIVED_LIST_SIZE * 500);
JsonObject root = doc.to<JsonObject>();
auto received = root.createNestedArray("received");
for (auto element: receivedPackets){
@ -346,6 +372,12 @@ 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);
} else {
apPassword = defApPassword;
}
if (!wifi_ssid.length()){
WiFi.softAP(apSSID.c_str(), apPassword.c_str());
} else {
@ -361,15 +393,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