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:
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),
|
title: Text(l10n.radioStats_screenTitle),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
Selector<MeshCoreConnector, bool>(
|
||||||
icon: const Icon(Icons.thermostat),
|
selector: (_, c) => c.isConnected,
|
||||||
tooltip: l10n.contact_telemetry,
|
builder: (context, connected, _) => IconButton(
|
||||||
onPressed: () => pushSelfTelemetryScreen(context),
|
icon: const Icon(Icons.thermostat),
|
||||||
|
tooltip: l10n.contact_telemetry,
|
||||||
|
onPressed: connected
|
||||||
|
? () => pushSelfTelemetryScreen(context)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -275,10 +275,13 @@ class _TelemetryScreenState extends State<TelemetryScreen> {
|
|||||||
frame = buildSendTelemetryReq(widget.contact.publicKey);
|
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);
|
await connector.sendFrame(frame);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_awaitingSent = false;
|
_awaitingSent = false;
|
||||||
|
_statusTimeout?.cancel();
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
|
|||||||
Reference in new issue
Block a user