Electric Imp versions impOS™ releases as follows: odd-numbered major versions are pre-releases and even-numbered major versions are production-quality releases. As such, impOS 38 builds heavily on impOS 37, which was not released publicly. For information on changes and bug-fixes implemented in the various minor releases of impOS 37, please see the relevant release notes. This document will focus on changes made following the release of impOS 38, and upon new features introduced in impOS 37 but made public for the first time with impOS 38.
The imp004m module’s on-board WiFi sub-system also incorporates Bluetooth 4.1; impOS 38 adds imp API support for this functionality. Please note that the Bluetooth 4.1 sub-system is not connected directly to the imp004m’s MCU, in order to preserve as many pins for customer use as possible, but can be connected back to it externally by connecting certain module pins to imp004m UART and other pins.
impOS 38’s preliminary Bluetooth support centers on a new bluetooth class (a property of hardware) which provides methods to initialize the Bluetooth sub-system; start and stop GAP beacon advertising; start and stop GAP beacon scanning; set up a GATT server; and manage attempts to connect to the imp004m. The methods are called in instances of the bluetooth class created using the open() class method.
impOS 38 adds support for an external digital filter for sigma-delta modulation (DFSDM) that has been added to an imp004m module. This allows two pins on the imp004m, S (clock) and R (data), to be used for convenient, low-cost audio input functionality as an alternative to impOS’ sampler object, which the imp004m does not support. Instead, the imp004m (only) gains a dfsdm object which provides the same methods available to other imps via the sampler object.
Under impOS 38, the imp004m gains support for the fixedfrequencydac object that is made available to other imps, provided the customer adds a suitable external digital filter. The imp004m does not contain a DAC, but it is able to emulate one using PWM and pass the output through pins K and D (pin D may be re-assigned to other roles after fixedfrequencydac configuration, if required, at the cost of reduced resolution/audio quality). The imp004m’s audio output is set up using a modified form of fixedfrequencydac.configure() but all other fixedfrequencydac methods work as expected.
With impOS 38, the imp004m can be configured to continue outputting a pulse width modulation signal even across Squirrel reloads and firmware updates. This so-called ‘zombie’ mode is applied by setting a new parameter added to the existing method pin.configure(). The output is effectively continuous: the inevitable drop-outs that take place during the course of a Squirrel reload or a firmware upgrade are tested as being less than 5ms.
impOS 38 provides a new API method, imp.onunhandledexception(), which is used to register a function that will be called if your Squirrel throws any exception that has not been caught locally with a
try… catch structure: for example, an exception thrown by a callback function.
With impOS 38, devices can be set with a new send policy: RETURN_ON_ERROR_NO_DISCONNECT. In this case, impOS will check whether all of the outgoing data (from agent.send(), server.log() or similar) will fit into the send buffer, which may already have data waiting to be sent. If the new data will not fit in the buffer, a new error code, SEND_ERROR_WOULDBLOCK, is returned. Code continues to run but the device does not disconnect (as is the case with the RETURN_ON_ERROR policy). This allows the application to take remedial action, such as waiting for the buffer to drain and then trying to send the new data, without having to deal with the disconnection, or the wait while Squirrel blocks until all the passed data has finally entered the buffer. This will benefit any customers streaming bulk data, such as photographs, from the device to the agent.
imp.net.info()’s ipv4.server slot has a new property tcpsendfree to help debug all-or-nothing send mode.
imp.net.counters() is a new impOS method which allows advanced developers to retrieve profiling data from an imp’s WiFi sub-system, specifically a snapshot of WiFi counters retrieved from the imp’s WICED firmware.
When an imp connects to a wireless router or access point for the first time, it records both the network station’s BSSID and the WiFi channel on which the network is operating (1-13 for 2.4GHz, 36-165 for 5GHz). This saves the imp from having to scan for this data at every subsequent re-connect. The imp API now provides imp.net.setwifihints() and imp.net.getwifihints() to set and verify these hints in code.
imp.reset() is a new impOS method which allows Squirrel to trigger a full device reset that’s the equivalent of a cold reset (power cycle).
Changes from 37.33: