Changeset 75 for webserver

Show
Ignore:
Timestamp:
10/24/10 11:38:27 (14 years ago)
Author:
phil
Message:

corrected hour yield query data encoding (binary coded hex for hour query)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r74 r75  
    14031403        req_hour_yield[5] = 0x30 + channel; // channel 
    14041404 
    1405       
    1406         hourMSB = hour % 16; 
    1407         hourLSB = hour - hourMSB; 
     1405        if (hour >= 0x10) /* >= 16 */ 
     1406        { 
     1407          hourMSB = 1; 
     1408        } 
     1409        else 
     1410        { 
     1411          hourMSB = 0; 
     1412        } 
     1413        hourLSB = hour - (hourMSB * 0x10); 
     1414 
     1415        if (hourLSB <= 9) 
     1416        { 
     1417           req_hour_yield[9] = 0x30 + hourLSB; // minute LSB (binary coded hex) 
     1418        } 
     1419        else 
     1420        { 
     1421           req_hour_yield[9] = 0x40 + hourLSB - 0xA; // minute LSB (binary coded hex, 0xA --> 0x40, 0xF -> 0x45) 
     1422        } 
    14081423         
    1409         req_hour_yield[8] = 0x30 + hourMSB; // minute MSB (binary coded hex)  
    1410         req_hour_yield[9] = 0x30 + hourLSB; // minute LSB (binary coded hex) 
     1424        req_hour_yield[8] = 0x30 + hourMSB; // minute MSB (binary coded hex), 30 or 31 here.  
     1425 
    14111426 
    14121427        newChkSum = calculate_crc8(  (&(req_hour_yield[0])), (sizeof(req_hour_yield)-1));