co2_sensor: process only reliable measurements
Log every measurement to the serial console, but return only true in `processData` (thus allowing further processing like CSV, MQTT, LORAWAN) if the data is reliable, i.e. * CO2 measurements have stabilized after startup * CO2 != 0 * not preparing calibration (with reduced measurement timesteps)
-
Hmm. The goal is good, but the implementation looks a bit complex IMHO, and is basically what you wanted to avoid by adding States in the first place. I'll think about an alternate way to implement it.
-
Author Owner
Do you mean the whole MR is too complex or this "feedback mechanism" for the main
loop()
? I'm asking because I would not invest time in addressing the comments if you're going to write everything from scratch. -
I was referring to this specific commit. Don't worry, I won't rewrite anything from scratch. Your branch is good enough, and just needs to be polished before it's merged.
What about:
- don't return anything from
switchStateForCurrentPPM()
- only send data via MQTT/LoRa/CSV if the sensor is in READY or NEED_CALIBRATION state. I thought about only sending data in READY mode, but you're right, it should be sent in NEED_CALIBRATION state too, as a warning that something should be done.
- So
processData
would return `freshData && (current_state == READY || current_state == NEEDS_CALIBRATION); - If it's too long, a new method
interestingData()
could be defined ascurrent_state == READY || current_state == NEEDS_CALIBRATION
.
- don't return anything from
-
Author Owner
Sounds good.
👍🏼
Please register or sign in to comment