Show
Ignore:
Timestamp:
10/19/10 20:56:18 (14 years ago)
Author:
phil
Message:

- changed DAY output on webpage to one line
- added checksum check for daily values
- output for invalid DAY values (or checksum error) is now 65535
- corrected previous day-of-month calculation in case of day 1

Files:

Legend:

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

    r70 r71  
    2121  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;Demo Source" name="unnamed" /> 
    2222  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;EnergyMeters" name="unnamed" /> 
    23   <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;FreeRTOS.org Source" name="unnamed" /> 
    24   <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;uIP Source" name="unnamed" /> 
    2523 </Project> 
    2624 <Register1> 
     
    4240 <Watch1> 
    4341  <Watches active="0" update="Three Seconds" > 
     42   <Watchpoint evalMode="2" linenumber="312" numelements="10" evalType="0" radix="16" name="rxUART3" expression="rxUART3" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     43   <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
     44   <Watchpoint linenumber="547" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    4445   <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    45    <Watchpoint linenumber="547" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    46    <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    47    <Watchpoint evalMode="2" linenumber="312" numelements="10" evalType="0" radix="16" name="rxUART3" expression="rxUART3" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    4846  </Watches> 
    4947 </Watch1> 
     
    5856 <Watch4> 
    5957  <Watches active="1" update="Twice a Second" > 
    60    <Watchpoint evalMode="2" linenumber="679" numelements="21" evalType="0" radix="-1" name="yield_day_rsp" expression="yield_day_rsp" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    61    <Watchpoint evalMode="2" linenumber="668" numelements="6" evalType="0" radix="16" name="dayRxYield" expression="dayRxYield" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    62    <Watchpoint evalMode="2" linenumber="669" numelements="100" evalType="0" radix="-1" name="rxUART3" expression="rxUART3" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     58   <Watchpoint evalMode="2" linenumber="677" numelements="6" evalType="0" radix="16" name="dayRxYield" expression="dayRxYield" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     59   <Watchpoint evalMode="2" linenumber="678" numelements="100" evalType="0" radix="-1" name="rxUART3" expression="rxUART3" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     60   <Watchpoint evalMode="2" linenumber="699" numelements="21" evalType="0" radix="-1" name="yield_day_rsp" expression="yield_day_rsp" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     61   <Watchpoint linenumber="667" radix="16" name="rxYieldChkSum" expression="rxYieldChkSum" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    6362  </Watches> 
    6463 </Watch4> 
    6564 <Files> 
    66   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="40" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="612" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="1" name="unnamed" top="592" /> 
    67   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="29" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" y="36" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" left="0" selected="0" name="unnamed" top="51" /> 
    68   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="115" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="0" name="unnamed" top="99" /> 
     65  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="662" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="0" name="unnamed" top="637" /> 
     66  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" y="36" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" left="0" selected="0" name="unnamed" top="11" /> 
     67  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="115" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="1" name="unnamed" top="99" /> 
    6968  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" y="216" path="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" left="0" selected="0" name="unnamed" top="195" /> 
    7069  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\queue.c" y="799" path="D:\repo\webserver\example\EnergyMeters\Source\queue.c" left="0" selected="0" name="unnamed" top="781" /> 
    7170  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" y="1128" path="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" left="0" selected="0" name="unnamed" top="1104" /> 
    72   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="21" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" y="286" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" left="0" selected="0" name="unnamed" top="278" /> 
     71  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" y="287" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" left="0" selected="0" name="unnamed" top="269" /> 
    7372 </Files> 
    7473 <ARMCrossStudioWindow activeProject="EnergyMetersEmbedded" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388479" debugSearchPath="" buildConfiguration="ARM Flash Debug" /> 
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c

    r70 r71  
    285285      } /* for */ 
    286286 
    287       for (i = 0; i < NUMBER_OF_SOLAR_CHANNELS; i++) 
    288       { 
    289          sprintf( cCountBuf, "DAY %u %u\n", (int)i, dayRxYield[i] ); 
    290          strcat( uip_appdata, cCountBuf ); 
    291       } 
    292  
     287 
     288      sprintf( cCountBuf, "DAY %u %u %u\n", dayRxYield[0], dayRxYield[1], dayRxYield[2] ); 
    293289      strcat( uip_appdata, cCountBuf ); 
     290 
    294291 
    295292 
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r70 r71  
    270270  for (i = 0; i < NUMBER_OF_SOLAR_CHANNELS; i++) 
    271271  { 
    272       dayRxYield[i] = 0; 
     272      dayRxYield[i] = 65535; /* default: invalid/unset value */ 
    273273  } /* for */ 
    274274 
     
    450450  unsigned char power; /* variable for conversions */ 
    451451  unsigned char checkDate; /* temp variable for day of month */ 
    452  
     452  unsigned char rxYieldChkSum; /* temp checksum for rx yield */ 
    453453 
    454454  /* always get Rx data */ 
     
    616616            else if  
    617617                 ((scDate[1] == 1) || 
    618                  (scDate[1] == 5) || 
    619                  (scDate[1] == 7) || 
    620                  (scDate[1] == 8) || 
    621                  (scDate[1] == 10) || 
    622                  (scDate[1] == 12)) 
     618                 (scDate[1] == 1+1) || 
     619                 (scDate[1] == 3+1) || 
     620                 (scDate[1] == 5+1) || 
     621                 (scDate[1] == 7+1) || 
     622                 (scDate[1] == 8+1) || 
     623                 (scDate[1] == 10+1)) 
    623624                 {  
    624625                    checkDate = 31; 
     
    660661      if (cmpResult == 0) 
    661662      { 
    662         /* we have got a match! */ 
    663         
    664           if (currentChannel <= 5) 
     663          /* we have got a match (i.e. expected frame received) ! */ 
     664           
     665          /* calculate the checksum of the received data */ 
     666 
     667          rxYieldChkSum = calculate_crc8(  (&(rxUART3[0])), (sizeof(yield_day_rsp)-2)); 
     668 
     669          if (rxYieldChkSum == rxUART3[17]) 
    665670          { 
    666  
    667  
    668               dayRxYield[currentChannel] = 
    669                 extractBinaryHexDigitString( &(rxUART3[0]), 13, 16 ); 
    670  
    671           } /* if */ 
     671            /* checksum is correct! */ 
     672 
     673            if (currentChannel <= 5) 
     674            { 
     675   
     676                /* convert and copy value */ 
     677                dayRxYield[currentChannel] = 
     678                  extractBinaryHexDigitString( &(rxUART3[0]), 13, 16 ); 
     679   
     680            } /* if */ 
     681            else 
     682            { 
     683              /* all channels done. nothing to do, we leave via SOL_QUERY_YIELD */ 
     684            } 
     685          } 
     686          else if (currentChannel <= 5) 
     687          { 
     688            /* valid channel index. but checksum is incorrect ! */ 
     689            dayRxYield[currentChannel] = 65535; /* invalid value */ 
     690          } 
    672691          else 
    673692          { 
    674             /* all channels done. nothing to do, we leave via SOL_QUERY_YIELD */ 
     693            /* checksum incorrect and channel index out of range. do nothing. */ 
    675694          } 
    676695 
     696          /* always move on to the next value... */ 
    677697 
    678698          currentChannel++; /* increment channel counter so we query the next channel in the next round */