OTA: a Check button tells whether the node is up to date, without sending anything
Login, `ver`, `fw status` (and `fw ver` for the release lookup), then the outcome: "up to date: the node already runs <tag>, no update needed" or "update available: <tag>, delta N B", with the node's version on top. It stops before `fw begin` and before the side channel, so no chunks go on air. OtaTransfer.checkOnly, OtaState.available; OtaResult carries the release tag and the `ver` reply. Refs #28 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8939cef7c1
commit
3293254443
3 files changed
+82
-10
No files matched your search
@@ -96,7 +96,7 @@ class _RepeaterOtaScreenState extends State<RepeaterOtaScreen> {
|
||||
if (skipped.isNotEmpty) _addLog('not OTA packages: ${skipped.join(', ')}');
|
||||
}
|
||||
|
||||
Future<void> _start() async {
|
||||
Future<void> _start({bool checkOnly = false}) async {
|
||||
if (!ensureRadioConnected(context)) return;
|
||||
final duty = double.tryParse(_duty.text.replaceAll(',', '.'));
|
||||
final gap = double.tryParse(_gap.text.replaceAll(',', '.'));
|
||||
@@ -130,6 +130,7 @@ class _RepeaterOtaScreenState extends State<RepeaterOtaScreen> {
|
||||
side: side,
|
||||
window: window ?? 15,
|
||||
apply: _apply,
|
||||
checkOnly: checkOnly,
|
||||
);
|
||||
setState(() {
|
||||
_transfer = transfer;
|
||||
@@ -139,12 +140,19 @@ class _RepeaterOtaScreenState extends State<RepeaterOtaScreen> {
|
||||
String outcome;
|
||||
try {
|
||||
final r = await transfer.run();
|
||||
final release = r.tag ?? 'this release';
|
||||
outcome = switch (r.state) {
|
||||
OtaState.applied => 'applied: ${r.versionAfter ?? r.package?.version}',
|
||||
OtaState.staged => 'staged ${r.package?.name} (not applied)',
|
||||
OtaState.current => 'the node already runs this release',
|
||||
OtaState.current =>
|
||||
'up to date: the node already runs $release, no update needed',
|
||||
OtaState.available =>
|
||||
'update available: $release, delta ${r.package?.data.length} B',
|
||||
OtaState.noPackage => 'no delta fits the node\'s image',
|
||||
};
|
||||
if (r.versionBefore != null) {
|
||||
outcome = 'node: ${r.versionBefore}\n$outcome';
|
||||
}
|
||||
outcome += ', airtime ${r.airtime.toStringAsFixed(1)} s';
|
||||
} on OtaCancelled {
|
||||
outcome = 'cancelled (the node keeps what it got until the next begin)';
|
||||
@@ -320,6 +328,14 @@ class _RepeaterOtaScreenState extends State<RepeaterOtaScreen> {
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||
child: Row(
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
onPressed: _running
|
||||
? null
|
||||
: () => _start(checkOnly: true),
|
||||
icon: const Icon(Icons.manage_search),
|
||||
label: const Text('Check'),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
onPressed: _running ? null : _start,
|
||||
|
||||
Reference in new issue
Block a user