Fix review findings in radio settings path hash size
- Presets no longer reset the path hash size; the unused preset field is gone - Confirm the new path hash size from the refreshed DEVICE_INFO and show a specific error when the radio does not apply it - Log path hash size with the other radio settings and on manual edits - Add MeshCoreConnector.supportsPathHashMode and use it in both screens - Use the same 0-2 mode values and helper text as the other selectors
This commit is contained in:
1 parent
f8a9922ba4
commit
143ca57279
25 files changed
+205
-32
No files matched your search
@@ -681,6 +681,9 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
/// from ver code 8.
|
/// from ver code 8.
|
||||||
bool get supportsNodeDiscover => (_firmwareVerCode ?? 0) >= 8;
|
bool get supportsNodeDiscover => (_firmwareVerCode ?? 0) >= 8;
|
||||||
|
|
||||||
|
/// CMD_SET_PATH_HASH_MODE exists from ver code 10 (v1.14.0).
|
||||||
|
bool get supportsPathHashMode => (_firmwareVerCode ?? 0) >= 10;
|
||||||
|
|
||||||
/// CMD_GET/SET_DEFAULT_FLOOD_SCOPE exist from ver code 11 (v1.15.0).
|
/// CMD_GET/SET_DEFAULT_FLOOD_SCOPE exist from ver code 11 (v1.15.0).
|
||||||
bool get supportsDefaultFloodScope => (_firmwareVerCode ?? 0) >= 11;
|
bool get supportsDefaultFloodScope => (_firmwareVerCode ?? 0) >= 11;
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,7 @@
|
|||||||
"settings_radioSettingsSubtitle": "Frequency, power, spreading factor",
|
"settings_radioSettingsSubtitle": "Frequency, power, spreading factor",
|
||||||
"settings_radioSettingsUpdated": "Radio settings updated",
|
"settings_radioSettingsUpdated": "Radio settings updated",
|
||||||
"settings_radioSettingsNotApplied": "The radio did not apply these settings",
|
"settings_radioSettingsNotApplied": "The radio did not apply these settings",
|
||||||
|
"settings_pathHashModeNotApplied": "Radio settings were applied, but the radio did not confirm the new path hash size",
|
||||||
"settings_regionSettings": "Regions",
|
"settings_regionSettings": "Regions",
|
||||||
"settings_regionSettingsSubtitle": "Limit channel floods to an area",
|
"settings_regionSettingsSubtitle": "Limit channel floods to an area",
|
||||||
"settings_regionEmptyExplanation": "Regions limit flood messages to repeaters in an area. Fetch them from nearby repeaters or add one by name.",
|
"settings_regionEmptyExplanation": "Regions limit flood messages to repeaters in an area. Fetch them from nearby repeaters or add one by name.",
|
||||||
|
|||||||
@@ -862,6 +862,12 @@ abstract class AppLocalizations {
|
|||||||
/// **'The radio did not apply these settings'**
|
/// **'The radio did not apply these settings'**
|
||||||
String get settings_radioSettingsNotApplied;
|
String get settings_radioSettingsNotApplied;
|
||||||
|
|
||||||
|
/// No description provided for @settings_pathHashModeNotApplied.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Radio settings were applied, but the radio did not confirm the new path hash size'**
|
||||||
|
String get settings_pathHashModeNotApplied;
|
||||||
|
|
||||||
/// No description provided for @settings_regionSettings.
|
/// No description provided for @settings_regionSettings.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
|
|||||||
@@ -425,6 +425,10 @@ class AppLocalizationsBg extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Радиото не приложи тези настройки';
|
'Радиото не приложи тези настройки';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Региони';
|
String get settings_regionSettings => 'Региони';
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,10 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Das Funkgerät hat diese Einstellungen nicht übernommen';
|
'Das Funkgerät hat diese Einstellungen nicht übernommen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regionen';
|
String get settings_regionSettings => 'Regionen';
|
||||||
|
|
||||||
|
|||||||
@@ -421,6 +421,10 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'The radio did not apply these settings';
|
'The radio did not apply these settings';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regions';
|
String get settings_regionSettings => 'Regions';
|
||||||
|
|
||||||
|
|||||||
@@ -425,6 +425,10 @@ class AppLocalizationsEs extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'La radio no aplicó esta configuración';
|
'La radio no aplicó esta configuración';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regiones';
|
String get settings_regionSettings => 'Regiones';
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,10 @@ class AppLocalizationsFr extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'La radio n\'a pas appliqué ces paramètres';
|
'La radio n\'a pas appliqué ces paramètres';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Régions';
|
String get settings_regionSettings => 'Régions';
|
||||||
|
|
||||||
|
|||||||
@@ -423,6 +423,10 @@ class AppLocalizationsHu extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'A rádió nem alkalmazta ezeket a beállításokat';
|
'A rádió nem alkalmazta ezeket a beállításokat';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Tájak';
|
String get settings_regionSettings => 'Tájak';
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,10 @@ class AppLocalizationsIt extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'La radio non ha applicato queste impostazioni';
|
'La radio non ha applicato queste impostazioni';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regioni';
|
String get settings_regionSettings => 'Regioni';
|
||||||
|
|
||||||
|
|||||||
@@ -407,6 +407,10 @@ class AppLocalizationsJa extends AppLocalizations {
|
|||||||
@override
|
@override
|
||||||
String get settings_radioSettingsNotApplied => 'ラジオがこれらの設定を適用しませんでした';
|
String get settings_radioSettingsNotApplied => 'ラジオがこれらの設定を適用しませんでした';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => '地域';
|
String get settings_regionSettings => '地域';
|
||||||
|
|
||||||
|
|||||||
@@ -407,6 +407,10 @@ class AppLocalizationsKo extends AppLocalizations {
|
|||||||
@override
|
@override
|
||||||
String get settings_radioSettingsNotApplied => '라디오가 이 설정을 적용하지 않았습니다';
|
String get settings_radioSettingsNotApplied => '라디오가 이 설정을 적용하지 않았습니다';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => '지역';
|
String get settings_regionSettings => '지역';
|
||||||
|
|
||||||
|
|||||||
@@ -423,6 +423,10 @@ class AppLocalizationsNl extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'De radio heeft deze instellingen niet toegepast';
|
'De radio heeft deze instellingen niet toegepast';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regio\'s';
|
String get settings_regionSettings => 'Regio\'s';
|
||||||
|
|
||||||
|
|||||||
@@ -431,6 +431,10 @@ class AppLocalizationsPl extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Radio nie zastosowało tych ustawień';
|
'Radio nie zastosowało tych ustawień';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regiony';
|
String get settings_regionSettings => 'Regiony';
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,10 @@ class AppLocalizationsPt extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'O rádio não aplicou estas configurações';
|
'O rádio não aplicou estas configurações';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regiões';
|
String get settings_regionSettings => 'Regiões';
|
||||||
|
|
||||||
|
|||||||
@@ -426,6 +426,10 @@ class AppLocalizationsRu extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Радиомодуль не применил эти настройки';
|
'Радиомодуль не применил эти настройки';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Регионы';
|
String get settings_regionSettings => 'Регионы';
|
||||||
|
|
||||||
|
|||||||
@@ -426,6 +426,10 @@ class AppLocalizationsSk extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Rádio tieto nastavenia neuplatnilo';
|
'Rádio tieto nastavenia neuplatnilo';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regiony';
|
String get settings_regionSettings => 'Regiony';
|
||||||
|
|
||||||
|
|||||||
@@ -425,6 +425,10 @@ class AppLocalizationsSl extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Radio teh nastavitev ni uveljavil';
|
'Radio teh nastavitev ni uveljavil';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regioni';
|
String get settings_regionSettings => 'Regioni';
|
||||||
|
|
||||||
|
|||||||
@@ -423,6 +423,10 @@ class AppLocalizationsSv extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Radion tillämpade inte dessa inställningar';
|
'Radion tillämpade inte dessa inställningar';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Regioner';
|
String get settings_regionSettings => 'Regioner';
|
||||||
|
|
||||||
|
|||||||
@@ -425,6 +425,10 @@ class AppLocalizationsUk extends AppLocalizations {
|
|||||||
String get settings_radioSettingsNotApplied =>
|
String get settings_radioSettingsNotApplied =>
|
||||||
'Радіомодуль не застосував ці налаштування';
|
'Радіомодуль не застосував ці налаштування';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => 'Ріси';
|
String get settings_regionSettings => 'Ріси';
|
||||||
|
|
||||||
|
|||||||
@@ -401,6 +401,10 @@ class AppLocalizationsZh extends AppLocalizations {
|
|||||||
@override
|
@override
|
||||||
String get settings_radioSettingsNotApplied => '收音机未应用这些设置';
|
String get settings_radioSettingsNotApplied => '收音机未应用这些设置';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings_pathHashModeNotApplied =>
|
||||||
|
'Radio settings were applied, but the radio did not confirm the new path hash size';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get settings_regionSettings => '地区';
|
String get settings_regionSettings => '地区';
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class RadioSettings {
|
|||||||
final LoRaSpreadingFactor spreadingFactor;
|
final LoRaSpreadingFactor spreadingFactor;
|
||||||
final LoRaCodingRate codingRate;
|
final LoRaCodingRate codingRate;
|
||||||
final int txPowerDbm;
|
final int txPowerDbm;
|
||||||
final int pathHashByteWidth;
|
|
||||||
|
|
||||||
RadioSettings({
|
RadioSettings({
|
||||||
required this.frequencyMHz,
|
required this.frequencyMHz,
|
||||||
@@ -58,7 +57,6 @@ class RadioSettings {
|
|||||||
required this.spreadingFactor,
|
required this.spreadingFactor,
|
||||||
required this.codingRate,
|
required this.codingRate,
|
||||||
required this.txPowerDbm,
|
required this.txPowerDbm,
|
||||||
this.pathHashByteWidth = 1, // app default; presets override if needed
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Regional preset configurations
|
// Regional preset configurations
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ import '../widgets/sync_progress_overlay.dart';
|
|||||||
import 'region_management_screen.dart';
|
import 'region_management_screen.dart';
|
||||||
import '../utils/share_origin.dart';
|
import '../utils/share_origin.dart';
|
||||||
|
|
||||||
/// Companion firmware version that added CMD_SET_PATH_HASH_MODE (v1.14.0).
|
|
||||||
const int _minFirmwareVerCodeForPathHashMode = 10;
|
|
||||||
|
|
||||||
class SettingsScreen extends StatefulWidget {
|
class SettingsScreen extends StatefulWidget {
|
||||||
const SettingsScreen({super.key});
|
const SettingsScreen({super.key});
|
||||||
|
|
||||||
@@ -566,14 +563,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
title: l10n.repeater_pathHashMode,
|
title: l10n.repeater_pathHashMode,
|
||||||
subtitle: !connected
|
subtitle: !connected
|
||||||
? offline
|
? offline
|
||||||
: (connector.firmwareVerCode ?? 0) <
|
: !connector.supportsPathHashMode
|
||||||
_minFirmwareVerCodeForPathHashMode
|
|
||||||
? l10n.settings_requiresFirmware('v1.14')
|
? l10n.settings_requiresFirmware('v1.14')
|
||||||
: _pathHashModeSubtitle(context, connector.pathHashByteWidth),
|
: _pathHashModeSubtitle(context, connector.pathHashByteWidth),
|
||||||
onTap:
|
onTap: connector.isConnected && connector.supportsPathHashMode
|
||||||
connector.isConnected &&
|
|
||||||
(connector.firmwareVerCode ?? 0) >=
|
|
||||||
_minFirmwareVerCodeForPathHashMode
|
|
||||||
? () => _editPathHashMode(context, connector)
|
? () => _editPathHashMode(context, connector)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -30,12 +30,9 @@ bool _isAllowedRepeatFreqKHz(MeshCoreConnector connector, int freqKHz) {
|
|||||||
/// Lowest TX power companion firmware accepts (CMD_SET_RADIO_TX_POWER).
|
/// Lowest TX power companion firmware accepts (CMD_SET_RADIO_TX_POWER).
|
||||||
const int _minTxPowerDbm = -9;
|
const int _minTxPowerDbm = -9;
|
||||||
|
|
||||||
/// Companion firmware version that added CMD_SET_PATH_HASH_MODE (v1.14.0).
|
/// Radio parameter editor (preset, frequency, bandwidth, SF, CR, TX power,
|
||||||
const int _minFirmwareVerCodeForPathHashMode = 10;
|
/// path-hash size and off-grid client repeat). Stays open when the radio
|
||||||
|
/// rejects or fails to apply the settings so the user's edits are not lost.
|
||||||
/// Radio parameter editor (preset, frequency, bandwidth, SF, CR, TX power and
|
|
||||||
/// off-grid client repeat). Stays open when the radio rejects or fails to
|
|
||||||
/// apply the settings so the user's edits are not lost.
|
|
||||||
class RadioSettingsDialog extends StatefulWidget {
|
class RadioSettingsDialog extends StatefulWidget {
|
||||||
final MeshCoreConnector connector;
|
final MeshCoreConnector connector;
|
||||||
|
|
||||||
@@ -58,9 +55,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
String? _frequencyError;
|
String? _frequencyError;
|
||||||
String? _txPowerError;
|
String? _txPowerError;
|
||||||
|
|
||||||
bool get _supportsPathHashMode =>
|
bool get _supportsPathHashMode => widget.connector.supportsPathHashMode;
|
||||||
(widget.connector.firmwareVerCode ?? 0) >=
|
|
||||||
_minFirmwareVerCodeForPathHashMode;
|
|
||||||
|
|
||||||
AppDebugLogService get _appLog =>
|
AppDebugLogService get _appLog =>
|
||||||
Provider.of<AppDebugLogService>(context, listen: false);
|
Provider.of<AppDebugLogService>(context, listen: false);
|
||||||
@@ -284,7 +279,6 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
_spreadingFactor = preset.spreadingFactor;
|
_spreadingFactor = preset.spreadingFactor;
|
||||||
_codingRate = preset.codingRate;
|
_codingRate = preset.codingRate;
|
||||||
_txPowerController.text = preset.txPowerDbm.toString();
|
_txPowerController.text = preset.txPowerDbm.toString();
|
||||||
_pathHashByteWidth = preset.pathHashByteWidth;
|
|
||||||
_selectedPresetIndex = index;
|
_selectedPresetIndex = index;
|
||||||
_lastNonRepeatSnapshot = baseSnapshot;
|
_lastNonRepeatSnapshot = baseSnapshot;
|
||||||
// Programmatic writes skip TextField.onChanged, so clear any stale
|
// Programmatic writes skip TextField.onChanged, so clear any stale
|
||||||
@@ -449,15 +443,34 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await widget.connector.sendFrame(buildSetRadioTxPowerFrame(txPower));
|
await widget.connector.sendFrame(buildSetRadioTxPowerFrame(txPower));
|
||||||
if (_supportsPathHashMode &&
|
// setPathHashMode updates the local width optimistically; the refreshed
|
||||||
_pathHashByteWidth != widget.connector.pathHashByteWidth) {
|
// DEVICE_INFO below overwrites it with what the radio actually stored.
|
||||||
await widget.connector.setPathHashMode(_pathHashByteWidth - 1);
|
final requestedPathHashWidth =
|
||||||
|
_supportsPathHashMode &&
|
||||||
|
_pathHashByteWidth != widget.connector.pathHashByteWidth
|
||||||
|
? _pathHashByteWidth
|
||||||
|
: null;
|
||||||
|
if (requestedPathHashWidth != null) {
|
||||||
|
await widget.connector.setPathHashMode(requestedPathHashWidth - 1);
|
||||||
}
|
}
|
||||||
final selfInfo = widget.connector.receivedFrames
|
final selfInfo = widget.connector.receivedFrames
|
||||||
.firstWhere((f) => f.isNotEmpty && f[0] == respCodeSelfInfo)
|
.firstWhere((f) => f.isNotEmpty && f[0] == respCodeSelfInfo)
|
||||||
.timeout(const Duration(seconds: 5));
|
.timeout(const Duration(seconds: 5));
|
||||||
|
final deviceInfo = requestedPathHashWidth == null
|
||||||
|
? null
|
||||||
|
: widget.connector.receivedFrames
|
||||||
|
.firstWhere((f) => f.isNotEmpty && f[0] == respCodeDeviceInfo)
|
||||||
|
.timeout(const Duration(seconds: 5));
|
||||||
await widget.connector.refreshDeviceInfo();
|
await widget.connector.refreshDeviceInfo();
|
||||||
final applied = await selfInfo.then(
|
// Without a refreshed DEVICE_INFO the path hash change is unconfirmed
|
||||||
|
// (this also covers setPathHashMode skipping a disconnected radio).
|
||||||
|
final pathHashApplied =
|
||||||
|
deviceInfo == null ||
|
||||||
|
await deviceInfo.then(
|
||||||
|
(_) => widget.connector.pathHashByteWidth == requestedPathHashWidth,
|
||||||
|
onError: (_) => false,
|
||||||
|
);
|
||||||
|
final radioApplied = await selfInfo.then(
|
||||||
(_) => _deviceMatches(
|
(_) => _deviceMatches(
|
||||||
freqHz: freqHz,
|
freqHz: freqHz,
|
||||||
bwHz: bwHz,
|
bwHz: bwHz,
|
||||||
@@ -468,7 +481,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
),
|
),
|
||||||
onError: (_) => true,
|
onError: (_) => true,
|
||||||
);
|
);
|
||||||
if (!applied) {
|
if (!radioApplied) {
|
||||||
_logRadioSettingsState('Radio did not apply requested settings');
|
_logRadioSettingsState('Radio did not apply requested settings');
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
showDismissibleSnackBar(
|
showDismissibleSnackBar(
|
||||||
@@ -477,6 +490,17 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!pathHashApplied) {
|
||||||
|
// Radio params and TX power were already applied; only the path
|
||||||
|
// hash size is outstanding, so say that rather than a generic error.
|
||||||
|
_logRadioSettingsState('Radio did not apply requested path hash size');
|
||||||
|
if (!mounted) return;
|
||||||
|
showDismissibleSnackBar(
|
||||||
|
context,
|
||||||
|
content: Text(l10n.settings_pathHashModeNotApplied),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
final rememberedSnapshot = _clientRepeat
|
final rememberedSnapshot = _clientRepeat
|
||||||
? _lastNonRepeatSnapshot
|
? _lastNonRepeatSnapshot
|
||||||
: _currentSnapshot();
|
: _currentSnapshot();
|
||||||
@@ -553,6 +577,7 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
'sf=${_spreadingFactor.label} '
|
'sf=${_spreadingFactor.label} '
|
||||||
'cr=${_codingRate.label} '
|
'cr=${_codingRate.label} '
|
||||||
'tx=${_txPowerController.text}dBm '
|
'tx=${_txPowerController.text}dBm '
|
||||||
|
'pathHash=${_pathHashByteWidth}B '
|
||||||
'repeat=$_clientRepeat '
|
'repeat=$_clientRepeat '
|
||||||
'preset=${_presetLabel(_selectedPresetIndex)} '
|
'preset=${_presetLabel(_selectedPresetIndex)} '
|
||||||
'lastNonRepeat=${_formatSnapshot(_lastNonRepeatSnapshot)}',
|
'lastNonRepeat=${_formatSnapshot(_lastNonRepeatSnapshot)}',
|
||||||
@@ -688,29 +713,36 @@ class _RadioSettingsDialogState extends State<RadioSettingsDialog> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
if (_supportsPathHashMode) ...[
|
if (_supportsPathHashMode) ...[
|
||||||
|
// Values are path hash modes (0-2, byte width - 1), matching
|
||||||
|
// the selectors in settings_screen and repeater_settings_screen.
|
||||||
DropdownButtonFormField<int>(
|
DropdownButtonFormField<int>(
|
||||||
initialValue: _pathHashByteWidth,
|
initialValue: (_pathHashByteWidth - 1).clamp(0, 2).toInt(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: l10n.repeater_pathHashMode,
|
labelText: l10n.repeater_pathHashMode,
|
||||||
|
helperText: l10n.settings_pathHashModeHelper,
|
||||||
|
helperMaxLines: 5,
|
||||||
border: const OutlineInputBorder(),
|
border: const OutlineInputBorder(),
|
||||||
),
|
),
|
||||||
items: [
|
items: [
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
value: 1,
|
value: 0,
|
||||||
child: Text(l10n.repeater_pathHashModeOption0),
|
child: Text(l10n.repeater_pathHashModeOption0),
|
||||||
),
|
),
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
value: 2,
|
value: 1,
|
||||||
child: Text(l10n.repeater_pathHashModeOption1),
|
child: Text(l10n.repeater_pathHashModeOption1),
|
||||||
),
|
),
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
value: 3,
|
value: 2,
|
||||||
child: Text(l10n.repeater_pathHashModeOption2),
|
child: Text(l10n.repeater_pathHashModeOption2),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
setState(() => _pathHashByteWidth = value);
|
setState(() => _pathHashByteWidth = value + 1);
|
||||||
|
_logRadioSettingsState(
|
||||||
|
'Manual settings edit: path hash size',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|||||||
+69
-1
@@ -1 +1,69 @@
|
|||||||
{}
|
{
|
||||||
|
"bg": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"de": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"es": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"fr": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"hu": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"it": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"ja": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"ko": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"nl": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"pl": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"pt": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"ru": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"sk": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"sl": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"sv": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"uk": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
],
|
||||||
|
|
||||||
|
"zh": [
|
||||||
|
"settings_pathHashModeNotApplied"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user