trekawek / air-quality-info

An attractive way to display air quality in your neighbourhood.
Other
49 stars 16 forks source link

Increase precision for PM values below 10 #88

Closed ProBackup-nl closed 2 years ago

ProBackup-nl commented 2 years ago

Code is not tested and my PHP is rusty. I'm not sure whether between the "}" and the echo statement, a semicolon should be inserted or not. if ($averages['values']['pm25'] < 10) { $precision = 1; } else { $precision = 0; };

trekawek commented 2 years ago

I think you overestimate the accuracy of the sensors, I don't expect them to provide good results up to decimal points. But the result page will probably look better with this patch, so let's have it :)

ProBackup-nl commented 2 years ago

It's not the need for the exact value. On the other hand having 2 or 3 of 3 sensors with value 3, then you start wondering which one is higher and which one is lower. I am not happy with my own solution, maybe try half or quarter values: ½ or ¼, ½, ¾. Less is more, I would try to implement the "½" range solution, thus > 0,25 and < 0,75 will show suffix "½".