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

Elasped Time Jumps in Value #213

Closed
KMacros opened this issue Jan 28, 2019 · 1 comment
Closed

Elasped Time Jumps in Value #213

KMacros opened this issue Jan 28, 2019 · 1 comment

Comments

@KMacros
Copy link

KMacros commented Jan 28, 2019

Versions: OpenEVSE v5 Advanced purchased Dec2018 / 4.8.0 wifi 2.7.5

I notice the Elapsed Time on the OpenEVSE tab in the Status Panel jumps up by 1 minute in value near 30 seconds and by 1 hour near 30 minute values. I suspect the code in ESP8266_WiFi_v2.x/src/html/view_models/TimeViewModel.js is rounding values rather than using floor/ceiling or simply truncating the value. I've ordered an ISP programmer to update my OpenEVSE firmware 4.8.0 to 5.0.1 and a serial interface to update the ESP8266 4.7.5 in case the web update fails so I am unable to make and verify changes at this time. I have reviewed Issue #66 and found the code which I would update Math.round to Math.trunc in lines 79, 81, and 83 to show the time without the rounding artifacts. I'm also learning my way around GitHub so I could be making mistakes about the suggested corrections. Please let me know how I should proceed in contributing to this open source project.

Note that this rounding jumps in the elapsed timer can be observed in the online simulator.

Current code :
var time = self.elapsedNow().getTime();
time = Math.round(time / 1000);
var seconds = time % 60;
time = Math.round(time / 60);
var minutes = time % 60;
var hours = Math.round(time / 60);
return hours+":"+addZero(minutes)+":"+addZero(seconds);

Suggested :
var time = self.elapsedNow().getTime();
time = Math.trunc(time / 1000);
var seconds = time % 60;
time = Math.trunc(time / 60);
var minutes = time % 60;
var hours = Math.trunc(time / 60);
return hours+":"+addZero(minutes)+":"+addZero(seconds);

Edited to add versions and simulator observation.

@glynhudson
Copy link
Contributor

Fixed by #214
and OpenEVSE/openevse_wifi_gui#2

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

No branches or pull requests

2 participants