From bf5e53b62b08801ef57f32ac8a858032bd46f157 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 15 Jul 2019 10:56:04 +1000 Subject: [PATCH] wacom: simplify the battery state debug message --- tuhi/wacom.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 9445f3c..1e3e0e9 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -857,10 +857,7 @@ class WacomProtocolBase(WacomProtocolLowLevelComm): self.e3_command() self.set_time() battery, charging = self.get_battery_info() - if charging: - logger.debug(f'device is plugged in and charged at {battery}%') - else: - logger.debug(f'device is discharging: {battery}%') + logger.debug(f'device battery: {battery}% ({"dis" if not charging else ""}charging)') self.emit('battery-status', battery, charging) if self.read_offline_data() == 0: logger.info('no data to retrieve') @@ -1099,10 +1096,7 @@ class WacomProtocolSlate(WacomProtocolSpark): fw_low = self.get_firmware_version(1) logger.info(f'firmware is {fw_high}-{fw_low}') battery, charging = self.get_battery_info() - if charging: - logger.debug(f'device is plugged in and charged at {battery}%') - else: - logger.debug(f'device is discharging: {battery}%') + logger.debug(f'device battery: {battery}% ({"dis" if not charging else ""}charging)') self.emit('battery-status', battery, charging) def retrieve_data(self): @@ -1110,10 +1104,7 @@ class WacomProtocolSlate(WacomProtocolSpark): self.check_connection() self.set_time() battery, charging = self.get_battery_info() - if charging: - logger.debug(f'device is plugged in and charged at {battery}%') - else: - logger.debug(f'device is discharging: {battery}%') + logger.debug(f'device battery: {battery}% ({"dis" if not charging else ""}charging)') self.emit('battery-status', battery, charging) self.width = w = self.get_dimensions('width') self.height = h = self.get_dimensions('height')