DFRobot / DFRobot_MultiGasSensor

MIT License
3 stars 5 forks source link

read_gas_concentration() does not support SO2 sensor, temperature correction different from C++ library #7

Closed Smegheid closed 1 year ago

Smegheid commented 1 year ago

This was originally brought up in issue #3, which was closed as fixed by 1c721dd but doesn't appear to be.

read_gas_concentration() did not receive any of the changes that were applied to analysis_all_data() for the SO2 and HCL sensors.

At the risk of polluting a ticket and raising two separate issues at once, the temperature correction in the python version also has significant differences from the C++ file. In a lot of cases, the temperature thresholds defining each correction are different, and in some places the calculation for the correction is also different. Finally, some of the temperature checks that were added in 1c721dd don't make a lot of sense.

For example, the SO2 sensor gets temperature checks for if(((temp)>-40) and ((temp)>=40)): and then elif((temp > 40) and (temp >= 60)). So, if the temperature is greater than -40C and >= 40C do a correction, else if over 40C and over 60?

I worked on some of these in a forked version and submitted a pull request (#6) this morning. It also makes a bunch of other changes to try to reduce code duplication, and I ended up making the temperature correction in the python module the same as the C++ version on the basis that one of them has to be correct, and the tutorial on the wiki is more arduino-focused. Make of it what you will.

96liuzhixin commented 1 year ago

Can you find out for yourself, what's wrong with our firmware?