Skip to content

Commit

Permalink
bugfix: sync command slowed the calls
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Nov 10, 2017
1 parent 42b4526 commit 9715aa0
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 26 deletions.
2 changes: 2 additions & 0 deletions appdiff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion brightness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fi

echo $VAL > /sys/class/backlight/rpi_backlight/brightness

sync
sync &
4 changes: 2 additions & 2 deletions indoor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ sip_authentication_name = 101

[devices]
ringtone = tone2.wav
volume = 50
micvolume = 60
volume = 55
micvolume = 50

[gui]
screen_mode = 4
Expand Down
2 changes: 1 addition & 1 deletion indoor.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions my_lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified my_lib/constants.pyc
Binary file not shown.
33 changes: 17 additions & 16 deletions pjindoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)))

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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\
Expand Down Expand Up @@ -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.)

Expand Down Expand Up @@ -1377,7 +1377,6 @@ def infinite_loop(self, dt):


# ###############################################################
# @mainthread
def image_update_loop(self,dt):
"image update"
Logger.debug('%s:' % whoami())
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)


# ###############################################################
Expand Down Expand Up @@ -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()
2 changes: 1 addition & 1 deletion setipaddress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ fi
ifconfig $IFACE 0.0.0.0
systemctl restart $SERVICE.service

sync
sync &
2 changes: 1 addition & 1 deletion setmicvolume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ amixer cset numid=$VOLUMEID $VOL%
amixer cset numid=$AGCID 0
alsactl store

sync
sync &
2 changes: 1 addition & 1 deletion settimezone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ ln -s /usr/share/zoneinfo/$TZ /etc/localtime
rm /etc/timezone
echo $TZ | tee /etc/timezone

sync
sync &
2 changes: 1 addition & 1 deletion setvolume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ fi
amixer cset numid=$VOLUMEID $VOL%
alsactl store

sync
sync &

0 comments on commit 9715aa0

Please sign in to comment.