diff --git a/lib/webinterface/webinterface.cpp b/lib/webinterface/webinterface.cpp index 9a49b81..7e4cc49 100644 --- a/lib/webinterface/webinterface.cpp +++ b/lib/webinterface/webinterface.cpp @@ -173,15 +173,22 @@ void send_page(const String &message = String()) page += html_escape(active_settings->access_point_name); page += F("'>"); +#ifdef DEVICE_SAILPLANE + page += F(""); +#endif +#ifdef DEVICE_SAILPLANE + page += F("" + page += F("'>"); +#endif + page += F("" "

Firmware aktualisieren

" "" "

Access Point: "); @@ -192,18 +199,27 @@ void send_page(const String &message = String()) bool parse_settings(TelemetrySettings &settings) { +#ifdef DEVICE_SAILPLANE String callsign = server.arg("callsign"); - String access_point_name = server.arg("ap_name"); - String access_point_password = server.arg("ap_password"); int min_speed = server.arg("min").toInt(); int max_speed = server.arg("max").toInt(); int active_time_seconds = server.arg("active_time").toInt(); callsign.trim(); + if (callsign.length() == 0 || callsign.length() > 16 || min_speed < 0 || max_speed > 300 || min_speed >= max_speed || active_time_seconds < 1 || active_time_seconds > 600) + return false; +#else + String callsign = settings.callsign; + int min_speed = settings.min_speed; + int max_speed = settings.max_speed; + int active_time_seconds = settings.active_time_seconds; +#endif + + String access_point_name = server.arg("ap_name"); + String access_point_password = server.arg("ap_password"); access_point_name.trim(); access_point_password.trim(); - 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) + if (access_point_password.length() < 8 || access_point_password.length() > 63) return false; settings.callsign = callsign; @@ -329,8 +345,12 @@ bool webinterface_begin(TelemetrySettings &settings) settings.min_speed = preferences.getInt("min", default_min_speed); settings.max_speed = preferences.getInt("max", default_max_speed); settings.active_time_seconds = preferences.getUInt("active_time", default_active_time_seconds); - if (settings.access_point_name.length() == 0 || settings.access_point_name.length() > 32 || settings.access_point_password.length() < 8 || settings.access_point_password.length() > 63 || settings.callsign.length() == 0 || settings.min_speed < 0 || settings.min_speed >= settings.max_speed || - settings.max_speed > 300 || settings.active_time_seconds < 1 || settings.active_time_seconds > 600) + + bool settings_valid = settings.access_point_name.length() > 0 && settings.access_point_name.length() <= 32 && settings.access_point_password.length() >= 8 && settings.access_point_password.length() <= 63; +#ifdef DEVICE_SAILPLANE + settings_valid = settings_valid && settings.callsign.length() > 0 && settings.min_speed >= 0 && settings.min_speed < settings.max_speed && settings.max_speed <= 300 && settings.active_time_seconds >= 1 && settings.active_time_seconds <= 600; +#endif + if (!settings_valid) { settings.callsign = default_callsign; settings.access_point_name = default_access_point_name();