Пример #1
0
def switch_ascent():
    global CURRENT_STATE
    batteryStatus = orbit_lib.getBatteryStatus()
    location = orbit_lib.LOCATION

    # Works out an interval for Switching state
    if location['altitude'] > 15000 and ASCENT_TIMES.get('15000') is None:
        ASCENT_TIMES['15000'] = time.time()
    if location['altitude'] > 17000 and ASCENT_TIMES.get('17000') is None:
        ASCENT_TIMES['17000'] = time.time()

    if ASCENT_TIMES.get('17000') and ASCENT_TIMES.get('15000'):
        diff = int(ASCENT_TIMES['17000'] - ASCENT_TIMES['15000'])
        schedule.enableFunc("scheduleRelease", scheduleRelease, diff)

    if batteryStatus['level'] < 50:
        LOG.warn("BATTERY LOW! %s" % batteryStatus['level'])
        orbit_lib.sendTextData("Battery Low. Releasing.")
        CURRENT_STATE = "RELEASE"
    if batteryStatus['temp'] < -200:
        LOG.warn("TEMPERATURE LOW! %s" % batteryStatus['temp'])
        orbit_lib.sendTextData("Temp Low. Releasing.")
        CURRENT_STATE = "RELEASE"

    if location['altitude'] > RELEASE_HEIGHT:
        orbit_lib.sendTextData("Releasing at %s" % location['altitude'])
        CURRENT_STATE = "RELEASE"
Пример #2
0
def startUp():
    DROID.startLocating(5000)  # period ms, dist
    DROID.startSensingThreshold(1, 0, 7)
    # DROID.startSensingTimed(1,250)
    DROID.wakeLockAcquirePartial()
    # DROID.wakeLockAcquireDim()
    DROID.batteryStartMonitoring()

    speak("Connecting")
    arduinoController.init()

    time.sleep(3)
    getLocation()
    schedule.enableFunc("getLocation", getLocation, 1)
    schedule.enableFunc("sendTextData", sendTextData, 60)