Debug Serial para programa resetar o buffer quando houver tamanhos errados na mensagem
Dependencies: pulga-lorawan-drv PingPong-P2P-ClickButtonToWork-SX1272
Diff: serial_cmds.cpp
- Revision:
- 10:f6ff8ec221ec
- Parent:
- 9:cf555a570349
- Child:
- 11:9ee88f11ed06
--- a/serial_cmds.cpp Wed Mar 31 13:04:22 2021 +0000 +++ b/serial_cmds.cpp Mon Apr 12 19:51:51 2021 +0000 @@ -1,14 +1,19 @@ #include "serial.h" - - bool SerialCommandRun(const char *msg) { char Option = msg[1]; /// recebo opcao switch (Option) { - + case CMD_PRINT_GPS: + { + gps_navPVT gps_data; + gps_data = get_struct(); + pc.printf("<g%d,%d>\n", (int)gps_data.lat, (int)gps_data.lon); + pc.printf("<t%d/%d/%d-%d:%d:%d>\n", (int)gps_data.year, (int)gps_data.month,(int)gps_data.day, (int)gps_data.hour, (int)gps_data.min, (int)gps_data.sec); + + break;} case CMD_SEND_HELLO: { @@ -17,8 +22,14 @@ case CMD_SEND_LORA_P2P: { - pc.printf("<p %s>", msg+2); + char *temp; + gps_navPVT gps_data; + gps_data = get_struct(); + pc.printf("<p%s>", msg+2); + //sprintf((char*) temp ,"<t%d/%d/%d-%d:%d:%d>\n", (int)gps_data.year, (int)gps_data.month,(int)gps_data.day, (int)gps_data.hour, (int)gps_data.min, (int)gps_data.sec); + //pc.printf(temp); send_msg((char*)(msg + 2)); + //send_msg((char*)temp); break;} }