Skip to main content

imp.enableblinkup(enabled)

Enables or disables BlinkUp™ on a device

Availability

Device

Parameters

Name Type Description
enabled Bool Whether BlinkUp configuration should be enabled (true) or disabled (false)

Returns

Nothing

Description

This method can be used to activate or deactivate BlinkUp, both the ability to register an optical signal from a mobile device and the reporting of the process by way of the imp-enabled device’s BlinkUp status LED. As such, it can be used to prevent re-starting devices from flashing their status LED. This is handy for devices which you would like to operate discreetly.

Important impOS™ 42 makes some key changes to the way imp.enableblinkup() is applied. Please see the Release-specific Notes section, below, for details. The following text details the behavior exhibited by impOS 40 and under, and will be updated to reflect the new behavior when impOS 42 is released to production.

Any call to imp.enableblinkup() interpreted according to the state of the system. The relevant system states are:

  • BOOTING — Within 60 seconds of the imp being cold-started (see note below for warm-boot behavior).
  • CONNECTING — Within 60 seconds of the imp first attempting to connect to the server.
  • IDLE — All other times.

Calls to imp.enableblinkup() are applied only when the imp enters a new systems state. Naturally, it is impossible to apply the call before the imp enters the BOOTING phase. Calls made during a given state are applied the next time the state changes. For example, suppose that during BOOTING, the programmer makes the call for BlinkUp configuration to be disabled. For the remainder of the 60 seconds of the BOOTING state, BlinkUp will remain enabled. However, when the state transitions to CONNECTING or to IDLE, then BlinkUp will be disabled.

The behavior can be summarized as follows:

imp.enableblinkup() Setting BOOTING CONNECTING IDLE
No call ON ON OFF
false ON OFF OFF
true ON ON ON

Note When an imp warm-starts after deep sleep, imp.enableblinkup() will be applied almost immediately because the imp goes straight to the active offline state — Squirrel starts immediately, and BlinkUp will be disabled (or re-enabled) as soon as the virtual machine processes your code’s call to imp.enableblinkup().

Release-specific Notes

impOS 42

From impOS 42 and up, there will no longer be any period for which BlinkUp will always remain active after the code imp.enableblinkup(false); has run, even if the host imp is still in the BOOTING phase. There is no initial 60-second window during which BlinkUp is always available; BlinkUp will be disabled (or re-enabled) as soon as Squirrel processes the imp.enableblinkup() call.

Customers should note this change, especially if their device code calls imp.enableblinkup() early on. If the imp cold boots and fails to connect to the server within ten seconds, Squirrel will start and an early call to imp.enableblinkup() may come too quickly to allow end-users to re-configure activated devices.

Rather than simply calling imp.enableblinkup(false);, consider adding a timer to provide a period before that code is called:

// Add timer to allow BlinkUp for 30s only
// NOTE This is in addition to the impOS 0-10s period
//      BlinkUp will always be available, ie. until Squirrel runs
//      on a cold-boot connection or cold-boot connection timeout
imp.wakeup(30, function() {
    imp.enableblinkup(false);
});

This should be placed as early as possible in your code, ideally immediately after any #require statements, which must come first.

Example Code

The following code, for the impExplorer™ Kit, uses imp.enableblinkup() to disable BlinkUp and thus prevent the Kit’s BlinkUp status LED from flashing when the Kit wakes from the deep sleep state triggered in the last line. As such, the Kit, which is here operating as a sensor node, will not disturb end-users with a periodic flash of the LED.