Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect calculations for BL0937 power meter pulses #1270

Open
rpv-tomsk opened this issue Jun 12, 2024 · 1 comment · May be fixed by #1280
Open

Incorrect calculations for BL0937 power meter pulses #1270

rpv-tomsk opened this issue Jun 12, 2024 · 1 comment · May be fixed by #1280

Comments

@rpv-tomsk
Copy link
Contributor

final_v *= (float)ticksElapsed;
final_v /= (1000.0f / (float)portTICK_PERIOD_MS);
final_c *= (float)ticksElapsed;
final_c /= (1000.0f / (float)portTICK_PERIOD_MS);
final_p *= (float)ticksElapsed;
final_p /= (1000.0f / (float)portTICK_PERIOD_MS);

I'm sorry if I'm wrong, but for me this code looks incorrect.
If we count more pulses due to more ticksElapsed since previous counter reset, the measured value (Voltage,Current, Power) should be less, not greater. Division and multiplication are swapped here.

@giedriuslt
Copy link
Contributor

Could this incorrect calculation cause wrong values with powersave? I need to try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants