mirror of
https://github.com/Steve-Tech/YAFI.git
synced 2026-04-19 16:50:36 +00:00
Handle custom power LED brightness levels
This commit is contained in:
@@ -48,11 +48,19 @@ class LedsPage(Gtk.Box):
|
|||||||
ec_commands.framework_laptop.set_fp_led_level(app.cros_ec, value)
|
ec_commands.framework_laptop.set_fp_led_level(app.cros_ec, value)
|
||||||
self.led_pwr.set_subtitle(["High", "Medium", "Low"][value])
|
self.led_pwr.set_subtitle(["High", "Medium", "Low"][value])
|
||||||
|
|
||||||
|
try:
|
||||||
current_fp_level = ec_commands.framework_laptop.get_fp_led_level(
|
current_fp_level = ec_commands.framework_laptop.get_fp_led_level(
|
||||||
app.cros_ec
|
app.cros_ec
|
||||||
).value
|
).value
|
||||||
self.led_pwr_scale.set_value(abs(current_fp_level - 2))
|
self.led_pwr_scale.set_value(abs(current_fp_level - 2))
|
||||||
self.led_pwr.set_subtitle(["High", "Medium", "Low"][current_fp_level])
|
self.led_pwr.set_subtitle(["High", "Medium", "Low"][current_fp_level])
|
||||||
|
except ValueError:
|
||||||
|
# LED isn't a normal value
|
||||||
|
current_fp_level = ec_commands.framework_laptop.get_fp_led_level_int(
|
||||||
|
app.cros_ec
|
||||||
|
)
|
||||||
|
self.led_pwr.set_subtitle(f"Custom ({current_fp_level}%)")
|
||||||
|
|
||||||
self.led_pwr_scale.connect("value-changed", handle_led_pwr)
|
self.led_pwr_scale.connect("value-changed", handle_led_pwr)
|
||||||
except ec_exceptions.ECError as e:
|
except ec_exceptions.ECError as e:
|
||||||
if e.ec_status == ec_exceptions.EcStatus.EC_RES_INVALID_COMMAND:
|
if e.ec_status == ec_exceptions.EcStatus.EC_RES_INVALID_COMMAND:
|
||||||
|
|||||||
Reference in New Issue
Block a user