mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-26 04:12:57 +10:00
Fix radio settings to only send repeat byte when the current state is known
This commit is contained in:
@@ -963,9 +963,11 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> {
|
|||||||
widget.connector.currentCr,
|
widget.connector.currentCr,
|
||||||
);
|
);
|
||||||
|
|
||||||
final supportsRepeat = (widget.connector.firmwareVerCode ?? 0) >= 9;
|
// if the client repeat isnt null then we know its supported
|
||||||
|
//otherwise we leave it out of the frame to avoid accidentally enabling
|
||||||
|
final knownRepeat = widget.connector.clientRepeat != null;
|
||||||
|
|
||||||
if (supportsRepeat) {
|
if (knownRepeat) {
|
||||||
const validRepeatFreqsKHz = {433000, 869000, 918000};
|
const validRepeatFreqsKHz = {433000, 869000, 918000};
|
||||||
if (_clientRepeat && !validRepeatFreqsKHz.contains(freqHz)) {
|
if (_clientRepeat && !validRepeatFreqsKHz.contains(freqHz)) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@@ -982,7 +984,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> {
|
|||||||
bwHz,
|
bwHz,
|
||||||
sf,
|
sf,
|
||||||
cr,
|
cr,
|
||||||
clientRepeat: supportsRepeat ? _clientRepeat : null,
|
clientRepeat: knownRepeat ? _clientRepeat : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await widget.connector.sendFrame(buildSetRadioTxPowerFrame(txPower));
|
await widget.connector.sendFrame(buildSetRadioTxPowerFrame(txPower));
|
||||||
@@ -1112,7 +1114,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> {
|
|||||||
),
|
),
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
),
|
),
|
||||||
if ((widget.connector.firmwareVerCode ?? 0) >= 9) ...[
|
if (widget.connector.clientRepeat != null) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(l10n.settings_clientRepeat),
|
title: Text(l10n.settings_clientRepeat),
|
||||||
|
|||||||
Reference in New Issue
Block a user