feat(v16): add voltage and current for battery, modules and charging HUD - #7496
Open
helloradiosky wants to merge 3 commits into
Open
feat(v16): add voltage and current for battery, modules and charging HUD#7496helloradiosky wants to merge 3 commits into
helloradiosky wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughAdds filtered CSD203 measurements and module sensor labels, then wires a Horus V16 charge dashboard into the main loop and shutdown path with a V16-specific build flag. ChangesCSD203 Sensor Pipeline and Module Setup UI
V16 Charge UI Feature
Sequence Diagram(s)sequenceDiagram
participant perMain
participant chargeUiTask
participant shutdownWaitIfCharging
participant ChargeDashboardDialog
participant CSD203
participant LVGL
perMain->>chargeUiTask: chargeUiTask()
chargeUiTask->>CSD203: readCSD203()
chargeUiTask->>ChargeDashboardDialog: create/update dialog
ChargeDashboardDialog->>CSD203: getBatteryVoltage(), getSystemCurrent()
ChargeDashboardDialog->>LVGL: refresh widgets
shutdownWaitIfCharging->>CSD203: readCSD203()
shutdownWaitIfCharging->>LVGL: pump MainWindow
shutdownWaitIfCharging->>ChargeDashboardDialog: open shutdown dialog
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 11
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@radio/src/targets/common/arm/stm32/csd203_sensor.cpp`:
- Around line 537-562: Keep each CSD203 sensor’s current and VBUS voltage paired
to the same rail in the sensor update path. In the GetSenSorStep 1 and
GetSenSorStep 2 branches of csd203_sensor.cpp, update the assignments so
CSD203_InSensorCFG feeds both csd203IntModuleCurrent and the matching voltage
variable, and CSD203_ExtSensorCFG feeds both csd203ExtModuleCurrent and the
matching battery/module voltage variable. Make the mapping consistent inside the
csd203EmaI32/csd203Clamp* calls so the UI and charge logic read aligned
current/voltage values from the same sensor.
In `@radio/src/targets/horus/charge_ui.cpp`:
- Line 689: The shutdown hold in charge_ui.cpp is using
chargeChargerLedDebounced() as the blocking condition, which can stop waiting
before the USB cable is actually removed. Update the wait loop in the shutdown
flow to use chargeCableConnected() instead, and keep the
s_shutdownChargeForceQuit escape behavior intact so the UI only proceeds once
the cable is unplugged.
- Around line 493-500: Keep SOC smoothing in fixed-point precision instead of
truncating to whole percent in charge_ui.cpp. The current socDisplay_ update
inside the estimateSoc2s()/socFilterInit_ path drops fractional progress each
refresh, so preserve a scaled accumulator (for example, fixed-point state
alongside socDisplay_) and only convert to display units when needed. Update the
smoothing logic in the SOC filter block so small rawSoc changes still accumulate
smoothly rather than stalling until a larger jump occurs.
In `@radio/src/translations/i18n/cz.h`:
- Around line 718-719: The new sensor label constants in cz.h are still using
English literals, so update the TR_MODULE_SENSOR_VOLTAGE and
TR_MODULE_SENSOR_CURRENT definitions to proper Czech translations. Keep the
change localized in the Czech translation header and preserve the existing macro
names so the module setup UI uses translated labels consistently.
In `@radio/src/translations/i18n/da.h`:
- Around line 724-725: The new sensor labels in the Danish translation file are
still using English text, so update the TR_MODULE_SENSOR_VOLTAGE and
TR_MODULE_SENSOR_CURRENT entries in da.h to Danish terms consistent with the
rest of the locale. Use the existing translation pattern in this file to choose
the correct Danish equivalents for these sensor labels and keep the naming
aligned with the module sensor strings.
In `@radio/src/translations/i18n/he.h`:
- Around line 722-723: The new module sensor labels in he.h are still hardcoded
in English, causing mixed-language UI in the Hebrew locale. Update the
TR_MODULE_SENSOR_VOLTAGE and TR_MODULE_SENSOR_CURRENT definitions in the Hebrew
translation header to proper Hebrew text, matching the existing translation
style used by the other TR_MODULE_SENSOR_* entries.
In `@radio/src/translations/i18n/it.h`:
- Around line 719-720: The new sensor label strings in the Italian translation
header are still in English, so update the TR_MODULE_SENSOR_VOLTAGE and
TR_MODULE_SENSOR_CURRENT entries in the i18n locale definitions to proper
Italian user-facing text. Keep the existing symbol names unchanged and only
replace the string literals in the translation table so the module uses
localized labels consistently.
In `@radio/src/translations/i18n/nl.h`:
- Around line 716-717: The new sensor label definitions in the Dutch translation
header are still using English text, causing mixed-language UI in the nl locale.
Update the TR_MODULE_SENSOR_VOLTAGE and TR_MODULE_SENSOR_CURRENT string values
in the nl.h translation set to proper Dutch equivalents, matching the existing
localization style used by nearby sensor/module labels.
In `@radio/src/translations/i18n/pt.h`:
- Around line 719-720: The new sensor label strings in the Portuguese
translation header are still hardcoded in English, so update the
TR_MODULE_SENSOR_VOLTAGE and TR_MODULE_SENSOR_CURRENT entries in pt.h to proper
Portuguese equivalents to keep the UI localized and consistent with the other
TR_MODULE_SENSOR_* translations.
In `@radio/src/translations/i18n/ru.h`:
- Around line 721-722: The new sensor label entries in the Russian translation
header are still in English, so update the TR_MODULE_SENSOR_VOLTAGE and
TR_MODULE_SENSOR_CURRENT definitions in the ru.h translation set to proper
Russian text. Keep the change localized to the existing translation macros so
the Russian UI stays consistent with the rest of the locale strings.
In `@radio/src/translations/i18n/se.h`:
- Around line 719-720: The Swedish translation catalog still contains English
literals for the new module sensor labels, so update the
TR_MODULE_SENSOR_VOLTAGE and TR_MODULE_SENSOR_CURRENT entries in the se.h locale
file to proper Swedish text. Use the existing translation style in this header
and keep the new strings consistent with the other TR_MODULE_SENSOR_*
definitions so Swedish builds do not show mixed-language UI.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e5e6679e-b9ba-4432-901f-198d69646172
📒 Files selected for processing (29)
radio/src/gui/colorlcd/module/module_setup.cppradio/src/main.cppradio/src/targets/common/arm/stm32/csd203_sensor.cppradio/src/targets/common/arm/stm32/csd203_sensor.hradio/src/targets/horus/CMakeLists.txtradio/src/targets/horus/charge_ui.cppradio/src/targets/horus/charge_ui.hradio/src/tasks.cppradio/src/translations/i18n/cn.hradio/src/translations/i18n/cz.hradio/src/translations/i18n/da.hradio/src/translations/i18n/de.hradio/src/translations/i18n/en.hradio/src/translations/i18n/es.hradio/src/translations/i18n/fi.hradio/src/translations/i18n/fr.hradio/src/translations/i18n/he.hradio/src/translations/i18n/it.hradio/src/translations/i18n/jp.hradio/src/translations/i18n/ko.hradio/src/translations/i18n/nl.hradio/src/translations/i18n/pl.hradio/src/translations/i18n/pt.hradio/src/translations/i18n/ru.hradio/src/translations/i18n/se.hradio/src/translations/i18n/tw.hradio/src/translations/i18n/ua.hradio/src/translations/sim_string_list.hradio/src/translations/string_list.h
#define TR_MODULE_SENSOR_VOLTAGE "Voltage" #define TR_MODULE_SENSOR_CURRENT "Current"
Collapse the six copy-pasted EMA filter-state variable pairs in csd203_sensor.cpp into two small per-channel arrays, and move the commented-out TRACE calls behind a new opt-in DEBUG_CSD203 guard (matching the existing DEBUG_LATENCY pattern in heartbeat_driver.cpp) instead of leaving them dead. Also drop the unused colText() helper in charge_ui.cpp. No behavior change to sensor readings or the UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
pfeerick
force-pushed
the
hrs-v16-current_sensor
branch
from
August 25, 2026 08:23
d575cee to
e0e870d
Compare
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 of changes
Target: HelloRadio V16 (Horus / V16_CHARGE_UI + CSD203_SENSOR)
Note
New charge UI is triggered in two different manners:
Summary by CodeRabbit