Bug with WiFi.selectAntenna()

First of all, I’d like to say that when a Photon encounters an error with the software, it should maybe flash red a few times, and then go into safe mode, with STARTUP(WiFi.selectAntenna(ANT_AUTO)). When these things are deployed out in the field, it can be a major pain in the ass to go manually put it into safe mode. This happened to me a few days ago with a sensor on top of a roof, and the change from


in the setup() section, to


outside of the setup() section

coupled with auto-upgrading of the firmware from 0.4.7 (I think, maybe an earlier version) to 0.4.9 caused the Photon to sit there flashing red (being 0% useful to me when the Photon is in a box on a roof).

I accidentally flashed a Photon with the wrong software (seemed to be a glitch in the web IDE that selected multiple Photons for some reason), and it caused the Photon to use the external antenna. However, no antenna was attached, so it couldn’t connect. In this case, the Photon should really automatically switch to STARTUP(WiFi.selectAntenna(ANT_AUTO)) after not being able to connect for a while.

The really annoying problem happened when I re-flashed the Photon with correct software. I just got rid of the
line, assuming it would automatically go back to STARTUP(WiFi.selectAntenna(ANT_AUTO));
but, it kept only trying to use the external antenna until I actually put
into the software. Shouldn’t the Photon be using auto-select for the antenna if theres no
command in the software?

The docs say,

Selects which antenna the device should connect to Wi-Fi with and remembers that setting until it is changed.

What you’re seeing is the expected behavior.

1 Like

haha, thanks. Didn’t even see that part. I’d say that’s the wrong way to do it though, it should switch to ANT_AUTO

The default setting for the Photon is not ANT_AUTO but ANT_INTERNAL.