fix(pm3py): LED return echoes what was sent instead of meaningless status int
This commit is contained in:
12
pm3py/hw.py
12
pm3py/hw.py
@@ -95,9 +95,17 @@ class HWCommands:
|
||||
action_code = 1
|
||||
brightness_val = 0
|
||||
|
||||
ACTION_NAMES = {0: "off", 1: "on", 2: "toggle", 3: "pwm", 4: "pulse", 5: "fade", 6: "blink"}
|
||||
|
||||
payload = struct.pack("<BBBHH", led_mask, action_code, brightness_val, speed, count)
|
||||
resp = await self._t.send_ng(Cmd.LED_CONTROL, payload)
|
||||
return {"status": resp.status}
|
||||
await self._t.send_ng(Cmd.LED_CONTROL, payload)
|
||||
return {
|
||||
"led": led_mask,
|
||||
"action": ACTION_NAMES[action_code],
|
||||
"brightness": brightness_val if action_code == 3 else None,
|
||||
"speed": speed if action_code >= 4 else None,
|
||||
"count": count if action_code in (4, 6) else None,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _parse_led_str(led: str) -> int:
|
||||
|
||||
Reference in New Issue
Block a user