fixed RST pin and umaluts
All checks were successful
build / build (push) Successful in 2m2s

This commit is contained in:
cheetah 2025-03-30 22:31:59 +02:00
parent 30a2a5553a
commit 44ef6a8f84
2 changed files with 50 additions and 8 deletions

View file

@ -8,4 +8,4 @@
#define LORA_DIO2 34
#undef LORA_RST
#define LORA_RST 14
#define LORA_RST 23

View file

@ -269,6 +269,25 @@ UmlautMap umlautMapIntl[] = {
{0xFC, 0x75}, {0xE4, 0x61}, {0xF6, 0x6F},
{0xDF, 0x73}
};
void printHex(const char* text) {
while (*text) {
if ((uint8_t)*text < 0x10) {
Serial.print("0"); // Ensure two-digit hex format
}
Serial.print((uint8_t)*text, HEX);
Serial.print(" ");
text++;
}
Serial.println();
}
void replaceStringWithChar(String &input, const String &find, char replace) {
int index = input.indexOf(find); // Find the first occurrence
while (index != -1) {
input = input.substring(0, index) + replace + input.substring(index + find.length());
index = input.indexOf(find, index + 1); // Find next occurrence
}
}
String txHandleUmlauts(String input) {
bool useGermanMap = globcfg.pocsag_german;
UmlautMap* map = useGermanMap ? umlautMapGermany : umlautMapIntl;
@ -277,6 +296,23 @@ String txHandleUmlauts(String input) {
for (int i = 0; i < mapSize; i++) {
input.replace(map[i].utf8, map[i].replacement);
}
if (useGermanMap) {
replaceStringWithChar(input, "Ä", '[');
replaceStringWithChar(input, "Ö", '\\');
replaceStringWithChar(input, "Ü", ']');
replaceStringWithChar(input, "ä", '{');
replaceStringWithChar(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');
}
return input;
}
void txControllerInsert(uint32_t ric, uint8_t functionBit, char *text)
@ -307,7 +343,7 @@ Timezone localTime;
bool time_beacon_first = true;
unsigned long lastTimeBeaconTime = 0;
String currentMessage;
String formattedTime;
char *idleBeaconText = new char[1]{};
bool idle_beacon_first = true;
@ -344,12 +380,16 @@ void broadcast_loop()
dwdClient.loop();
if (dwdClient.isDirty())
{
dwdClient.currentMessage = txHandleUmlauts(dwdClient.currentMessage);
char *messageText = new char[dwdClient.currentMessage.length() + 1]{};
dwdClient.currentMessage.toCharArray(messageText, dwdClient.currentMessage.length() + 1);
currentMessage = txHandleUmlauts(dwdClient.currentMessage);
Serial.print("Hex: ");
printHex(currentMessage.c_str());
char *messageText = new char[currentMessage.length() + 1]{};
currentMessage.toCharArray(messageText, currentMessage.length() + 1);
Serial.println(F("[DWD] Transmitting Warning"));
Serial.println(messageText);
transmitter.queuePage(globcfg.broadcast_ric, globcfg.dwd_fun + 0, messageText);
delete []messageText;
currentMessage.clear();
transmitter.transmitBatch();
}
}
@ -358,12 +398,14 @@ void broadcast_loop()
mowasClient.loop();
if (mowasClient.isDirty())
{
mowasClient.currentMessage = txHandleUmlauts(mowasClient.currentMessage);
char *messageText = new char[mowasClient.currentMessage.length() + 1]{};
mowasClient.currentMessage.toCharArray(messageText, mowasClient.currentMessage.length() + 1);
currentMessage = txHandleUmlauts(mowasClient.currentMessage);
char *messageText = new char[currentMessage.length() + 1]{};
currentMessage.toCharArray(messageText, currentMessage.length() + 1);
Serial.println(F("[MoWaS] Transmitting Warning"));
Serial.println(messageText);
transmitter.queuePage(globcfg.broadcast_ric, globcfg.mowas_fun + 0, messageText);
delete []messageText;
currentMessage.clear();
transmitter.transmitBatch();
}
}