Changeset 47 for webserver

Show
Ignore:
Timestamp:
02/14/10 13:59:45 (15 years ago)
Author:
phil
Message:

- now three meter entries: TST, GAS, EL1, EL2
- added CurrentTime? to web page

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c

    r46 r47  
    223223generate_rtos_stats(void *arg) 
    224224{ 
     225 
     226        unsigned long long currentTime = getEpochTimeWithMs(); 
     227 
    225228        lRefreshCount++; 
    226229        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, 
     230Wattages %d %d %d %d\r\nSolarReadErr %d\r\nSolarReadCount %d\r\nCurrentTime %d\r\n", lRefreshCount, 
    228231         chanVolt[0], chanVolt[1], chanVolt[2], chanVolt[3], 
    229232         chanWatt[0], chanWatt[1], chanWatt[2], chanWatt[3], 
    230          solarReadErrors, solarReadCounter 
     233         solarReadErrors, solarReadCounter, currentTime 
    231234         ); 
    232235        //strcat( uip_appdata, cCountBuf ); 
     
    239242        //strcat( ( char * ) uip_appdata, ( char * ) "\r\n" ); 
    240243 
    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].valueBeforeLastTick 
    250          ); 
    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", 
    257260            meterItems[METER_INDEX_GAS].meterEnabled, 
    258261            (portLONG)(meterItems[METER_INDEX_GAS].timeLastTick << 32), 
     
    267270 
    268271        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 
    269305 
    270306        //strcat( ( char * ) uip_appdata, ( char * ) "1234test" ); 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c

    r46 r47  
    139139 
    140140  // 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? */ 
    147147 
    148148  // Init Gas meter 
     
    154154  meterItems[METER_INDEX_GAS].valueBeforeLastTick = 0;   /* what value did we have at the tick before the last tick? */ 
    155155 
     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 
    156174} 
  • webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h

    r46 r47  
    55#define NUMBER_OF_METERS 5 /* the number of meters we use */ 
    66 
    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 */ 
    811 
    9 #define METER_INDEX_GAS 1 /* index of the gas meter data */ 
     12 
     13 
    1014 
    1115#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  
    3333  if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ 
    3434  { 
    35     handleMeterTick(METER_INDEX_BUTTON); 
     35    handleMeterTick(METER_INDEX_TST); 
    3636    IO2_INT_CLR |= (1<<10); 
    3737  } 
     
    4343  else if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ 
    4444  { 
    45     handleMeterTick(1); 
     45    handleMeterTick(METER_INDEX_EL1); 
    4646    IO2_INT_CLR |= (1<<1); 
    4747  } 
    4848  else if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ 
    4949  { 
    50     handleMeterTick(2); 
     50    handleMeterTick(METER_INDEX_EL2); 
    5151    IO2_INT_CLR |= (1<<2); 
    5252  }