Files
HaloKeymind/tools/hil/test_profile_switch_mixed.py
T
mikecarper 091c8d8324 Preserve radio lab experiments and reuse unchanged SX1262 modulation
Skip redundant modulation writes during owned fast RX retunes when the last
acknowledged SF/BW/CR/LDRO tuple matches. Invalidate that cache after ordinary
setters, failed writes, and lifecycle changes.

Include the remaining scan, preamble, settling, and memory-soak experiments,
their collectors, validation notes, and original capture records. Preserve
capture bytes across checkouts and keep private soak credentials local.

Run lab collector and compiled contract tests in CI. Update the expectation,
profile mapping, and result-buffer tests for the extended lab tools, and make
the private WiFi override header optional for ordinary soak diagnostics.

Validation: 145 host tests passed from the staged source snapshot. Clean
heltec_v4_repeater and Xiao_S3_WIO_companion_radio_usb builds passed their
RAM/flash gates. All 229 staged capture files retain their original bytes;
all 75 local documentation links resolve in the clean snapshot.
2026-09-14 22:34:17 -07:00

25 lines
1.3 KiB
Python

import unittest
from profile_switch_mixed import PROFILES,check_plan,check_scan
class MixedHostTests(unittest.TestCase):
def test_exact_equal_symbol_plan_and_peer_identity(self):
self.assertEqual([2**p['sf']*1000/p['bw_khz'] for p in PROFILES],[8192]*4)
reply=dict(mixed_profiles=1,symbol_us=8192,profiles=PROFILES)
check_plan(reply)
for key,value in (('symbol_us',4096),('profiles',PROFILES[::-1]),('mixed_profiles',0)):
with self.assertRaises(RuntimeError): check_plan(dict(reply,**{key:value}))
def test_every_hop_requires_a_modulation_write(self):
status=dict(switch=dict(n=100),mixed_profiles=True,accept_offchannel=False,rollback=0,
rx_gain_reg=148,channel_step_khz=1000,settle_us=0,frequency_repeat=True,
modulation_cache=True,rf_commands=200,modulation_commands=100,
optimized_rx_resumes=100,failures=0,rx_mode_errors=0,cache_errors=0,rx_errors=0)
check_scan(status,0)
for key,value in (('modulation_commands',0),('rf_commands',100),('rx_gain_reg',150),
('mixed_profiles',False),('cache_errors',1),('accept_offchannel',True)):
with self.assertRaises(RuntimeError): check_scan(dict(status,**{key:value}),0)
if __name__=='__main__': unittest.main()