added DWD/MOWAS build flags
All checks were successful
build / build (push) Successful in 2m0s

This commit is contained in:
cheetah 2025-03-31 00:30:44 +02:00
parent 44ef6a8f84
commit 60b8456757
8 changed files with 58 additions and 11 deletions

View file

@ -1,4 +1,4 @@
#if !defined(_DWD_H)
#if !defined(_DWD_H) && SMART_POC_MODULE_DWD
#define _DWD_H
#include <WiFiClient.h>

View file

@ -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 <pocsag_transmitter.h>
#include <board.h>
#include <config.h>
#ifdef SMART_POC_MODULE_DWD
#include <dwd.h>
#endif
#ifdef SMART_POC_MODULE_MOWAS
#include <mowas.h>
#endif
#include <display.h>
void txControllerBatchClear();

View file

@ -1,4 +1,4 @@
#if !defined(_MOWAS_H)
#if !defined(_MOWAS_H) && SMART_POC_MODULE_MOWAS
#define _MOWAS_H
#include <WiFiClient.h>

View file

@ -1,5 +1,6 @@
#if !defined(_POCSAG_TRANSMITTER_H)
#define _POCSAG_TRANSMITTER_H
#include <RadioLib.h>
#define POCSAG_MAX_ENCODING_BUFFER_SIZE 70 // 70 QBYTEs should be enough for max 80char Messages

View file

@ -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

View file

@ -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();

View file

@ -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

View file

@ -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);