Debug the exit problem with Serial on Rpi
parent
b2a4be3baf
commit
32629a2a3a
20
src/RUN.py
20
src/RUN.py
|
@ -384,30 +384,18 @@ def camera_update():
|
|||
CAMERA.relocate(rot, -tilt, point=[xm, map1.height(xm, zm)+5, zm], distance=camRad)
|
||||
draw()
|
||||
|
||||
#if rot:
|
||||
#print(rot, body_orientation, body_orientation_diff)
|
||||
#CAMERA.relocate(rot, tilt, point=[-5, 84.5, -0], distance=camRad)
|
||||
#tt, rrot = CAMERA.point_at()
|
||||
#tt, rrot, rr = CAMERA.get_direction()
|
||||
#print(tt, body_orientation)
|
||||
#rot = 0
|
||||
#body_orientation_diff = body_orientation
|
||||
#CAMERA.rotateZ(roll)
|
||||
|
||||
|
||||
# Main loop
|
||||
while DISPLAY.loop_running() and keep_running:
|
||||
handler.mykeys.do_input_events()
|
||||
keep_running = handler.read_exit()
|
||||
if not keep_running:
|
||||
DISPLAY.destroy()
|
||||
DISPLAY.stop()
|
||||
update_position()
|
||||
update_avatar()
|
||||
camera_update()
|
||||
handler.update()
|
||||
#engine.stats()
|
||||
|
||||
keep_running = handler.read_exit()
|
||||
|
||||
DISPLAY.destroy()
|
||||
DISPLAY.stop()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -235,18 +235,6 @@ class handlers:
|
|||
if self.mykeys.key_state("KEY_P"): #112: #key p picture
|
||||
pi3d.screenshot("BeYourHero" + str(scshots) + ".jpg")
|
||||
scshots += 1
|
||||
if self.mykeys.key_state("KEY_ESC"): #Escape key to exit
|
||||
print("***** EXIT *****")
|
||||
#os.system('xset r on')
|
||||
|
||||
self.keep_running = False
|
||||
|
||||
#self.mykeys.release()
|
||||
if self.USE_SERIAL:
|
||||
self.ser.stop()
|
||||
#mymouse.stop()
|
||||
#DISPLAY.destroy()
|
||||
#DISPLAY.stop()
|
||||
|
||||
if orientation == 1:
|
||||
self.body_orientation = 0
|
||||
|
@ -266,6 +254,13 @@ class handlers:
|
|||
self.body_orientation = 315
|
||||
|
||||
def read_exit(self):
|
||||
if self.mykeys.key_state("KEY_ESC"): #Escape key to exit
|
||||
print("***** EXIT *****")
|
||||
self.keep_running = False
|
||||
self.mykeys.release()
|
||||
if self.USE_SERIAL:
|
||||
self.ser.stop()
|
||||
|
||||
return self.keep_running
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue