Compare commits
9
Commits
e1ee1c560e
...
v0.0.8a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
333d87af3e | ||
|
|
13f1aa2148 | ||
|
|
5688f8d679 | ||
|
|
d8558b330a | ||
|
|
72d9923800 | ||
|
|
57ccb75847 | ||
|
|
e5453b29fa | ||
|
|
ea79561bcf | ||
|
|
cbceec1887 |
No files matched your search
@@ -52,8 +52,9 @@ jobs:
|
|||||||
run: python3 -m platformio run --environment "${{ matrix.environment }}"
|
run: python3 -m platformio run --environment "${{ matrix.environment }}"
|
||||||
- name: Verify firmware and create checksum
|
- name: Verify firmware and create checksum
|
||||||
run: |
|
run: |
|
||||||
test -n "$(find ".pio/build/${{ matrix.environment }}" -maxdepth 1 -type f -name 'firmware_*.bin' -print -quit)
|
FIRMWARE_FILE=$(find ".pio/build/${{ matrix.environment }}" -maxdepth 1 -type f -name 'firmware_*.bin' -print -quit)
|
||||||
sha256sum ".pio/build/${{ matrix.environment }}"/firmware_*.bin > "firmware-${{ matrix.environment }}.sha256"
|
test -n "$FIRMWARE_FILE"
|
||||||
|
sha256sum "$FIRMWARE_FILE" > "firmware-${{ matrix.environment }}.sha256"
|
||||||
- name: Archive firmware
|
- name: Archive firmware
|
||||||
uses: christopherhx/gitea-upload-artifact@62ac910c5d3dfa85c7cb2df15afe2e342b2407c2 # v4
|
uses: christopherhx/gitea-upload-artifact@62ac910c5d3dfa85c7cb2df15afe2e342b2407c2 # v4
|
||||||
with:
|
with:
|
||||||
@@ -85,16 +86,31 @@ jobs:
|
|||||||
path: firmware/winde
|
path: firmware/winde
|
||||||
- name: Verify release assets
|
- name: Verify release assets
|
||||||
run: |
|
run: |
|
||||||
test -n "$(find firmware -type f -name 'firmware_*.bin' -print -quit)"
|
RELEASE_VERSION="${{ gitea.ref_name }}"
|
||||||
test -n "$(find firmware -type f -name '*.sha256' -print -quit)"
|
SAILPLANE_FILE=$(find firmware/sailplane -type f -name 'firmware_*.bin' -print -quit)
|
||||||
|
WINDE_FILE=$(find firmware/winde -type f -name 'firmware_*.bin' -print -quit)
|
||||||
|
test -n "$SAILPLANE_FILE"
|
||||||
|
test -n "$WINDE_FILE"
|
||||||
|
cp "$SAILPLANE_FILE" "firmware/firmware_sailplane_${RELEASE_VERSION}.bin"
|
||||||
|
cp "$WINDE_FILE" "firmware/firmware_winde_${RELEASE_VERSION}.bin"
|
||||||
|
(cd firmware && sha256sum "firmware_sailplane_${RELEASE_VERSION}.bin" > "firmware_sailplane_${RELEASE_VERSION}.sha256")
|
||||||
|
(cd firmware && sha256sum "firmware_winde_${RELEASE_VERSION}.bin" > "firmware_winde_${RELEASE_VERSION}.sha256")
|
||||||
|
test -s "firmware/firmware_sailplane_${RELEASE_VERSION}.bin"
|
||||||
|
test -s "firmware/firmware_winde_${RELEASE_VERSION}.bin"
|
||||||
|
test -s "firmware/firmware_sailplane_${RELEASE_VERSION}.sha256"
|
||||||
|
test -s "firmware/firmware_winde_${RELEASE_VERSION}.sha256"
|
||||||
|
(cd firmware && sha256sum -c "firmware_sailplane_${RELEASE_VERSION}.sha256")
|
||||||
|
(cd firmware && sha256sum -c "firmware_winde_${RELEASE_VERSION}.sha256")
|
||||||
test -s LICENSE
|
test -s LICENSE
|
||||||
test -s THIRD_PARTY_NOTICES.md
|
test -s THIRD_PARTY_NOTICES.md
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: akkuman/gitea-release-action@5a83c90484ef4355121df5eb60558c8ce66e81ac # v1
|
uses: akkuman/gitea-release-action@5a83c90484ef4355121df5eb60558c8ce66e81ac # v1
|
||||||
with:
|
with:
|
||||||
files: |-
|
files: |-
|
||||||
firmware/**/*.bin
|
firmware/firmware_sailplane_${{ gitea.ref_name }}.bin
|
||||||
firmware/**/*.sha256
|
firmware/firmware_winde_${{ gitea.ref_name }}.bin
|
||||||
|
firmware/firmware_sailplane_${{ gitea.ref_name }}.sha256
|
||||||
|
firmware/firmware_winde_${{ gitea.ref_name }}.sha256
|
||||||
LICENSE
|
LICENSE
|
||||||
THIRD_PARTY_NOTICES.md
|
THIRD_PARTY_NOTICES.md
|
||||||
body_path: "CHANGELOG.md"
|
body_path: "CHANGELOG.md"
|
||||||
@@ -1,3 +1,23 @@
|
|||||||
|
CHANGELOG
|
||||||
|
## v0.0.8a (30.08.2026)
|
||||||
|
+ fix: Wifi Auto off Nachrichten Schleife
|
||||||
|
+ Verbesserung Redirect to Einstellungs Seite
|
||||||
|
+ Verbesserung AutoBuild
|
||||||
|
|
||||||
|
## v0.0.8 (30.08.2026)
|
||||||
|
+ Firmware-Version als Build-Tag im Code und im Webinterface eingebaut
|
||||||
|
+ WLAN-Name für Segelflug- und Winden-Module angepasst (`Telemetry-<Callsign>` bzw. `Telemetry-Winch`)
|
||||||
|
+ Webinterface zeigt aktuell geladene Firmware-Version an
|
||||||
|
+ Speichern der Einstellungen springt nach dem Speichern auf die Startseite mit Erfolg/Fehlerstatus zurück
|
||||||
|
+ Captive-Portal / DNS-Weiterleitung für das Webinterface ergänzt
|
||||||
|
+ Access Point bleibt nur 5 Minuten nach PowerOn aktiv, wenn kein Client verbunden ist, und wird dann automatisch deaktiviert
|
||||||
|
|
||||||
|
## v0.0.7d (28.08.2026)
|
||||||
|
+ AutoBuild und Release-Prozess für Versionsnamen, Prüfsummen und Release-Artefakte korrigiert
|
||||||
|
|
||||||
|
## v0.0.7c (28.08.2026)
|
||||||
|
+ korrektur AutoBuild (Checksum)
|
||||||
|
|
||||||
## v0.0.7b (28.08.2026)
|
## v0.0.7b (28.08.2026)
|
||||||
+ korrektur AutoBuild
|
+ korrektur AutoBuild
|
||||||
|
|
||||||
|
|||||||
+16
-3
@@ -1,10 +1,23 @@
|
|||||||
import os
|
import os
|
||||||
Import("env")
|
from typing import Any
|
||||||
|
|
||||||
|
# PlatformIO injects Import() and env at runtime. The editor does not know these
|
||||||
|
# names at file-load time, so we keep a short, explicit guard and silence the
|
||||||
|
# static-analysis warning for the SCons hook itself.
|
||||||
|
try:
|
||||||
|
Import("env") # type: ignore[name-defined]
|
||||||
|
except NameError:
|
||||||
|
env: Any = None
|
||||||
|
|
||||||
|
if env is None:
|
||||||
|
raise RuntimeError("This script must be run by PlatformIO's SCons environment.")
|
||||||
|
|
||||||
# Access to global construction environment
|
# Access to global construction environment
|
||||||
build_tag = env['PIOENV']
|
build_tag = env["PIOENV"]
|
||||||
version_tag = os.getenv("FIRMWARE_VERSION")
|
version_tag = os.getenv("FIRMWARE_VERSION", "dev").strip()
|
||||||
|
|
||||||
|
# CPPDEFINES ensures the macro expands to a valid C string literal instead of a bare identifier.
|
||||||
|
env.Append(CPPDEFINES=[("FIRMWARE_VERSION", f'\\"{version_tag}\\"')])
|
||||||
env.Replace(PROGNAME="firmware_%s_%s" % (build_tag, version_tag))
|
env.Replace(PROGNAME="firmware_%s_%s" % (build_tag, version_tag))
|
||||||
|
|
||||||
# include toolchain paths
|
# include toolchain paths
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "webinterface.h"
|
#include "webinterface.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <DNSServer.h>
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include <Update.h>
|
#include <Update.h>
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -13,22 +15,58 @@ constexpr char default_callsign[] = "D1234";
|
|||||||
constexpr int default_min_speed = 80;
|
constexpr int default_min_speed = 80;
|
||||||
constexpr int default_max_speed = 150;
|
constexpr int default_max_speed = 150;
|
||||||
constexpr unsigned int default_active_time_seconds = 90;
|
constexpr unsigned int default_active_time_seconds = 90;
|
||||||
|
constexpr unsigned long access_point_timeout_ms = 5UL * 60UL * 1000UL;
|
||||||
|
constexpr char telemetry_ap_prefix[] = "Telemetry-";
|
||||||
|
|
||||||
String default_access_point_name()
|
String default_access_point_name()
|
||||||
{
|
{
|
||||||
#ifdef DEVICE_SAILPLANE
|
#ifdef DEVICE_SAILPLANE
|
||||||
return String("Sailplane-") + default_callsign;
|
return String(telemetry_ap_prefix) + default_callsign;
|
||||||
#else
|
#else
|
||||||
return "Winde-Telemetry";
|
return String(telemetry_ap_prefix) + "Winch";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String generated_access_point_name(const String &callsign)
|
||||||
|
{
|
||||||
|
#ifdef DEVICE_SAILPLANE
|
||||||
|
String safe_callsign = callsign;
|
||||||
|
if (safe_callsign.length() == 0)
|
||||||
|
safe_callsign = default_callsign;
|
||||||
|
return String(telemetry_ap_prefix) + safe_callsign;
|
||||||
|
#else
|
||||||
|
return String(telemetry_ap_prefix) + "Winch";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
String url_encode(const String &value)
|
||||||
|
{
|
||||||
|
String encoded;
|
||||||
|
encoded.reserve(value.length() * 3);
|
||||||
|
for (unsigned int i = 0; i < value.length(); ++i)
|
||||||
|
{
|
||||||
|
const char c = value.charAt(i);
|
||||||
|
if (std::isalnum(static_cast<unsigned char>(c)) || c == '-' || c == '_' || c == '.' || c == '~')
|
||||||
|
encoded += c;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char buffer[4];
|
||||||
|
snprintf(buffer, sizeof(buffer), "%%%02X", static_cast<unsigned char>(c));
|
||||||
|
encoded += buffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
|
||||||
WebServer server(80);
|
WebServer server(80);
|
||||||
|
DNSServer dns_server;
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
TelemetrySettings *active_settings = nullptr;
|
TelemetrySettings *active_settings = nullptr;
|
||||||
bool restart_after_update = false;
|
bool restart_after_update = false;
|
||||||
bool update_failed = false;
|
bool update_failed = false;
|
||||||
bool access_point_restart_pending = false;
|
bool access_point_restart_pending = false;
|
||||||
|
bool access_point_active = false;
|
||||||
|
unsigned long access_point_started_ms = 0UL;
|
||||||
|
|
||||||
String html_escape(const String &value)
|
String html_escape(const String &value)
|
||||||
{
|
{
|
||||||
@@ -41,6 +79,73 @@ String html_escape(const String &value)
|
|||||||
return escaped;
|
return escaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_captive_portal_target(const String &host, const String &uri)
|
||||||
|
{
|
||||||
|
String lowercase_host = host;
|
||||||
|
lowercase_host.toLowerCase();
|
||||||
|
|
||||||
|
String lowercase_uri = uri;
|
||||||
|
lowercase_uri.toLowerCase();
|
||||||
|
|
||||||
|
static const char *captive_hosts[] = {
|
||||||
|
"connectivitycheck.gstatic.com",
|
||||||
|
"clients3.google.com",
|
||||||
|
"google.com",
|
||||||
|
"www.google.com",
|
||||||
|
"msftconnecttest.com",
|
||||||
|
"msftncsi.com",
|
||||||
|
"captive.apple.com",
|
||||||
|
"www.apple.com",
|
||||||
|
"apple.com",
|
||||||
|
"connectivitycheck.android.com"};
|
||||||
|
|
||||||
|
for (const char *candidate : captive_hosts)
|
||||||
|
{
|
||||||
|
if (lowercase_host == candidate)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *captive_paths[] = {
|
||||||
|
"/generate_204",
|
||||||
|
"/hotspot-detect.html",
|
||||||
|
"/library/test/success.html",
|
||||||
|
"/connecttest.txt",
|
||||||
|
"/redirect",
|
||||||
|
"/ncsi.txt",
|
||||||
|
"/success.txt",
|
||||||
|
"/wap"};
|
||||||
|
|
||||||
|
for (const char *candidate : captive_paths)
|
||||||
|
{
|
||||||
|
if (lowercase_uri == candidate)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void redirect_to_root(const String &message, bool success)
|
||||||
|
{
|
||||||
|
String location = String("/?status=") + (success ? "success" : "error") + "&msg=" + url_encode(message);
|
||||||
|
server.sendHeader("Location", location, true);
|
||||||
|
server.send(303, "text/plain; charset=utf-8", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_captive_portal_redirect()
|
||||||
|
{
|
||||||
|
String host = server.hostHeader();
|
||||||
|
String uri = server.uri();
|
||||||
|
|
||||||
|
if (is_captive_portal_target(host, uri))
|
||||||
|
{
|
||||||
|
server.sendHeader("Location", "/", true);
|
||||||
|
server.send(302, "text/plain; charset=utf-8", "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
server.send(404, "text/plain; charset=utf-8", "Not Found");
|
||||||
|
}
|
||||||
|
|
||||||
void send_page(const String &message = String())
|
void send_page(const String &message = String())
|
||||||
{
|
{
|
||||||
String page;
|
String page;
|
||||||
@@ -51,15 +156,19 @@ void send_page(const String &message = String())
|
|||||||
"body{font-family:sans-serif;max-width:38rem;margin:2rem auto;padding:0 1rem}"
|
"body{font-family:sans-serif;max-width:38rem;margin:2rem auto;padding:0 1rem}"
|
||||||
"label{display:block;margin-top:1rem}input{box-sizing:border-box;width:100%;padding:.6rem;font-size:1rem}"
|
"label{display:block;margin-top:1rem}input{box-sizing:border-box;width:100%;padding:.6rem;font-size:1rem}"
|
||||||
"button{margin-top:1rem;padding:.65rem 1rem;font-size:1rem}"
|
"button{margin-top:1rem;padding:.65rem 1rem;font-size:1rem}"
|
||||||
".msg{padding:.6rem;background:#e5f4e8}small{color:#555}"
|
".msg{padding:.6rem;background:#e5f4e8}.error{padding:.6rem;background:#fbe5e5}small{color:#555}"
|
||||||
"</style></head><body><h1>Winden-Telemetry</h1>");
|
"</style></head><body><h1>Winden-Telemetry</h1>");
|
||||||
if (message.length() > 0)
|
if (message.length() > 0)
|
||||||
{
|
{
|
||||||
page += F("<p class='msg'>");
|
page += F("<p class='");
|
||||||
|
page += String(message.startsWith("Fehler") || message.startsWith("Ungueltig") || message.startsWith("Invalid") ? "error" : "msg");
|
||||||
|
page += F("'>");
|
||||||
page += html_escape(message);
|
page += html_escape(message);
|
||||||
page += F("</p>");
|
page += F("</p>");
|
||||||
}
|
}
|
||||||
page += F("<form method='post' action='/settings'>"
|
page += F("<p><small>Firmware: ");
|
||||||
|
page += html_escape(firmware_version_string());
|
||||||
|
page += F("</small></p><form method='post' action='/settings'>"
|
||||||
"<label>WLAN-Name<input name='ap_name' maxlength='32' required value='");
|
"<label>WLAN-Name<input name='ap_name' maxlength='32' required value='");
|
||||||
page += html_escape(active_settings->access_point_name);
|
page += html_escape(active_settings->access_point_name);
|
||||||
page += F("'></label><label>WLAN-Passwort<input name='ap_password' type='password' minlength='8' maxlength='63' required value='");
|
page += F("'></label><label>WLAN-Passwort<input name='ap_password' type='password' minlength='8' maxlength='63' required value='");
|
||||||
@@ -92,12 +201,13 @@ bool parse_settings(TelemetrySettings &settings)
|
|||||||
callsign.trim();
|
callsign.trim();
|
||||||
access_point_name.trim();
|
access_point_name.trim();
|
||||||
access_point_password.trim();
|
access_point_password.trim();
|
||||||
if (access_point_name.length() == 0 || access_point_name.length() > 32 || access_point_password.length() < 8 || access_point_password.length() > 63 || callsign.length() == 0 || callsign.length() > 16 || min_speed < 0 || max_speed > 300 ||
|
|
||||||
|
if (callsign.length() == 0 || callsign.length() > 16 || access_point_password.length() < 8 || access_point_password.length() > 63 || min_speed < 0 || max_speed > 300 ||
|
||||||
min_speed >= max_speed || active_time_seconds < 1 || active_time_seconds > 600)
|
min_speed >= max_speed || active_time_seconds < 1 || active_time_seconds > 600)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
settings.callsign = callsign;
|
settings.callsign = callsign;
|
||||||
settings.access_point_name = access_point_name;
|
settings.access_point_name = generated_access_point_name(callsign);
|
||||||
settings.access_point_password = access_point_password;
|
settings.access_point_password = access_point_password;
|
||||||
settings.min_speed = min_speed;
|
settings.min_speed = min_speed;
|
||||||
settings.max_speed = max_speed;
|
settings.max_speed = max_speed;
|
||||||
@@ -107,7 +217,13 @@ bool parse_settings(TelemetrySettings &settings)
|
|||||||
|
|
||||||
void handle_root()
|
void handle_root()
|
||||||
{
|
{
|
||||||
send_page();
|
String message = server.arg("msg");
|
||||||
|
String status = server.arg("status");
|
||||||
|
if (status == "error" && message.length() == 0)
|
||||||
|
message = "Ungueltige Einstellungen";
|
||||||
|
else if (status == "success" && message.length() == 0)
|
||||||
|
message = "Einstellungen gespeichert.";
|
||||||
|
send_page(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_settings()
|
void handle_settings()
|
||||||
@@ -115,10 +231,13 @@ void handle_settings()
|
|||||||
TelemetrySettings updated = *active_settings;
|
TelemetrySettings updated = *active_settings;
|
||||||
if (!parse_settings(updated))
|
if (!parse_settings(updated))
|
||||||
{
|
{
|
||||||
server.send(400, "text/plain; charset=utf-8", "Ungueltige Einstellungen");
|
redirect_to_root("Ungueltige Einstellungen", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool ap_name_changed = active_settings->access_point_name != updated.access_point_name;
|
||||||
|
const bool ap_password_changed = active_settings->access_point_password != updated.access_point_password;
|
||||||
|
|
||||||
active_settings->callsign = updated.callsign;
|
active_settings->callsign = updated.callsign;
|
||||||
active_settings->access_point_name = updated.access_point_name;
|
active_settings->access_point_name = updated.access_point_name;
|
||||||
active_settings->access_point_password = updated.access_point_password;
|
active_settings->access_point_password = updated.access_point_password;
|
||||||
@@ -131,8 +250,11 @@ void handle_settings()
|
|||||||
preferences.putInt("min", active_settings->min_speed);
|
preferences.putInt("min", active_settings->min_speed);
|
||||||
preferences.putInt("max", active_settings->max_speed);
|
preferences.putInt("max", active_settings->max_speed);
|
||||||
preferences.putUInt("active_time", active_settings->active_time_seconds);
|
preferences.putUInt("active_time", active_settings->active_time_seconds);
|
||||||
send_page("Einstellungen gespeichert.");
|
|
||||||
|
if (ap_name_changed || ap_password_changed)
|
||||||
access_point_restart_pending = true;
|
access_point_restart_pending = true;
|
||||||
|
|
||||||
|
redirect_to_root("Einstellungen gespeichert.", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_update_upload()
|
void handle_update_upload()
|
||||||
@@ -188,6 +310,15 @@ void handle_update_result()
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
String firmware_version_string(void)
|
||||||
|
{
|
||||||
|
#ifdef FIRMWARE_VERSION
|
||||||
|
return String(FIRMWARE_VERSION);
|
||||||
|
#else
|
||||||
|
return "dev";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool webinterface_begin(TelemetrySettings &settings)
|
bool webinterface_begin(TelemetrySettings &settings)
|
||||||
{
|
{
|
||||||
active_settings = &settings;
|
active_settings = &settings;
|
||||||
@@ -208,16 +339,37 @@ bool webinterface_begin(TelemetrySettings &settings)
|
|||||||
settings.max_speed = default_max_speed;
|
settings.max_speed = default_max_speed;
|
||||||
settings.active_time_seconds = default_active_time_seconds;
|
settings.active_time_seconds = default_active_time_seconds;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settings.access_point_name = generated_access_point_name(settings.callsign);
|
||||||
|
}
|
||||||
|
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_AP);
|
||||||
bool ap_started = WiFi.softAP(settings.access_point_name, settings.access_point_password);
|
bool ap_started = WiFi.softAP(settings.access_point_name, settings.access_point_password);
|
||||||
if (!ap_started)
|
if (!ap_started)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
access_point_active = true;
|
||||||
|
access_point_started_ms = millis();
|
||||||
|
dns_server.start(53, "connectivitycheck.gstatic.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "clients3.google.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "msftconnecttest.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "msftncsi.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "captive.apple.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "apple.com", WiFi.softAPIP());
|
||||||
|
dns_server.start(53, "*", WiFi.softAPIP());
|
||||||
server.on("/", HTTP_GET, handle_root);
|
server.on("/", HTTP_GET, handle_root);
|
||||||
|
server.on("/generate_204", HTTP_GET, handle_captive_portal_redirect);
|
||||||
|
server.on("/hotspot-detect.html", HTTP_GET, handle_captive_portal_redirect);
|
||||||
|
server.on("/connecttest.txt", HTTP_GET, handle_captive_portal_redirect);
|
||||||
|
server.on("/ncsi.txt", HTTP_GET, handle_captive_portal_redirect);
|
||||||
|
server.on("/success.txt", HTTP_GET, handle_captive_portal_redirect);
|
||||||
server.on("/settings", HTTP_POST, handle_settings);
|
server.on("/settings", HTTP_POST, handle_settings);
|
||||||
server.on("/update", HTTP_POST, handle_update_result, handle_update_upload);
|
server.on("/update", HTTP_POST, handle_update_result, handle_update_upload);
|
||||||
|
server.onNotFound(handle_captive_portal_redirect);
|
||||||
server.begin();
|
server.begin();
|
||||||
|
Serial.print("Firmware-Version: ");
|
||||||
|
Serial.println(firmware_version_string());
|
||||||
Serial.print("Webinterface: http://");
|
Serial.print("Webinterface: http://");
|
||||||
Serial.println(WiFi.softAPIP());
|
Serial.println(WiFi.softAPIP());
|
||||||
return true;
|
return true;
|
||||||
@@ -226,13 +378,25 @@ bool webinterface_begin(TelemetrySettings &settings)
|
|||||||
void webinterface_handle(void)
|
void webinterface_handle(void)
|
||||||
{
|
{
|
||||||
server.handleClient();
|
server.handleClient();
|
||||||
|
dns_server.processNextRequest();
|
||||||
if (access_point_restart_pending)
|
if (access_point_restart_pending)
|
||||||
{
|
{
|
||||||
access_point_restart_pending = false;
|
access_point_restart_pending = false;
|
||||||
WiFi.softAPdisconnect(true);
|
WiFi.softAPdisconnect(true);
|
||||||
|
access_point_active = false;
|
||||||
delay(100);
|
delay(100);
|
||||||
if (!WiFi.softAP(active_settings->access_point_name, active_settings->access_point_password))
|
if (!WiFi.softAP(active_settings->access_point_name, active_settings->access_point_password))
|
||||||
Serial.println("Access Point konnte nicht neu gestartet werden");
|
Serial.println("Access Point konnte nicht neu gestartet werden");
|
||||||
|
else
|
||||||
|
access_point_active = true;
|
||||||
|
access_point_started_ms = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_point_active && WiFi.softAPgetStationNum() == 0 && (millis() - access_point_started_ms) >= access_point_timeout_ms)
|
||||||
|
{
|
||||||
|
Serial.println("Access Point nach 5 Minuten ohne Client deaktiviert");
|
||||||
|
WiFi.softAPdisconnect(true);
|
||||||
|
access_point_active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ struct TelemetrySettings
|
|||||||
unsigned int active_time_seconds;
|
unsigned int active_time_seconds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String firmware_version_string(void);
|
||||||
bool webinterface_begin(TelemetrySettings &settings);
|
bool webinterface_begin(TelemetrySettings &settings);
|
||||||
void webinterface_handle(void);
|
void webinterface_handle(void);
|
||||||
const TelemetrySettings &webinterface_settings(void);
|
const TelemetrySettings &webinterface_settings(void);
|
||||||
|
|||||||
Reference in new issue
Block a user