Avoid reconnecting if no radio changes
This commit is contained in:
parent
4437c69d11
commit
85c95dff1b
1 changed files with 20 additions and 18 deletions
38
modjam.py
38
modjam.py
|
|
@ -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,24 +324,27 @@ 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)
|
||||||
reconnectRadio()
|
if did_change:
|
||||||
print('waiting for start')
|
reconnectRadio()
|
||||||
while t < scenario['start']:
|
if scenario['sender'] == run_config['this_station']:
|
||||||
t = time() - start
|
print('waiting for start')
|
||||||
sleep(0.1)
|
while t < scenario['start']: # Give other stations time to get ready
|
||||||
print('starting scenario')
|
t = time() - start
|
||||||
|
sleep(0.1)
|
||||||
|
print('starting scenario')
|
||||||
|
|
||||||
while t < scenario['end']:
|
while t < scenario['end']:
|
||||||
t = time() - start
|
t = time() - start
|
||||||
if scenario['sender'] == run_config['this_station']:
|
if scenario['sender'] == run_config['this_station']:
|
||||||
num_packets += 1
|
num_packets += 1
|
||||||
await sendPacket(scenario['sender'], scenario['size'])
|
await sendPacket(scenario['sender'], scenario['size'])
|
||||||
await asyncio.sleep(scenario['between'])
|
await asyncio.sleep(scenario['between'])
|
||||||
else:
|
else:
|
||||||
# Wait until the next scenario and just listen
|
print('waiting for rx')
|
||||||
wait_for_s = max(scenario['end'] - t,0.5)
|
# Wait until the next scenario and just listen
|
||||||
await asyncio.sleep(wait_for_s)
|
wait_for_s = max(scenario['end'] - t,0.5)
|
||||||
|
await asyncio.sleep(wait_for_s)
|
||||||
print('scenario complete')
|
print('scenario complete')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue