Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 45) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 46) @@ -138,4 +138,12 @@ } + // Init Example Button meter + meterItems[METER_INDEX_BUTTON].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_BUTTON].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_BUTTON].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_BUTTON].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_BUTTON].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_BUTTON].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ + // Init Gas meter meterItems[METER_INDEX_GAS].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 45) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 46) @@ -33,10 +33,10 @@ if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ { - handleMeterTick(10); + handleMeterTick(METER_INDEX_BUTTON); IO2_INT_CLR |= (1<<10); } else if ((IO2_INT_STAT_R & (1 << 0)) != 0) /* P0.0 interrupt triggered - connector J4, Pin 0*/ { - handleMeterTick(0); + handleMeterTick(METER_INDEX_GAS); IO2_INT_CLR |= (1<<0); } Index: /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 45) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 46) @@ -3,7 +3,9 @@ unsigned long long getEpochTimeWithMs(void); -#define NUMBER_OF_METERS 11 /* the number of meters we use */ +#define NUMBER_OF_METERS 5 /* the number of meters we use */ -#define METER_INDEX_GAS 10 /* index of the gas meter data */ +#define METER_INDEX_BUTTON 0 /* index of the button example meter data */ + +#define METER_INDEX_GAS 1 /* index of the gas meter data */ #define DEBOUNCE_TICK_THRESHOLD_MS 50 /* when two ticks are less than this time period apart, the second tick is ignored (debouncing) */ Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 45) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 46) @@ -239,4 +239,19 @@ //strcat( ( char * ) uip_appdata, ( char * ) "\r\n" ); + sprintf( cCountBuf, "
BUTTONmeter %d %d %d %d %d %d %d %d\r\n",
+ meterItems[METER_INDEX_BUTTON].meterEnabled,
+ (portLONG)(meterItems[METER_INDEX_BUTTON].timeLastTick << 32),
+ (portLONG)(meterItems[METER_INDEX_BUTTON].timeLastTick & 0xffffffff),
+ (portLONG)(meterItems[METER_INDEX_BUTTON].timeBeforeLastTick << 32),
+ (portLONG)(meterItems[METER_INDEX_BUTTON].timeBeforeLastTick & 0xffffffff),
+ meterItems[METER_INDEX_BUTTON].valueLastTick,
+ meterItems[METER_INDEX_BUTTON].currentValue,
+ meterItems[METER_INDEX_BUTTON].valueBeforeLastTick
+ );
+
+
+ strcat( uip_appdata, cCountBuf );
+
+
sprintf( cCountBuf, "
GASmeter %d %d %d %d %d %d %d %d\r\n",
meterItems[METER_INDEX_GAS].meterEnabled,
Index: /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs
===================================================================
--- /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 39)
+++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs (revision 46)
@@ -5,5 +5,5 @@