[TrimUI Smart Pro S] Fix RGB LED live preview in PyUI, joystick ring driver, and cooling fan max speed / kernel lock - #1681
Conversation
| } | ||
|
|
||
| show_trimui_osd() { | ||
| log_message "button_actions.sh: Toggling TrimUI OSD" |
There was a problem hiding this comment.
@Sundownersport , @ryanmsartor did we intentionally have this disabled? I remember going back and forth on whether or not the trimui OSDD was going to be used
There was a problem hiding this comment.
I believe Sun disabled it due to aesthetic conflicts with spruce and other themes. The TrimUI OSD should probably follow user theme colors at the very least
| unmute_if_raised "$new_vol" | ||
| } | ||
|
|
||
| handle_fan_event() { |
There was a problem hiding this comment.
Why is fan event in a volume_sync watchdog?
| esac | ||
| } | ||
|
|
||
| handle_led_on_event() { |
There was a problem hiding this comment.
Same with some of these other ones. We either need to rename this file or break these out somewhere else
|
@leslieclemence do you mind splitting off the stock OSDD and the rest of the changes? (e.g. the LED fixes) |
… and fan max speed
- Fix cooling fan not reaching maximum speed (level 6) due to driver user_max_state locking and process conflict with adaptive_fan.py/thermal-watchdog; map level 6 to full speed 31 (PWM 255/100%).
- Ensure user_max_state is set to -1 prior to writing cur_state to prevent kernel -EINVAL.
- Add changeCmd hooks in spruce-config.json and applyRgbLed.sh to instantly apply RGB LED brightness, color, effect, and duration when changed in PyUI.
- Format LED color with trailing space ("%s ") and toggle effect trigger to force driver animation update; support joystick ring zone "lr".
- Restore saved fan level on system boot and wake from sleep.
02ccd0b to
6400a7a
Compare
|
@chrisj951 I have split off the stock TrimUI OSDD and volume_sync watchdog changes as requested! This PR now strictly contains the non-controversial core hardware improvements:
|
|
@chrisj951 Following up on your request to separate concerns into clean, modular PRs:
Thank you! |
Resolves #1673
Ref: Sundownersport's request in #1673 (comment)
Overview
As requested by @chrisj951, this pull request has been separated to focus exclusively on the non-controversial hardware fixes for the TrimUI Smart Pro S (TG5050 / Allwinner A133P):
_lrsysfs node), space formatting required by the kernel driver (printf "%s " "$color"), and trigger reset (echo 0 > effect_$zone).-EINVALdue touser_max_stateordering.31(true 100% duty cycle / PWM 255).adaptive_fan.pyandthermal-watchdogby PID) so manual levels or Off are not overwritten.(Note: The stock TrimUI OSDD overlay and watchdog event routing have been split off completely from this PR as requested).
Root Cause Analysis & Technical Details
1. Live RGB LED Preview in PyUI & Driver Formatting
changeCmd): InApp/PyUI/main-ui/utils/cfw_system_config.py, when a setting changes, PyUI checks for achangeCmdattribute to execute. The"RGB LED Settings"options lackedchangeCmd, meaning changes were only saved to JSON.led_animdriver requires:printf "%s " "$color" > /sys/class/led_anim/effect_rgb_hex_$zone).effect_$zonethrough0to rearm the animation engine when an effect or color is changed._lrsysfs node (effect_rgb_hex_lr), which was previously ignored.spruce/scripts/applySetting/applyRgbLed.shhook.changeCmdtodisableLEDs,LEDmaxScale,defaultLEDcolor,defaultLEDeffect,defaultLEDduration, and emulator LED settings inSaves/spruce/spruce-config.json.rgb_led_trimui()to support_lrzones, space formatting, and animation retriggering (echo 0 > effect_$zone).2. Fan Maximum Speed & Kernel Lock
user_max_statelock): In the Linux kernel driver for the TG5050 pwm-fan (/sys/devices/platform/soc@3000000/soc@3000000:pwm_fan/hwmon/hwmon0/user_max_state), any write tocur_stategreater thanuser_max_stateis rejected with-EINVAL. Intrimui_delegate.sh,cur_statewas previously written before unlockinguser_max_state.0..31). Level 6 was previously capped at24(~86% duty cycle). Speed31represents the true 100% duty cycle (PWM 255/255).commaspython3. Simplepgrep -forkillallcalls could fail to terminateadaptive_fan.py, which would continue running in the background and overwritecur_stateback to0every second.apply_fan_level()unlocksuser_max_state(echo -1 > user_max_state) before writingcur_state.31(100% duty cycle / PWM 255).psreliably terminatesadaptive_fan.pyandthermal-watchdogwhen manual fan levels or Off are selected.init_gpio_SmartProS) and resume (device_exit_sleep).Files Modified
spruce/scripts/applySetting/applyRgbLed.sh: [NEW] Hook script to apply LED settings dynamically from PyUI.Saves/spruce/spruce-config.json: AddedchangeCmdto RGB LED settings.spruce/scripts/platform/device_functions/trimui_delegate.sh:apply_fan_level(): Fix kernel-EINVALordering, add level 6 = 31, robustly terminate competing thermal daemons.save_fan_level(): Persist fan level toSYSTEM_JSONand/mnt/UDISK/system.json.rgb_led_trimui(): Support_lrjoystick ring zone, format color with trailing space, reset effect trigger.spruce/scripts/platform/device_functions/SmartProS.sh:toggle_led(): Checkeffect_rgb_hex_lr.init_gpio_SmartProS: Restore saved fan level on boot.device_init: Fixed bluetooth comparison check (-eq 1), run thermal manager iffan_lvl == -1.device_exit_sleep: Restore saved fan level after resume.spruce/smartpros/bin/update-thermal-watchdog-to-setting: Resetuser_max_stateto-1before daemon start, improve process termination.Verification & Testing
sh -n).python3 -m json.tool.