BRN-POCSAG: 171 channels, 26 x 40 char messages, make toggles

EEPROM layout (settings.h), replacing the broken 24 byte layout from
85fb527 (200 x 24 B channels overran the VFOs, attributes and settings;
names were saved at ch*24 but read at ch*20):
- 32 byte channel records with the 10 char name and the 16 bit scrambler
  inside, 171 channels in two areas (0x0000, 0x11E0); VFOs at 0x1020 with
  the same record; attributes moved to 0x0F50.
- Message store from 0x1900: 26 messages of 40 characters.
- Reset VFO no longer wipes the memory channels and messages.
- Static asserts that no area overlaps another or the calibration.

Identity: reports "BRN-POCSAG v4.0" to CHIRP and in the packed image, so
stock / egzumer / F4HWN drivers do not accept the new layout; the name is
shown on the welcome screen.

Make toggles: ENABLE_POCSAG, ENABLE_POCSAG_DEBUG, ENABLE_POCSAG_DEV_TUNING,
ENABLE_OOK_SENDER (POCSAG code and the OOK sender compile out completely).

Fonts: removed the unused big font, big digits and small digits; the 3x5
font is only built with the spectrum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 01:43:05 +01:00
co-authored by Claude Opus 5.5
parent c5a2b41fdb
commit aabd0f4956
20 changed files with 159 additions and 312 deletions

No files matched your search

+22
View File
@@ -34,6 +34,7 @@ RXState rxState = Ready;
uint8_t SMSResponseCounterTarget = 6;
#ifdef ENABLE_POCSAG
// ---------------------------------------------------------------------------
// POCSAG 1200 modem (BK4819 native 2-FSK, NRZ)
//
@@ -186,13 +187,17 @@ static void POCSAG_AlertTimeSlice500ms(void)
}
}
#endif // ENABLE_POCSAG
void FSKModem_TimeSlice500ms(void) {
#ifdef ENABLE_POCSAG
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
if (pocsagDuplicateTimeout > 0)
pocsagDuplicateTimeout--;
POCSAG_AlertTimeSlice500ms();
return;
}
#endif
if (SMSResponseCounter && FUNCTION_IsRx() && SMSResponseCounter++ > SMSResponseCounterTarget) {
switch (gSMSResponseState) {
@@ -224,10 +229,12 @@ void FSKModem_TimeSlice500ms(void) {
}
void MSG_ConfigureFSK(bool rx) {
#ifdef ENABLE_POCSAG
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
POCSAG_ConfigureModem(rx);
return;
}
#endif
// quick helper
bool isAFSK = (gEeprom.FSKMode == MOD_AFSK_1200 ||
@@ -514,6 +521,7 @@ void processReceivedPacket(DataPacket *packet) {
}
}
#ifdef ENABLE_POCSAG
static void MSG_POCSAGStoreReceived(void);
// The chip locks somewhere in the preamble, so it usually has not collected all
@@ -530,8 +538,12 @@ static void POCSAG_FlushCapture(void)
pocsagRxSize = 0;
}
#endif // ENABLE_POCSAG
void MSG_EnableRX(const bool enable) {
#ifdef ENABLE_POCSAG
POCSAG_FlushCapture();
#endif
if (enable) {
MSG_ConfigureFSK(true);
@@ -565,6 +577,7 @@ static void MSG_EndDataTransmission(const bool audioWasEnabled)
dataPTR = gMessageText;
}
#ifdef ENABLE_POCSAG
void MSG_POCSAGSend(const uint32_t ric, const char *text)
{
uint8_t frame[POCSAG_MAX_FRAME_SIZE];
@@ -641,7 +654,10 @@ void MSG_POCSAGSend(const uint32_t ric, const char *text)
MSG_EndDataTransmission(audioWasEnabled);
}
#endif // ENABLE_POCSAG
void MSG_FSKSendData(DataPacket *dataPacketIn) {
#ifdef ENABLE_POCSAG
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) { // e.g. UART command 0x06FF
char text[DataPacketDataSize + 1U];
memcpy(text, dataPacketIn->data, DataPacketDataSize);
@@ -649,6 +665,7 @@ void MSG_FSKSendData(DataPacket *dataPacketIn) {
MSG_POCSAGSend(dataPacketIn->dest, text);
return;
}
#endif
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO
: gEeprom.TX_VFO;
@@ -764,6 +781,7 @@ void prepareDataPacket() {
dataPacket.ttl = 20;
}
#ifdef ENABLE_POCSAG
// UART debug log for POCSAG RX (38400 8N1 on the programming cable):
// "PS" chip locked on the preamble (FSK RX sync)
// "PF <n>" capture finished, n bytes
@@ -903,6 +921,8 @@ static void POCSAG_HandleIRQ(const bool rx_sync, const bool rx_fifo_almost_full,
}
}
#endif // ENABLE_POCSAG
void FSK_HANDLE_IRQ(unsigned short irq) {
//const uint16_t rx_sync_flags = BK4819_ReadRegister(BK4819_REG_0B);
@@ -912,10 +932,12 @@ void FSK_HANDLE_IRQ(unsigned short irq) {
//UART_printf("\nMSG : S%i, F%i, E%i | %i", rx_sync, rx_fifo_almost_full, rx_finished, irq);
#ifdef ENABLE_POCSAG
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
POCSAG_HandleIRQ(rx_sync, rx_fifo_almost_full, rx_finished);
return;
}
#endif
if (rx_sync) {
// prevent listening to fsk data and squelch (kamilsss655)