diff --git a/pitopd/hub_manager.py b/pitopd/hub_manager.py index 3dcbbca2..32a6be90 100644 --- a/pitopd/hub_manager.py +++ b/pitopd/hub_manager.py @@ -94,10 +94,8 @@ def wait_for_device_identification(self): time_waited = 0 while time_waited < 5: - device_id = self.get_device_id() if device_id == DeviceID.unknown: - sleep(0.25) time_waited += 0.25 diff --git a/pitopd/notification_manager.py b/pitopd/notification_manager.py index ed5ad565..dde788bb 100644 --- a/pitopd/notification_manager.py +++ b/pitopd/notification_manager.py @@ -101,7 +101,6 @@ def __show_message( action_text=None, action=None, ): - try: cmd = self.__notify_send_command( message_title_id, diff --git a/pitopd/poweroff.py b/pitopd/poweroff.py index 543fb6f3..a9e6d539 100644 --- a/pitopd/poweroff.py +++ b/pitopd/poweroff.py @@ -109,7 +109,6 @@ def _do_poweroff(device_id): PWR__SHUTDOWN_CTRL__MODE4 = 0x20 try: - hub = I2CDevice("/dev/i2c-1", i2c_address) hub.connect() diff --git a/pitopd/pthub/pthub.py b/pitopd/pthub/pthub.py index 96e991a8..4976746c 100644 --- a/pitopd/pthub/pthub.py +++ b/pitopd/pthub/pthub.py @@ -41,7 +41,6 @@ def register_client( on_shutdown_requested_func=None, on_battery_state_changed_func=None, ): - self._brightness_change_func = on_brightness_changed_func self._screen_blanked_func = on_screen_blanked_func self._screen_unblanked_func = on_screen_unblanked_func @@ -180,7 +179,6 @@ def register_client( on_shutdown_requested_func=None, on_battery_state_changed_func=None, ): - _state.register_client( on_brightness_changed_func, on_screen_blanked_func, diff --git a/pitopd/pthub/pthub_spi.py b/pitopd/pthub/pthub_spi.py index 03d3923c..ee31e776 100644 --- a/pitopd/pthub/pthub_spi.py +++ b/pitopd/pthub/pthub_spi.py @@ -102,7 +102,6 @@ def __init__(self, state_instance): def _update_state_from_pending_state_change(self, state_change_to_send): # If state is to change, update appropriate bit(s) if state_change_to_send is not None: - if state_change_to_send._type == SPIStateChangeType.screen: if state_change_to_send._operation == SPIScreenOperations.blank: self._state.set_screen_blanked() @@ -114,7 +113,6 @@ def _update_state_from_pending_state_change(self, state_change_to_send): logger.info(msg) elif state_change_to_send._type == SPIStateChangeType.brightness: - if _represents_int(state_change_to_send._operation): brightness_level = int(state_change_to_send._operation) if brightness_level >= 0 and brightness_level <= 10: @@ -139,19 +137,16 @@ def transceive_and_process(self): # Determine if received byte represents device ID or state if byte_type == SPIResponseType.device_id: - logger.debug("Valid response from hub - DEVICE ID") self._process_device_id(hub_response_bstring) elif byte_type == SPIResponseType.state: - self._process_spi_resp(hub_response_bstring) # State update has been sent to hub: perform another transceive to sync states self._get_state_from_hub(process_state=False) else: - logger.warning("Invalid response from hub") return False @@ -242,7 +237,6 @@ def _determine_byte(self, resp): def _process_spi_resp_shutdown(self, spi_shutdown_bit_int): if spi_shutdown_bit_int == 1: - # Increment shutdown counter self._shutdown_ctr.increment() @@ -451,7 +445,6 @@ def _add_state_change_to_send_class_to_stack(pending_state_change_to_send): def change_brightness_state(brightness_val): if is_initialised(): - if brightness_val > 10: brightness_val = 10 @@ -589,7 +582,6 @@ def _main_thread_loop(): ) while len(_spi_handler.queued_changes) > 0: - communicate() sleep(_cycle_sleep_time) diff --git a/pitopd/pthub2/pthub2.py b/pitopd/pthub2/pthub2.py index 1a8e9b05..877b9eb8 100644 --- a/pitopd/pthub2/pthub2.py +++ b/pitopd/pthub2/pthub2.py @@ -35,7 +35,6 @@ def register_client( on_shutdown_requested_func=None, on_battery_state_changed_func=None, ): - _state.register_client( on_brightness_changed_func, on_screen_blanked_func, diff --git a/pitopd/pthub2/pthub2_connection.py b/pitopd/pthub2/pthub2_connection.py index e475fe18..98b30b86 100644 --- a/pitopd/pthub2/pthub2_connection.py +++ b/pitopd/pthub2/pthub2_connection.py @@ -235,7 +235,6 @@ def disable_hdmi_audio(self): def _main_thread_loop(self): while self._run_polling_thread is True: - self._poll_hub() sleep(self._cycle_sleep_time) @@ -262,7 +261,6 @@ def _read_shutdown_control(self): ) if shutdown_control & ShutdownRegister.PWR__SHUTDOWN_CTRL__BUTT != 0: - # The power button been held for the time indicated in PWR__BUTT_SHORT_HOLD_TURNOFF self._state.emit_shutdown() diff --git a/pitopd/pthub2/pthub2_state.py b/pitopd/pthub2/pthub2_state.py index 429d6f1c..16383b2b 100644 --- a/pitopd/pthub2/pthub2_state.py +++ b/pitopd/pthub2/pthub2_state.py @@ -28,7 +28,6 @@ def register_client( on_shutdown_requested_func=None, on_battery_state_changed_func=None, ): - self._brightness_change_func = on_brightness_changed_func self._screen_blanked_func = on_screen_blanked_func self._screen_unblanked_func = on_screen_unblanked_func diff --git a/pitopd/sys_config.py b/pitopd/sys_config.py index 41696113..e8dd18b8 100644 --- a/pitopd/sys_config.py +++ b/pitopd/sys_config.py @@ -381,10 +381,8 @@ def set_value(property_name, value_to_set): desired_line = "" with open(temp_file, "w") as output_file: - last_char = "" with open(_BootConfig.BOOT_CONFIG_FILE, "r") as input_file: - for line in input_file: line_to_write = line @@ -581,7 +579,6 @@ def configure_in_boot_config( def boot_config_correctly_configured( expected_clock_val=None, expected_baud_val=None, expected_enabled_val=None ): - if expected_clock_val is not None: if isinstance(expected_clock_val, int): clock_string = _BootConfig.get_value(