tfsd

Dependencies:   Servo GroveGPS Cayenne-LPP driver_mbed_TH02

Revision:
47:b6d132f1079f
Parent:
46:a124538e2891
Child:
56:39847849d219
diff -r a124538e2891 -r b6d132f1079f main.cpp
--- a/main.cpp	Thu Jan 10 12:15:30 2019 +0000
+++ b/main.cpp	Sun Jan 27 21:45:34 2019 +0000
@@ -168,7 +168,7 @@
                          sensor_value);
 
     retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len,
-                           MSG_CONFIRMED_FLAG);
+                           MSG_UNCONFIRMED_FLAG);
 
     if (retcode < 0) {
         retcode == LORAWAN_STATUS_WOULD_BLOCK ? printf("send - WOULD BLOCK\r\n")
@@ -192,24 +192,21 @@
  */
 static void receive_message()
 {
-    int16_t retcode;
-    retcode = lorawan.receive(MBED_CONF_LORA_APP_PORT, rx_buffer,
-                              sizeof(rx_buffer),
-                              MSG_CONFIRMED_FLAG | MSG_UNCONFIRMED_FLAG);
+    uint8_t port;
+    int flags;
+    int16_t retcode = lorawan.receive(rx_buffer, sizeof(rx_buffer), port, flags);
 
     if (retcode < 0) {
         printf("\r\n receive() - Error code %d \r\n", retcode);
         return;
     }
 
-    printf(" Data:");
-
+    printf(" RX Data on port %u (%d bytes): ", port, retcode);
     for (uint8_t i = 0; i < retcode; i++) {
-        printf("%x", rx_buffer[i]);
+        printf("%02x ", rx_buffer[i]);
     }
-
-    printf("\r\n Data Length: %d\r\n", retcode);
-
+    printf("\r\n");
+    
     memset(rx_buffer, 0, sizeof(rx_buffer));
 }