After suffering a few range problems, I have tried adding an external antenna to a Xenon, and using the following function to pick which antenna is used:
int setAntenna(int i) {
// Save to EEPROM
EEPROM.put(antAddr, i);
if(i==0) {
Mesh.selectAntenna(MeshAntennaType::INTERNAL);
} else {
Mesh.selectAntenna(MeshAntennaType::EXTERNAL);
}
}
This gives the following error on all 1.5.x firmwares when compiling from the webIDE, including the 1.5.4-rc.1:
In file included from ./inc/Arduino.h:27:0,
from ./inc/WProgram.h:1,
from lib/Adafruit_BME280/src/Adafruit_BME280.h:27,
from solar_soil_sensor.ino:65:
solar_soil_sensor.ino: In function 'int setAntenna(int)':
../wiring/inc/spark_wiring_arduino_constants.h:44:21: error: expected unqualified-id before numeric constant
#define EXTERNAL 0
^
solar_soil_sensor.ino:282:45: note: in expansion of macro 'EXTERNAL'
solar_soil_sensor.ino:284:1: warning: no return statement in function returning non-void [-Wreturn-type]
../build/module.mk:274: recipe for target '../build/target/user/platform-14-msrc/solar_soil_sensor.o' failed
make[2]: *** [../build/target/user/platform-14-msrc/solar_soil_sensor.o] Error 1
Can I get away with just doing:
Mesh.selectAntenna(0);
to use the external antenna?
I had a look at some of the code people have posted here, to test if my RSSI changes, but if I can be sure the antenna changes then greater reliability is enough to show an improvement.