Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3293254443 | ||
|
|
8939cef7c1 |
No files matched your search
@@ -53,7 +53,10 @@ in this README describes upstream and still applies.
|
||||
*Firmware update (OTA)*, for nodes on an `-ota` image of
|
||||
[meshcore-tth](https://git.rfa.cz/tth-pub/meshcore-tth): the delta for the
|
||||
node's image comes from the latest release by itself; optionally on a side
|
||||
channel, off the shared mesh. See
|
||||
channel, off the shared mesh. **Experimental, not for regular users:**
|
||||
meshcore-tth and its `-ota` images are a rolling release on MeshCore `dev`
|
||||
(about twice a day, no stable channel, no rollback), for nodes you can
|
||||
reach. See
|
||||
[documentation/ota-updates.md](documentation/ota-updates.md).
|
||||
- **Fix:** `shared_preferences_android` pinned to 2.4.28 — 2.5.0 crashes on
|
||||
start under R8 (black screen).
|
||||
|
||||
@@ -7,6 +7,14 @@ against the image the node runs, the node checks it and rewrites itself.
|
||||
Classic MeshCore firmware has no such command; the tile is there, but the
|
||||
update stops with "not an -ota build".
|
||||
|
||||
> **Experimental, not meant for regular users.** meshcore-tth is a personal
|
||||
> development fork, and its `-ota` images track MeshCore `dev`
|
||||
> and a new release comes roughly twice a day; there is no stable channel, no
|
||||
> second bank and no automatic rollback. A bad image that still boots runs
|
||||
> until you push the next one; one that does not boot needs USB/BLE DFU in
|
||||
> hand. Update only nodes you can reach, and try each release on one of them
|
||||
> first. Details: [docs/ota.md](https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/docs/ota.md).
|
||||
|
||||
## How to
|
||||
|
||||
1. Log in to the repeater as **admin** (Contacts → long-press → Manage).
|
||||
@@ -15,7 +23,10 @@ update stops with "not an -ota build".
|
||||
(`fw ver`, `fw status`) and takes the matching delta from the **latest
|
||||
release** on git.rfa.cz, checked against the release's `SHA256SUMS`.
|
||||
*Choose .mcfw files* is for your own builds (signed with your own key).
|
||||
4. **Update**. Keep the app open until the log ends with `applied`; about
|
||||
4. **Check** (optional) only finds out: it shows the node's `ver` and either
|
||||
"up to date … no update needed" or "update available" with the delta
|
||||
size. A login and three or four CLI replies on air, no chunks.
|
||||
5. **Update**. Keep the app open until the log ends with `applied`; about
|
||||
2–3 minutes on a direct link, a minute of it waiting for the reboot.
|
||||
|
||||
A second run against an updated node ends with "the node already runs …".
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -40,12 +40,23 @@ class OtaCancelled extends OtaError {
|
||||
OtaCancelled() : super('cancelled');
|
||||
}
|
||||
|
||||
enum OtaState { current, noPackage, staged, applied }
|
||||
/// [available]: only with [OtaTransfer.checkOnly] -- a delta for the node's
|
||||
/// image exists, nothing was sent.
|
||||
enum OtaState { current, available, noPackage, staged, applied }
|
||||
|
||||
class OtaResult {
|
||||
OtaResult(this.state, {this.package, this.versionAfter, this.airtime = 0});
|
||||
OtaResult(
|
||||
this.state, {
|
||||
this.package,
|
||||
this.tag,
|
||||
this.versionBefore,
|
||||
this.versionAfter,
|
||||
this.airtime = 0,
|
||||
});
|
||||
final OtaState state;
|
||||
final OtaPackage? package;
|
||||
final String? tag; // the release, when the package came from one
|
||||
final String? versionBefore; // `ver`, with checkOnly
|
||||
final String? versionAfter;
|
||||
final double airtime;
|
||||
}
|
||||
@@ -68,6 +79,7 @@ class OtaTransfer {
|
||||
this.apply = true,
|
||||
this.applyWait = const Duration(seconds: 60),
|
||||
this.release,
|
||||
this.checkOnly = false,
|
||||
}) : _bucket = OtaBucket(duty);
|
||||
|
||||
final MeshCoreConnector connector;
|
||||
@@ -87,6 +99,10 @@ class OtaTransfer {
|
||||
/// latest public release).
|
||||
final OtaRelease? release;
|
||||
|
||||
/// Only find out whether an update exists: login, `ver`, `fw status`, the
|
||||
/// release lookup -- and stop before `fw begin`.
|
||||
final bool checkOnly;
|
||||
|
||||
final OtaBucket _bucket;
|
||||
late final RepeaterCommandService _cli = RepeaterCommandService(connector);
|
||||
StreamSubscription<Uint8List>? _frames;
|
||||
@@ -540,6 +556,7 @@ class OtaTransfer {
|
||||
});
|
||||
try {
|
||||
await _login();
|
||||
final before = checkOnly ? await _ask('ver') : null;
|
||||
final status = await _ask('fw status');
|
||||
var base = otaParseStatus(status)?.$2;
|
||||
if (base == null && status.startsWith('>')) {
|
||||
@@ -548,14 +565,23 @@ class OtaTransfer {
|
||||
}
|
||||
if (base == null) {
|
||||
log('no base image: not an -ota build');
|
||||
return OtaResult(OtaState.noPackage, airtime: airtime);
|
||||
return OtaResult(
|
||||
OtaState.noPackage,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
var pkgs = packages;
|
||||
String? tag;
|
||||
if (pkgs.isEmpty) {
|
||||
final target = otaParseTarget(await _ask('fw ver'));
|
||||
if (target == null) {
|
||||
log('`fw ver` names no target: not an -ota build');
|
||||
return OtaResult(OtaState.noPackage, airtime: airtime);
|
||||
return OtaResult(
|
||||
OtaState.noPackage,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
log('looking for $target from $base in the latest release');
|
||||
final OtaReleaseMatch m;
|
||||
@@ -566,15 +592,26 @@ class OtaTransfer {
|
||||
} catch (e) {
|
||||
throw OtaError('release: cannot download ($e)');
|
||||
}
|
||||
tag = m.tag;
|
||||
if (m.current) {
|
||||
log('the node already runs ${m.tag}');
|
||||
return OtaResult(OtaState.current, airtime: airtime);
|
||||
return OtaResult(
|
||||
OtaState.current,
|
||||
tag: tag,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
if (m.package == null) {
|
||||
log(
|
||||
'${m.tag} has no delta from $base (too old: a full image over USB/BLE)',
|
||||
);
|
||||
return OtaResult(OtaState.noPackage, airtime: airtime);
|
||||
return OtaResult(
|
||||
OtaState.noPackage,
|
||||
tag: tag,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
log('${m.tag}: ${m.package!.name}, sha256 ok');
|
||||
pkgs = [m.package!];
|
||||
@@ -585,6 +622,8 @@ class OtaTransfer {
|
||||
return OtaResult(
|
||||
OtaState.current,
|
||||
package: pick.package,
|
||||
tag: tag,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
@@ -592,11 +631,25 @@ class OtaTransfer {
|
||||
log(
|
||||
'no delta starts from $base (a full image does not go over the mesh)',
|
||||
);
|
||||
return OtaResult(OtaState.noPackage, airtime: airtime);
|
||||
return OtaResult(
|
||||
OtaState.noPackage,
|
||||
tag: tag,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
final pkg = pick.package!;
|
||||
final data = pkg.data;
|
||||
log('package ${pkg.name} (delta, ${data.length} B)');
|
||||
if (checkOnly) {
|
||||
return OtaResult(
|
||||
OtaState.available,
|
||||
package: pkg,
|
||||
tag: tag,
|
||||
versionBefore: before,
|
||||
airtime: airtime,
|
||||
);
|
||||
}
|
||||
if (side != null) await _enterSide();
|
||||
|
||||
final sid = 1 + math.Random().nextInt(0xFFFF);
|
||||
|
||||
Reference in new issue
Block a user