cuu 5 years ago
parent
commit
15f4839a45
2 changed files with 20 additions and 7 deletions
  1. 14 1
      sys.py/UI/counter_screen.py
  2. 6 6
      sys.py/run.py

+ 14 - 1
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()

+ 6 - 6
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):