mirror of
https://github.com/MCKero6423/uv-k5-v3-emulator.git
synced 2026-10-02 03:15:36 +00:00
The firmware now draws a working meter: -53 dBm, +40 over S9, nine of thirteen segments, next to a MONI label and a running receive timer. The two numbers agree with each other -- S9 is -93 dBm on UHF, so -53 really is S9+40. Three pieces had to line up, and the order they were found in was the hard part. RSSI and audio amplitude are refreshed when the firmware polls REG_0C, not when it configures the chip. Raising a flag at configuration time is a trap: REG_3F is written 0 then 0x0C0C repeatedly during setup, so anything announced there is disabled again before it can be collected. The squelch flag is SQUELCH_LOST, bit 2 -- not SQUELCH_FOUND. Per app/app.c:1027 "squelch lost" is what sets g_SquelchLost = true, i.e. a signal is present. SQUELCH_FOUND reads like "found a signal" and means the opposite. Announcing is rate-limited to every 64th poll. Announcing once means the firmware collects it during startup, before the flag leads anywhere. Announcing on every poll re-arms the request bit inside the firmware's own collection loop, which uses REG_0C as its condition and has no timeout, so it never exits. Periodic satisfies both. What finally made the meter appear was not the interrupt at all. The radio idles in power save and does not act on squelch there. ACTION_Monitor skips squelch entirely -- app/app.c:482 picks FUNCTION_MONITOR over FUNCTION_RECEIVE when gMonitor is set -- and settings.c:263 defaults an out-of-range stored action to ACTION_OPT_MONITOR, which blank flash (0xFF) is. So SIDE1 short-press is the way in. Measured: fn=5 idle=1 monitor=0 before, fn=2 idle=0 monitor=1 after. Gating on RX_DSP (REG_30 bit 0, from App/driver/bk4819-regs.h:240) rather than the whole register being zero: TX and tone paths leave other bits set with RX_DSP clear, and would otherwise look like a live receiver. tools/test_smeter.py covers the whole path -- boots pristine, confirms power save, presses SIDE1, and checks the screen gained content. It compares lit-pixel counts rather than matching pixels, so an unrelated UI change does not produce a mysterious failure. None of this is radio simulation. The levels are plausible numbers that move; they are not the result of modelling a signal. What they buy is firmware control flow running on live values instead of on zero.