I am using a third status LED in the same light pipe as the blinkup red and green status LED’s.
Is there a software way to know when blinkup LED’s are active, in order to avoid indicating with the third LED during those times? I am using IMP002.
The only sure way I can find, is to hardwire pin 3 and 4 (LED_GREEN and LED_RED) to a couple of IMP002 input pins configured as digital input, and use a callback function?
The code below delays own LED blinking with 60 sec if cold booting.
This code works when the imp immediately connects to a wifi router. However, if the wifi router is enabled 20 sec after the Imp is turned on, there is a 20+ sec gap between blinkup status LED’s stopping and the extra LED starts blinking …
So the challenge seems to be, not knowing when the server connection succeded, compared to when the 60 sec. connection timer controlling the blinkup LED’s was started?
`
/**********************************************
Control a blinking LED to only be active when
imp status LED’s are not active
********************************************/
// Blink our LED
function BlinkLED(){
led.write(1-led.read());
server.log(“blink”);
imp.wakeup(1.30, BlinkLED);
}
// Setup our LED
led <- hardware.pin2
led.configure(DIGITAL_OUT, 0);
// Wait with our status LED untill blinkup status LED’s are done
server.log("hardware.wakereason: " + hardware.wakereason());
if(hardware.wakereason() == WAKEREASON_POWER_ON) imp.wakeup(60, BlinkLED);
else BlinkLED();
`
In RETURN_ON_ERROR mode with blinkup enabled, it remains unreliable to guestimate the timing of where the Imp is in the wifi state diagram in combination with 9 hardware startup reasons and the user doing blinkup at a random point during the startup.
The hardware method mentioned in the start is easy and works very well with one exception: during blinkup, the blinkup led’s are passive.
I see this working reliably when a device.blinkupisactive() or similar becomes available.