Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: pulga-lorawan-drv SPI_MX25R Si1133 BME280
Revision 65:4090220e19d2, committed 2021-03-02
- Comitter:
- ruschigo
- Date:
- Tue Mar 02 18:22:16 2021 +0000
- Parent:
- 64:ed68ddac6360
- Commit message:
- Test ok
Changed in this revision
--- a/gps.cpp Tue Mar 02 16:57:31 2021 +0000
+++ b/gps.cpp Tue Mar 02 18:22:16 2021 +0000
@@ -21,7 +21,7 @@
wait_ms(5);
cont++;
if (cont > 100){
- printf("\n no response \n");
+ pc.printf("\n no response \n");
return;
}
}
@@ -34,7 +34,7 @@
}
else {
//lora_send_packet (packet , (uint8_t) packet_size+1); // manda atraves do lora a mensagem de boot do gps
- printf("Boot msg: %s \n", packet);
+ pc.printf("Boot msg: %s \n", packet);
return;
}
@@ -585,7 +585,7 @@
0x00, 0x00 //checksums A & B
};
uint8_t pos_ck = sizeof(packet_cfg_gnss)-2;
- printf("gnss config finish");
+ pc.printf("gnss config finish");
uint8_t ubxi;
//calcula checksum
for (ubxi=2; ubxi<pos_ck ; ubxi++) {
--- a/gps.h Tue Mar 02 16:57:31 2021 +0000 +++ b/gps.h Tue Mar 02 18:22:16 2021 +0000 @@ -3,6 +3,7 @@ #define __GPS_H #include "mbed.h" +#include "serial.h" #define SYNC1 0xB5 #define SYNC2 0x62
--- a/lora_radio.cpp Tue Mar 02 16:57:31 2021 +0000
+++ b/lora_radio.cpp Tue Mar 02 18:22:16 2021 +0000
@@ -81,22 +81,9 @@
int lora_send_message(uint8_t *msg_to_transmit, uint16_t packet_len)
{
int16_t retcode;
- int32_t sensor_value;
retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, msg_to_transmit, packet_len,MSG_UNCONFIRMED_FLAG);
- if (retcode < 0) {
- /*retcode == LORAWAN_STATUS_WOULD_BLOCK ? PrintDebugMsg("send - WOULD BLOCK\r\n")
- : PrintDebugMsg("\r\n send() Error \r\n");
- */
- /*if (retcode == LORAWAN_STATUS_WOULD_BLOCK) {
- //retry in 3 seconds
- if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
- ev_queue.call_in(10000, send_message);
- }
- }*/
-
- }
return (int)retcode;
}
--- a/lora_radio.h Tue Mar 02 16:57:31 2021 +0000 +++ b/lora_radio.h Tue Mar 02 18:22:16 2021 +0000 @@ -24,6 +24,7 @@ #include "lorawan/LoRaWANInterface.h" #include "lorawan/system/lorawan_data_structures.h" +#include "serial.h" //#include "lora_radio_helper.h"
--- a/main.cpp Tue Mar 02 16:57:31 2021 +0000
+++ b/main.cpp Tue Mar 02 18:22:16 2021 +0000
@@ -110,8 +110,8 @@
* Entry point for application
*/
-//mbed::DigitalOut _alive_led(P1_13, 0);
-//mbed::DigitalOut _actuated_led(P1_14,1);
+mbed::DigitalOut _alive_led(P1_13, 0);
+mbed::DigitalOut _actuated_led(P1_14,1);
//int lat=0;
//int lon=0;
int latitude=0;
@@ -323,7 +323,8 @@
pc.printf("\r\n Connection - In Progress ...\r\n");
- //_actuated_led =0;
+ _actuated_led =0;
+
//
// make your event queue dispatching events forever
ev_queue.dispatch_forever();
@@ -402,7 +403,7 @@
pc.printf("\r\n Connection - Successful \r\n");
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
//send_message();
- lora_send_message((uint8_t*)"testeLora", (uint16_t)10);
+ //lora_send_message((uint8_t*)"testeLora", (uint16_t)10);
} //else {
//ev_queue.call_every(TX_TIMER, (void)lora_send_message((uint8_t*)"testeLoraEvery", (uint16_t)15));
//}
@@ -415,7 +416,7 @@
case TX_DONE:
// printf("\r\n Message Sent to Network Server \r\n");
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
- lora_send_message((uint8_t*)"teste", (uint16_t)6);
+ //lora_send_message((uint8_t*)"teste", (uint16_t)6);
}
break;
case TX_TIMEOUT:
@@ -431,7 +432,7 @@
// printf("\r\n Transmission Error - EventCode = %d \r\n", event);
// try again
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
- lora_send_message((uint8_t*)"teste2", (uint16_t)7);
+ //lora_send_message((uint8_t*)"teste2", (uint16_t)7);
}
break;
case RX_DONE:
@@ -450,7 +451,7 @@
case UPLINK_REQUIRED:
// printf("\r\n Uplink required by NS \r\n");
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
- lora_send_message((uint8_t*)"uplink", (uint16_t)7);
+ //lora_send_message((uint8_t*)"uplink", (uint16_t)7);
}
break;
default:
--- a/serial_cmds.cpp Tue Mar 02 16:57:31 2021 +0000
+++ b/serial_cmds.cpp Tue Mar 02 18:22:16 2021 +0000
@@ -16,15 +16,21 @@
break;
case CMD_SEND_HELLO:
- pc.printf("<hHELLOANTONIO>");
- char hello[100] = "Ola Antonio!\n";
+ pc.printf("<hHello>");
+ char hello[100] = "helloWord\n";
int ret;
- ret = lora_send_message((uint8_t*)hello, (uint16_t)sizeof(hello));
- if(ret > 0)
+ ret = lora_send_message((uint8_t*)hello, (uint16_t)strlen(hello));
+ if(ret > 0){
pc.printf("Send OK\n");
- else
+ }
+ else{
+ ret == 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;
}