diff --git a/sys.py/UI/counter_screen.py b/sys.py/UI/counter_screen.py index c6cd867..335d6ff 100644 --- a/sys.py/UI/counter_screen.py +++ b/sys.py/UI/counter_screen.py @@ -91,8 +91,21 @@ class CounterScreen(FullScreen): commands.getstatusoutput("echo 0 > /proc/driver/led1") pygame.time.delay(800) - commands.getstatusoutput("echo 0 > /proc/driver/led1") + commands.getstatusoutput("echo 0 > /proc/driver/led1") + try: + f = open("/proc/driver/led1","w") + except IOError: + print( "RestoreLastBackLightBrightness open %s failed, try to adjust brightness in Settings" % config.BackLight) + pass + else: + with f: + f.seek(0) + f.write("0") + f.truncate() + f.close() + + def Init(self): self._CanvasHWND = pygame.Surface((self._Width,self._Height)) self._TopLabel = Label() diff --git a/sys.py/run.py b/sys.py/run.py index a0757e2..da525b7 100644 --- a/sys.py/run.py +++ b/sys.py/run.py @@ -104,11 +104,6 @@ def RestoreLastBackLightBrightness(main_screen): gobject.source_remove(gobject_flash_led1) gobject_flash_led1 = -1 - if main_screen._CounterScreen._Counting==True: - main_screen._CounterScreen.StopCounter() - main_screen.Draw() - main_screen.SwapAndShow() - return False if last_brt == -1: return True @@ -131,8 +126,13 @@ def RestoreLastBackLightBrightness(main_screen): last_brt = -1 else: f.close() - return True + if main_screen._CounterScreen._Counting==True: + main_screen._CounterScreen.StopCounter() + main_screen.Draw() + main_screen.SwapAndShow() + return False + return True def InspectionTeam(main_screen):