예제 #1
0
def quit(screensaver=True):
	head.aim(1430, 1200)
	head.laser(False)
	if screensaver:
		oled.clear_buffer()
		oled.write("Booted.")
		oled.refresh()
		time.sleep(0.2)
	else:
		oled.clear()
		time.sleep(0.2)
	duino.disable()
예제 #2
0
def halt():
	duino.enable()
	time.sleep(0.1)
	tries = 0
	while not duino.online() and tries < 5:
		print "Resetting..."
		duino.reset()
		time.sleep(2)
		tries += 1
	duino.shutdown()
	terminal.info("Shutting down Lobsang...")
	log.log("Halting Lobsang. Raspbian is shutting down.")
	log.new_log() # If Lobsang halted through this code (it generally does) then create a new logfile.
	oled.clear_buffer()
	oled.write("Shutting down Lobsang...", pos=(0,0))
	oled.write("Wait until Duino light goes out before switching off.", pos=(0, 24))
	oled.refresh()
	os.system("sudo halt")
예제 #3
0
# Created Nov 2015 by Finley Watson

print "Auto Run: Initialising."

# Import the necessary libraries
import Oled
import Padlock
import random
import time
import subprocess
import os
import sys

# Display a message on the oled, if it works.
try: # We have not yet checked if the OLED is connected, so only "try:" to do this.
	Oled.write("Starting Auto Run.")
	Oled.refresh()
except: # Oled failed, but don't cause a fuss.
	pass

# Variables to be set lower down
camera_online = True
oled_online = True
duino_online = True

# Run boot.py, a system checkup script.
boot_errors = subprocess.call(["python", "boot.py"])

# Script exit code gives info about systems: 0 is all online,
# +4 == camera offline, +2 == oled offline, +1 == duino offline.
# So an error code of 6 == oled and cam offline but error of