Fix the spectrum labels, bandscope build, OOK on F+7, save flash

- Spectrum: GUI_DisplaySmallest() now draws with gFontSmall (7 px per
  character) for the status bar; the spectrum layout needs the 3x5 font
  (4 px), so it gets its own renderer again. Its labels were overlapping.
- make BANDSCOPE=1: spectrum instead of the FM radio. Both do not fit in
  60 KB together (FM radio is 4.9 KB). Debug log off and -finline-limit=1
  in that edition; it fits with a few bytes to spare.
- OOK sender on F+7 / long 7 (the VOX key is free, VOX is not built);
  F+EXIT is back to only cancelling F.
- POCSAG deviation tuning keys behind POCSAG_DEVIATION_TUNING (default 0).
- Smaller code: shared end of SMS/POCSAG transmissions, non-inlined fast
  SPI wait, compact OOK field tables, sprintf message header, shorter OOK
  strings.
- Makefile: EXTRA_CFLAGS for passing defines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 01:24:16 +01:00
co-authored by Claude Opus 5.5
parent 183dd8fb0d
commit 4a99a21a21
11 changed files with 109 additions and 101 deletions

No files matched your search

+28 -16
View File
@@ -46,25 +46,37 @@ static const OOK_RcProtocol_t rcProtocols[7] = {
{150, {2, 62}, {1, 6}, {6, 1}, false}, // 7: HS2303-PT
};
static const char *const fieldLabels[OOKSENDER_PROTO_END][OOK_FIELD_COUNT] = {
[OOKSENDER_PROTO_PT2262] = {"Code", NULL, NULL, "Pulse", "Repeat"},
[OOKSENDER_PROTO_EV1527] = {"ID", "Key", NULL, "Pulse", "Repeat"},
[OOKSENDER_PROTO_RCSWITCH] = {"Code", "Bits", "Proto", "Pulse", "Repeat"},
[OOKSENDER_PROTO_INTERTECHNO] = {"ID", "Unit", "On", "Pulse", "Repeat"},
[OOKSENDER_PROTO_MANCHESTER] = {"Code", "Bits", NULL, "Half", "Repeat"},
// Field labels per protocol, index into labelText (0 = field not used)
static const char labelText[][7] = {"", "Code", "ID", "Key", "Bits", "Proto", "Unit", "On", "Pulse", "Half", "Repeat"};
static const uint8_t fieldLabels[OOKSENDER_PROTO_END][OOK_FIELD_COUNT] = {
[OOKSENDER_PROTO_PT2262] = {1, 0, 0, 8, 10},
[OOKSENDER_PROTO_EV1527] = {2, 3, 0, 8, 10},
[OOKSENDER_PROTO_RCSWITCH] = {1, 4, 5, 8, 10},
[OOKSENDER_PROTO_INTERTECHNO] = {2, 6, 7, 8, 10},
[OOKSENDER_PROTO_MANCHESTER] = {1, 4, 0, 9, 10},
};
static const uint32_t fieldMax[OOKSENDER_PROTO_END][OOK_FIELD_COUNT] = {
[OOKSENDER_PROTO_PT2262] = {0x00FFFFFF, PT2262_MAX_TRITS, 0, 5000, 100},
[OOKSENDER_PROTO_EV1527] = {0x000FFFFF, 15, 0, 5000, 100},
[OOKSENDER_PROTO_RCSWITCH] = {0xFFFFFFFF, 32, 7, 5000, 100},
[OOKSENDER_PROTO_INTERTECHNO] = {0x03FFFFFF, 15, 1, 5000, 100},
[OOKSENDER_PROTO_MANCHESTER] = {0xFFFFFFFF, 32, 0, 5000, 100},
};
// Largest value per field: code / ID in bits, the others plain
static const uint8_t codeBits[OOKSENDER_PROTO_END] = {24, 20, 32, 26, 32};
static const uint8_t argMax[OOKSENDER_PROTO_END] = {PT2262_MAX_TRITS, 15, 32, 15, 32};
static const uint8_t extraMax[OOKSENDER_PROTO_END] = {0, 0, 7, 1, 0};
static uint32_t OOK_FieldMax(const uint8_t field)
{
switch (field) {
case OOK_FIELD_CODE: return codeBits[gOOKSenderProtocol] >= 32U ? 0xFFFFFFFFU
: (1UL << codeBits[gOOKSenderProtocol]) - 1U;
case OOK_FIELD_ARG: return argMax[gOOKSenderProtocol];
case OOK_FIELD_EXTRA: return extraMax[gOOKSenderProtocol];
case OOK_FIELD_PULSE: return 5000U;
default: return 100U;
}
}
const char *OOKSENDER_FieldLabel(const uint8_t protocol, const uint8_t field)
{
return fieldLabels[protocol][field];
const uint8_t label = fieldLabels[protocol][field];
return label ? labelText[label] : NULL;
}
static void OOK_SetDefaults(void)
@@ -247,7 +259,7 @@ static void OOK_NextField(const int8_t direction)
{
for (uint8_t n = 0; n < OOK_FIELD_COUNT; n++) {
gOOKSenderField = (uint8_t) ((gOOKSenderField + OOK_FIELD_COUNT + direction) % OOK_FIELD_COUNT);
if (fieldLabels[gOOKSenderProtocol][gOOKSenderField] != NULL)
if (fieldLabels[gOOKSenderProtocol][gOOKSenderField] != 0)
return;
}
}
@@ -267,7 +279,7 @@ static void OOK_Digit(const uint8_t digit)
return;
}
const uint32_t max = fieldMax[gOOKSenderProtocol][gOOKSenderField];
const uint32_t max = OOK_FieldMax(gOOKSenderField);
if (*value > (max - digit) / 10U) { // value * 10 + digit > max, without overflow
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
return;