From deec9b55f2283fa1c858b4ceaac34b8f2865b4ac Mon Sep 17 00:00:00 2001 From: Rysiek Labus Date: Mon, 8 Mar 2021 22:47:00 +0100 Subject: [PATCH] BT enable/disable from WWW --- data_embed/index.html | 39 +++++++++++++++++++++++++++++------ include/taskWebServer.h | 2 ++ src/TTGO_T-Beam_LoRa_APRS.ino | 26 +++++++++++++++++------ src/taskWebServer.cpp | 9 ++++++++ 4 files changed, 64 insertions(+), 12 deletions(-) diff --git a/data_embed/index.html b/data_embed/index.html index f2cdf29..a336a9d 100644 --- a/data_embed/index.html +++ b/data_embed/index.html @@ -19,9 +19,8 @@
-
-
-
+
+
@@ -32,10 +31,10 @@
-
- -
+
+ +
@@ -107,6 +106,34 @@ +
+
+
+
+

Device Settings

+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ +
+
+
+
+

Actions

diff --git a/include/taskWebServer.h b/include/taskWebServer.h index b6367da..a3530bd 100644 --- a/include/taskWebServer.h +++ b/include/taskWebServer.h @@ -37,6 +37,8 @@ static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET = "aprs_fb_inter static const char *const PREF_APRS_FIXED_BEACON_INTERVAL_PRESET_INIT = "aprs_fb_in_init"; static const char *const PREF_APRS_GPS_EN = "gps_enabled"; static const char *const PREF_APRS_GPS_EN_INIT = "gps_state_init"; +static const char *const PREF_DEV_BT_EN = "bt_enabled"; +static const char *const PREF_DEV_BT_EN_INIT = "bt_enabled_init"; typedef struct { String callsign; diff --git a/src/TTGO_T-Beam_LoRa_APRS.ino b/src/TTGO_T-Beam_LoRa_APRS.ino index fcb4dee..8f8cf99 100644 --- a/src/TTGO_T-Beam_LoRa_APRS.ino +++ b/src/TTGO_T-Beam_LoRa_APRS.ino @@ -77,6 +77,11 @@ boolean fixed_beacon_enabled = false; #else boolean showBattery = false; #endif +#ifdef ENABLE_BLUETOOTH + boolean enable_bluetooth = true; +#else + boolean enable_bluetooth = false; +#endif // Variables and Constants String loraReceivedFrameString = ""; //data on buff is copied to this string @@ -470,6 +475,12 @@ void setup(){ } } + + if (!preferences.getBool(PREF_DEV_BT_EN_INIT)){ + preferences.putBool(PREF_DEV_BT_EN_INIT, true); + preferences.putBool(PREF_DEV_BT_EN, enable_bluetooth); + } + enable_bluetooth = preferences.getBool(PREF_DEV_BT_EN); #endif for (int i=0;i