Not all photons are created equal, System.sleep behaviour

In order to run a battery project I’ve been experimenting with Spark.publish and System.sleep in deep sleep mode. I now have three Photons with the same code and firmware 0.4.4 but only 2 of them wake up after sleeping; the third runs through the code once, sleeps and never comes back.

I have seen other threads reporting problems with sleep but it’s unclear to me if they still exist in 0.4.4 and I appear to have Photons with different behaviour (hardware levels? marginal Photon? deep firmware differences?).

Is System.sleep still suspect or should it work on a Photon as advertised?
Can anyone explain the Photon differences or suggest what I might check?

PS. It may have been the recent update to 0.4.4 firmware but I had a lot of trouble flashing the Photons and spent some time flashing different code on them before I was satisfied they were all running the same code.

PPS. The code I’m using is below and started from @bko getting started with Spark.publish with an added self subscribe to check the publish is complete and then a SLEEP_MODE_DEEP at the end.

char publishString[40];

unsigned uptimeFlag;
unsigned sleepEnable;

void myHandler(const char *event, const char *data) {  
    if (strcmp(event,"Uptime")==0) {
        uptimeFlag = 1;
    }
}

void myHandler2(const char *event, const char *data) {  
    if (strcmp(event,"Sleep-off")==0) {
        sleepEnable = 0;
    }
    if (strcmp(event,"Sleep-on")==0) {
        sleepEnable = 1;
    }
}

void setup() {
    sleepEnable = 1;
    Spark.subscribe("Uptime", myHandler, MY_DEVICES);
    Spark.subscribe("Sleep", myHandler2, MY_DEVICES);
}

void loop() {
    unsigned long now = millis();
    unsigned millis = now%1000UL;
    unsigned nowSec = now/1000UL;
    unsigned sec = nowSec%60;
    unsigned min = (nowSec%3600)/60;
    unsigned hours = (nowSec%86400)/3600;
    sprintf(publishString,"%u:%u:%u.%04u ",hours,min,sec,millis);
    uptimeFlag = 0;

    Spark.publish("Uptime",publishString,  60, PRIVATE);
    for(int i=0;i<50;i++){
        delay(100);
        Spark.process();
        if (uptimeFlag) break;
    }
    RGB.control(true);
    if (uptimeFlag) RGB.color(0,255,0);
    else RGB.color(255,0,0);

    for(int i=0;i<10;i++){
        delay(100);
        Spark.process();
    }

    while (sleepEnable==0) {
        RGB.color(0,0,255);
        delay (1000);
        Spark.process();
    }
    System.sleep(SLEEP_MODE_DEEP, 5UL);
}

Just to confirm, I had the same issue with the old firmware, didnt find a solution so had to drop deep sleep for now, I only tried on one photon, it ran fine for a week, then started not waking up after running the code once…

I have not checked if the problem is still present on 0.4.4.