Skip to content

Commit

Permalink
RPLIDAR A1 debug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiaai committed Feb 5, 2024
1 parent af42cb8 commit 3452811
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions src/LDS_RPLIDAR_A1.cpp
Original file line number Diff line number Diff line change
@@ -118,37 +118,25 @@ void LDS_RPLIDAR_A1::markScanTime() {
LDS::result_t LDS_RPLIDAR_A1::waitScanDot() {

while (true) {

if (recvPos >= sizeof(node_info_t))
recvPos = 0;

int current_byte = readSerial();
if (current_byte < 0)
return ERROR_NOT_READY;

uint8_t test;
switch (recvPos) {
case 0:
test = ((current_byte >> 1) ^ current_byte) & 0x01;
if (!test) {
Serial.print(current_byte < 16 ? ".0" : ".");
Serial.print(current_byte, HEX);
continue;
}
break;
if (((current_byte >> 1) ^ current_byte) & 0x01)
break;
continue;
case 1:
test = current_byte & RESP_MEAS_CHECKBIT;
if (!test) {
recvPos = 0;
test = ((current_byte >> 1) ^ current_byte) & 0x01;
if (!test) {
Serial.print(current_byte < 16 ? ".0" : ".");
Serial.print(current_byte, HEX);
continue;
}
if (current_byte & RESP_MEAS_CHECKBIT)
break;
recvPos = 0;
if (((current_byte >> 1) ^ current_byte) & 0x01)
break;
}
break;
continue;
}

uint8_t *nodebuf = (uint8_t*)&node;

0 comments on commit 3452811

Please sign in to comment.