How can I find out which antenna mode is currently selected?
I looked in the firmware reference but cant see a method for that?
I’m pretty sure you can’t get the currently selected antenna. It’s not exposed in the wiring API, and it’s not exposed in the HAL API either.
For my application I really need to check that the antennas is set correctly as some products are in metal boxes.
I am considering using selectAntenna() at startup but I am concerned about writing to flash at every power on as I know that this can cause flash/key/credential corruptions if the power fails while flashing.
If you haven’t specifically changed it in your firmware, the default is internal.
The docs state:
If no antenna has been previously selected, the ANT_INTERNAL antenna will be chosen by default.
other options are available, either
AUTOMATIC, which one you use depends on your use.
I am using selectAntenna() to allow to configuration of the antenna, its also possible for our customer to change the antenna option in our application.
What I am looking requiring is a way to check/report/validate the antenna status over the cloud for support purposes, it seems very odd that current antenna ‘mode’ is not visible by the firmware. I can track the setting with my own flag in flash although this seems a little abstract to peeking the actual setting?
Make the setting once, and keep track of a EEPROM variable… so that once you set the antenna, you keep that variable in sync… from now on, every time the antenna is switched, you also switch the variable… you need to check the value, ask for the variable.
Variable can be three states… ,internal, external, notset…
SetAntenna to Internal
antMode = internal
This way you don’t keep writing to eeprom and only set once to keep in sync with a managed variable.
I know it’s a work around.