mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
flash led1 when screen down
This commit is contained in:
parent
a5e73a2cec
commit
94fe3586e6
@ -54,7 +54,8 @@ class CounterScreen(FullScreen):
|
||||
self.Draw()
|
||||
self.SwapAndShow()
|
||||
|
||||
|
||||
|
||||
"""
|
||||
if self._inter_counter == 2:
|
||||
commands.getstatusoutput("echo 0 > /proc/driver/led1")
|
||||
#turn off
|
||||
@ -62,6 +63,7 @@ class CounterScreen(FullScreen):
|
||||
elif self._inter_counter == 7:
|
||||
commands.getstatusoutput("echo 1 > /proc/driver/led1")
|
||||
#turn on
|
||||
"""
|
||||
|
||||
return self._Counting
|
||||
|
||||
@ -72,7 +74,7 @@ class CounterScreen(FullScreen):
|
||||
self._Number = 10
|
||||
self._Counting = True
|
||||
|
||||
self._GobjectIntervalId = gobject.timeout_add(100,self.GObjectInterval)
|
||||
# self._GobjectIntervalId = gobject.timeout_add(100,self.GObjectInterval)
|
||||
|
||||
def StopCounter(self):
|
||||
if self._Counting == False:
|
||||
@ -81,10 +83,11 @@ class CounterScreen(FullScreen):
|
||||
self._Number = 10
|
||||
commands.getstatusoutput("echo 0 > /proc/driver/led1")
|
||||
|
||||
"""
|
||||
if self._GobjectIntervalId != -1:
|
||||
gobject.source_remove(self._GobjectIntervalId)
|
||||
self._GobjectIntervalId = -1
|
||||
|
||||
"""
|
||||
def Init(self):
|
||||
self._CanvasHWND = pygame.Surface((self._Width,self._Height))
|
||||
self._TopLabel = Label()
|
||||
|
||||
@ -125,7 +125,7 @@ class MainScreen(object):
|
||||
_PosX = 0
|
||||
_PosY = TitleBar._BarHeight+1
|
||||
_Width = Width
|
||||
_Height = Height -FootBar._BarHeight -TitleBar._BarHeight-1
|
||||
_Height = Height -FootBar._BarHeight -TitleBar._BarHeight
|
||||
_MyPageStack = None
|
||||
_CurrentPage = None # pointer to the current displaying Page Class
|
||||
_CanvasHWND = None
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import dbus
|
||||
import dbus.service
|
||||
import sys
|
||||
import commands
|
||||
from wicd import misc
|
||||
##misc.to_bool
|
||||
##misc.misc.noneToString
|
||||
@ -63,6 +64,9 @@ passout_time_stage = 0
|
||||
|
||||
last_brt = -1
|
||||
|
||||
gobject_flash_led1 = -1
|
||||
gobject_flash_led1_counter = 0
|
||||
|
||||
def gobject_loop():
|
||||
"""
|
||||
here to receive dbus signal
|
||||
@ -73,18 +77,35 @@ def gobject_loop():
|
||||
gobject_main_loop.quit()
|
||||
exit(-1)
|
||||
|
||||
def GobjectFlashLed1(main_screen):
|
||||
gobject_flash_led1_counter+=1
|
||||
|
||||
if gobject_flash_led1_counter == 2:
|
||||
commands.getstatusoutput("echo 0 > /proc/driver/led1")
|
||||
#turn off
|
||||
|
||||
elif gobject_flash_led1_counter == 7:
|
||||
commands.getstatusoutput("echo 1 > /proc/driver/led1")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def RestoreLastBackLightBrightness(main_screen):
|
||||
global last_brt,passout_time_stage
|
||||
|
||||
main_screen._CounterScreen.StopCounter()
|
||||
|
||||
passout_time_stage = 0
|
||||
main_screen._TitleBar._InLowBackLight = -1
|
||||
|
||||
if last_brt == -1:
|
||||
return
|
||||
|
||||
if gobject_flash_led1 != -1:
|
||||
gobject.source_remove(GobjectFlashLed1)
|
||||
gobject_flash_led1 = -1
|
||||
|
||||
main_screen._CounterScreen.StopCounter()
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
passout_time_stage = 0
|
||||
main_screen._TitleBar._InLowBackLight = -1
|
||||
|
||||
try:
|
||||
f = open(config.BackLight,"r+")
|
||||
except IOError:
|
||||
@ -106,7 +127,7 @@ def RestoreLastBackLightBrightness(main_screen):
|
||||
return
|
||||
|
||||
def InspectionTeam(main_screen):
|
||||
global everytime_keydown,last_brt,passout_time_stage
|
||||
global everytime_keydown,last_brt,passout_time_stage,gobject_flash_led1
|
||||
|
||||
cur_time = time.time()
|
||||
time_1 = config.PowerLevels[config.PowerLevel][0]
|
||||
@ -142,7 +163,7 @@ def InspectionTeam(main_screen):
|
||||
|
||||
elif cur_time - everytime_keydown > time_2 and passout_time_stage == 1:
|
||||
print("timeout, close screen %d" % int(cur_time - everytime_keydown))
|
||||
|
||||
|
||||
try:
|
||||
f = open(config.BackLight,"r+")
|
||||
except IOError:
|
||||
@ -154,11 +175,15 @@ def InspectionTeam(main_screen):
|
||||
f.write(str(brt))
|
||||
f.truncate()
|
||||
f.close()
|
||||
|
||||
|
||||
main_screen._TitleBar._InLowBackLight = 0
|
||||
|
||||
if time_3 != 0:
|
||||
passout_time_stage = 2 # next
|
||||
passout_time_stage = 2 # next
|
||||
|
||||
gobject_flash_led1 = gobject.timeout_add(100,GobjectFlashLed1,main_screen)
|
||||
|
||||
everytime_keydown = cur_time
|
||||
|
||||
elif cur_time - everytime_keydown > time_3 and passout_time_stage == 2:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user