Index: webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c =================================================================== --- webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 47) +++ webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 50) @@ -171,4 +171,21 @@ + // Init Auxiliary meter 1 + meterItems[METER_INDEX_AU1].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_AU1].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_AU1].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_AU1].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_AU1].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_AU1].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ + + // Init Auxiliary meter 2 + meterItems[METER_INDEX_AU2].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ + meterItems[METER_INDEX_AU2].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_AU2].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ + meterItems[METER_INDEX_AU2].valueLastTick = 1; /* what value did we have at the last tick? */ + meterItems[METER_INDEX_AU2].currentValue = 1; /* same: start value of the meter */ + meterItems[METER_INDEX_AU2].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 47) +++ webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 50) @@ -53,15 +53,14 @@ else if ((IO2_INT_STAT_R & (1 << 3)) != 0) /* P0.3 interrupt triggered - connector J4, Pin 3*/ { - handleMeterTick(3); + handleMeterTick(METER_INDEX_AU1); IO2_INT_CLR |= (1<<3); } else if ((IO2_INT_STAT_R & (1 << 4)) != 0) /* P0.4 interrupt triggered - connector J4, Pin 4*/ { - handleMeterTick(4); + handleMeterTick(METER_INDEX_AU2); IO2_INT_CLR |= (1<<4); } /* Clear the interrupt. */ - IO2_INT_CLR |= (1<<10); VICVectAddr = 0; Index: webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h =================================================================== --- webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 47) +++ webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (revision 50) @@ -3,12 +3,12 @@ unsigned long long getEpochTimeWithMs(void); -#define NUMBER_OF_METERS 5 /* the number of meters we use */ +#define NUMBER_OF_METERS 6 /* the number of meters we use */ -#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_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_AU1 4 /* index of Auxiliary input 1 */ +#define METER_INDEX_AU2 5 /* index of Auxiliary input 1 */