ElectronicCats / CayenneLPP

Library for Arduino compatible with Cayenne Low Power Payload
http://electroniccats.com/
MIT License
106 stars 48 forks source link

Enhancement: "businesslike conduct" round to reduce data error from 0.09 to 0.05 (~50% accuracy enhancement) #43

Closed g6094199 closed 1 year ago

g6094199 commented 1 year ago

hi,

we have seen some problems when it comes to rounding (in our case for temp measurements).

in the current code the float temp just gets cut after the 1st decimal place, which is very inaccurate!

uint32_t v = value * multiplier;

in this case the error is at worst 0.09. so almost 0.1° off.

instead the float temp should be businesslike conduct rounded (in germany we call this "Kaufmännisches Runden") before chopping off the last digit, like so:

uint32_t v = round(value * multiplier);

in this case the error is @ max. 0.05° off. which is much more accurate for professional use. of cause other values can benefit from this kind of correction, too.

jazhe commented 1 year ago

Hello @g6094199!

We appreciate you bringing this issue to our attention. Truly appreciated you have taken the time out of your day. Could you please a pull request with the correction you are mentioning? I will communicate this to our Engineering Team to review your pull request and fix this as quickly as possible.

Have an amazing day! Kind regards.

stale[bot] commented 1 year ago

This is a message to remind you that your request has been pending for 5 days and awaits your comments. Our agent would like to hear from you about your previous request to see if the difficulty you were facing has been resolved or if we can provide further assistance. Otherwise, if we do not hear back from you within the next three days, the issue will be closed. Kind regards, Electronic Cats Support Team

sabas1080 commented 1 year ago

for reference: https://github.com/ElectronicCats/CayenneLPP/issues/44#issuecomment-1594235566