testDims = ["MAG"] testCoords = ["x","y","z"] testForBadSensor = "MAG" lastValue = {} thresholdDefault = 0.01 while True: try: tt = time.time() if sensor in sensors: for devId in sensors[sensor]: if devId not in lastValue: lastValue[devId] = copy.copy(lastValueDefault) if devId not in G.threshold: G.threshold[devId] = thresholdDefault values = getValues(devId) lastValue =U.checkMGACCGYRdata( values,lastValue, testDims,testCoords,testForBadSensor,devId,sensor,quick) loopCount +=1 quick = U.checkNowFile(G.program) if U.checkNewCalibration(G.program): U.toLog(-1, u"starting new calibration in 5 sec for 1 minute.. move sensor around") time.sleep(5) for devId in theSENSORdict: U.magCalibrate(theSENSORdict[devId], force = False,calibTime=30) U.toLog(-1, u"finished new calibration") U.echoLastAlive(G.program) tt= time.time() if tt - lastRead > 5.: readParams()
singleTest ={"dim":"EULER","coord":"heading","limits":[-9999.,400.]} startTime = time.time() while True: try: tt = time.time() if sensor in sensors: skip =False if sensor in sensors: for devId in sensors[sensor]: if devId not in lastValue: lastValue[devId] = copy.copy(lastValueDefault) if devId not in G.threshold: G.threshold[devId] = thresholdDefault values = getValues(devId) lastValue =U.checkMGACCGYRdata( values,lastValue,testDims,testCoords,testForBadSensor,devId,sensor,quick, sumTest=sumTest,singleTest=singleTest) loopCount +=1 quick = U.checkNowFile(G.program) U.echoLastAlive(G.program) tt= time.time() if tt - lastRead > 5.: readParams() lastRead = tt if not quick: time.sleep(G.sensorLoopWait) except Exception, e:
startTime = time.time() while True: try: tt = time.time() if sensor in sensors: skip = False if sensor in sensors: for devId in sensors[sensor]: if devId not in lastValue: lastValue[devId] = copy.copy(lastValueDefault) if devId not in G.threshold: G.threshold[devId] = thresholdDefault values = getValues(devId) lastValue = U.checkMGACCGYRdata(values, lastValue, testDims, testCoords, testForBadSensor, devId, sensor, quick) #sumTest=sumTest,singleTest=singleTest) loopCount += 1 quick = U.checkNowFile(G.program) U.echoLastAlive(G.program) tt = time.time() if tt - lastRead > 5.: readParams() lastRead = tt if not quick: time.sleep(G.sensorLoopWait)