From 9715aa082804d67f4be765a87ed16b5afd7f4ac3 Mon Sep 17 00:00:00 2001 From: isra67 Date: Fri, 10 Nov 2017 10:01:39 +0100 Subject: [PATCH] bugfix: sync command slowed the calls --- appdiff.sh | 2 ++ brightness.sh | 2 +- indoor.ini | 4 ++-- indoor.kv | 2 +- my_lib/constants.py | 4 ++-- my_lib/constants.pyc | Bin 3165 -> 3169 bytes pjindoor.py | 33 +++++++++++++++++---------------- setipaddress.sh | 2 +- setmicvolume.sh | 2 +- settimezone.sh | 2 +- setvolume.sh | 2 +- 11 files changed, 29 insertions(+), 26 deletions(-) diff --git a/appdiff.sh b/appdiff.sh index 9e2ab79..42ba1b0 100755 --- a/appdiff.sh +++ b/appdiff.sh @@ -38,6 +38,8 @@ else # fi ./share/update.sh $REPO + sync + PID=`ps aux | grep -i 'python pjindoor' | grep -iv 'grep ' | sed 's/\s\+/ /g' | cut -d' ' -f 2` kill $PID diff --git a/brightness.sh b/brightness.sh index df49c77..0c0a158 100755 --- a/brightness.sh +++ b/brightness.sh @@ -15,4 +15,4 @@ fi echo $VAL > /sys/class/backlight/rpi_backlight/brightness -sync +sync & diff --git a/indoor.ini b/indoor.ini index 9fc5567..6ac1557 100644 --- a/indoor.ini +++ b/indoor.ini @@ -15,8 +15,8 @@ sip_authentication_name = 101 [devices] ringtone = tone2.wav -volume = 50 -micvolume = 60 +volume = 55 +micvolume = 50 [gui] screen_mode = 4 diff --git a/indoor.kv b/indoor.kv index 8f5db8a..4a394d0 100644 --- a/indoor.kv +++ b/indoor.kv @@ -26,7 +26,7 @@ font_size: self.height/5 color: 0.6,0.6,0.6,0.9 Label: - text: '' + text: 'Starting...' id: lblresult font_size: self.height/3 color: 0.9,0.9,0.9,0.9 diff --git a/my_lib/constants.py b/my_lib/constants.py index c2a0ff9..e670251 100644 --- a/my_lib/constants.py +++ b/my_lib/constants.py @@ -97,8 +97,8 @@ # ### time: ### ICON_RELOAD = .3 -HIDINIT_TIME = 4. -PHONEINIT_TIME = 3. +HIDINIT_TIME = 3. # 4 +PHONEINIT_TIME = HIDINIT_TIME + .2 # 3 # ### variables & constatnts: ### main_state = 0 diff --git a/my_lib/constants.pyc b/my_lib/constants.pyc index 71344414943193304096052657dfbff4d7357708..eb4b725b39e2b7cba7538b614eb2b99550eb075e 100644 GIT binary patch delta 87 zcmcaB@lZmV`7 W$0owY%*M#Z#Ky!4#6T7ZG64YmeGW_j diff --git a/pjindoor.py b/pjindoor.py index 05c7fb1..c3b3df0 100644 --- a/pjindoor.py +++ b/pjindoor.py @@ -157,7 +157,6 @@ def on_incoming_call(self, call): if mainLayout.popupSettings: mainLayout.popupSettings.dismiss() mainLayout.popupSettings = None -# mainLayout.showPlayers() Window.release_all_keyboards() if mainLayout.showVideoEvent: @@ -201,8 +200,8 @@ def on_state(self): setloginfo(True, 'Call width=%s is %s (%d) last code=%d (%s) as role=%s'\ % (ci.remote_uri, ci.state_text, ci.state, ci.last_code, ci.last_reason, role)) -# Logger.info('pjSip on_state: Call width=%s is %s (%d) last code=%d (%s) as role=%s'\ -# % (ci.remote_uri, ci.state_text, ci.state, ci.last_code, ci.last_reason, role)) + Logger.info('pjSip on_state: Call width=%s is %s (%d) last code=%d (%s) as role=%s'\ + % (ci.remote_uri, ci.state_text, ci.state, ci.last_code, ci.last_reason, role)) Logger.debug('pjSip on_state: sip_call_id=%s outgoing call=%r current call=%s'\ % (ci.sip_call_id, mainLayout.outgoingCall, str(current_call))) @@ -439,6 +438,7 @@ def __init__(self,winpos,servaddr,sipcall,streamaddr,relaycmd,rotation=0,aspectr prcs = self.initPlayer() procs.append(prcs) + sendNodeInfo('[***]VIDEO: %d %s' % (self.screenIndex, 'OK' if prcs else 'ERROR')) # tt = Thread(target=self.play_worker) # tt.daemon = True # tt.start() @@ -528,9 +528,9 @@ def initPlayer(self): except: pass - sendNodeInfo('[***]VIDEO: %d ERROR' % self.screenIndex) +# sendNodeInfo('[***]VIDEO: %d ERROR' % self.screenIndex) - interval = 69.# + .2 * self.screenIndex + interval = 60.# + .2 * self.screenIndex if self.checkEvent: Clock.unschedule(self.checkEvent) self.checkEvent = Clock.schedule_interval(self.checkLoop, interval) self.isPlaying = (mainLayout.scrmngr.current == CAMERA_SCR and not mainLayout.popupSettings and not current_call) or\ @@ -935,15 +935,15 @@ def __init__(self, **kwargs): self.get_volume_value() - self.init_widgets() - -# self.init_myphone() - Clock.schedule_once(lambda _: self.init_myphone(), PHONEINIT_TIME) - initcallstat() sendNodeInfo('[***]START') +# self.init_myphone() +# self.init_widgets() + Clock.schedule_once(lambda dt: self.init_myphone(), 3.1) + Clock.schedule_once(lambda dt: self.init_widgets(), 3.9) + self.infinite_event = Clock.schedule_interval(self.infinite_loop, 6.9) Clock.schedule_interval(self.info_state_loop, 12.) @@ -1377,7 +1377,6 @@ def infinite_loop(self, dt): # ############################################################### -# @mainthread def image_update_loop(self,dt): "image update" Logger.debug('%s:' % whoami()) @@ -2316,10 +2315,12 @@ def build(self): self.config = config - send_command('pkill -9 omxplayer') - reset_usb_audio() - Clock.schedule_once(lambda _: send_command(HIDINIT_SCRIPT), HIDINIT_TIME) # safe restart time + time.sleep(HIDINIT_TIME) + send_command(HIDINIT_SCRIPT) +# Clock.schedule_once(lambda dt: send_command(HIDINIT_SCRIPT), HIDINIT_TIME) # safe restart time + + send_command('pkill -9 omxplayer') try: self.rotation = config.getint('gui', 'screen_orientation') except: self.rotation = 0 @@ -2644,7 +2645,7 @@ def appUpdate(self): scrmngr.current = SETTINGS_SCR else: # self.appUpdateWorker() - Clock.schedule_once(lambda _: self.appUpdateWorker(), .2) + Clock.schedule_once(lambda dt: self.appUpdateWorker(), .2) # ############################################################### @@ -2757,5 +2758,5 @@ def myAlertListBox(self, titl, ldata, cb=None, ad=True): # ############################################################### if __name__ == '__main__': - Clock.schedule_once(lambda dt: send_command('./killapp.sh runme.py'), 30) + Clock.schedule_once(lambda dt: send_command('./killapp.sh runme.py'), 20) IndoorApp().run() diff --git a/setipaddress.sh b/setipaddress.sh index ed26111..b50699c 100755 --- a/setipaddress.sh +++ b/setipaddress.sh @@ -33,4 +33,4 @@ fi ifconfig $IFACE 0.0.0.0 systemctl restart $SERVICE.service -sync +sync & diff --git a/setmicvolume.sh b/setmicvolume.sh index 299f78a..f6dd417 100755 --- a/setmicvolume.sh +++ b/setmicvolume.sh @@ -20,4 +20,4 @@ amixer cset numid=$VOLUMEID $VOL% amixer cset numid=$AGCID 0 alsactl store -sync +sync & diff --git a/settimezone.sh b/settimezone.sh index 614a48a..cc0695c 100755 --- a/settimezone.sh +++ b/settimezone.sh @@ -18,4 +18,4 @@ ln -s /usr/share/zoneinfo/$TZ /etc/localtime rm /etc/timezone echo $TZ | tee /etc/timezone -sync +sync & diff --git a/setvolume.sh b/setvolume.sh index fb4736f..db53ff5 100755 --- a/setvolume.sh +++ b/setvolume.sh @@ -18,4 +18,4 @@ fi amixer cset numid=$VOLUMEID $VOL% alsactl store -sync +sync &