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/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  }