|
@@ -275,14 +275,17 @@ void halIntPressure(void) {
|
|
|
* If called during a heating process, it returns the time elapsed since the heating started
|
|
|
* If called after a heating process, it returns the total time elapsed during the heating cycle
|
|
|
*/
|
|
|
-double halgetHeatingTime(void){
|
|
|
+float halgetHeatingTime(void){
|
|
|
+ //TODO clock is the improper function for this purpose due to overflow etc
|
|
|
+ //maybe clock_gettime() or use time() and localtime()
|
|
|
+ //stackoverflow: clock() is defined to tell you how much CPU time is used; using more threads uses more CPU time, sleeping threads use less time.
|
|
|
if (halIsHeating()) {
|
|
|
- logger(V_HAL, "Heating Time: %f", (double)(clock() - heatingCycle[0]) / CLOCKS_PER_SEC);
|
|
|
- return (double)(clock() - heatingCycle[0]) / CLOCKS_PER_SEC;
|
|
|
+ logger(V_HAL, "Hot Heating Time: %f\n", (float)(clock() - heatingCycle[0]) / CLOCKS_PER_SEC);
|
|
|
+ return (float)(clock() - heatingCycle[0]) / CLOCKS_PER_SEC;
|
|
|
}
|
|
|
else {
|
|
|
- logger(V_HAL, "Heating Time: %f", (double)(heatingCycle[1] - heatingCycle[0]) / CLOCKS_PER_SEC);
|
|
|
- return (double)(heatingCycle[1] - heatingCycle[0]) / CLOCKS_PER_SEC;
|
|
|
+ logger(V_HAL, "Heating Time: %f\n", (float)(heatingCycle[1] - heatingCycle[0]) / CLOCKS_PER_SEC);
|
|
|
+ return (float)(heatingCycle[1] - heatingCycle[0]) / CLOCKS_PER_SEC;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -366,7 +369,6 @@ void halSendSignal(HalSig val) {
|
|
|
switch (val) {
|
|
|
case SigInt0Psh:
|
|
|
case SigInt1Psh:
|
|
|
- idleCounter = 0;
|
|
|
if (idle) {
|
|
|
return;
|
|
|
}
|
|
@@ -376,7 +378,6 @@ void halSendSignal(HalSig val) {
|
|
|
case SigInt0RlsLong:
|
|
|
case SigInt1Rls:
|
|
|
case SigInt1RlsLong:
|
|
|
- idleCounter = 0;
|
|
|
if (idle) {
|
|
|
halLeaveIdle();
|
|
|
return;
|
|
@@ -440,6 +441,7 @@ void halEnterIdle(void){
|
|
|
*
|
|
|
*/
|
|
|
void halLeaveIdle(void){
|
|
|
+ idleCounter = 0;
|
|
|
logger(V_HAL, "Leaving Idle Mode\n");
|
|
|
halDisplayOn();
|
|
|
idleTimer.start();
|