Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c
===================================================================
--- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 30)
+++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 32)
@@ -70,7 +70,9 @@
* enough on the web page to be read by the server
*/
- if ( currentTime > ((unsigned long long)meterItems[METER_INDEX_GAS].timeLastTick + ((unsigned long long)ACCUMULATE_TICK_THRESHOLD_SEC * (unsigned long long)1000)) )
+ if ( currentTime > ((unsigned long long)meterItems[METER_INDEX_GAS].timeBeforeLastTick + ((unsigned long long)ACCUMULATE_TICK_THRESHOLD_SEC * (unsigned long long)1000)) )
{
- /* if the last meter tick happened longer than DEBOUNCE_TICK_THRESHOLD_MS ago (i.e. the switch did not just bounce) */
+ /* if the last meter tick happened longer than DEBOUNCE_TICK_THRESHOLD_MS ago (i.e. the switch did not just bounce),
+ * we create a new data item
+ */
meterItems[METER_INDEX_GAS].timeBeforeLastTick = meterItems[METER_INDEX_GAS].timeLastTick; /* when did the tick before the last tick occur? (epoch in milliseconds) */
meterItems[METER_INDEX_GAS].timeLastTick = currentTime; /* when did the last tick occur? (epoch in milliseconds) */
@@ -81,5 +83,7 @@
else
{
- ; /* nothing to do, curentValue was increased already above */
+ /* do not create a new data item, but update the current "last" data item */
+ meterItems[METER_INDEX_GAS].timeLastTick = currentTime;
+ meterItems[METER_INDEX_GAS].valueLastTick = meterItems[METER_INDEX_GAS].currentValue;
}
}
Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs
===================================================================
--- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 31)
+++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 32)
@@ -19,4 +19,5 @@
+
@@ -38,7 +39,7 @@
-
+
+
-
@@ -58,8 +59,8 @@
-
-
+
+
-
+