Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 46) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 47) @@ -139,10 +139,10 @@ // 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? */ + meterItems[METER_INDEX_TST].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_TST].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_TST].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_TST].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_TST].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_TST].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ // Init Gas meter @@ -154,3 +154,21 @@ meterItems[METER_INDEX_GAS].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ + // Init Electricity meter 1 + meterItems[METER_INDEX_EL1].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_EL1].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_EL1].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_EL1].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_EL1].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_EL1].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ + + // Init Electricity meter 2 + meterItems[METER_INDEX_EL2].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_EL2].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_EL2].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_EL2].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_EL2].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_EL2].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ + + + } Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 46) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 47) @@ -33,5 +33,5 @@ if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ { - handleMeterTick(METER_INDEX_BUTTON); + handleMeterTick(METER_INDEX_TST); IO2_INT_CLR |= (1<<10); } @@ -43,10 +43,10 @@ else if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ { - handleMeterTick(1); + handleMeterTick(METER_INDEX_EL1); IO2_INT_CLR |= (1<<1); } else if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ { - handleMeterTick(2); + handleMeterTick(METER_INDEX_EL2); IO2_INT_CLR |= (1<<2); } Index: /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 46) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 47) @@ -5,7 +5,11 @@ #define NUMBER_OF_METERS 5 /* the number of meters we use */ -#define METER_INDEX_BUTTON 0 /* index of the button example meter data */ +#define METER_INDEX_TST 0 /* index of the button example meter data */ +#define METER_INDEX_GAS 1 /* index of the gas meter data */ +#define METER_INDEX_EL1 2 /* index of the Electricity 1 meter data */ +#define METER_INDEX_EL2 3 /* index of the Electricity 2 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 46) +++ /webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (revision 47) @@ -223,10 +223,13 @@ generate_rtos_stats(void *arg) { + + unsigned long long currentTime = getEpochTimeWithMs(); + lRefreshCount++; sprintf( cCountBuf, "


Refresh count = %d\r\nVoltages %d %d %d %d\r\n\ -Wattages %d %d %d %d\r\nSolarReadErr %d\r\nSolarReadCount %d\r\n", lRefreshCount, +Wattages %d %d %d %d\r\nSolarReadErr %d\r\nSolarReadCount %d\r\nCurrentTime %d\r\n", lRefreshCount, chanVolt[0], chanVolt[1], chanVolt[2], chanVolt[3], chanWatt[0], chanWatt[1], chanWatt[2], chanWatt[3], - solarReadErrors, solarReadCounter + solarReadErrors, solarReadCounter, currentTime ); //strcat( uip_appdata, cCountBuf ); @@ -239,20 +242,20 @@ //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", + sprintf( cCountBuf, "


TSTmeter %d %d %d %d %d %d %d %d\r\n", + meterItems[METER_INDEX_TST].meterEnabled, + (portLONG)(meterItems[METER_INDEX_TST].timeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_TST].timeLastTick & 0xffffffff), + (portLONG)(meterItems[METER_INDEX_TST].timeBeforeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_TST].timeBeforeLastTick & 0xffffffff), + meterItems[METER_INDEX_TST].valueLastTick, + meterItems[METER_INDEX_TST].currentValue, + meterItems[METER_INDEX_TST].valueBeforeLastTick + ); + + + strcat( uip_appdata, cCountBuf ); + + + sprintf( cCountBuf, "GASmeter %d %d %d %d %d %d %d %d\r\n", meterItems[METER_INDEX_GAS].meterEnabled, (portLONG)(meterItems[METER_INDEX_GAS].timeLastTick << 32), @@ -267,4 +270,37 @@ strcat( uip_appdata, cCountBuf ); + + + sprintf( cCountBuf, "EL1meter %d %d %d %d %d %d %d %d\r\n", + meterItems[METER_INDEX_EL1].meterEnabled, + (portLONG)(meterItems[METER_INDEX_EL1].timeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_EL1].timeLastTick & 0xffffffff), + (portLONG)(meterItems[METER_INDEX_EL1].timeBeforeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_EL1].timeBeforeLastTick & 0xffffffff), + meterItems[METER_INDEX_EL1].valueLastTick, + meterItems[METER_INDEX_EL1].currentValue, + meterItems[METER_INDEX_EL1].valueBeforeLastTick + ); + + + strcat( uip_appdata, cCountBuf ); + + + sprintf( cCountBuf, "EL2meter %d %d %d %d %d %d %d %d\r\n", + meterItems[METER_INDEX_EL2].meterEnabled, + (portLONG)(meterItems[METER_INDEX_EL2].timeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_EL2].timeLastTick & 0xffffffff), + (portLONG)(meterItems[METER_INDEX_EL2].timeBeforeLastTick << 32), + (portLONG)(meterItems[METER_INDEX_EL2].timeBeforeLastTick & 0xffffffff), + meterItems[METER_INDEX_EL2].valueLastTick, + meterItems[METER_INDEX_EL2].currentValue, + meterItems[METER_INDEX_EL2].valueBeforeLastTick + ); + + + strcat( uip_appdata, cCountBuf ); + + + //strcat( ( char * ) uip_appdata, ( char * ) "1234test" );