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