feat(telemetry): auto-scale current/power units and humanize uptime (#3261)#3264
Merged
Conversation
…3261) Sub-1 readings rendered as unreadable "0.01 A" / "0.00 W" and uptime showed raw seconds. Add a shared display helper that rescales current (A<->mA) and power (mW<->W<->kW) by magnitude, and renders uptime as a human-readable duration. - src/utils/telemetryFormat.ts: unitScale/scaleMeasurement, isUptimeType, formatDuration (+ unit tests) - UnifiedTelemetryPage: per-row scaling + duration uptime in the fleet table - TelemetryChart: one series-wide scale factor shared across the chart axis, gauge range (round-tripped on edit) and numeric readout Fixes both Meshtastic (mA / envCurrent) and MeshCore LPP telemetry (current=A, power=W, mc_*_uptime_secs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job PR Review: Telemetry Unit Auto-scaling and Uptime Humanization ✅I've thoroughly reviewed this pull request. Here's my comprehensive assessment: Review Progress
Code Quality Assessment✅ Excellent Implementation Quality
✅ Robust Algorithm Design
✅ Comprehensive Test Coverage29 well-designed test cases covering:
Integration Quality✅ Excellent Component Integration
Performance Considerations✅ Efficient Implementation
Security Assessment✅ No Security Concerns
Potential Issues & Recommendations
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #3261.
MeshCore (and Meshtastic) telemetry rendered small current/power readings as unreadable
0.01 A/0.00 W, and uptime as a large raw seconds count. This adds a shared display helper that auto-scales current and power to the most readable SI prefix and renders uptime as a human-readable duration — applied consistently across the telemetry table, charts, gauges, and numeric widgets.Behavior
0.45 A → 450 mA,1500 mA → 1.5 A0.012 W → 12 mW,2500 W → 2.5 kW350000 s → 4d 1h(no unit suffix)Fixes both Meshtastic (
mA/envCurrent) and MeshCore LPP telemetry (current=A,power=W,mc_*_uptime_secs).Changes
src/utils/telemetryFormat.ts(new):unitScale/scaleMeasurement(magnitude-driven prefix selection),isUptimeType,formatDuration.src/utils/telemetryFormat.test.ts(new): 29 unit tests covering prefix boundaries, sign handling, non-scalable units, and durations.src/pages/UnifiedTelemetryPage.tsx: per-row auto-scaling of current/power; uptime rendered as a duration with no unit suffix; reuses the sharedformatDuration.src/components/TelemetryChart.tsx: one series-wide scale factor applied consistently to the plotted line, Y-axis unit, gauge range (round-tripped to base units on edit), and numeric readout.Testing
tsc --noEmit: 0 errorsmainare unrelated and unaffected (verified by reproducing them on a clean base with these changes stashed).🤖 Generated with Claude Code