Skip to content

Commit

Permalink
Serial debug in example
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiaai authored May 11, 2024
1 parent e7b632d commit aac74e6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions examples/lds_basic_esp32/lds_basic_esp32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,23 @@ void setup() {
}

int lidar_serial_read_callback() {
return LidarSerial.read();
int c = LidarSerial.read();
// Uncomment below for debug
/*
if (c < 0)
return c;
if (c < 16)
Serial.print('0');
Serial.print(c, HEX);
static int i=0;
if (i++ % 16 == 0)
Serial.println();
else
Serial.print(' ');
*/
return c;
}

size_t lidar_serial_write_callback(const uint8_t * buffer, size_t length) {
Expand Down Expand Up @@ -132,4 +148,4 @@ void lidar_packet_callback(uint8_t * packet, uint16_t length, bool scan_complete

void loop() {
lidar.loop();
}
}

0 comments on commit aac74e6

Please sign in to comment.