Environment Variables for DFU
Certain reserved environment variables are available for scheduling and managing DFU actions.
Initiate DFU
After
uploading a new host firmware binary
to Notehub, or using an available Notecard firmware binary, you can initiate a
host or Notecard DFU action by using the _fw
or _fwc
environment variables,
respectively.
For example, to update your devices to a specific Notecard firmware version, copy the appropriate file name from Notecard Firmware Releases. Note that you will need to apply the appropriate firmware binary type to the correct Notecard devices (e.g. Notecard Cell+WiFi has a different firmware binary than Notecard WiFi), so it can be useful to have specific fleets set up that segment by device type.
Set the _fwc
environment variable on the device, fleet, or project level:
Likewise, to initiate a host firmware binary update, set the _fw
environment
variable on the device, fleet, or project level:
Schedule DFU
If you need to ensure that DFU actions (whether they are host or Notecard
updates) only occur during specific time periods, you may use the _dfu_period
environment variable.
The value provided to this environment variable must be in the form of
0000000,00,0
, which breaks down as follows:
0000000
corresponds to days of the week, starting with Sunday.- For example, to enable DFU only on weekends, you would use
1000001
.
- For example, to enable DFU only on weekends, you would use
00
corresponds to the local time of the device in 24-hour clock format.- For example, to enable DFU starting at 5:00 PM, you would use
17
.
- For example, to enable DFU starting at 5:00 PM, you would use
0
corresponds to how many hours the DFU window should remain open.- For example, to open the window for two hours, you would use
2
.
- For example, to open the window for two hours, you would use
Voltage-Variable DFU
Just as both hub.set
and card.location.mode
configurations can be customized
to sync data or gather location information on a
voltage-variable basis,
DFU actions can be enabled/disabled in a similar way.
The _dfu_enabled
environment variable allows you to enable DFU actions based
on Notecard voltage thresholds already defined with the
card.voltage API.
For example, to only enable DFU downloads when your device is powered by USB or the voltage is high or normal, you would use the following string:
usb:1;high:1;normal:1;low:0;dead:0