enhanced tx-tuning, added tx-want-request
All checks were successful
build / build (push) Successful in 3m52s

This commit is contained in:
cheetah 2025-04-05 17:17:58 +02:00
parent 85bc9ac003
commit 8e04459210
4 changed files with 30 additions and 12 deletions

View file

@ -78,6 +78,8 @@ void setup_leds();
void mqtt_callback(char* topic, byte* payload, unsigned int length);
//
void broadcast_loop();
void tx_controller_want();
void tx_controller_loop();
void broadcastTriggerTimeBeacon();
void heap_loop();
#endif

View file

@ -77,7 +77,7 @@ String keyWX_WindGusts = "wind_gusts_10m";
String keyWX_PressureMSL = "wind_gusts_10m";
String keyWX_CloudCover = "cloud_cover";
const char *wxFormat = "Temp %0.1f / rH %d / Wind %d deg - %0.1f km/h, Boehe %0.1fkm/h (gusts) / %0.1f hPa / Wolken: %d";
const char *wxFormat = "Temp %0.1f / rH %d% / Wind %d deg - %0.1f km/h, Boehe %0.1fkm/h (gusts) / %0.1f hPa / Wolken: %d%";
String wxRes;
String DWDWXClient::parseJSON(String jsonData)
{

View file

@ -33,7 +33,7 @@ void setup()
Serial.println("starting up modem");
float bitrate = globcfg.tx_baud / 1000.0;
float freq = globcfg.tx_freq + (float)((float)globcfg.tx_tune / 1000.0);
float freq = globcfg.tx_freq + (float)((float)globcfg.tx_tune / 1000000.0);
Serial.printf("tuned to %0.6f\n", freq);
int state = radio.beginFSK(freq, bitrate, globcfg.tx_dev);
if (state == 0) {
@ -203,13 +203,14 @@ void mqtt_callback(char *topic, byte *payload, unsigned int length)
text = txHandleUmlauts(text);
int addr = doc["ric"].as<int>();
int func = 3;
if (doc["fun"].is<int>())
{
func = doc["fun"].as<int>();
}
bool numeric = false;
if (doc["fun"].is<int>()) func = doc["fun"].as<int>();
if (doc["num"].is<bool>()) numeric = doc["num"].as<bool>();
char *messageText = new char[text.length() + 1]{};
text.toCharArray(messageText, text.length() + 1);
txControllerInsert((uint32_t)addr, (uint8_t)func, messageText);
txControllerInsert((uint32_t)addr, (uint8_t)func, numeric, messageText);
delete []messageText;
// if (transmitter.isActive() == false)
// {
@ -271,6 +272,7 @@ void loop()
broadcast_loop();
heap_loop();
tx_controller_loop();
old_tx_state = tx_state;
}
//
@ -311,6 +313,17 @@ void replaceStringWithChar(String &input, const String &find, char replace) {
}
}
bool wantTX = false;
void tx_controller_want() {
wantTX = true;
}
void tx_controller_loop() {
if (wantTX) {
wantTX = false;
transmitter.transmitBatch();
}
}
String txHandleUmlauts(String input) {
bool useGermanMap = globcfg.pocsag_german;
UmlautMap* map = useGermanMap ? umlautMapGermany : umlautMapIntl;
@ -437,7 +450,7 @@ void broadcast_loop()
delete []messageText;
dwdClient.currentMessage.clear();
currentMessage.clear();
transmitter.transmitBatch();
tx_controller_want();
}
}
#endif
@ -459,7 +472,7 @@ void broadcast_loop()
delete []messageText;
dwdWXClient.currentMessage.clear();
currentMessage.clear();
transmitter.transmitBatch();
tx_controller_want();
}
}
#endif
@ -481,7 +494,7 @@ void broadcast_loop()
transmitter.queuePage(globcfg.broadcast_ric, globcfg.mowas_fun + 0, messageText);
delete []messageText;
currentMessage.clear();
transmitter.transmitBatch();
tx_controller_want();
}
}
#endif
@ -512,7 +525,7 @@ void broadcast_loop()
transmitter.queuePage(globcfg.time_ric, globcfg.time_fun + 0, messageText);
delete []messageText;
formattedTime.clear();
transmitter.transmitBatch();
tx_controller_want();
}
}
if (globcfg.idle_enable) {
@ -521,9 +534,10 @@ void broadcast_loop()
idle_beacon_first = false;
Serial.println(F("[Idle] Transmitting Beacon"));
transmitter.queuePage(0, 0, idleBeaconText);
transmitter.transmitBatch();
tx_controller_want();
}
}
}
//
void broadcastTriggerTimeBeacon() {

View file

@ -97,6 +97,8 @@ static void redirectHomeResponse(AsyncWebServerRequest *request, String location
if (request->hasArg("addtx")) {
txControllerBatchStart();
} else {
tx_controller_want();
}
}
redirectHomeResponse(request, "/");