[SOLVED] SYSTEM_MODE(MANUAL) in firmware 0.5.1-rc.1 and 'latest'

The following small firmware works as expected on my Photon in version 0.4.9 but in ‘latest’ and v0.5.1-rc.1 it blinks blue as if it were in listening mode and the button_status doesn’t fire (which of course it wouldn’t if the device is in listening mode).

Is there something obvious that I’m doing wrong? Should I stick with 4.9?

#include "Particle.h"

SYSTEM_MODE(MANUAL);

#define LED D7
#define DURATION 200

unsigned long off = 0;
bool on = false;

void setup_pressed_handler(system_event_t event, int dur){
	if(dur == 0){
		on = true;
		off = millis() + DURATION;
		pinSetFast(LED);
	}
}

void setup(){
	RGB.control(true);
	RGB.brightness(0);

	pinMode(LED, OUTPUT);
	System.on(button_status, setup_pressed_handler);
}

void loop(){
	if(on && millis() > off){
		digitalWrite(LED, 0);
		on = false;
	}
}

I’ve just tried your code as is with one of my own Photons and I can’t reproduce your issue.
The device did just behave as should do.

Could it be that you held your button too long once (or it got stuck) and cleared the WiFi credentials?
Also try to reflash that code via Safe Mode.

How did you flash this code in the first place? (Web IDE would not require the include statement)

There are no credentials on the device at all, this is intentional.

In the “MANUAL” system mode it shouldn’t need to connect to WiFi just to run a simple program. To my understanding, that’s the purpose of MANUAL mode.

For some reason it works with firmware version 0.4.9 but not later.

BTW, I compiled the code with the particle-firmware build system using gcc-arm-non-eabi and uploaded with dfu-util like a normal person.

After replying to ScruffR it dawned on me that I can’t remember flashing the system modules to the device between version changes.

If I forgot that, it would explain everything. Doh!

Tomorrow I will test this theory and report back.

1 Like

That was it. Between firmware versions I had forgotten to ‘make clean all program-dfu’ from the modules directory.

Boy is my face red.

1 Like

Sometimes using the "less normal" tools might not be that objectionable after all.
BTW, others might have to cast the judgement whether I can be considered "normal", but I use Particle Build on a regular basis (e.g. for testing user code like yours).
Although I can use my local toolchain too :wink: