From 5b0b18c9894d2ed73fedf15c83b5df670fe790fe Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Fri, 26 Jan 2018 02:56:57 -0600 Subject: Only sound beep once per IPL completion --- pyiplledmonitor/ipl_status_led_monitor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyiplledmonitor/ipl_status_led_monitor.py b/pyiplledmonitor/ipl_status_led_monitor.py index 29f1ae6..ac3d6ad 100644 --- a/pyiplledmonitor/ipl_status_led_monitor.py +++ b/pyiplledmonitor/ipl_status_led_monitor.py @@ -54,7 +54,7 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager): for x in [114, 111, 116, 49, 51]]) random.seed(None) - self.updateIPLLeds(True) + self.updateIPLLeds(True, True) bus.add_signal_receiver( self.IPLStatusChangeHandler, @@ -129,8 +129,11 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager): def IPLStatusChangeHandler(self, interface_name, changed_properties, invalidated_properties): + status_changed = False value = changed_properties.get('current_status') if value is not None: + if (self.current_ipl_status != value): + status_changed = True self.current_ipl_status = value value = changed_properties.get('current_istep') if value is not None: @@ -142,9 +145,9 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager): self.current_ipl_istep_major = 0 self.current_ipl_istep_minor = 0 - self.updateIPLLeds(False) + self.updateIPLLeds(False, status_changed) - def updateIPLLeds(self, initial_start): + def updateIPLLeds(self, initial_start, status_changed): if (self.current_ipl_status == "IPL_RUNNING"): # Show major ISTEP on LED bank # On Talos we only have three LEDs plus a fourth indicator modification bit, but the major ISTEPs range from 2 to 21 @@ -183,7 +186,7 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager): proc = subprocess.Popen(["i2cset", "-y", "12", "0x31", "0x10", "0x00"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False) (out, err) = proc.communicate() - if (self.current_ipl_status == "IPL_COMPLETE"): + if ((status_changed == True) and (self.current_ipl_status == "IPL_COMPLETE")): if (initial_start == False): # Sound IPL complete beep try: -- cgit v1.2.1