Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getters for RX1 and RX2 windows #97

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/MKRWAN.h
Original file line number Diff line number Diff line change
@@ -618,6 +618,39 @@ class LoRaModem : public Stream
return false;
}

/**
* Returns the delay between the end of the Tx and the Rx Window 1 in ms.
* This may get changed automatically based on a network server's preference after joining it.
* This can be used to determine the wait time after a poll() call until data is available.
* Data will be available earliest after the RX1 window has passed.
* E.g.
* modem.poll();
* delay(modem.getRX1Delay() + 2000);
* Take into account the time required to demodulate the downlink message.
* At Spreading Factor 12 it can take more than two seconds while at SF7, it will take less than 100 ms.
* */
long getRX1Delay(){
sendAT(GF("+RX1DL?"));
if (waitResponse("+OK=") == 1) {
return stream.readStringUntil('\r').toInt();
}
return -1;
}

/**
* Returns the delay between the end of the Tx and the Rx Window 2 in ms.
* This may get changed automatically based on a network server's preference after joining it.
* This can be used to determine the wait time after a poll() call until data is available.
* @see getRX1Delay()
* */
long getRX2Delay(){
sendAT(GF("+RX2DL?"));
if (waitResponse() == 1) {
return stream.readStringUntil('\r').toInt();
}
return -1;
}

String version() {
sendAT(GF("+DEV?"));
if (waitResponse("+OK=") == 1) {