Skip to content

Commit e8d68dc

Browse files
committed
debug: rpc raw_buffer print helper
1 parent 29b8f1f commit e8d68dc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/Arduino_RPClite.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "Arduino.h"
99

1010
//#define HANDLE_RPC_ERRORS
11+
//#define DEBUG
1112
#include "rpc.h"
1213
#include "transport.h"
1314
#include "client.h"

src/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class RPCClient {
7171
MsgPack::arr_size_t resp_size;
7272

7373
if (!unpacker.deserialize(resp_size, r_msg_type, r_msg_id)){
74-
Serial.println("malformed response");
74+
Serial.println("incomplete or malformed response");
7575
continue;
7676
};
7777

src/rpc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@
1919
uint8_t raw_buffer[MAX_BUFFER_SIZE] = {0};
2020
size_t raw_buffer_fill = 0;
2121

22+
23+
#ifdef DEBUG
24+
25+
void print_raw_buf(){
26+
27+
Serial.print("RPC buffer content");
28+
for (size_t i=0; i<raw_buffer_fill; i++) {
29+
Serial.print(raw_buffer[i]);
30+
Serial.print(" ");
31+
}
32+
Serial.println(" ");
33+
34+
}
35+
36+
#endif
37+
2238
inline void flush_buffer(){
2339
raw_buffer_fill = 0;
2440
}

0 commit comments

Comments
 (0)