Changeset 47 for webserver/example/EnergyMeters
- Timestamp:
- 02/14/10 13:59:45 (15 years ago)
- Files:
-
- webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c (modified) (3 diffs)
- webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (modified) (2 diffs)
- webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h (modified) (1 diff)
- webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c
r46 r47 223 223 generate_rtos_stats(void *arg) 224 224 { 225 226 unsigned long long currentTime = getEpochTimeWithMs(); 227 225 228 lRefreshCount++; 226 229 sprintf( cCountBuf, "<p><br>Refresh count = %d\r\nVoltages %d %d %d %d\r\n\ 227 Wattages %d %d %d %d\r\nSolarReadErr %d\r\nSolarReadCount %d\r\n ", lRefreshCount,230 Wattages %d %d %d %d\r\nSolarReadErr %d\r\nSolarReadCount %d\r\nCurrentTime %d\r\n", lRefreshCount, 228 231 chanVolt[0], chanVolt[1], chanVolt[2], chanVolt[3], 229 232 chanWatt[0], chanWatt[1], chanWatt[2], chanWatt[3], 230 solarReadErrors, solarReadCounter 233 solarReadErrors, solarReadCounter, currentTime 231 234 ); 232 235 //strcat( uip_appdata, cCountBuf ); … … 239 242 //strcat( ( char * ) uip_appdata, ( char * ) "\r\n" ); 240 243 241 sprintf( cCountBuf, "<p><br> BUTTONmeter %d %d %d %d %d %d %d %d\r\n",242 meterItems[METER_INDEX_ BUTTON].meterEnabled,243 (portLONG)(meterItems[METER_INDEX_ BUTTON].timeLastTick << 32),244 (portLONG)(meterItems[METER_INDEX_ BUTTON].timeLastTick & 0xffffffff),245 (portLONG)(meterItems[METER_INDEX_ BUTTON].timeBeforeLastTick << 32),246 (portLONG)(meterItems[METER_INDEX_ BUTTON].timeBeforeLastTick & 0xffffffff),247 meterItems[METER_INDEX_ BUTTON].valueLastTick,248 meterItems[METER_INDEX_ BUTTON].currentValue,249 meterItems[METER_INDEX_ BUTTON].valueBeforeLastTick250 ); 251 252 253 strcat( uip_appdata, cCountBuf ); 254 255 256 sprintf( cCountBuf, " <p><br>GASmeter %d %d %d %d %d %d %d %d\r\n",244 sprintf( cCountBuf, "<p><br>TSTmeter %d %d %d %d %d %d %d %d\r\n", 245 meterItems[METER_INDEX_TST].meterEnabled, 246 (portLONG)(meterItems[METER_INDEX_TST].timeLastTick << 32), 247 (portLONG)(meterItems[METER_INDEX_TST].timeLastTick & 0xffffffff), 248 (portLONG)(meterItems[METER_INDEX_TST].timeBeforeLastTick << 32), 249 (portLONG)(meterItems[METER_INDEX_TST].timeBeforeLastTick & 0xffffffff), 250 meterItems[METER_INDEX_TST].valueLastTick, 251 meterItems[METER_INDEX_TST].currentValue, 252 meterItems[METER_INDEX_TST].valueBeforeLastTick 253 ); 254 255 256 strcat( uip_appdata, cCountBuf ); 257 258 259 sprintf( cCountBuf, "GASmeter %d %d %d %d %d %d %d %d\r\n", 257 260 meterItems[METER_INDEX_GAS].meterEnabled, 258 261 (portLONG)(meterItems[METER_INDEX_GAS].timeLastTick << 32), … … 267 270 268 271 strcat( uip_appdata, cCountBuf ); 272 273 274 sprintf( cCountBuf, "EL1meter %d %d %d %d %d %d %d %d\r\n", 275 meterItems[METER_INDEX_EL1].meterEnabled, 276 (portLONG)(meterItems[METER_INDEX_EL1].timeLastTick << 32), 277 (portLONG)(meterItems[METER_INDEX_EL1].timeLastTick & 0xffffffff), 278 (portLONG)(meterItems[METER_INDEX_EL1].timeBeforeLastTick << 32), 279 (portLONG)(meterItems[METER_INDEX_EL1].timeBeforeLastTick & 0xffffffff), 280 meterItems[METER_INDEX_EL1].valueLastTick, 281 meterItems[METER_INDEX_EL1].currentValue, 282 meterItems[METER_INDEX_EL1].valueBeforeLastTick 283 ); 284 285 286 strcat( uip_appdata, cCountBuf ); 287 288 289 sprintf( cCountBuf, "EL2meter %d %d %d %d %d %d %d %d\r\n", 290 meterItems[METER_INDEX_EL2].meterEnabled, 291 (portLONG)(meterItems[METER_INDEX_EL2].timeLastTick << 32), 292 (portLONG)(meterItems[METER_INDEX_EL2].timeLastTick & 0xffffffff), 293 (portLONG)(meterItems[METER_INDEX_EL2].timeBeforeLastTick << 32), 294 (portLONG)(meterItems[METER_INDEX_EL2].timeBeforeLastTick & 0xffffffff), 295 meterItems[METER_INDEX_EL2].valueLastTick, 296 meterItems[METER_INDEX_EL2].currentValue, 297 meterItems[METER_INDEX_EL2].valueBeforeLastTick 298 ); 299 300 301 strcat( uip_appdata, cCountBuf ); 302 303 304 269 305 270 306 //strcat( ( char * ) uip_appdata, ( char * ) "1234test" ); webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c
r46 r47 139 139 140 140 // Init Example Button meter 141 meterItems[METER_INDEX_ BUTTON].meterEnabled = 1; /* 0: item not used, 1: meter enabled */142 meterItems[METER_INDEX_ BUTTON].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */143 meterItems[METER_INDEX_ BUTTON].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */144 meterItems[METER_INDEX_ BUTTON].valueLastTick = 1; /* what value did we have at the last tick? */145 meterItems[METER_INDEX_ BUTTON].currentValue = 1; /* same: start value of the meter */146 meterItems[METER_INDEX_ BUTTON].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */141 meterItems[METER_INDEX_TST].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ 142 meterItems[METER_INDEX_TST].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 143 meterItems[METER_INDEX_TST].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 144 meterItems[METER_INDEX_TST].valueLastTick = 1; /* what value did we have at the last tick? */ 145 meterItems[METER_INDEX_TST].currentValue = 1; /* same: start value of the meter */ 146 meterItems[METER_INDEX_TST].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ 147 147 148 148 // Init Gas meter … … 154 154 meterItems[METER_INDEX_GAS].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ 155 155 156 // Init Electricity meter 1 157 meterItems[METER_INDEX_EL1].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ 158 meterItems[METER_INDEX_EL1].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 159 meterItems[METER_INDEX_EL1].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 160 meterItems[METER_INDEX_EL1].valueLastTick = 1; /* what value did we have at the last tick? */ 161 meterItems[METER_INDEX_EL1].currentValue = 1; /* same: start value of the meter */ 162 meterItems[METER_INDEX_EL1].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ 163 164 // Init Electricity meter 2 165 meterItems[METER_INDEX_EL2].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ 166 meterItems[METER_INDEX_EL2].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 167 meterItems[METER_INDEX_EL2].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 168 meterItems[METER_INDEX_EL2].valueLastTick = 1; /* what value did we have at the last tick? */ 169 meterItems[METER_INDEX_EL2].currentValue = 1; /* same: start value of the meter */ 170 meterItems[METER_INDEX_EL2].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ 171 172 173 156 174 } webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h
r46 r47 5 5 #define NUMBER_OF_METERS 5 /* the number of meters we use */ 6 6 7 #define METER_INDEX_BUTTON 0 /* index of the button example meter data */ 7 #define METER_INDEX_TST 0 /* index of the button example meter data */ 8 #define METER_INDEX_GAS 1 /* index of the gas meter data */ 9 #define METER_INDEX_EL1 2 /* index of the Electricity 1 meter data */ 10 #define METER_INDEX_EL2 3 /* index of the Electricity 2 meter data */ 8 11 9 #define METER_INDEX_GAS 1 /* index of the gas meter data */ 12 13 10 14 11 15 #define DEBOUNCE_TICK_THRESHOLD_MS 50 /* when two ticks are less than this time period apart, the second tick is ignored (debouncing) */ webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c
r46 r47 33 33 if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ 34 34 { 35 handleMeterTick(METER_INDEX_ BUTTON);35 handleMeterTick(METER_INDEX_TST); 36 36 IO2_INT_CLR |= (1<<10); 37 37 } … … 43 43 else if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ 44 44 { 45 handleMeterTick( 1);45 handleMeterTick(METER_INDEX_EL1); 46 46 IO2_INT_CLR |= (1<<1); 47 47 } 48 48 else if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ 49 49 { 50 handleMeterTick( 2);50 handleMeterTick(METER_INDEX_EL2); 51 51 IO2_INT_CLR |= (1<<2); 52 52 }