Changeset 71 for webserver/example/EnergyMeters/Source
- Timestamp:
- 10/19/10 20:56:18 (14 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c
r70 r71 270 270 for (i = 0; i < NUMBER_OF_SOLAR_CHANNELS; i++) 271 271 { 272 dayRxYield[i] = 0;272 dayRxYield[i] = 65535; /* default: invalid/unset value */ 273 273 } /* for */ 274 274 … … 450 450 unsigned char power; /* variable for conversions */ 451 451 unsigned char checkDate; /* temp variable for day of month */ 452 452 unsigned char rxYieldChkSum; /* temp checksum for rx yield */ 453 453 454 454 /* always get Rx data */ … … 616 616 else if 617 617 ((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)) 623 624 { 624 625 checkDate = 31; … … 660 661 if (cmpResult == 0) 661 662 { 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]) 665 670 { 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 } 672 691 else 673 692 { 674 /* all channels done. nothing to do, we leave via SOL_QUERY_YIELD*/693 /* checksum incorrect and channel index out of range. do nothing. */ 675 694 } 676 695 696 /* always move on to the next value... */ 677 697 678 698 currentChannel++; /* increment channel counter so we query the next channel in the next round */