Changeset 78

Show
Ignore:
Timestamp:
11/02/10 16:36:57 (14 years ago)
Author:
phil
Message:

- hour query gets now read hour - 1
- renamed convertSingleDigit to convertSingleDigitHex
- intdoduced convert_uchar_to_2_byte_decencoding (not used!)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h

    r77 r78  
    33 
    44void convert_uchar_to_2_byte_hexencoding(unsigned char inValue, unsigned char * outMSB, unsigned char * outLSB); 
    5 unsigned char convertSingleDigit(unsigned char inValue); 
     5unsigned char convertSingleDigitHex(unsigned char inValue); 
     6 
     7void convert_uchar_to_2_byte_decencoding(unsigned char inValue, unsigned char * outMSB, unsigned char * outLSB); 
    68 
    79 
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r77 r78  
    715715          } 
    716716 
    717           send_yield_query_hour(/* channel: */ currentChannel, /* hour: last hour */ checkHour ); 
     717          send_yield_query_hour(/* channel: */ currentChannel, /* hour: last hour */ checkHour-1 ); 
    718718          xLastSolarStateChangeTime = xTaskGetTickCount(); 
    719719          solarState = SOL_QUERY_LASTHOUR_YIELD_WAIT_REPLY; /* query next channel. change state: now wait for response */ 
     
    13701370        unsigned char newChkSum; 
    13711371 
    1372         req_day_yield[5] = 0x30 + channel; // channel 
     1372        req_day_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 
    13731373 
    13741374 
     
    13941394        unsigned char hourLSB; 
    13951395 
    1396         req_hour_yield[5] = 0x30 + channel; // channel 
     1396        req_hour_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 
    13971397 
    13981398 
     
    14221422        unsigned char minuteLSB; 
    14231423 
    1424         req_minute_yield[5] = 0x30 + channel; // channel 
     1424        req_minute_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 
    14251425 
    14261426      
     
    14451445{ 
    14461446 
    1447   *outLSB = convertSingleDigit(inValue & 0xF); 
    1448   *outMSB = convertSingleDigit(((inValue >> 4) & 0xF)); 
     1447  *outLSB = convertSingleDigitHex(inValue & 0xF); 
     1448  *outMSB = convertSingleDigitHex(((inValue >> 4) & 0xF)); 
    14491449} 
    14501450 
    1451 unsigned char convertSingleDigit(unsigned char inValue) 
     1451 
     1452void convert_uchar_to_2_byte_decencoding(unsigned char inValue, unsigned char * outMSB, unsigned char * outLSB) 
     1453
     1454 
     1455  unsigned char msb; 
     1456  unsigned char lsb; 
     1457 
     1458  lsb = (inValue % 10); /* remainder of division by 10 */ 
     1459  msb = (inValue - lsb) / 10; 
     1460 
     1461  /* now convert to ASCII chars */ 
     1462  *outLSB = 0x30 + lsb; 
     1463  *outMSB = 0x30 + msb; 
     1464
     1465 
     1466 
     1467unsigned char convertSingleDigitHex(unsigned char inValue) 
    14521468{ 
    14531469  unsigned char retVal; 
     
    15111527  return retVal; 
    15121528 
    1513 } /* convertSingleDigit() */ 
     1529} /* convertSingleDigitHex() */