Teste Flash

Dependencies:   pulga-lorawan-drv Si1133 BME280

serial_cmds.cpp

Committer:
ruschigo
Date:
2021-03-02
Revision:
65:4090220e19d2
Parent:
64:ed68ddac6360
Child:
66:f40f985a6b97

File content as of revision 65:4090220e19d2:

#include "serial.h"


bool SerialCommandRun(const char *msg)
{
    char Option = msg[1]; /// recebo opcao
    
    switch (Option)
    {
    
    case CMD_PRINT_LAST_GPS:
        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;
        
    case CMD_SEND_HELLO:
        pc.printf("<hHello>");
        char hello[100] = "helloWord\n";
        int ret;
        ret = lora_send_message((uint8_t*)hello, (uint16_t)strlen(hello));
        if(ret > 0){
            pc.printf("Send OK\n");
        }
        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;
           
    }
    
    return true;
}