Show
Ignore:
Timestamp:
08/14/09 23:28:59 (15 years ago)
Author:
phil
Message:

completed the gas meter calculation algorithm

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs

    r31 r32  
    1919  <ProjectSessionItem path="EnergyMetersEmbedded" name="unnamed" /> 
    2020  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded" name="unnamed" /> 
     21  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;Demo Source" name="unnamed" /> 
    2122  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;EnergyMeters" name="unnamed" /> 
    2223 </Project> 
     
    3839 </TraceWindow> 
    3940 <Watch1> 
    40   <Watches active="1" update="Never" > 
     41  <Watches active="1" update="Three Seconds" > 
     42   <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    4143   <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    42    <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="-1" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    4344  </Watches> 
    4445 </Watch1> 
     
    5859 <Files> 
    5960  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\Source\EnergyMeters\Meters.c" y="122" path="D:\EnergyMetersProject\Source\EnergyMeters\Meters.c" left="0" selected="0" name="unnamed" top="122" /> 
    60   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="113" path="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="0" name="unnamed" top="101" /> 
    61   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\Source\EnergyMeters\Meters_ISRs.c" y="89" path="D:\EnergyMetersProject\Source\EnergyMeters\Meters_ISRs.c" left="0" selected="1" name="unnamed" top="66" /> 
     61  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="113" path="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="1" name="unnamed" top="129" /> 
     62  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\Source\EnergyMeters\Meters_ISRs.c" y="71" path="D:\EnergyMetersProject\Source\EnergyMeters\Meters_ISRs.c" left="0" selected="0" name="unnamed" top="69" /> 
    6263  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\energymetersproject\source\energymeters\timeConversion.c" y="18" path="D:\energymetersproject\source\energymeters\timeConversion.c" left="0" selected="0" name="unnamed" top="18" /> 
    63   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\energymetersproject\source\energymeters\MetersIncludes.h" y="8" path="D:\energymetersproject\source\energymeters\MetersIncludes.h" left="0" selected="0" name="unnamed" top="8" /> 
     64  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\energymetersproject\source\energymeters\MetersIncludes.h" y="8" path="D:\energymetersproject\source\energymeters\MetersIncludes.h" left="0" selected="0" name="unnamed" top="0" /> 
    6465  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" y="0" path="D:\EnergyMetersProject\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" left="0" selected="0" name="unnamed" top="0" /> 
    6566 </Files> 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c

    r30 r32  
    7070     * enough on the web page to be read by the server  
    7171     */ 
    72     if ( currentTime > ((unsigned long long)meterItems[METER_INDEX_GAS].timeLastTick + ((unsigned long long)ACCUMULATE_TICK_THRESHOLD_SEC * (unsigned long long)1000)) ) 
     72    if ( currentTime > ((unsigned long long)meterItems[METER_INDEX_GAS].timeBeforeLastTick + ((unsigned long long)ACCUMULATE_TICK_THRESHOLD_SEC * (unsigned long long)1000)) ) 
    7373    { 
    74       /* if the last meter tick happened longer than DEBOUNCE_TICK_THRESHOLD_MS ago (i.e. the switch did not just bounce) */ 
     74      /* if the last meter tick happened longer than DEBOUNCE_TICK_THRESHOLD_MS ago (i.e. the switch did not just bounce), 
     75       * we create a new data item 
     76       */ 
    7577      meterItems[METER_INDEX_GAS].timeBeforeLastTick = meterItems[METER_INDEX_GAS].timeLastTick;     /* when did the tick before the last tick occur? (epoch in milliseconds) */ 
    7678      meterItems[METER_INDEX_GAS].timeLastTick = currentTime; /* when did the last tick occur? (epoch in milliseconds) */ 
     
    8183    else 
    8284    { 
    83       ; /* nothing to do, curentValue was increased already above */ 
     85      /* do not create a new data item, but update the current "last" data item */ 
     86      meterItems[METER_INDEX_GAS].timeLastTick = currentTime; 
     87      meterItems[METER_INDEX_GAS].valueLastTick = meterItems[METER_INDEX_GAS].currentValue; 
    8488    } 
    8589  }