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