diff --git a/pioreactor/actions/led_intensity.py b/pioreactor/actions/led_intensity.py index 048d3053..d50343b3 100644 --- a/pioreactor/actions/led_intensity.py +++ b/pioreactor/actions/led_intensity.py @@ -154,11 +154,12 @@ def led_intensity( # any locked channels? for channel in list(desired_state.keys()): if is_led_channel_locked(channel): - updated_successfully = False logger.debug( f"Unable to update channel {channel} due to a software lock on it. Please try again." ) - del desired_state[channel] + desired_state = {k: v for k, v in desired_state.items() if k != channel} + + updated_successfully = False for channel, intensity in desired_state.items(): try: diff --git a/pioreactor/utils/__init__.py b/pioreactor/utils/__init__.py index 39bd9dcc..e5d26ce9 100644 --- a/pioreactor/utils/__init__.py +++ b/pioreactor/utils/__init__.py @@ -25,9 +25,11 @@ from pioreactor.pubsub import subscribe_and_callback -def boolean_retry(function: Callable, f_args, max_attempts: int = 3, sleep_for=0.25) -> bool: +def boolean_retry( + func: Callable[..., bool], f_args: tuple, max_attempts: int = 3, sleep_for: float = 0.25 +) -> bool: for _ in range(max_attempts): - res = function(*f_args) + res = func(*f_args) if res: return res time.sleep(sleep_for)