diff --git a/include/dwd.h b/include/dwd.h index 544cbca..085f1d8 100644 --- a/include/dwd.h +++ b/include/dwd.h @@ -1,4 +1,4 @@ -#if !defined(_DWD_H) +#if !defined(_DWD_H) && SMART_POC_MODULE_DWD #define _DWD_H #include diff --git a/include/main.h b/include/main.h index f1faa95..badba73 100644 --- a/include/main.h +++ b/include/main.h @@ -24,16 +24,36 @@ #define warn(format, arg...) {printf("%s:%d " format , __FILE__ , __LINE__ , ## arg);} #endif -#define RADIOLIB_LOW_LEVEL 1 -#define RADIOLIB_GODMODE 1 +// // #define RADIOLIB_EXCLUDE_RF69 (1) +// #define RADIOLIB_EXCLUDE_SX1231 (1) // dependent on RADIOLIB_EXCLUDE_RF69 +// #define RADIOLIB_EXCLUDE_SI443X (1) +// #define RADIOLIB_EXCLUDE_RFM2X (1) // dependent on RADIOLIB_EXCLUDE_SI443X +// // #define RADIOLIB_EXCLUDE_SX127X (1) +// // #define RADIOLIB_EXCLUDE_SX126X (1) +// #define RADIOLIB_EXCLUDE_STM32WLX (1) // dependent on RADIOLIB_EXCLUDE_SX126X +// #define RADIOLIB_EXCLUDE_SX128X (1) +// #define RADIOLIB_EXCLUDE_AFSK (1) +// #define RADIOLIB_EXCLUDE_AX25 (1) +// #define RADIOLIB_EXCLUDE_HELLSCHREIBER (1) +// #define RADIOLIB_EXCLUDE_MORSE (1) +// #define RADIOLIB_EXCLUDE_APRS (1) +// #define RADIOLIB_EXCLUDE_RTTY (1) +// #define RADIOLIB_EXCLUDE_SSTV (1) +// // #define RADIOLIB_EXCLUDE_DIRECT_RECEIVE (1) +// #define RADIOLIB_LOW_LEVEL 1 +// #define RADIOLIB_GODMODE 1 // // #define POCSAG_DEBUG 1 // #define POCSAG_DEBUG_PORT Serial #include #include #include +#ifdef SMART_POC_MODULE_DWD #include +#endif +#ifdef SMART_POC_MODULE_MOWAS #include +#endif #include void txControllerBatchClear(); diff --git a/include/mowas.h b/include/mowas.h index 7beff5c..f1179ba 100644 --- a/include/mowas.h +++ b/include/mowas.h @@ -1,4 +1,4 @@ -#if !defined(_MOWAS_H) +#if !defined(_MOWAS_H) && SMART_POC_MODULE_MOWAS #define _MOWAS_H #include diff --git a/include/pocsag_transmitter.h b/include/pocsag_transmitter.h index 60ea615..d7c0ca9 100644 --- a/include/pocsag_transmitter.h +++ b/include/pocsag_transmitter.h @@ -1,5 +1,6 @@ #if !defined(_POCSAG_TRANSMITTER_H) #define _POCSAG_TRANSMITTER_H + #include #define POCSAG_MAX_ENCODING_BUFFER_SIZE 70 // 70 QBYTEs should be enough for max 80char Messages diff --git a/src/dwd.cpp b/src/dwd.cpp index a75f49b..f55e5a4 100644 --- a/src/dwd.cpp +++ b/src/dwd.cpp @@ -1,3 +1,4 @@ +#ifdef SMART_POC_MODULE_DWD #include "dwd.h" String emptyDWDResponse = "Es sind keine Warnungen"; @@ -119,3 +120,5 @@ String DWDClient::extractTagContent(String source, String tag) return content; } + +#endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f26ac56..6714f92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -305,13 +305,13 @@ String txHandleUmlauts(String input) { replaceStringWithChar(input, "ü", '}'); replaceStringWithChar(input, "ß", '~'); } else { - replaceStringWithChar(input, "Ä", 'A'); - replaceStringWithChar(input, "Ö", 'O'); - replaceStringWithChar(input, "Ü", 'U'); - replaceStringWithChar(input, "ä", 'a'); - replaceStringWithChar(input, "ö", 'o'); - replaceStringWithChar(input, "ü", 'u'); - replaceStringWithChar(input, "ß", 's'); + replaceStringWithChar(input, "Ä", 'A'); + replaceStringWithChar(input, "Ö", 'O'); + replaceStringWithChar(input, "Ü", 'U'); + replaceStringWithChar(input, "ä", 'a'); + replaceStringWithChar(input, "ö", 'o'); + replaceStringWithChar(input, "ü", 'u'); + replaceStringWithChar(input, "ß", 's'); } return input; } @@ -335,8 +335,12 @@ int txControllerBatchQueueCount() // DWD + MoWaS + Time + Idle // WiFiClient wifiHttpClient; +#ifdef SMART_POC_MODULE_DWD DWDClient dwdClient(&wifiHttpClient); +#endif +#ifdef SMART_POC_MODULE_MOWAS MoWaSClient mowasClient(&wifiHttpClient); +#endif Timezone utcTime; Timezone localTime; @@ -357,16 +361,20 @@ void setup_broadcasts() globcfg.mowas_enable = false; globcfg.time_enable = false; } + #ifdef SMART_POC_MODULE_DWD // DWD if (globcfg.dwd_interval < 1) globcfg.dwd_enable = false; if (globcfg.dwd_enable) dwdClient.begin(globcfg.dwd_interval, globcfg.dwd_region); + #endif + #ifdef SMART_POC_MODULE_MOWAS // MoWaS if (globcfg.mowas_interval < 1) globcfg.mowas_enable = false; if (globcfg.mowas_enable) mowasClient.begin(globcfg.mowas_interval, globcfg.mowas_region); + #endif // Time if (globcfg.time_enable) { waitForSync(30e3); @@ -375,6 +383,7 @@ void setup_broadcasts() } void broadcast_loop() { + #ifdef SMART_POC_MODULE_DWD if (globcfg.dwd_enable) { dwdClient.loop(); @@ -393,6 +402,8 @@ void broadcast_loop() transmitter.transmitBatch(); } } + #endif + #ifdef SMART_POC_MODULE_MOWAS if (globcfg.mowas_enable) { mowasClient.loop(); @@ -409,6 +420,7 @@ void broadcast_loop() transmitter.transmitBatch(); } } + #endif if (globcfg.time_enable) { events(); diff --git a/src/mowas.cpp b/src/mowas.cpp index aba6e5d..665d142 100644 --- a/src/mowas.cpp +++ b/src/mowas.cpp @@ -1,3 +1,4 @@ +#ifdef SMART_POC_MODULE_MOWAS #include "mowas.h" String mowasDWDMessageIDPrefix = "dwd."; @@ -80,3 +81,5 @@ String MoWaSClient::parseDashboard(String jsonData) } return emptyString; } + +#endif \ No newline at end of file diff --git a/src/webserver.cpp b/src/webserver.cpp index 0d3a0c8..846c461 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -216,6 +216,7 @@ static void redirectHomeResponse(AsyncWebServerRequest *request, String location redirectHomeResponse(request, "/#config"); } // + #if (defined(SMART_POC_MODULE_DWD) || defined(SMART_POC_MODULE_MOWAS)) static void setDWDMoWaS(AsyncWebServerRequest *request) { int broadcast_ric, broadcast_fun; bool dwd_enable, mowas_enable; @@ -235,6 +236,7 @@ static void redirectHomeResponse(AsyncWebServerRequest *request, String location } // dwd + #ifdef SMART_POC_MODULE_DWD if (request->hasArg("dwd_enable")) { dwd_enable = request->arg("dwd_enable").equals("on"); cfg_adjust("dwd_enable", dwd_enable); @@ -253,6 +255,8 @@ static void redirectHomeResponse(AsyncWebServerRequest *request, String location dwd_region = request->arg("dwd_region"); cfg_adjust("dwd_region", dwd_region); } + #endif + #ifdef SMART_POC_MODULE_MOWAS // mowas if (request->hasArg("mowas_enable")) { mowas_enable = request->arg("mowas_enable").equals("on"); @@ -272,10 +276,12 @@ static void redirectHomeResponse(AsyncWebServerRequest *request, String location mowas_region = request->arg("mowas_region"); cfg_adjust("mowas_region", mowas_region); } + #endif cfg_write(); redirectHomeResponse(request, "/#dwdmowas"); } + #endif // static void setTimebeacon(AsyncWebServerRequest *request) { int time_ric, time_fun; @@ -409,7 +415,9 @@ void webserver_setup() { server.on("/setwifi2", setWifi2Cfg); server.on("/settransmitter", setTransmitterCfg); server.on("/setmqtt", setMQTTCfg); + #ifdef SMART_POC_MODULE_DWD || SMART_POC_MODULE_MOWAS server.on("/setdwdmowas", setDWDMoWaS); + #endif server.on("/settimebeacon", setTimebeacon); server.on("/setidlebeacon", setIdlebeacon); server.on("/setdev", setDevCfg);