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

Add getters for RX1 and RX2 windows #97

wants to merge 2 commits into from

Conversation

sebromero
Copy link
Contributor

To minimize the wait time for downlink messages it's necessary to know the delay times of the RX1 and RX2 windows before any data can be available. After a call to poll() the device needs to wait at least until the RX1 window has passed. This PR implements the getter functions to do the math.
That way downlink messages can be retrieved reliably and with minimal wait time. E.g.

modem.poll();
delay(modem.getRX1Delay() + 1000); // Allow for a bit of extra time for the transmission of the data
while (modem.available()) {   
  // Fetch data from the modem
}

@sebromero
Copy link
Contributor Author

@facchinm The RX1 getter works but for some reason I can't get the RX2 getter to work.

Might be because of the missing AT_PRINTF("+OK="); statement here: https://github.com/arduino/mkrwan1300-fw/blob/b1c48b27280cb455ebe73f723e4a6cc01854d1f5/Projects/Multi/Applications/LoRa/AT_Slave/src/at.c#L672
Then again, a simple check waitResponse() == 1 should work, given that the function returns AT_OK.

Any hint on what's going on? I might be overlooking something.

@github-actions
Copy link

Memory usage change @ 2e86755

Board flash % RAM for global variables %
arduino:mbed_portenta:envie_m4 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1300 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1310 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/DumbModemLoraSender
flash
% examples/DumbModemLoraSender
RAM for global variables
% examples/FirstConfiguration
flash
% examples/FirstConfiguration
RAM for global variables
% examples/LoraSendAndReceive
flash
% examples/LoraSendAndReceive
RAM for global variables
% examples/FWUpdaterBridge
flash
% examples/FWUpdaterBridge
RAM for global variables
% examples/MKRWANFWUpdate_standalone
flash
% examples/MKRWANFWUpdate_standalone
RAM for global variables
%
arduino:mbed_portenta:envie_m4 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:mbed_portenta:envie_m7 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1300 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrwan1310 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,examples/DumbModemLoraSender<br>flash,%,examples/DumbModemLoraSender<br>RAM for global variables,%,examples/FirstConfiguration<br>flash,%,examples/FirstConfiguration<br>RAM for global variables,%,examples/LoraSendAndReceive<br>flash,%,examples/LoraSendAndReceive<br>RAM for global variables,%,examples/FWUpdaterBridge<br>flash,%,examples/FWUpdaterBridge<br>RAM for global variables,%,examples/MKRWANFWUpdate_standalone<br>flash,%,examples/MKRWANFWUpdate_standalone<br>RAM for global variables,%
arduino:mbed_portenta:envie_m4,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:mbed_portenta:envie_m7,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrwan1300,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrwan1310,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0

@flhofer
Copy link

flhofer commented Dec 5, 2021

@sebromero
Hi, I fixed many of these issues in my firmware pull request. You might need to adapt to the matching library version though. Anyway, the library uses internal setters and getters, making the change mostly one-liners. 😃 (i did it for my tests)
Hope it helps
(EDIT: I chose not to commit them because (a) you use them only in non-standard systems, and (b) it's easy to add in the new version)

@sebromero sebromero closed this by deleting the head repository Jan 25, 2024
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants