There is already a "Board Version" property in the JS side that is used to identify the board, but needs be updated for V2.2 support anyway:
|
The following properties provide version information: |
|
|
|
<dl> |
|
<dt>boardVersion</dt><dd> |
|
Property. The micro:bit hardware version (currently either 1.3 or 1.5).</dd> |
|
this.boardVersion = this.boardVersionFromSerialNumber(p.serialNumber); |
|
boardVersionFromSerialNumber(usbSerialNumber) { |
|
// The micro:bit board version can be determined from the USB device serial number. |
|
// See https://support.microbit.org/support/solutions/articles/19000084312-micro-bit-motion-sensor-hardware-changes-for-editor-developers |
|
var id = usbSerialNumber.slice(0, 4); |
|
if ('9900' == id) return '1.3'; |
|
if ('9901' == id) return '1.5'; |
|
if ('9903' == id) return '2.0'; |
|
if ('9904' == id) return '2.0'; |
|
return 'unrecognized board'; |
|
} |
We also need to fix the Firmware Version reported by the firmware programme, as the DAL_VERSION macro does not get a valid version number in CODAL (lancaster-university/codal-microbit-v2#138):
|
static void reportFirmwareVersion() { |
|
// Send firmware version plus DAL, mbed library, and softdevice version info. |
|
// The softdevice version can be found by looking up the firmward ID (FWID) here: |
|
// https://devzone.nordicsemi.com/f/nordic-q-a/1171/how-do-i-access-softdevice-version-string |
|
|
|
// Some Event IDs changed between firmware 1.0 (DAL <= 2.1.1) and 1.1 (DAL >= 2.2.0-rc6 and CODAL) |
|
// MICROBIT_ID_DISPLAY/GESTURE/IO_P0/IO_P1/IO_P2 |
|
int major = 1; |
|
int minor = 1; |
|
char s[100]; |
|
|
|
ble_version_t bleInfo; |
|
sd_ble_version_get(&bleInfo); |
|
sprintf(s, "[based on DAL %s; mbed %d; softdeviceFWID %d] micro:bit Firmata", |
|
DAL_VERSION, MBED_LIBRARY_VERSION, bleInfo.subversion_number); |
|
|
|
send2Bytes(SYSEX_START, REPORT_FIRMWARE); |
|
send2Bytes(major, minor); // firmware version (vs. Firmata protocol version) |
|
sendStringData((const char *) s); |
|
sendByte(SYSEX_END); |
|
} |
The "Board Version" property is only provided from the JS firmware library, which uses the USB ID to identify the board.
@JohnVidler we should consider if we also want to provide that info from the micro:bit firmata programme, as it could be included (only as V1 or V2, no need to query DAPLink to identify V2.0 or V2.2) in the "Firmware Version" string form.
There is already a "Board Version" property in the JS side that is used to identify the board, but needs be updated for V2.2 support anyway:
microbit-firmata/firmataClient.md
Lines 26 to 30 in 3b057a8
microbit-firmata/client/MBFirmataClient.js
Line 200 in 3b057a8
microbit-firmata/client/MBFirmataClient.js
Lines 231 to 240 in 3b057a8
We also need to fix the Firmware Version reported by the firmware programme, as the
DAL_VERSIONmacro does not get a valid version number in CODAL (lancaster-university/codal-microbit-v2#138):microbit-firmata/firmware/source/mbFirmata.cpp
Lines 310 to 330 in 3b057a8
The "Board Version" property is only provided from the JS firmware library, which uses the USB ID to identify the board.
@JohnVidler we should consider if we also want to provide that info from the micro:bit firmata programme, as it could be included (only as V1 or V2, no need to query DAPLink to identify V2.0 or V2.2) in the "Firmware Version" string form.