Changeset 78
- Timestamp:
- 11/02/10 16:36:57 (14 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h
r77 r78 3 3 4 4 void convert_uchar_to_2_byte_hexencoding(unsigned char inValue, unsigned char * outMSB, unsigned char * outLSB); 5 unsigned char convertSingleDigit(unsigned char inValue); 5 unsigned char convertSingleDigitHex(unsigned char inValue); 6 7 void convert_uchar_to_2_byte_decencoding(unsigned char inValue, unsigned char * outMSB, unsigned char * outLSB); 6 8 7 9 webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c
r77 r78 715 715 } 716 716 717 send_yield_query_hour(/* channel: */ currentChannel, /* hour: last hour */ checkHour );717 send_yield_query_hour(/* channel: */ currentChannel, /* hour: last hour */ checkHour-1 ); 718 718 xLastSolarStateChangeTime = xTaskGetTickCount(); 719 719 solarState = SOL_QUERY_LASTHOUR_YIELD_WAIT_REPLY; /* query next channel. change state: now wait for response */ … … 1370 1370 unsigned char newChkSum; 1371 1371 1372 req_day_yield[5] = 0x30 + channel; // channel 1372 req_day_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 1373 1373 1374 1374 … … 1394 1394 unsigned char hourLSB; 1395 1395 1396 req_hour_yield[5] = 0x30 + channel; // channel 1396 req_hour_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 1397 1397 1398 1398 … … 1422 1422 unsigned char minuteLSB; 1423 1423 1424 req_minute_yield[5] = 0x30 + channel; // channel 1424 req_minute_yield[5] = 0x30 + channel; // channel ( 0 to 5 ) 1425 1425 1426 1426 … … 1445 1445 { 1446 1446 1447 *outLSB = convertSingleDigit (inValue & 0xF);1448 *outMSB = convertSingleDigit (((inValue >> 4) & 0xF));1447 *outLSB = convertSingleDigitHex(inValue & 0xF); 1448 *outMSB = convertSingleDigitHex(((inValue >> 4) & 0xF)); 1449 1449 } 1450 1450 1451 unsigned char convertSingleDigit(unsigned char inValue) 1451 1452 void 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 1467 unsigned char convertSingleDigitHex(unsigned char inValue) 1452 1468 { 1453 1469 unsigned char retVal; … … 1511 1527 return retVal; 1512 1528 1513 } /* convertSingleDigit () */1529 } /* convertSingleDigitHex() */