Skip to content

Commit

Permalink
Added checks for incoming info. Hopefully fixes the incorrect values …
Browse files Browse the repository at this point in the history
…at the beginning of a day
  • Loading branch information
Jan ten Hove committed Jul 1, 2017
1 parent 7219a54 commit 28dfab7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions GoodWeCommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ void GoodWeCommunicator::parseIncomingData(char incomingDataLength) //
//check the contorl code and function code to see what to do
if (inputBuffer[2] == 0x00 && inputBuffer[3] == 0x80)
handleRegistration(inputBuffer + 5, 16);
if (inputBuffer[2] == 0x00 && inputBuffer[3] == 0x81)
else if (inputBuffer[2] == 0x00 && inputBuffer[3] == 0x81)
handleRegistrationConfirmation(inputBuffer[0]);
if (inputBuffer[2] == 0x01 && inputBuffer[3] == 0x81)
else if (inputBuffer[2] == 0x01 && inputBuffer[3] == 0x81)
handleIncomingInformation(inputBuffer[0], inputBuffer[4], inputBuffer + 5);
}

Expand Down Expand Up @@ -305,13 +305,16 @@ void GoodWeCommunicator::handleRegistrationConfirmation(char address)
askInverterForInformation(address);
}

void GoodWeCommunicator::handleIncomingInformation(char address, char dataLengthh, char * data)
void GoodWeCommunicator::handleIncomingInformation(char address, char dataLength, char * data)
{
//need to parse the information and update our struct
//parse all pairs of two bytes and output them
auto inverter = getInverterInfoByAddress(address);
if (inverter == nullptr) return;

if (dataLength < 44) //minimum for non dt series
return;

//data from iniverter, means online
inverter->lastSeen = millis();
char dtPtr = 0;
Expand Down

0 comments on commit 28dfab7

Please sign in to comment.