define maximum used bandwidth during transmission

This commit is contained in:
DJ2LS 2024-03-24 21:17:07 +01:00
parent b28ee0aa85
commit 8c224ab7dc
5 changed files with 34 additions and 21 deletions

View file

@ -165,20 +165,20 @@ const audioStore = useAudioStore();
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable 250Hz bandwidth mode</label>
<label class="input-group-text w-50">
<div class="form-check form-switch form-check-inline">
<input
class="form-check-input"
type="checkbox"
id="250HzModeSwitch"
v-model="settings.remote.MODEM.enable_low_bandwidth_mode"
@change="onChange"
/>
<label class="form-check-label" for="250HzModeSwitch">250Hz</label>
</div>
</label>
<label class="input-group-text w-50">Maximum used bandwidth</label>
<select
class="form-select form-select-sm"
id="maximum_bandwidth"
@change="onChange"
v-model.number="settings.remote.MODEM.maximum_bandwidth"
>
<option value="250">250 Hz</option>
<option value="563">563 Hz</option>
<option value="1700">1700 Hz</option>
</select>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Respond to CQ</label>
<label class="input-group-text w-50">

View file

@ -54,11 +54,11 @@ const defaultConfig = {
enable_protocol: false,
},
MODEM: {
enable_low_bandwidth_mode: false,
respond_to_cq: false,
tx_delay: 0,
enable_hamc: false,
enable_morse_identifier: false,
maximum_bandwidth: 3000,
},
RADIO: {
control: "disabled",

View file

@ -16,16 +16,19 @@ class ARQSession:
'mode': codec2.FREEDV_MODE.datac4,
'min_snr': -10,
'duration_per_frame': 5.17,
'bandwidth': 250,
},
1: {
'mode': codec2.FREEDV_MODE.datac3,
'min_snr': 0,
'duration_per_frame': 3.19,
'bandwidth': 563,
},
2: {
'mode': codec2.FREEDV_MODE.datac1,
'min_snr': 3,
'duration_per_frame': 4.18,
'bandwidth': 1700,
},
}
@ -162,10 +165,20 @@ class ARQSession:
return stats
def get_appropriate_speed_level(self, snr):
# Start with the lowest speed level as default
# In case of a not fitting SNR, we return the lowest speed level
maximum_bandwidth = self.config['MODEM']['maximum_bandwidth']
# Adjust maximum_bandwidth based on special conditions or invalid configurations
if maximum_bandwidth == 0:
# Use the maximum available bandwidth from the speed level dictionary
maximum_bandwidth = max(details['bandwidth'] for details in self.SPEED_LEVEL_DICT.values())
# Initialize appropriate_speed_level to the lowest level that meets the minimum criteria
appropriate_speed_level = min(self.SPEED_LEVEL_DICT.keys())
for level, details in self.SPEED_LEVEL_DICT.items():
if snr >= details['min_snr'] and level > appropriate_speed_level:
appropriate_speed_level = level
if snr >= details['min_snr'] and details['bandwidth'] <= maximum_bandwidth:
# Update appropriate_speed_level to the current level if it meets both SNR and bandwidth criteria
if level > appropriate_speed_level:
appropriate_speed_level = level
return appropriate_speed_level

View file

@ -45,10 +45,10 @@ enable_protocol = False
[MODEM]
enable_hmac = False
enable_low_bandwidth_mode = False
enable_morse_identifier = False
respond_to_cq = True
tx_delay = 200
tx_delay = 50
maximum_bandwidth = 1700
[MESSAGES]
enable_auto_repeat = False

View file

@ -57,7 +57,7 @@ class CONFIG:
'MODEM': {
'enable_hmac': bool,
'enable_morse_identifier': bool,
'enable_low_bandwidth_mode': bool,
'maximum_bandwidth': int,
'respond_to_cq': bool,
'tx_delay': int
},