Closed github-actions[bot] closed 3 years ago
Hold on do the sensirion and plantower return the same strings????
https://github.com/pyonair/PyonAir-pycom/blob/6366f2315b4180aec0568e1affcf46754bc78f13/code/lib/PM_read.py#L87
sensor.read() init_count += 1 except SensirionException as e: debugLogger.exception("Failed to read from sensor SPS030") blink_led((0x550000, 0.4, True)) # start a periodic timer interrupt to poll readings every second #Use welford here : https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance #Average variables? -- pass them in #TODO: Hold on do the sensirion and plantower return the same strings???? processing_alarm = Timer.Alarm(process_readings, arg=(sensor_type, sensor, sensor_logger, debugLogger,averages), s=1, periodic=True) #DO averaging here? -- timer processing_averages = Timer.Alarm(process_averages, arg=(averages,averageLogger), s=10, periodic=True) def process_averages(args): averages, averageLogger = args[0], args[1] gr03umCount, gr03umMean, gr03umVariance, gr03umSampleVariance = averages[0].getAverageAndReset() gr05umCount, gr05umMean, gr05umVariance, gr05umSampleVariance = averages[1].getAverageAndReset() gr10umCount, gr10umMean, gr10umVariance, gr10umSampleVariance = averages[2].getAverageAndReset() #log to file if(gr03umCount == gr03umCount == gr03umCount): averageLogger.log_row("".join([str(gr03umMean) , "," ,str(gr05umMean) , "," ,str(gr10umMean), "," , str(gr10umCount)])) else: averageLogger.log_row("".join([str(gr03umMean) , "," ,str(gr05umMean) , "," ,str(gr10umMean) , "," , str(gr03umCount) , "," , str(gr05umCount) , "," , str(gr10umCount)])) #add to transmit? def process_readings(args): """ Method to be evoked by a timed alarm, which reads and processes data from the PM sensor, and logs it to the sd card :param args: sensor_type, sensor, sensor_logger, debugLogger :type args: str, str, SensorLogger object, LoggerFactory object """ sensor_type, sensor, sensor_logger, debugLogger, averages = args[0], args[1], args[2], args[3] , args[4] #TODO: this looks clunky and in need of a fix try: recv = sensor.read()
c2c41674ec6608f2c438272964be1f0d7b4a1bae
Closed in 32be6ecf263489bd5b757667cb6a40dacfd831c4
Hold on do the sensirion and plantower return the same strings????
https://github.com/pyonair/PyonAir-pycom/blob/6366f2315b4180aec0568e1affcf46754bc78f13/code/lib/PM_read.py#L87
c2c41674ec6608f2c438272964be1f0d7b4a1bae