Files
opengd77-uv380-sms/patches/patch_sms2.py
T
viktor b5a8e92e45 DMR-данные (SMS) на TYT MD-UV380 под OpenGD77
Восстановлено из транскрипта сессии после потери рабочего дерева на сервере сборки.

Что внутри:
- четыре новых модуля прошивки (приём, сборка исходящего, меню Messages);
- правки существующих файлов в виде скриптов, с порядком применения;
- инструменты стенда: снятие экрана рации по USB, дамп кадров, эталонная сборка пакета;
- NOTES.md: что проверено в эфире, что не доделано, где грабли.

Работало в эфире в августе 2026: данные ходят в обе стороны в режиме хотспота,
рация принимает SMS и показывает на экране. Отправка собрана и сверена с эталоном
сервера побайтово, но в эфире не проверялась.

Claude-Session: https://claude.ai/code/session_01GJtvG5WwqYNe1b7s9LLtgy
2026-09-11 02:39:24 +09:00

36 строки
1.3 KiB
Python

#!/usr/bin/env python3
"""SMS step 2: run the assembler from the main loop and initialise it at startup."""
W = "/home/viktor/ogd77rel/uv_src/OpenGD77_MDUV380_DM1701_20260130/MDUV380_firmware/application"
p = W + "/source/applicationMain.c"
s = open(p).read()
if "smsTick" in s:
print("already wired into the main loop")
raise SystemExit(0)
# include
anchor = None
for cand in ['#include "functions/voicePrompts.h"\n', '#include "functions/settings.h"\n', '#include "functions/ticks.h"\n']:
if cand in s:
anchor = cand
break
assert anchor, "no suitable include anchor in applicationMain.c"
s = s.replace(anchor, anchor + '#include "functions/sms.h"\n', 1)
# drain the received bursts once per main loop pass, next to the other periodic work
a = "\t\tvoxTick();\n"
assert a in s, "voxTick anchor missing"
s = s.replace(a, a + "\t\tsmsTick();// turn received data bursts into messages\n", 1)
# initialise alongside the other subsystems
init_anchor = None
for cand in ["\tbatteryUpdate();\n", "\tvoxInit();\n"]:
if cand in s:
init_anchor = cand
break
assert init_anchor, "no init anchor found"
s = s.replace(init_anchor, init_anchor + "\tsmsInit();\n", 1)
open(p, "w").write(s)
print("applicationMain.c: smsInit() + smsTick() wired in")