core: frontend: system-information: Fix negative bandwidth display#3779
Open
patrickelectric wants to merge 1 commit intobluerobotics:masterfrom
Open
core: frontend: system-information: Fix negative bandwidth display#3779patrickelectric wants to merge 1 commit intobluerobotics:masterfrom
patrickelectric wants to merge 1 commit intobluerobotics:masterfrom
Conversation
Clamp network speed calculations to zero to prevent negative bandwidth values when interface counters reset or wrap around. Closes bluerobotics#3587 Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsures network bandwidth values are never negative both when computing speeds in the Vuex store and when formatting them for display, clamping raw and formatted values to zero or higher. Flow diagram for non-negative bandwidth calculation and formattingflowchart TD
A[Input network byte counters and previous counters] --> B[Compute dt_seconds]
B --> C{Previous network sample exists}
C -- No --> D[Set last_update and skip speed computation]
C -- Yes --> E[Compute delta_received_B and delta_transmitted_B]
E --> F[Compute raw_download_speed_bytes_per_second]
E --> G[Compute raw_upload_speed_bytes_per_second]
F --> H[Clamp download_speed to non_negative using Math_max_0]
G --> I[Clamp upload_speed to non_negative using Math_max_0]
H --> J[Store non_negative_download_speed in Vuex_state]
I --> K[Store non_negative_upload_speed in Vuex_state]
J --> L[Pass download_speed_bytes_per_second to formatBandwidth]
K --> M[Pass upload_speed_bytes_per_second to formatBandwidth]
subgraph formatBandwidth_function
L & M --> N[Clamp bytes_per_second_to_non_negative using Math_max_0]
N --> O[Compute mbps = 8_times_bytes_per_second_div_1024_div_1024]
O --> P{mbps < 10}
P -- Yes --> Q[decimal_places = 2]
P -- No --> R{mbps < 100}
R -- Yes --> S[decimal_places = 1]
R -- No --> T[decimal_places = 0]
Q --> U[Format string using mbps_toFixed_decimal_places]
S --> U
T --> U
end
U --> V[Display non_negative_bandwidth_string_in_UI]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
joaoantoniocardoso
approved these changes
Feb 10, 2026
Member
joaoantoniocardoso
left a comment
There was a problem hiding this comment.
haha well, I guess that "solves" it. Did you take a look at why it happens? Was it only a frontend thing? I ask that because it might be the backend reporting wrong values.
Member
Author
|
I'll check it further |
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.
Closes #3587
Summary by Sourcery
Prevent negative bandwidth values from being calculated or displayed in the system information frontend.
Bug Fixes: