Brand New Electron flashed code... sometimes works, sometimes doesn't

I have 6 electrons.
I have released a certain firmware version for my product.
All 6 electrons are a device in this product.

So by this setting, every time the electron comes online, it should be either already updated, or flashed this firmware and then be updated.

When I bring an Electron online, sometimes the firmware works on the flash, and sometimes it doesn’t. Why is there this variability? I haven’t done anything fancy with the firmware… but even if I did, why does it work on one electron and not the other?

I am testing these Electrons out-of-the-box.

What I have found… is after about 5 minutes of leaving it alone and letting it continuously do this blinking magenta, static magenta, reset, etc. it eventually is working.

Am I doing something wrong? Code below(product_id hidden)

PRODUCT_ID(my_secret);
PRODUCT_VERSION(1);

int led1 = D6; // LED is connected to D6
int led2 = A0; // LED is connected to A0
int led3 = A5; // LED is connected to A5
int led4 = D0; // LED is connected to D0
int pushButton = D5; // Push button is connected to D5


// This routine runs only once upon reset
void setup() 
{
  pinMode(led1, OUTPUT); // Initialize D6 pin as output
  pinMode(led2, OUTPUT); // Initialize A0 pin as output
  pinMode(led3, OUTPUT); // Initialize A5 pin as output
  pinMode(led4, OUTPUT); // Initialize D0 pin as output
  pinMode(pushButton, INPUT_PULLUP); 
  // Initialize D2 pin as input with an internal pull-up resistor
}

// This routine loops forever
void loop() 
{
  int pushButtonState; 

  pushButtonState = digitalRead(pushButton);

  if(pushButtonState == LOW){ //If we push down on the push button
    digitalWrite(led1, HIGH);  // Turn ON the LED
    digitalWrite(led2, HIGH);  // Turn ON the LED
    digitalWrite(led3, HIGH);  // Turn ON the LED
    digitalWrite(led4, HIGH);  // Turn ON the LED
    Particle.publish("my-webhook", PRIVATE);
    // Add a delay to prevent getting tons of emails from IFTTT
    delay(10000); 
  }
  else
  {
    digitalWrite(led1, LOW);   // Turn OFF the LED 
    digitalWrite(led2, LOW);   // Turn OFF the LED 
    digitalWrite(led3, LOW);   // Turn OFF the LED 
    digitalWrite(led4, LOW);   // Turn OFF the LED 
  }

}

Newest update(10 minutes after plugging them into power):
2 out of 5 flashed successfully
1 is stuck breathing green
2 are stuck blinking cyan

Why is there such variability amongst these 5 Electrons? I bought these 5 to make the prototypes, but now I am wondering if this is a viable option. Please help me if I am doing something wrong here.

Newest update(15 minutes after plugging them into power):
3 out of 5 flashed successfully and breathing cyan
1 is now blinking blue and is in listening mode?
1 is blinking cyan

According to my dashboard, 4 out of 5 are now up-to-date on the firmware

This can have two reasons

  1. the original (old system 0.4.8) had a bad habbit of going into LM after a periode of inability to hook up to the cell network, the more current systems do have a timeout for that behaviour, so that you won’t get stuck there anymore.
  2. the SIM may not have good contact (not curable via firmware ;-))

But in your case I’d guess it’s 1. which should be solved once your system got updated.

What happens to this, once you hit RESET?

I got them all to work after either hitting reset or just unplugging and plugging back in. Problem is, I don’t want a customer to have this issue. I want them to be able to plug it in and it works. I was hoping to do OTA flash for giving new devices their code… not sure if I can do that anymore.

Having to plug the device in and wait 10…15 minutes or having to reset the device a couple of times won’t be a good product. People will just think it doesn’t work.

They could connect to the cloud to activate the device, so the SIM contact isn’t an issue.