File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,11 +48,19 @@ def handle_led_pwr(scale):
4848 ec_commands .framework_laptop .set_fp_led_level (app .cros_ec , value )
4949 self .led_pwr .set_subtitle (["High" , "Medium" , "Low" ][value ])
5050
51- current_fp_level = ec_commands .framework_laptop .get_fp_led_level (
52- app .cros_ec
53- ).value
54- self .led_pwr_scale .set_value (abs (current_fp_level - 2 ))
55- self .led_pwr .set_subtitle (["High" , "Medium" , "Low" ][current_fp_level ])
51+ try :
52+ current_fp_level = ec_commands .framework_laptop .get_fp_led_level (
53+ app .cros_ec
54+ ).value
55+ self .led_pwr_scale .set_value (abs (current_fp_level - 2 ))
56+ self .led_pwr .set_subtitle (["High" , "Medium" , "Low" ][current_fp_level ])
57+ except ValueError :
58+ # LED isn't a normal value
59+ current_fp_level = ec_commands .framework_laptop .get_fp_led_level_int (
60+ app .cros_ec
61+ )
62+ self .led_pwr .set_subtitle (f"Custom ({ current_fp_level } %)" )
63+
5664 self .led_pwr_scale .connect ("value-changed" , handle_led_pwr )
5765 except ec_exceptions .ECError as e :
5866 if e .ec_status == ec_exceptions .EcStatus .EC_RES_INVALID_COMMAND :
You can’t perform that action at this time.
0 commit comments