feat(radio): allow disabling USB charge while the radio is running (on compatible hardware)#7564
feat(radio): allow disabling USB charge while the radio is running (on compatible hardware)#75643djc wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughAdds a persisted USB charging-disable setting for TX15 and TX16SMK3 radios, with firmware GPIO control, radio and Companion UI options, YAML serialization, build flags, simulator support, and translation strings. ChangesUSB charge control
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RadioSetup
participant g_eeGeneral
participant handleUsbConnection
participant usbChargerEnableCharge
participant UCHARGER_EN_GPIO
RadioSetup->>g_eeGeneral: Store usbChargeDisabled
handleUsbConnection->>g_eeGeneral: Read usbChargeDisabled
handleUsbConnection->>usbChargerEnableCharge: Apply charge setting
usbChargerEnableCharge->>UCHARGER_EN_GPIO: Set or clear control pin
handleUsbConnection->>usbChargerEnableCharge: Enable charging after unplug
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@pfeerick https://github.com/EdgeTX/edgetx/tree/3djc/usb-charge-control is 2.12 ready for backport |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (2)
companion/src/generaledit/generalsetup.ui (1)
908-921: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider capitalizing "Charge" for consistency.
Other settings in this section use Title Case (e.g., "USB Mode", "Jack Mode", "Hats Mode"). Consider capitalizing "Charge" to maintain visual consistency across the UI panel.
💡 Proposed capitalization fix
<widget class="QLabel" name="usbChargeLabel"> <property name="text"> - <string>USB SD/Joystick/VCP charge</string> + <string>USB SD/Joystick/VCP Charge</string> </property> </widget>🤖 Prompt for 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. In `@companion/src/generaledit/generalsetup.ui` around lines 908 - 921, Update the usbChargeLabel text in the general setup UI from “USB SD/Joystick/VCP charge” to use Title Case, “USB SD/Joystick/VCP Charge,” matching the neighboring setting labels.radio/src/main.cpp (1)
211-230: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptionally apply the charger setting dynamically.
Currently, the
UCHARGER_EN_GPIOstate is updated only when the USB mode first starts. If a user changes the "USB SD/Joystick/VCP charge" setting in the Radio Setup menu while already connected in Joystick or VCP mode, the hardware state won't update until the USB is replugged.You can move the GPIO update logic out of the
!usbStarted()block so it runs continuously while USB is active, making the UI setting responsive in real-time.💡 Proposed refactor to dynamically apply the setting
Remove the GPIO block from its current location inside
if (!_usbDisabled && !usbStarted() && usbPlugged()) { ... }and place it immediately after, like this:- if (g_eeGeneral.usbChargeDisabled) { - gpio_set(UCHARGER_EN_GPIO); - } else { - gpio_clear(UCHARGER_EN_GPIO); - } } } + +#if defined(USB_CHARGE_CONTROL) + // Continuously apply the charger-enable state so changes in Radio Setup + // take effect immediately without requiring a replug. + if (usbStarted() && usbPlugged()) { + if (g_eeGeneral.usbChargeDisabled) { + gpio_set(UCHARGER_EN_GPIO); + } else { + gpio_clear(UCHARGER_EN_GPIO); + } + } +#endif if (usbStarted() && !usbPlugged()) {🤖 Prompt for 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. In `@radio/src/main.cpp` around lines 211 - 230, Move the UCHARGER_EN_GPIO update logic from the USB-start initialization block to the active-USB path after that block, so it executes continuously while USB is connected. Preserve the existing usbChargeDisabled-to-gpio_set/gpio_clear mapping and keep the unplug cleanup in the usbStop path unchanged.
🤖 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/datastructs.h`:
- Around line 82-86: Update the USB_CHARGE_CONTROL branch’s CHKSIZE assertion
for RadioData to expect 1182 bytes, matching the non-USB branch; do not add a
byte for usbChargeDisabled.
In `@radio/src/translations/i18n/cn.h`:
- Line 987: Replace the English TR_USB_CHARGE value with the approved Chinese
translation in radio/src/translations/i18n/cn.h at lines 987-987 and with the
approved Czech translation in radio/src/translations/i18n/cz.h at lines 985-985,
preserving the existing translation macro structure.
In `@radio/src/translations/i18n/da.h`:
- Line 992: Localize the TR_USB_CHARGE label in radio/src/translations/i18n/da.h
lines 992-992 to “USB SD/Joystick/VCP-opladning” and in
radio/src/translations/i18n/de.h lines 986-986 to “USB-SD/Joystick/VCP-Laden”,
replacing the English fallback in both headers.
In `@radio/src/translations/i18n/es.h`:
- Line 981: Localize the TR_USB_CHARGE label in all affected headers: replace
the English text in radio/src/translations/i18n/es.h lines 981-981 with Spanish,
radio/src/translations/i18n/fi.h lines 981-981 with Finnish, and
radio/src/translations/i18n/tw.h lines 984-984 with Traditional Chinese.
In `@radio/src/translations/i18n/fr.h`:
- Line 985: Replace the English TR_USB_CHARGE value with the approved localized
translations in radio/src/translations/i18n/fr.h:985-985,
radio/src/translations/i18n/he.h:990-990, and
radio/src/translations/i18n/it.h:987-987; keep the key unchanged.
In `@radio/src/translations/i18n/jp.h`:
- Line 986: Update TR_USB_CHARGE in radio/src/translations/i18n/jp.h:986-986,
radio/src/translations/i18n/ko.h:1030-1030, and
radio/src/translations/i18n/nl.h:983-983 with appropriate Japanese, Korean, and
Dutch labels respectively, or add an explicit note in each file if retaining the
English text is intentional.
In `@radio/src/translations/i18n/pl.h`:
- Line 980: Update the TR_USB_CHARGE definition in pl.h to use the appropriate
Polish translation instead of the current English label, while preserving the
existing translation key and formatting.
In `@radio/src/translations/i18n/pt.h`:
- Line 988: Translate the TR_USB_CHARGE label in
radio/src/translations/i18n/pt.h:988-988,
radio/src/translations/i18n/ru.h:989-989, and
radio/src/translations/i18n/se.h:988-988, replacing the English text with the
appropriate locale-specific translations while preserving the existing macro
name and format.
In `@radio/src/translations/i18n/ua.h`:
- Line 988: Update the TR_USB_CHARGE translation in the Ukrainian header from
English to an approved Ukrainian label, while preserving the technical mode
names USB, SD, Joystick, and VCP unchanged.
---
Nitpick comments:
In `@companion/src/generaledit/generalsetup.ui`:
- Around line 908-921: Update the usbChargeLabel text in the general setup UI
from “USB SD/Joystick/VCP charge” to use Title Case, “USB SD/Joystick/VCP
Charge,” matching the neighboring setting labels.
In `@radio/src/main.cpp`:
- Around line 211-230: Move the UCHARGER_EN_GPIO update logic from the USB-start
initialization block to the active-USB path after that block, so it executes
continuously while USB is connected. Preserve the existing
usbChargeDisabled-to-gpio_set/gpio_clear mapping and keep the unplug cleanup in
the usbStop path unchanged.
🪄 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: 69fc4b60-ffab-47bd-af95-5511e6812de1
📒 Files selected for processing (35)
companion/src/firmwares/edgetx/yaml_generalsettings.cppcompanion/src/firmwares/generalsettings.hcompanion/src/generaledit/generalsetup.cppcompanion/src/generaledit/generalsetup.hcompanion/src/generaledit/generalsetup.uiradio/src/boards/rm-h750/usb_charger_driver.cppradio/src/datastructs.hradio/src/datastructs_private.hradio/src/gui/colorlcd/radio/radio_setup.cppradio/src/main.cppradio/src/storage/yaml/yaml_datastructs_tx15.cppradio/src/storage/yaml/yaml_datastructs_tx16smk3.cppradio/src/targets/tx15/CMakeLists.txtradio/src/targets/tx16smk3/CMakeLists.txtradio/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
| #if defined(USB_CHARGE_CONTROL) | ||
| CHKSIZE(RadioData, 1183); // +1 byte for usbChargeDisabled | ||
| #else | ||
| CHKSIZE(RadioData, 1182); | ||
| #endif |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Keep the RadioData size at 1182 bytes.
usbChargeDisabled:1 fills the remaining bit after the preceding 7-bit allocation unit; it should not add a byte. The 1183 assertion will fail for USB-charge-control builds unless the target compiler lays out these fields differently.
🐛 Proposed fix
- `#if` defined(USB_CHARGE_CONTROL)
- CHKSIZE(RadioData, 1183); // +1 byte for usbChargeDisabled
- `#else`
- CHKSIZE(RadioData, 1182);
- `#endif`
+ CHKSIZE(RadioData, 1182);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #if defined(USB_CHARGE_CONTROL) | |
| CHKSIZE(RadioData, 1183); // +1 byte for usbChargeDisabled | |
| #else | |
| CHKSIZE(RadioData, 1182); | |
| #endif | |
| CHKSIZE(RadioData, 1182); |
🤖 Prompt for 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.
In `@radio/src/datastructs.h` around lines 82 - 86, Update the USB_CHARGE_CONTROL
branch’s CHKSIZE assertion for RadioData to expect 1182 bytes, matching the
non-USB branch; do not add a byte for usbChargeDisabled.
| #define TR_SENSOR "传感器" | ||
| #define TR_COUNTRY_CODE "国别码" | ||
| #define TR_USBMODE "USB模式" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize TR_USB_CHARGE in every affected language header.
The new setting currently displays English text in both localized UIs:
radio/src/translations/i18n/cn.h#L987-L987: replace the English value with approved Chinese text.radio/src/translations/i18n/cz.h#L985-L985: replace the English value with approved Czech text.
📍 Affects 2 files
radio/src/translations/i18n/cn.h#L987-L987(this comment)radio/src/translations/i18n/cz.h#L985-L985
🤖 Prompt for 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.
In `@radio/src/translations/i18n/cn.h` at line 987, Replace the English
TR_USB_CHARGE value with the approved Chinese translation in
radio/src/translations/i18n/cn.h at lines 987-987 and with the approved Czech
translation in radio/src/translations/i18n/cz.h at lines 985-985, preserving the
existing translation macro structure.
| #define TR_SENSOR "SENSOR" | ||
| #define TR_COUNTRY_CODE "Lande kode" | ||
| #define TR_USBMODE "USB tilstand" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the new setting label in non-English headers. Both files currently show the English fallback to users.
radio/src/translations/i18n/da.h#L992-L992: useUSB SD/Joystick/VCP-opladning.radio/src/translations/i18n/de.h#L986-L986: useUSB-SD/Joystick/VCP-Laden.
📍 Affects 2 files
radio/src/translations/i18n/da.h#L992-L992(this comment)radio/src/translations/i18n/de.h#L986-L986
🤖 Prompt for 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.
In `@radio/src/translations/i18n/da.h` at line 992, Localize the TR_USB_CHARGE
label in radio/src/translations/i18n/da.h lines 992-992 to “USB
SD/Joystick/VCP-opladning” and in radio/src/translations/i18n/de.h lines 986-986
to “USB-SD/Joystick/VCP-Laden”, replacing the English fallback in both headers.
| #define TR_SENSOR "SENSOR" | ||
| #define TR_COUNTRY_CODE "Código país" | ||
| #define TR_USBMODE "Modo USB" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize TR_USB_CHARGE in every affected language header.
The new setting label currently remains English in all three localized headers:
radio/src/translations/i18n/es.h#L981-L981: add Spanish text.radio/src/translations/i18n/fi.h#L981-L981: add Finnish text.radio/src/translations/i18n/tw.h#L984-L984: add Traditional Chinese text.
📍 Affects 3 files
radio/src/translations/i18n/es.h#L981-L981(this comment)radio/src/translations/i18n/fi.h#L981-L981radio/src/translations/i18n/tw.h#L984-L984
🤖 Prompt for 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.
In `@radio/src/translations/i18n/es.h` at line 981, Localize the TR_USB_CHARGE
label in all affected headers: replace the English text in
radio/src/translations/i18n/es.h lines 981-981 with Spanish,
radio/src/translations/i18n/fi.h lines 981-981 with Finnish, and
radio/src/translations/i18n/tw.h lines 984-984 with Traditional Chinese.
| #define TR_SENSOR "CAPTEUR" | ||
| #define TR_COUNTRY_CODE TR("Zone géo.", "Zone géographique") | ||
| #define TR_USBMODE "Mode USB" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Provide localized values for TR_USB_CHARGE.
The new key is currently English in all three locale headers, so the Radio Settings option remains untranslated for French, Hebrew, and Italian users.
radio/src/translations/i18n/fr.h#L985-L985: replace the English value with the approved French translation.radio/src/translations/i18n/he.h#L990-L990: replace the English value with the approved Hebrew translation.radio/src/translations/i18n/it.h#L987-L987: replace the English value with the approved Italian translation.
📍 Affects 3 files
radio/src/translations/i18n/fr.h#L985-L985(this comment)radio/src/translations/i18n/he.h#L990-L990radio/src/translations/i18n/it.h#L987-L987
🤖 Prompt for 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.
In `@radio/src/translations/i18n/fr.h` at line 985, Replace the English
TR_USB_CHARGE value with the approved localized translations in
radio/src/translations/i18n/fr.h:985-985,
radio/src/translations/i18n/he.h:990-990, and
radio/src/translations/i18n/it.h:987-987; keep the key unchanged.
| #define TR_SENSOR "センサー" | ||
| #define TR_COUNTRY_CODE "カントリーコード" | ||
| #define TR_USBMODE "USBモード" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== TR_USB_CHARGE occurrences ==\n'
rg -n 'TR_USB_CHARGE' radio/src/translations/i18n
printf '\n== Nearby lines in affected files ==\n'
for f in radio/src/translations/i18n/jp.h radio/src/translations/i18n/ko.h radio/src/translations/i18n/nl.h; do
echo "--- $f"
# show a small window around the matching line if present
line=$(rg -n 'TR_USB_CHARGE' "$f" | head -n1 | cut -d: -f1 || true)
if [ -n "${line:-}" ]; then
start=$((line-3)); [ "$start" -lt 1 ] && start=1
end=$((line+3))
sed -n "${start},${end}p" "$f" | cat -n
fi
done
printf '\n== File size hints ==\n'
wc -l radio/src/translations/i18n/jp.h radio/src/translations/i18n/ko.h radio/src/translations/i18n/nl.hRepository: EdgeTX/edgetx
Length of output: 3686
Translate TR_USB_CHARGE in these locale files. jp.h, ko.h, and nl.h still show the English fallback here; add localized labels or leave a note if the English text is intentional.
📍 Affects 3 files
radio/src/translations/i18n/jp.h#L986-L986(this comment)radio/src/translations/i18n/ko.h#L1030-L1030radio/src/translations/i18n/nl.h#L983-L983
🤖 Prompt for 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.
In `@radio/src/translations/i18n/jp.h` at line 986, Update TR_USB_CHARGE in
radio/src/translations/i18n/jp.h:986-986,
radio/src/translations/i18n/ko.h:1030-1030, and
radio/src/translations/i18n/nl.h:983-983 with appropriate Japanese, Korean, and
Dutch labels respectively, or add an explicit note in each file if retaining the
English text is intentional.
| #define TR_SENSOR "SENSOR" | ||
| #define TR_COUNTRY_CODE "Kod regionu" | ||
| #define TR_USBMODE "Tryb USB" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add the Polish translation.
This new label is still English in pl.h, so Polish users will see an untranslated setting. For example:
Proposed fix
-#define TR_USB_CHARGE "USB SD/Joystick/VCP charge"
+#define TR_USB_CHARGE "Ładowanie USB SD/Dżojstika/VCP"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" | |
| `#define` TR_USB_CHARGE "Ładowanie USB SD/Dżojstika/VCP" |
🤖 Prompt for 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.
In `@radio/src/translations/i18n/pl.h` at line 980, Update the TR_USB_CHARGE
definition in pl.h to use the appropriate Polish translation instead of the
current English label, while preserving the existing translation key and
formatting.
| #define TR_SENSOR "SENSOR" | ||
| #define TR_COUNTRY_CODE "Código pais" | ||
| #define TR_USBMODE "Modo USB" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
for f in radio/src/translations/i18n/pt.h radio/src/translations/i18n/ru.h radio/src/translations/i18n/se.h; do
echo "===== $f ====="
grep -n -C 2 'TR_USB_CHARGE' "$f" || true
echo
done
echo "===== repository-wide TR_USB_CHARGE occurrences ====="
rg -n 'TR_USB_CHARGE' radio/src/translations/i18n || true
echo "===== nearby translation names in these files ====="
for f in radio/src/translations/i18n/pt.h radio/src/translations/i18n/ru.h radio/src/translations/i18n/se.h; do
echo "--- $f ---"
grep -n -E 'TR_USB_CHARGE|TR_USB_' "$f" | sed -n '1,30p'
doneRepository: EdgeTX/edgetx
Length of output: 4353
Translate TR_USB_CHARGE in the locale headers. The new label is still English in these translated files, so users will see untranslated UI text.
radio/src/translations/i18n/pt.hradio/src/translations/i18n/ru.hradio/src/translations/i18n/se.h
📍 Affects 3 files
radio/src/translations/i18n/pt.h#L988-L988(this comment)radio/src/translations/i18n/ru.h#L989-L989radio/src/translations/i18n/se.h#L988-L988
🤖 Prompt for 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.
In `@radio/src/translations/i18n/pt.h` at line 988, Translate the TR_USB_CHARGE
label in radio/src/translations/i18n/pt.h:988-988,
radio/src/translations/i18n/ru.h:989-989, and
radio/src/translations/i18n/se.h:988-988, replacing the English text with the
appropriate locale-specific translations while preserving the existing macro
name and format.
| #define TR_SENSOR "СЕНСОР" | ||
| #define TR_COUNTRY_CODE "Код країни" | ||
| #define TR_USBMODE "Режим USB" | ||
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Localize the Ukrainian label.
TR_USB_CHARGE is user-facing but remains in English in the Ukrainian header. Provide an approved Ukrainian translation while preserving the technical mode names.
Suggested fix
-#define TR_USB_CHARGE "USB SD/Joystick/VCP charge"
+#define TR_USB_CHARGE "Заряджання USB SD/Джойстик/VCP"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #define TR_USB_CHARGE "USB SD/Joystick/VCP charge" | |
| `#define` TR_USB_CHARGE "Заряджання USB SD/Джойстик/VCP" |
🤖 Prompt for 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.
In `@radio/src/translations/i18n/ua.h` at line 988, Update the TR_USB_CHARGE
translation in the Ukrainian header from English to an approved Ukrainian label,
while preserving the technical mode names USB, SD, Joystick, and VCP unchanged.
66d175b to
6ac0799
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/translations/i18n/cn.h`:
- Around line 573-576: Update the translations for TR_KEY_LOCK_FMT,
TR_KEYS_LOCKED, TR_KEYS_LOCKED_FMT, TR_KEYS_UNLOCKED, and TR_USB_CHARGE in cn.h
to approved Chinese UI text. Preserve both %s placeholders and their ordering in
the two formatted strings, and remove all remaining English text for these keys.
🪄 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: 201ffab9-4987-4aea-87a1-273196f7eb51
📒 Files selected for processing (35)
companion/src/firmwares/edgetx/yaml_generalsettings.cppcompanion/src/firmwares/generalsettings.hcompanion/src/generaledit/generalsetup.cppcompanion/src/generaledit/generalsetup.hcompanion/src/generaledit/generalsetup.uiradio/src/boards/rm-h750/usb_charger_driver.cppradio/src/datastructs.hradio/src/datastructs_private.hradio/src/gui/colorlcd/radio/radio_setup.cppradio/src/main.cppradio/src/storage/yaml/yaml_datastructs_tx15.cppradio/src/storage/yaml/yaml_datastructs_tx16smk3.cppradio/src/targets/tx15/CMakeLists.txtradio/src/targets/tx16smk3/CMakeLists.txtradio/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
🚧 Files skipped from review as they are similar to previous changes (32)
- companion/src/generaledit/generalsetup.h
- radio/src/translations/i18n/ru.h
- radio/src/translations/i18n/pl.h
- radio/src/translations/i18n/cz.h
- radio/src/translations/sim_string_list.h
- radio/src/translations/i18n/se.h
- radio/src/storage/yaml/yaml_datastructs_tx16smk3.cpp
- radio/src/translations/i18n/fr.h
- radio/src/translations/i18n/ua.h
- radio/src/translations/string_list.h
- radio/src/translations/i18n/de.h
- radio/src/translations/i18n/tw.h
- radio/src/translations/i18n/it.h
- radio/src/translations/i18n/es.h
- radio/src/translations/i18n/pt.h
- radio/src/translations/i18n/jp.h
- radio/src/translations/i18n/nl.h
- radio/src/datastructs_private.h
- radio/src/translations/i18n/da.h
- radio/src/storage/yaml/yaml_datastructs_tx15.cpp
- radio/src/datastructs.h
- radio/src/translations/i18n/en.h
- radio/src/gui/colorlcd/radio/radio_setup.cpp
- companion/src/firmwares/generalsettings.h
- radio/src/translations/i18n/he.h
- radio/src/translations/i18n/ko.h
- radio/src/targets/tx16smk3/CMakeLists.txt
- radio/src/translations/i18n/fi.h
- companion/src/firmwares/edgetx/yaml_generalsettings.cpp
- radio/src/boards/rm-h750/usb_charger_driver.cpp
- radio/src/main.cpp
- companion/src/generaledit/generalsetup.ui
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🤖 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/translations/i18n/cn.h`:
- Around line 573-576: Update the translations for TR_KEY_LOCK_FMT,
TR_KEYS_LOCKED, TR_KEYS_LOCKED_FMT, TR_KEYS_UNLOCKED, and TR_USB_CHARGE in cn.h
to approved Chinese UI text. Preserve both %s placeholders and their ordering in
the two formatted strings, and remove all remaining English text for these keys.
🪄 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: 201ffab9-4987-4aea-87a1-273196f7eb51
📒 Files selected for processing (35)
companion/src/firmwares/edgetx/yaml_generalsettings.cppcompanion/src/firmwares/generalsettings.hcompanion/src/generaledit/generalsetup.cppcompanion/src/generaledit/generalsetup.hcompanion/src/generaledit/generalsetup.uiradio/src/boards/rm-h750/usb_charger_driver.cppradio/src/datastructs.hradio/src/datastructs_private.hradio/src/gui/colorlcd/radio/radio_setup.cppradio/src/main.cppradio/src/storage/yaml/yaml_datastructs_tx15.cppradio/src/storage/yaml/yaml_datastructs_tx16smk3.cppradio/src/targets/tx15/CMakeLists.txtradio/src/targets/tx16smk3/CMakeLists.txtradio/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
🚧 Files skipped from review as they are similar to previous changes (32)
- companion/src/generaledit/generalsetup.h
- radio/src/translations/i18n/ru.h
- radio/src/translations/i18n/pl.h
- radio/src/translations/i18n/cz.h
- radio/src/translations/sim_string_list.h
- radio/src/translations/i18n/se.h
- radio/src/storage/yaml/yaml_datastructs_tx16smk3.cpp
- radio/src/translations/i18n/fr.h
- radio/src/translations/i18n/ua.h
- radio/src/translations/string_list.h
- radio/src/translations/i18n/de.h
- radio/src/translations/i18n/tw.h
- radio/src/translations/i18n/it.h
- radio/src/translations/i18n/es.h
- radio/src/translations/i18n/pt.h
- radio/src/translations/i18n/jp.h
- radio/src/translations/i18n/nl.h
- radio/src/datastructs_private.h
- radio/src/translations/i18n/da.h
- radio/src/storage/yaml/yaml_datastructs_tx15.cpp
- radio/src/datastructs.h
- radio/src/translations/i18n/en.h
- radio/src/gui/colorlcd/radio/radio_setup.cpp
- companion/src/firmwares/generalsettings.h
- radio/src/translations/i18n/he.h
- radio/src/translations/i18n/ko.h
- radio/src/targets/tx16smk3/CMakeLists.txt
- radio/src/translations/i18n/fi.h
- companion/src/firmwares/edgetx/yaml_generalsettings.cpp
- radio/src/boards/rm-h750/usb_charger_driver.cpp
- radio/src/main.cpp
- companion/src/generaledit/generalsetup.ui
🛑 Comments failed to post (1)
radio/src/translations/i18n/cn.h (1)
573-576: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the new Chinese UI strings.
TR_KEY_LOCK_FMT,TR_KEYS_LOCKED,TR_KEYS_LOCKED_FMT,TR_KEYS_UNLOCKED, andTR_USB_CHARGEstill contain English text incn.h. Replace them with approved Chinese translations while preserving the%splaceholders inTR_KEY_LOCK_FMTandTR_KEYS_LOCKED_FMT. TheTR_USB_CHARGEportion repeats the prior review finding.Also applies to: 991-991
🤖 Prompt for 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. In `@radio/src/translations/i18n/cn.h` around lines 573 - 576, Update the translations for TR_KEY_LOCK_FMT, TR_KEYS_LOCKED, TR_KEYS_LOCKED_FMT, TR_KEYS_UNLOCKED, and TR_USB_CHARGE in cn.h to approved Chinese UI text. Preserve both %s placeholders and their ordering in the two formatted strings, and remove all remaining English text for these keys.
Summary of changes
Some users have reported issues when using sims on laptops when radio batteries are not fully charged, especially on newer radio can charge quite fast from USB port.
This adds a setting to prevent the radio from charging when USB mode are used (SD/JOY/VCP)
Default charge is on, like on this picture, to behave like existing radio, turning it off will disable charge.
This is currently available only on TX15 and TX16SMK3
Test conducted by RM have shown with a PD charger
Unplugged 0.0w
Plugged with charging on 11.6w
Plugged with charging off 2.4w
When radio is off, charging occurs normally, whatever the setting is.
Summary by CodeRabbit