Finish the OOK remote sender, fix F+EXIT

OOK sender for 433 MHz remotes: PT2262, EV1527, rc-switch protocols 1-7,
Intertechno self-learning and raw Manchester. The carrier is keyed with the
PA enable line through a new fast BK4819 GPIO write (~25 us instead of
~300 us), and every edge is scheduled on an absolute SysTick clock.

F+EXIT never opened the OOK sender: APP_ProcessKey cancels the F state for
EXIT before the screen handler runs. Open it there instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 01:13:24 +01:00
co-authored by Claude Opus 5.5
parent 7832c1968e
commit 04297ed019
7 changed files with 439 additions and 143 deletions

No files matched your search

+47 -13
View File
@@ -4,36 +4,70 @@
#include "ooksender.h"
#include "../app/ooksender.h"
#include "../external/printf/printf.h"
#include "../misc.h"
#include "../radio.h"
const char OOKPROTONAMES[OOKSENDER_PROTO_END][7] = {
static const char OOKPROTONAMES[OOKSENDER_PROTO_END][7] = {
"PT2262",
"EV1527",
"MANCHE",
"RC-SW",
"INTECH",
"ORESCI"
"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[19];
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++) {
if (gOOKSenderProtocol == i) {
UI_PrintStringSmallBold(OOKPROTONAMES[i], 0, 0, i /*, 8 */);
}
UI_PrintStringSmallNormal(OOKPROTONAMES[i], 0, 0, i /*, 8 */);
sprintf(String, "%c %s", gOOKSenderProtocol == i ? '>' : ' ', OOKPROTONAMES[i]);
UI_PrintStringSmallNormal(String, 0, 0, 1 + i);
}
UI_PrintStringSmallNormal("MENU select", 0, 0, 7);
break;
case OOKSENDER_DATA_INPUT:
UI_PrintString("ENTER DATA", 0, 0, 0 /*, 8 */);
break;
case OOKSENDER_SENDING:
UI_PrintString("SENDING OOK", 0, 0, 0 /*, 8 */);
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/MENU send",
0, 0, 7);
break;
}
default:
break;
}
ST7565_BlitFullScreen();
}
}