Fix self telemetry timeout handling and disconnected stats button

- Cancel the self-request timeout when sendFrame throws, so a failed send
  no longer shows a second timeout snackbar or reschedules auto-refresh twice.
- Do not wait for respCodeSent on self requests: none is sent for a local
  request, so any that arrives belongs to another send and replaced the
  5s self timeout.
- Disable the Radio Stats telemetry button while disconnected, matching
  the Settings tile.
This commit is contained in:
zjs81 committed 2026-09-27 12:10:10 -07:00
1 parent 052a45e3cd
commit d7d197ca84
2 files changed
+13 -5

No files matched your search

@@ -79,10 +79,15 @@ class _CompanionRadioStatsScreenState extends State<CompanionRadioStatsScreen> {
title: Text(l10n.radioStats_screenTitle),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Icons.thermostat),
tooltip: l10n.contact_telemetry,
onPressed: () => pushSelfTelemetryScreen(context),
Selector<MeshCoreConnector, bool>(
selector: (_, c) => c.isConnected,
builder: (context, connected, _) => IconButton(
icon: const Icon(Icons.thermostat),
tooltip: l10n.contact_telemetry,
onPressed: connected
? () => pushSelfTelemetryScreen(context)
: null,
),
),
],
),
+4 -1
View File
@@ -275,10 +275,13 @@ class _TelemetryScreenState extends State<TelemetryScreen> {
frame = buildSendTelemetryReq(widget.contact.publicKey);
}
}
_awaitingSent = true;
// A local self request gets no respCodeSent, so any that arrives belongs
// to another send and must not replace the 5s self timeout.
_awaitingSent = !widget.isSelf;
await connector.sendFrame(frame);
} catch (e) {
_awaitingSent = false;
_statusTimeout?.cancel();
if (mounted) {
setState(() {
_isLoading = false;