kriswiner / ESP32

Arduino sketches for the ESP32
163 stars 46 forks source link

Is the rate calculation correct? #21

Open shomedas opened 5 years ago

shomedas commented 5 years ago

I may be wrong but I think that the rate computation in your code() has a bug. sumCount & sum are reset to zero inside the LCD update part

if (delt_t > 500) { // update LCD once per half-second independent of read rate ... ... sumCount = 0; sum = 0; }

I think it should be outside the if (delt_t > 500) conditional part. Moving the reset of sumcount and sum reduces the rate drastically.

kriswiner commented 5 years ago

No the idea is to get the average rate, in this case averaged over several hundred cycles of new data.

On Fri, Jul 19, 2019 at 10:35 AM shomedas notifications@github.com wrote:

I may be wrong but I think that the rate computation in your code() https://github.com/kriswiner/ESP32/blob/master/MPU9250_MS5637/MPU9250_MS5637_AHRS.ino has a bug. sumCount & sum are reset to zero inside the LCD update part

if (delt_t > 500) { // update LCD once per half-second independent of read rate ... ... sumCount = 0; sum = 0; }

I think it should be outside the if (delt_t > 500) conditional part. Moving the reset of sumcount and sum reduces the rate drastically.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/ESP32/issues/21?email_source=notifications&email_token=ABTDLKTT7FUUX2O373ZOKZLQAH3NTA5CNFSM4IFJDJDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HAKP3BQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTDLKQGL6TCY55WDM5X3J3QAH3NTANCNFSM4IFJDJDA .