Teste Flash

Dependencies:   pulga-lorawan-drv Si1133 BME280

Revision:
66:f40f985a6b97
Parent:
65:4090220e19d2
Child:
67:17addc7bf8c2
--- a/serial_cmds.cpp	Tue Mar 02 18:22:16 2021 +0000
+++ b/serial_cmds.cpp	Wed Mar 10 13:40:55 2021 +0000
@@ -9,14 +9,14 @@
     {
     
     case CMD_PRINT_LAST_GPS:
-        int local_lat, local_log;
+        {int local_lat, local_log;
         //gps_get_lat_lon(&local_lat, &local_log);
         //get_latitude
         pc.printf("<g%d,%d\n>", get_latitude(), get_longitude());
-        break;
+        break;}
         
     case CMD_SEND_HELLO:
-        pc.printf("<hHello>");
+        {pc.printf("<hHello>");
         char hello[100] = "helloWord\n";
         int ret;
         ret = lora_send_message((uint8_t*)hello, (uint16_t)strlen(hello));
@@ -31,8 +31,25 @@
                     //ev_queue.call_in(10000, send_message);
             pc.printf("Fail to Send\n");
         }
-        break;
-           
+        break;}
+    case CMD_SEND_LORAWAN_NO_RETRANS:
+        {pc.printf("<w %s>", msg[+2]);
+        char msg_lora [32]; 
+        strncpy(msg_lora, msg+2, strlen(msg)); //original string, begin index (2), substring length
+        int ret1;
+        ret1 = lora_send_message((uint8_t*)msg_lora, (uint16_t)strlen(msg_lora));
+        if(ret1 > 0){
+            pc.printf("Send OK\n");
+        }
+        else{
+            ret1 == LORAWAN_STATUS_WOULD_BLOCK ? pc.printf("send - WOULD BLOCK\r\n") : pc.printf("\r\n send() Error  \r\n");
+            //if (ret == LORAWAN_STATUS_WOULD_BLOCK) {
+            //retry in 3 seconds
+                //if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
+                    //ev_queue.call_in(10000, send_message);
+            pc.printf("Fail to Send\n");
+        }
+        break;}
     }
     
     return true;