Avoid reconnecting if no radio changes

This commit is contained in:
Alec K2XAP 2026-01-07 12:46:17 -05:00
parent 4437c69d11
commit 85c95dff1b

View file

@ -289,7 +289,6 @@ async def waitForTx (packet_id: int):
s = time() s = time()
timed_out = False timed_out = False
while not packet_id in txed and not timed_out: while not packet_id in txed and not timed_out:
# sleep(0.1)
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
if time() - s > 45: if time() - s > 45:
timed_out = True timed_out = True
@ -325,10 +324,12 @@ async def runCues (cuesheet: Cuesheet, run_config: RunConfig):
print(scenario) print(scenario)
print('configure radio') print('configure radio')
scenario_prefix = f'{scenario['freq']},{scenario['bw']},{scenario['sf']},{scenario['cr']},{scenario['pow']}' scenario_prefix = f'{scenario['freq']},{scenario['bw']},{scenario['sf']},{scenario['cr']},{scenario['pow']}'
configureRadio(scenario) did_change = configureRadio(scenario)
if did_change:
reconnectRadio() reconnectRadio()
if scenario['sender'] == run_config['this_station']:
print('waiting for start') print('waiting for start')
while t < scenario['start']: while t < scenario['start']: # Give other stations time to get ready
t = time() - start t = time() - start
sleep(0.1) sleep(0.1)
print('starting scenario') print('starting scenario')
@ -340,6 +341,7 @@ async def runCues (cuesheet: Cuesheet, run_config: RunConfig):
await sendPacket(scenario['sender'], scenario['size']) await sendPacket(scenario['sender'], scenario['size'])
await asyncio.sleep(scenario['between']) await asyncio.sleep(scenario['between'])
else: else:
print('waiting for rx')
# Wait until the next scenario and just listen # Wait until the next scenario and just listen
wait_for_s = max(scenario['end'] - t,0.5) wait_for_s = max(scenario['end'] - t,0.5)
await asyncio.sleep(wait_for_s) await asyncio.sleep(wait_for_s)