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

+4
View File
@@ -92,7 +92,9 @@
#include "ui/status.h"
#include "ui/ui.h"
#include "messages.h"
#ifdef ENABLE_OOK_SENDER
#include "ooksender.h"
#endif
static bool flagSaveVfo;
static bool flagSaveSettings;
@@ -106,7 +108,9 @@ void (*ProcessKeysFunctions[])(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
[DISPLAY_MENU] = &MENU_ProcessKeys,
[DISPLAY_SCANNER] = &SCANNER_ProcessKeys,
[DISPLAY_MESSAGES] = &MESSAGES_ProcessKeys,
#ifdef ENABLE_OOK_SENDER
[DISPLAY_OOKSENDER] = &OOKSENDER_ProcessKeys,
#endif
#ifdef ENABLE_FMRADIO
[DISPLAY_FM] = &FM_ProcessKeys,
+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)
+1 -1
View File
@@ -80,7 +80,7 @@
#define DataPacketDataSize (21)
#define SEQParameterEEPROM 0x1C00
#define SEQParameterEEPROM 0x1900 // message counters, after the channels (settings.h)
typedef struct __attribute__((packed)){
uint32_t dest; //4bytes
+1 -1
View File
@@ -250,7 +250,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep) {
case KEY_7:
#ifdef ENABLE_VOX
ACTION_Vox();
#else
#elif defined(ENABLE_OOK_SENDER)
gRequestDisplayScreen = DISPLAY_OOKSENDER; // the VOX key is free: OOK sender
#endif
break;
+4
View File
@@ -126,10 +126,12 @@ static void MESSAGES_ClearText(void) {
}
static void MESSAGES_Send(void) {
#ifdef ENABLE_POCSAG
if (MODEM_IS_POCSAG(gEeprom.FSKMode)) {
MSG_POCSAGSend(dataPacket.dest, gMessageText);
return;
}
#endif
memset(dataPacket.data, 0, DataPacketDataSize);
memcpy(dataPacket.data, gMessageText, DataPacketDataSize - 1U);
@@ -137,10 +139,12 @@ static void MESSAGES_Send(void) {
}
void MESSAGES_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) {
#ifdef ENABLE_OOK_SENDER
if(Key == KEY_STAR) {
gRequestDisplayScreen = DISPLAY_OOKSENDER;
return;
}
#endif
gKeyTimeout = 1;
#if POCSAG_DEVIATION_TUNING
// POCSAG deviation tuning: 2 = more, 8 = less (send a page and check it on an SDR)
+6 -5
View File
@@ -13,17 +13,18 @@
// Message store: MESSAGES_COUNT slots between MESSAGES_START and the calibration
// data at MESSAGES_END. Override MESSAGES_COUNT / POCSAG_MAX_MESSAGE_LENGTH with -D;
// changing either moves the slots (old stored messages read back as garbage).
#define MESSAGES_START (0x1C08)
#define MESSAGES_END (0x1E00)
#ifndef MESSAGES_COUNT
#define MESSAGES_COUNT (12)
#endif
#define MESSAGES_START (SEQParameterEEPROM + 8U)
#define MESSAGES_END (0x1E00U)
#define MESSAGE_FLAG_POCSAG (0x20U)
#define MESSAGES_TEXT_LENGTH POCSAG_MAX_MESSAGE_LENGTH
#define MESSAGES_HEADER_SIZE 7U // src, seq, ttl, flags
// EEPROM is written in 8 byte blocks, so slots are a multiple of 8 bytes
#define MESSAGES_SLOT_SIZE (((MESSAGES_HEADER_SIZE + MESSAGES_TEXT_LENGTH + 7U) / 8U) * 8U)
// default: as many messages as fit (40 characters -> 48 byte slots -> 26 messages)
#ifndef MESSAGES_COUNT
#define MESSAGES_COUNT ((MESSAGES_END - MESSAGES_START) / MESSAGES_SLOT_SIZE)
#endif
// Display: 18 small-font characters per line, header line + text lines per message
#define MESSAGES_LINE_CHARS 18U
+1 -1
View File
@@ -13,7 +13,7 @@
// Longest alphanumeric message (TX and RX). Also the stored message length, see
// app/messages.h. Up to 45 fits the fixed two-batch TX frame (checked in pocsag.c).
#ifndef POCSAG_MAX_MESSAGE_LENGTH
#define POCSAG_MAX_MESSAGE_LENGTH 33U
#define POCSAG_MAX_MESSAGE_LENGTH 40U
#endif
#define POCSAG_PREAMBLE_BYTES 72U // 576 bits of 1010..., the minimum the spec allows
#define POCSAG_BATCH_WORDS 16U