I’m running 4.0.2 and I noticed that if pinMode is set to Output - HIGH, each time Boron looses cellular connectivity it resets the pin Output to LOW. Does anyone know why this is and if there is a way to prevent this? I was thinking about saving the pin Output state to EEPROM but is there a better way to handle this?
That should not occur. Which pin, and can you make a really simple version of the firmware that can reproduce the problem?
I did some more testing and it appears to happen when the antenna is mounted directly above and no more than 1/4 inch from the Boron. Here is some sample code I used.
int pin = D7;
int CR(String command);
void setup()
{
pinMode(pin, OUTPUT);
Particle.function("Control", CR);
}
void loop()
{
}
int CR(String command)
{
if (command.equalsIgnoreCase("1"))
{
digitalWrite(pin, HIGH);
return 1;
}
if (command.equalsIgnoreCase("0"))
{
digitalWrite(pin, LOW);
return 0;
}
if (command.equalsIgnoreCase("Reset"))
{
digitalWrite(pin, HIGH);
for (uint32_t ms = millis();
millis() - ms < 10000;
Particle.process())
;
digitalWrite(pin, LOW);
return 2;
}
return 9;
}