Repository navigation
MegaOpen 1.8.0
The stabilisation release: the review of 2026-11-03 (the architecture behind the heap corruptions) implemented, plus the stock radio's code.
Added
- The stock radio's code, typed for you. With «Реєструвати щиток» off (the OEM radio drives the panel), the radio asks for its four-digit code on the panel after the battery was off. Плата → Система → «Код магнітоли» (
radioCode, NVS; empty = off): when the prompt appears (" CODE "on 0x151, then the entry field with the 0xB0 cursor, as the car's captures show), the board types it on the bus as the stalk would, one key frame every 160 ms — the wheel up per digit, the bottom button to the next place, held to confirm. One attempt per prompt and never two within a minute (the radio waits longer after every wrong code); the screen's verdict goes to the log, tagcode(typed, accepted, rejected, skipped). The logic is pure (src/display/RadioCode.*), host-tested against the captured frames. - The heap diagnostic build.
PLATFORMIO_BUILD_FLAGS=-DHEAP_SENTINEL=1(src/utils/HeapSentinel.h) walks the heap at every network step, around every web route and every 500 ms, and on a hit logs the address, the step, the task and the bytes around it before the coredump. It replaces HEAP_HUNT (2026-10-19). Not in the release image.
Changed
- One network worker. The log push and the GitHub update each created a task per job (10 kB and 8 kB of internal stack, every minute for the push) and deleted it after, serialised by a mutex and a 100 ms poll (TlsJob). The bench's heap corruption of 2026-11-01 sat in exactly the hole those stacks churned. Both jobs now run on
netjob, one task for the whole boot with a queue; its 8 kB stack is taken from the internal heap once, at the first job, and kept (a static one moved the heap under the OTA trial's floor: rc1 never confirmed). A check or install pressed during a push waits its turn as before (queued); the push's heap floor is 30 kB now that the stack is already there (it was 40 kB with the stack still to take). The error codetls_busyis gone;push_busysays the worker's queue was full. - Settings hold no Strings. Every text in Settings is a fixed
Cfg::Text<N>: a copy is a copy, and a reader on another task can never find a freed buffer behind a field (the car task'sresolveCarSigsread one while httpd'ssave()reassigned it; WifiManager readmdnsNameon net_svc). The settings lock is for the writers now. - Web replies stream. 28 routes built the whole reply as a String on httpd (2 kB realloc steps in internal heap, under the settings lock) and 59 documents took their pools there: a document now goes straight into the chunked reply (
replyDoc), every document on httpd allocates in PSRAM, and the head-unit ring (/api/canbox/last) streams too. - The formula parser caps nesting. Brackets, calls and chains of nots recursed with no limit (127 brackets in a rule were 12–40 kB of recursion on the car task's 4 kB stack): past
Program::MAX_NEST(about five levels) a formula is refused asexpr_deep. The car task never takes the blocking settings lock (tryLock, retried next pass), its stack is 6 kB, andtools/check_rules.pychecks its functions in main.cpp. The stacks that lived outsideTaskPlan.h(logbus, capwr, bt_begin) are in it. - One of each.
utils/PsHeap.his the one "PSRAM, else internal" allocator (ten copies before);utils/Hex.hthe one hex digit (five);utils/JsonEscape.hthe one JSON string escape (three, two of which let a control byte through into/api/catalogand the head-unit ring).LogFile::pathfills the caller's buffer instead of handing one static buffer to every task; the pane copies its Custom picture, so the web's copy of it is whole; the request gate uses the boot's mDNS name without a lock (nothing renames it: it is not in the registry); the log push can no longer spin on a flash-log stretch with no line end.
Removed
- Functions with no callers:
WebUi::addRoute,Registry::enumName,Keys::laneName,Log::statusInterval,Rav4Emitter::msgEnabled,LogFile::requestFlush;src/net/TlsJob.*; HEAP_HUNT.
Built from 288740b with AffaDisplay@6183b2e.
First flash over USB: esptool.py write_flash 0x0 megaopen-<env>-1.8.0-factory.bin.
Later updates: megaopen-<env>-1.8.0.bin from the board's /update page.
The head unit's app: install megaopen-companion-1.8.0.apk (Android 7+, no root).
Same files as v1.8.0-rc2.