Skip to content

Commit

Permalink
Bulk processing incoming serial from ZED.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseidle committed Jun 12, 2023
1 parent 6d04c5a commit 3202cc5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ uint8_t *ringBuffer; // Buffer for reading from F9P. At 230400bps, 23040 bytes/s
// * 0.25 = 5760 bytes worst case.
TaskHandle_t gnssReadTaskHandle =
nullptr; // Store handles so that we can kill them if user goes into WiFi NTRIP Server mode
const int gnssReadTaskStackSize = 2000;
const int gnssReadTaskStackSize = 2500;

TaskHandle_t handleGnssDataTaskHandle = nullptr;
const int handleGnssDataTaskStackSize = 3000;
Expand Down
26 changes: 15 additions & 11 deletions Firmware/RTK_Surveyor/Tasks.ino
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,22 @@ void gnssReadTask(void *e)
while (serialGNSS.available())
{
// Read the data from UART1
incomingData = serialGNSS.read();
uint8_t incomingData[500];
int bytesIncoming = serialGNSS.read(incomingData, sizeof(incomingData));

// Save the data byte
parse.buffer[parse.length++] = incomingData;
parse.length %= PARSE_BUFFER_LENGTH;
for (int x = 0; x < bytesIncoming; x++)
{
// Save the data byte
parse.buffer[parse.length++] = incomingData[x];
parse.length %= PARSE_BUFFER_LENGTH;

// Compute the CRC value for the message
if (parse.computeCrc)
parse.crc = COMPUTE_CRC24Q(&parse, incomingData);
// Compute the CRC value for the message
if (parse.computeCrc)
parse.crc = COMPUTE_CRC24Q(&parse, incomingData[x]);

// Update the parser state based on the incoming byte
parse.state(&parse, incomingData);
// Update the parser state based on the incoming byte
parse.state(&parse, incomingData[x]);
}
}
}
else // SPI GNSS
Expand Down Expand Up @@ -663,8 +667,8 @@ void ButtonCheckTask(void *e)
if (millis() - lastRockerSwitchChange < 500)
{
if (systemState == STATE_ROVER_NOT_STARTED && online.display == true) // Catch during Power On
requestChangeState(STATE_TEST); // If RTK Surveyor, with display attached, during Rover not
// started, then enter test mode
requestChangeState(STATE_TEST); // If RTK Surveyor, with display attached, during Rover not
// started, then enter test mode
else
requestChangeState(STATE_WIFI_CONFIG_NOT_STARTED);
}
Expand Down

0 comments on commit 3202cc5

Please sign in to comment.