Merge pull request #424 from zjs81/chan-util

basic repeater chan util
This commit is contained in:
zjs81
2026-05-08 13:40:28 -07:00
committed by GitHub
24 changed files with 111 additions and 17 deletions
+14
View File
@@ -55,6 +55,7 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
int? _directRx;
int? _dupFlood;
int? _dupDirect;
double? _chanUtil;
PathSelection? _pendingStatusSelection;
@override
@@ -195,6 +196,7 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
_lastSnr = lastSnrRaw / 4.0;
_dupDirect = directDups;
_dupFlood = floodDups;
_chanUtil = ((txAirSecs + rxAirSecs) / uptimeSecs) * 100;
});
final connector = Provider.of<MeshCoreConnector>(context, listen: false);
connector.updateRepeaterBatterySnapshot(
@@ -285,6 +287,7 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
_directRx = null;
_dupFlood = null;
_dupDirect = null;
_chanUtil = null;
});
try {
@@ -572,6 +575,7 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
_buildInfoRow(l10n.repeater_sent, _packetTxText()),
_buildInfoRow(l10n.repeater_received, _packetRxText()),
_buildInfoRow(l10n.repeater_duplicates, _duplicateText()),
_buildInfoRow(l10n.repeater_chanUtil, _chanUtilText()),
],
),
),
@@ -677,6 +681,11 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
return l10n.repeater_packetRxTotal(_packetsRecv!, flood, direct);
}
String _chanUtilText() {
if (_chanUtil == null) return '';
return _formatPercent(_chanUtil);
}
String _duplicateText() {
final l10n = context.l10n;
if (_dupFlood != null || _dupDirect != null) {
@@ -697,6 +706,11 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
return suffix == null ? value.toString() : '$value$suffix';
}
String _formatPercent(double? p) {
if (p == null) return '';
return '${p.toStringAsFixed(2)}%';
}
String _formatSnr(double? snr) {
if (snr == null) return '';
return snr.toStringAsFixed(2);