Apply dart format

chore/offband-rebrand
zjs81 2 months ago
parent dbe0a5411b
commit 4a72fbd1ad

@ -416,6 +416,7 @@ class MeshCoreConnector extends ChangeNotifier {
final prefix = pubKeyToHex(publicKey.sublist(0, 6)); final prefix = pubKeyToHex(publicKey.sublist(0, 6));
return _repeaterLoginClocks[prefix]; return _repeaterLoginClocks[prefix];
} }
void rememberNonRepeatRadioState(MeshCoreRadioStateSnapshot snapshot) { void rememberNonRepeatRadioState(MeshCoreRadioStateSnapshot snapshot) {
_rememberedNonRepeatRadioState = snapshot; _rememberedNonRepeatRadioState = snapshot;
} }
@ -5662,11 +5663,12 @@ class MeshCoreConnector extends ChangeNotifier {
void _handleLoginSuccess(Uint8List frame) { void _handleLoginSuccess(Uint8List frame) {
if (frame.length < 12) return; if (frame.length < 12) return;
final prefix = pubKeyToHex(frame.sublist(2, 8)); final prefix = pubKeyToHex(frame.sublist(2, 8));
final ts = final ts = ByteData.sublistView(frame, 8, 12).getUint32(0, Endian.little);
ByteData.sublistView(frame, 8, 12).getUint32(0, Endian.little);
if (ts == 0) return; if (ts == 0) return;
_repeaterLoginClocks[prefix] = _repeaterLoginClocks[prefix] = DateTime.fromMillisecondsSinceEpoch(
DateTime.fromMillisecondsSinceEpoch(ts * 1000, isUtc: true); ts * 1000,
isUtc: true,
);
notifyListeners(); notifyListeners();
} }

@ -585,20 +585,62 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
command: 'clear stats', command: 'clear stats',
description: l10n.repeater_cliHelpClearStats, description: l10n.repeater_cliHelpClearStats,
), ),
_CommandHelpEntry(command: 'poweroff', description: l10n.repeater_cliHelpPowerOff), _CommandHelpEntry(
_CommandHelpEntry(command: 'shutdown', description: l10n.repeater_cliHelpPowerOff), command: 'poweroff',
_CommandHelpEntry(command: 'clkreboot', description: l10n.repeater_cliHelpClkReboot), description: l10n.repeater_cliHelpPowerOff,
_CommandHelpEntry(command: 'advert.zerohop', description: l10n.repeater_cliHelpAdvertZeroHop), ),
_CommandHelpEntry(command: 'start ota', description: l10n.repeater_cliHelpStartOta), _CommandHelpEntry(
_CommandHelpEntry(command: 'time {epoch-seconds}', description: l10n.repeater_cliHelpTime), command: 'shutdown',
_CommandHelpEntry(command: 'board', description: l10n.repeater_cliHelpBoard), description: l10n.repeater_cliHelpPowerOff,
_CommandHelpEntry(command: 'discover.neighbors', description: l10n.repeater_cliHelpDiscoverNeighbors), ),
_CommandHelpEntry(command: 'powersaving', description: l10n.repeater_cliHelpPowersaving), _CommandHelpEntry(
_CommandHelpEntry(command: 'powersaving {on|off}', description: l10n.repeater_cliHelpPowersavingOnOff), command: 'clkreboot',
_CommandHelpEntry(command: 'erase', description: l10n.repeater_cliHelpErase), description: l10n.repeater_cliHelpClkReboot,
_CommandHelpEntry(command: 'stats-packets', description: l10n.repeater_cliHelpStatsPackets), ),
_CommandHelpEntry(command: 'stats-radio', description: l10n.repeater_cliHelpStatsRadio), _CommandHelpEntry(
_CommandHelpEntry(command: 'stats-core', description: l10n.repeater_cliHelpStatsCore), command: 'advert.zerohop',
description: l10n.repeater_cliHelpAdvertZeroHop,
),
_CommandHelpEntry(
command: 'start ota',
description: l10n.repeater_cliHelpStartOta,
),
_CommandHelpEntry(
command: 'time {epoch-seconds}',
description: l10n.repeater_cliHelpTime,
),
_CommandHelpEntry(
command: 'board',
description: l10n.repeater_cliHelpBoard,
),
_CommandHelpEntry(
command: 'discover.neighbors',
description: l10n.repeater_cliHelpDiscoverNeighbors,
),
_CommandHelpEntry(
command: 'powersaving',
description: l10n.repeater_cliHelpPowersaving,
),
_CommandHelpEntry(
command: 'powersaving {on|off}',
description: l10n.repeater_cliHelpPowersavingOnOff,
),
_CommandHelpEntry(
command: 'erase',
description: l10n.repeater_cliHelpErase,
),
_CommandHelpEntry(
command: 'stats-packets',
description: l10n.repeater_cliHelpStatsPackets,
),
_CommandHelpEntry(
command: 'stats-radio',
description: l10n.repeater_cliHelpStatsRadio,
),
_CommandHelpEntry(
command: 'stats-core',
description: l10n.repeater_cliHelpStatsCore,
),
]; ];
final settingsCommands = [ final settingsCommands = [
@ -706,14 +748,38 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
command: 'setperm {pubkey-hex} {permissions}', command: 'setperm {pubkey-hex} {permissions}',
description: l10n.repeater_cliHelpSetPerm, description: l10n.repeater_cliHelpSetPerm,
), ),
_CommandHelpEntry(command: 'set dutycycle {1-100}', description: l10n.repeater_cliHelpSetDutyCycle), _CommandHelpEntry(
_CommandHelpEntry(command: 'set prv.key {hex}', description: l10n.repeater_cliHelpSetPrvKey), command: 'set dutycycle {1-100}',
_CommandHelpEntry(command: 'set radio.rxgain {on|off}', description: l10n.repeater_cliHelpSetRadioRxGain), description: l10n.repeater_cliHelpSetDutyCycle,
_CommandHelpEntry(command: 'set owner.info {text}', description: l10n.repeater_cliHelpSetOwnerInfo), ),
_CommandHelpEntry(command: 'set path.hash.mode {0|1|2}', description: l10n.repeater_cliHelpSetPathHashMode), _CommandHelpEntry(
_CommandHelpEntry(command: 'set loop.detect {off|minimal|moderate|strict}', description: l10n.repeater_cliHelpSetLoopDetect), command: 'set prv.key {hex}',
_CommandHelpEntry(command: 'set freq {mhz}', description: l10n.repeater_cliHelpSetFreq), description: l10n.repeater_cliHelpSetPrvKey,
_CommandHelpEntry(command: 'set bridge.channel {1-14}', description: l10n.repeater_cliHelpSetBridgeChannel), ),
_CommandHelpEntry(
command: 'set radio.rxgain {on|off}',
description: l10n.repeater_cliHelpSetRadioRxGain,
),
_CommandHelpEntry(
command: 'set owner.info {text}',
description: l10n.repeater_cliHelpSetOwnerInfo,
),
_CommandHelpEntry(
command: 'set path.hash.mode {0|1|2}',
description: l10n.repeater_cliHelpSetPathHashMode,
),
_CommandHelpEntry(
command: 'set loop.detect {off|minimal|moderate|strict}',
description: l10n.repeater_cliHelpSetLoopDetect,
),
_CommandHelpEntry(
command: 'set freq {mhz}',
description: l10n.repeater_cliHelpSetFreq,
),
_CommandHelpEntry(
command: 'set bridge.channel {1-14}',
description: l10n.repeater_cliHelpSetBridgeChannel,
),
]; ];
final bridgeCommands = [ final bridgeCommands = [
@ -790,62 +856,203 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
command: 'region save', command: 'region save',
description: l10n.repeater_cliHelpRegionSave, description: l10n.repeater_cliHelpRegionSave,
), ),
_CommandHelpEntry(command: 'region default', description: l10n.repeater_cliHelpRegionDefault), _CommandHelpEntry(
_CommandHelpEntry(command: 'region default {* | name-prefix | <null>}', description: l10n.repeater_cliHelpRegionDefaultSet), command: 'region default',
_CommandHelpEntry(command: 'region list allowed', description: l10n.repeater_cliHelpRegionListAllowed), description: l10n.repeater_cliHelpRegionDefault,
_CommandHelpEntry(command: 'region list denied', description: l10n.repeater_cliHelpRegionListDenied), ),
_CommandHelpEntry(
command: 'region default {* | name-prefix | <null>}',
description: l10n.repeater_cliHelpRegionDefaultSet,
),
_CommandHelpEntry(
command: 'region list allowed',
description: l10n.repeater_cliHelpRegionListAllowed,
),
_CommandHelpEntry(
command: 'region list denied',
description: l10n.repeater_cliHelpRegionListDenied,
),
]; ];
final getCommands = [ final getCommands = [
_CommandHelpEntry(command: 'get name', description: l10n.repeater_cliHelpGetName), _CommandHelpEntry(
_CommandHelpEntry(command: 'get role', description: l10n.repeater_cliHelpGetRole), command: 'get name',
_CommandHelpEntry(command: 'get public.key', description: l10n.repeater_cliHelpGetPublicKey), description: l10n.repeater_cliHelpGetName,
_CommandHelpEntry(command: 'get prv.key', description: l10n.repeater_cliHelpGetPrvKey), ),
_CommandHelpEntry(command: 'get repeat', description: l10n.repeater_cliHelpGetRepeat), _CommandHelpEntry(
_CommandHelpEntry(command: 'get tx', description: l10n.repeater_cliHelpGetTx), command: 'get role',
_CommandHelpEntry(command: 'get freq', description: l10n.repeater_cliHelpGetFreq), description: l10n.repeater_cliHelpGetRole,
_CommandHelpEntry(command: 'get radio', description: l10n.repeater_cliHelpGetRadio), ),
_CommandHelpEntry(command: 'get radio.rxgain', description: l10n.repeater_cliHelpGetRadioRxGain), _CommandHelpEntry(
_CommandHelpEntry(command: 'get af', description: l10n.repeater_cliHelpGetAf), command: 'get public.key',
_CommandHelpEntry(command: 'get dutycycle', description: l10n.repeater_cliHelpGetDutyCycle), description: l10n.repeater_cliHelpGetPublicKey,
_CommandHelpEntry(command: 'get int.thresh', description: l10n.repeater_cliHelpGetIntThresh), ),
_CommandHelpEntry(command: 'get agc.reset.interval', description: l10n.repeater_cliHelpGetAgcResetInterval), _CommandHelpEntry(
_CommandHelpEntry(command: 'get multi.acks', description: l10n.repeater_cliHelpGetMultiAcks), command: 'get prv.key',
_CommandHelpEntry(command: 'get allow.read.only', description: l10n.repeater_cliHelpGetAllowReadOnly), description: l10n.repeater_cliHelpGetPrvKey,
_CommandHelpEntry(command: 'get advert.interval', description: l10n.repeater_cliHelpGetAdvertInterval), ),
_CommandHelpEntry(command: 'get flood.advert.interval', description: l10n.repeater_cliHelpGetFloodAdvertInterval), _CommandHelpEntry(
_CommandHelpEntry(command: 'get guest.password', description: l10n.repeater_cliHelpGetGuestPassword), command: 'get repeat',
_CommandHelpEntry(command: 'get lat', description: l10n.repeater_cliHelpGetLat), description: l10n.repeater_cliHelpGetRepeat,
_CommandHelpEntry(command: 'get lon', description: l10n.repeater_cliHelpGetLon), ),
_CommandHelpEntry(command: 'get rxdelay', description: l10n.repeater_cliHelpGetRxDelay), _CommandHelpEntry(
_CommandHelpEntry(command: 'get txdelay', description: l10n.repeater_cliHelpGetTxDelay), command: 'get tx',
_CommandHelpEntry(command: 'get direct.txdelay', description: l10n.repeater_cliHelpGetDirectTxDelay), description: l10n.repeater_cliHelpGetTx,
_CommandHelpEntry(command: 'get flood.max', description: l10n.repeater_cliHelpGetFloodMax), ),
_CommandHelpEntry(command: 'get owner.info', description: l10n.repeater_cliHelpGetOwnerInfo), _CommandHelpEntry(
_CommandHelpEntry(command: 'get path.hash.mode', description: l10n.repeater_cliHelpGetPathHashMode), command: 'get freq',
_CommandHelpEntry(command: 'get loop.detect', description: l10n.repeater_cliHelpGetLoopDetect), description: l10n.repeater_cliHelpGetFreq,
_CommandHelpEntry(command: 'get acl', description: l10n.repeater_cliHelpGetAcl), ),
_CommandHelpEntry(command: 'get bridge.enabled', description: l10n.repeater_cliHelpGetBridgeEnabled), _CommandHelpEntry(
_CommandHelpEntry(command: 'get bridge.delay', description: l10n.repeater_cliHelpGetBridgeDelay), command: 'get radio',
_CommandHelpEntry(command: 'get bridge.source', description: l10n.repeater_cliHelpGetBridgeSource), description: l10n.repeater_cliHelpGetRadio,
_CommandHelpEntry(command: 'get bridge.baud', description: l10n.repeater_cliHelpGetBridgeBaud), ),
_CommandHelpEntry(command: 'get bridge.channel', description: l10n.repeater_cliHelpGetBridgeChannel), _CommandHelpEntry(
_CommandHelpEntry(command: 'get bridge.secret', description: l10n.repeater_cliHelpGetBridgeSecret), command: 'get radio.rxgain',
_CommandHelpEntry(command: 'get bootloader.ver', description: l10n.repeater_cliHelpGetBootloaderVer), description: l10n.repeater_cliHelpGetRadioRxGain,
_CommandHelpEntry(command: 'get adc.multiplier', description: l10n.repeater_cliHelpGetAdcMultiplier), ),
_CommandHelpEntry(
command: 'get af',
description: l10n.repeater_cliHelpGetAf,
),
_CommandHelpEntry(
command: 'get dutycycle',
description: l10n.repeater_cliHelpGetDutyCycle,
),
_CommandHelpEntry(
command: 'get int.thresh',
description: l10n.repeater_cliHelpGetIntThresh,
),
_CommandHelpEntry(
command: 'get agc.reset.interval',
description: l10n.repeater_cliHelpGetAgcResetInterval,
),
_CommandHelpEntry(
command: 'get multi.acks',
description: l10n.repeater_cliHelpGetMultiAcks,
),
_CommandHelpEntry(
command: 'get allow.read.only',
description: l10n.repeater_cliHelpGetAllowReadOnly,
),
_CommandHelpEntry(
command: 'get advert.interval',
description: l10n.repeater_cliHelpGetAdvertInterval,
),
_CommandHelpEntry(
command: 'get flood.advert.interval',
description: l10n.repeater_cliHelpGetFloodAdvertInterval,
),
_CommandHelpEntry(
command: 'get guest.password',
description: l10n.repeater_cliHelpGetGuestPassword,
),
_CommandHelpEntry(
command: 'get lat',
description: l10n.repeater_cliHelpGetLat,
),
_CommandHelpEntry(
command: 'get lon',
description: l10n.repeater_cliHelpGetLon,
),
_CommandHelpEntry(
command: 'get rxdelay',
description: l10n.repeater_cliHelpGetRxDelay,
),
_CommandHelpEntry(
command: 'get txdelay',
description: l10n.repeater_cliHelpGetTxDelay,
),
_CommandHelpEntry(
command: 'get direct.txdelay',
description: l10n.repeater_cliHelpGetDirectTxDelay,
),
_CommandHelpEntry(
command: 'get flood.max',
description: l10n.repeater_cliHelpGetFloodMax,
),
_CommandHelpEntry(
command: 'get owner.info',
description: l10n.repeater_cliHelpGetOwnerInfo,
),
_CommandHelpEntry(
command: 'get path.hash.mode',
description: l10n.repeater_cliHelpGetPathHashMode,
),
_CommandHelpEntry(
command: 'get loop.detect',
description: l10n.repeater_cliHelpGetLoopDetect,
),
_CommandHelpEntry(
command: 'get acl',
description: l10n.repeater_cliHelpGetAcl,
),
_CommandHelpEntry(
command: 'get bridge.enabled',
description: l10n.repeater_cliHelpGetBridgeEnabled,
),
_CommandHelpEntry(
command: 'get bridge.delay',
description: l10n.repeater_cliHelpGetBridgeDelay,
),
_CommandHelpEntry(
command: 'get bridge.source',
description: l10n.repeater_cliHelpGetBridgeSource,
),
_CommandHelpEntry(
command: 'get bridge.baud',
description: l10n.repeater_cliHelpGetBridgeBaud,
),
_CommandHelpEntry(
command: 'get bridge.channel',
description: l10n.repeater_cliHelpGetBridgeChannel,
),
_CommandHelpEntry(
command: 'get bridge.secret',
description: l10n.repeater_cliHelpGetBridgeSecret,
),
_CommandHelpEntry(
command: 'get bootloader.ver',
description: l10n.repeater_cliHelpGetBootloaderVer,
),
_CommandHelpEntry(
command: 'get adc.multiplier',
description: l10n.repeater_cliHelpGetAdcMultiplier,
),
]; ];
final powerMgmtCommands = [ final powerMgmtCommands = [
_CommandHelpEntry(command: 'get pwrmgt.support', description: l10n.repeater_cliHelpGetPwrMgtSupport), _CommandHelpEntry(
_CommandHelpEntry(command: 'get pwrmgt.source', description: l10n.repeater_cliHelpGetPwrMgtSource), command: 'get pwrmgt.support',
_CommandHelpEntry(command: 'get pwrmgt.bootreason', description: l10n.repeater_cliHelpGetPwrMgtBootReason), description: l10n.repeater_cliHelpGetPwrMgtSupport,
_CommandHelpEntry(command: 'get pwrmgt.bootmv', description: l10n.repeater_cliHelpGetPwrMgtBootMv), ),
_CommandHelpEntry(
command: 'get pwrmgt.source',
description: l10n.repeater_cliHelpGetPwrMgtSource,
),
_CommandHelpEntry(
command: 'get pwrmgt.bootreason',
description: l10n.repeater_cliHelpGetPwrMgtBootReason,
),
_CommandHelpEntry(
command: 'get pwrmgt.bootmv',
description: l10n.repeater_cliHelpGetPwrMgtBootMv,
),
]; ];
final sensorCommands = [ final sensorCommands = [
_CommandHelpEntry(command: 'sensor get {key}', description: l10n.repeater_cliHelpSensorGet), _CommandHelpEntry(
_CommandHelpEntry(command: 'sensor set {key} {value}', description: l10n.repeater_cliHelpSensorSet), command: 'sensor get {key}',
_CommandHelpEntry(command: 'sensor list [start]', description: l10n.repeater_cliHelpSensorList), description: l10n.repeater_cliHelpSensorGet,
),
_CommandHelpEntry(
command: 'sensor set {key} {value}',
description: l10n.repeater_cliHelpSensorSet,
),
_CommandHelpEntry(
command: 'sensor list [start]',
description: l10n.repeater_cliHelpSensorList,
),
]; ];
final gpsCommands = [ final gpsCommands = [
@ -910,11 +1117,7 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
powerMgmtCommands, powerMgmtCommands,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildHelpSection( _buildHelpSection(context, l10n.repeater_sensors, sensorCommands),
context,
l10n.repeater_sensors,
sensorCommands,
),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildHelpSection(context, l10n.repeater_bridge, bridgeCommands), _buildHelpSection(context, l10n.repeater_bridge, bridgeCommands),
const SizedBox(height: 16), const SizedBox(height: 16),

@ -151,7 +151,8 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
// Advanced // Advanced
int _pathHashMode = 0; // 0-2 int _pathHashMode = 0; // 0-2
final TextEditingController _txDelayController = TextEditingController(); final TextEditingController _txDelayController = TextEditingController();
final TextEditingController _directTxDelayController = TextEditingController(); final TextEditingController _directTxDelayController =
TextEditingController();
final TextEditingController _intThreshController = TextEditingController(); final TextEditingController _intThreshController = TextEditingController();
int _agcResetInterval = 0; // seconds, multiple of 4, 0 disabled int _agcResetInterval = 0; // seconds, multiple of 4, 0 disabled
@ -762,10 +763,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
_txPowerController.text.isNotEmpty) { _txPowerController.text.isNotEmpty) {
final dbm = int.tryParse(_txPowerController.text.trim()); final dbm = int.tryParse(_txPowerController.text.trim());
if (dbm != null) { if (dbm != null) {
pending.add(( pending.add((field: _SettingField.txPower, command: 'set tx $dbm'));
field: _SettingField.txPower,
command: 'set tx $dbm',
));
} }
} }
@ -913,9 +911,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
rebootNeeded = true; rebootNeeded = true;
} }
} catch (e) { } catch (e) {
failures.add( failures.add('${_shortCommandLabel(entry.command)}: ${e.toString()}');
'${_shortCommandLabel(entry.command)}: ${e.toString()}',
);
failed = true; failed = true;
} }
if (failed) { if (failed) {

Loading…
Cancel
Save

Powered by TurnKey Linux.