Hello!
I am trying to read the configuration from the RAK4270’s config AT command.
The problem is that it returns multiple lines that all seem to have a \r\n at the end.
Here is an example from the docs:
at+get_config=lora:status\r\n
OK Work Mode: LoRaWAN
Region: EU868
Send_interval: 600s
Auto send status: false.
MulticastEnable: true.
Multi_Dev_Addr: 260111FD
Multi_Apps_Key: F13DDFA2619B10411F02F042E1C0F356
Multi_Nwks_Key: 1D1991F5377C675879C39B6908D437A6
Join_mode: OTAA
DevEui: 0000000000000888
AppEui: 0000000000000888
AppKey: 00000000000008880000000000000888
Class: C
Joined Network:false
IsConfirm: unconfirm
AdrEnable: true
EnableRepeaterSupport: false
RX2_CHANNEL_FREQUENCY: 869525000, RX2_CHANNEL_DR:0
RX_WINDOW_DURATION: 3000ms
RECEIVE_DELAY_1: 1000ms
RECEIVE_DELAY_2: 2000ms
JOIN_ACCEPT_DELAY_1: 5000ms
JOIN_ACCEPT_DELAY_2: 6000ms
Current Datarate: 4
Primeval Datarate: 4
ChannelsTxPower: 0
UpLinkCounter: 0
DownLinkCounter: 0
That complicates things as I need to have some sort of stop character to look for like with this code:
bool SerialCommand(String command, String expected_response)
{
_serial.println(command);
String response = "";
response = _serial.readStringUntil('\n');
Serial.println("Command: " + command + ", Response: " + response);
if (response.indexOf(expected_response) >= 0)
{
return true;
}
else if (response.indexOf("ERROR") >= 0)
{
lastError = response;
return false;
}
return false;
}
This… this doesn’t work. If each of the lines had a simple \r at the end, and an \r\n to signal the end of the transmission, that would make things great, however, that does not seem to be the case (unless I am missing something)
SO! My question is how would you guys recommend reading from this settings list?
I don’t want to be setting my settings up every wake cycle, and at the same time, I don’t want to have to manually set each device up every time I want to deploy a new device.
Thanks for the help!