Files
BRNSystemsandClaude Opus 5.5 4a99a21a21 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>
2026-11-15 01:24:16 +01:00

74 lines
2.4 KiB
C

//
// Created by bruno on 3/30/25.
//
#include "ooksender.h"
#include "../app/ooksender.h"
#include "../external/printf/printf.h"
#include "../misc.h"
#include "../radio.h"
static const char OOKPROTONAMES[OOKSENDER_PROTO_END][7] = {
"PT2262",
"EV1527",
"RC-SW",
"INTECH",
"MANCH",
};
static void OOK_FormatValue(const uint8_t field, char *out)
{
const uint32_t value = gOOKSenderValue[field];
if (gOOKSenderProtocol == OOKSENDER_PROTO_PT2262 && field == OOK_FIELD_CODE) {
const uint32_t trits = gOOKSenderValue[OOK_FIELD_ARG];
for (uint32_t i = 0; i < trits; i++) {
const uint32_t trit = (value >> (2U * (trits - 1U - i))) & 3U;
out[i] = trit == 2U ? 'F' : (char) ('0' + trit);
}
out[trits] = '\0';
return;
}
sprintf(out, "%lu", (unsigned long) value);
}
void OOKSENDER_Display(void) {
char String[22];
UI_DisplayClear();
switch (gOOKSenderState) {
case OOKSENDER_PROTO_CHOOSE:
UI_PrintStringSmallBold("OOK protocol", 0, 0, 0);
for (uint8_t i = 0; i < OOKSENDER_PROTO_END; i++) {
sprintf(String, "%c %s", gOOKSenderProtocol == i ? '>' : ' ', OOKPROTONAMES[i]);
UI_PrintStringSmallNormal(String, 0, 0, 1 + i);
}
UI_PrintStringSmallNormal("MENU = OK", 0, 0, 7);
break;
case OOKSENDER_DATA_INPUT:
case OOKSENDER_SENDING: {
uint8_t line = 1;
sprintf(String, "%s %lu.%05lu", OOKPROTONAMES[gOOKSenderProtocol],
(unsigned long) (gCurrentVfo->pTX->Frequency / 100000U),
(unsigned long) (gCurrentVfo->pTX->Frequency % 100000U));
UI_PrintStringSmallBold(String, 0, 0, 0);
for (uint8_t f = 0; f < OOK_FIELD_COUNT; f++) {
const char *label = OOKSENDER_FieldLabel(gOOKSenderProtocol, f);
char value[14];
if (label == NULL)
continue;
OOK_FormatValue(f, value);
sprintf(String, "%c%-6s %s", gOOKSenderField == f ? '>' : ' ', label, value);
UI_PrintStringSmallNormal(String, 0, 0, line++);
}
UI_PrintStringSmallNormal(gOOKSenderState == OOKSENDER_SENDING ? "Sending" : "PTT send",
0, 0, 7);
break;
}
default:
break;
}
ST7565_BlitFullScreen();
}