So right off the bat, I’m aware that calling the At_Parser function in code is probably not advised for various reasons. Having said that I thought I would ask for help anyway.
I have modified the downlink callback to call the At_Parser function if an AT command is send as a downlink (I can send the series of characters “AT+CLASS=?” for example and it will run that AT command).
/**
* @brief Handler for downlink AT commands
*
* @param data
*/
void handleDownlinkATCommand(const SERVICE_LORA_RECEIVE_T *data)
{
if (strstr((char *)data->Buffer, "ATZ") != NULL)
{
api.system.reboot();
}
else if (strstr((char *)data->Buffer, "AT+") != NULL || strstr((char *)data->Buffer, "ATC+") != NULL)
{
uint8_t nRet = At_Parser(SERIAL_UART1, (char *)data->Buffer, data->BufferSize);
CHARBUFFERLOG("AT", data->Buffer, data->BufferSize);
MYLOG("AT", "Buffer Size: %d, nRet: %d", data->BufferSize, nRet);
}
}
For the first ~30min after the device is turned on this works fine, but after that I get an AT_PARAM_ERROR no matter the command. If I run AT commands locally (over serial) I do not have an issue. I know that the command and command length I am inputting into the function are correct.
I have tried to look through function code and believe it is occurring at a number of places where the nRet value is set to AT_PARAM_ERROR, however I’m unsure why the exact same commands work over serial.
Any insight?