Skip to content

Commit

Permalink
Fix compile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitschpatrol committed Jan 18, 2014
1 parent eadc1ea commit aee6ff1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Brain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ void Brain::init() {
inPacket = false;
packetIndex = 0;
packetLength = 0;
checksum = 0;
checksumAccumulator = 0;
eegPowerLength = 0;
hasPower = false;

checksum = 0;
checksumAccumulator = 0;

signalQuality = 200;
attention = 0;
meditation = 0;
Expand All @@ -43,7 +43,7 @@ boolean Brain::update() {
if (packetLength > MAX_PACKET_LENGTH) {
// Packet exceeded max length
// Send an error
sprintf(latestError, "ERROR: Packet too long");
sprintf(latestError, "ERROR: Packet too long %i", packetLength);
inPacket = false;
}
}
Expand Down Expand Up @@ -97,8 +97,6 @@ boolean Brain::update() {
// Start of packet
inPacket = true;
packetIndex = 0;
packetLength = 0; // Technically not necessarry.
checksum = 0; // Technically not necessary.
checksumAccumulator = 0;
}

Expand Down Expand Up @@ -135,6 +133,8 @@ boolean Brain::parsePacket() {
// Returns true if passing succeeds
hasPower = false;
boolean parseSuccess = true;
int rawValue = 0;

clearEegPower(); // clear the eeg power to make sure we're honest about missing values

for (uint8_t i = 0; i < packetLength; i++) {
Expand Down Expand Up @@ -167,7 +167,7 @@ boolean Brain::parsePacket() {
// We dont' use this value so let's skip it and just increment i
// uint8_t packetLength = packetData[++i];
i++;
int checksum = ((int)packetData[++i] << 8) | packetData[++i];
rawValue = ((int)packetData[++i] << 8) | packetData[++i];
break;
default:
// Broken packet ?
Expand Down

0 comments on commit aee6ff1

Please sign in to comment.