diff options
author | Darren Lines <darren@darrenlines.uk> | 2022-06-24 14:59:05 +0300 |
---|---|---|
committer | Darren Lines <darren@darrenlines.uk> | 2022-06-24 14:59:05 +0300 |
commit | cc09a8fe90700f1944a10deb8f0497d66f0a9d73 (patch) | |
tree | f3deedc7dcac8775bd38f1e6b4487939d17dec42 /js | |
parent | 50d931f739987dde479f57869848d8516e30fd6e (diff) |
Implemented target autodetection
This PR adds target autodetection to the firmware flasher. It will attempt an autodetect on load. Plus there is a manual button to autodetect by the description.
- Extended MSPHelper to collect the missing data sent in `MSP_BOARD_INFO`. Plus added a `getTarget()` function.
- Added target autodetect on load of Firmware Flasher.
- Added button to Firmware Flasher to command an autodetect.
- Toggling **Show unstable builds** now remembers the selected target.
- Fixed **Offline** notices in the board and version select boxes.
- Added target name to firmware version displayed when connected.
Diffstat (limited to 'js')
-rw-r--r-- | js/msp/MSPHelper.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index ef448dda..e6fae020 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -777,6 +777,18 @@ var mspHelper = (function (gui) { CONFIG.boardIdentifier = identifier; CONFIG.boardVersion = data.getUint16(offset, 1); offset += 2; + if (semver.gt(CONFIG.flightControllerVersion, "4.1.0")) { + CONFIG.osdUsed = data.getUint8(offset++); + CONFIG.commCompatability = data.getUint8(offset++); + let targetNameLen = data.getUint8(offset++); + let targetName = ""; + targetNameLen += offset; + for (offset = offset; offset < targetNameLen; offset++) { + targetName += String.fromCharCode(data.getUint8(offset)); + } + CONFIG.target = targetName; + } + break; case MSPCodes.MSP_SET_CHANNEL_FORWARDING: @@ -3190,6 +3202,15 @@ var mspHelper = (function (gui) { MSP.send_message(MSPCodes.MSP_MOTOR, false, false, callback); }; + self.getTarget = function(callback) { + MSP.send_message(MSPCodes.MSP_FC_VERSION, false, false, function(resp){ + var target = resp.data.readString(); + if (callback) { + callback(target); + } + }); + } + self.getCraftName = function (callback) { MSP.send_message(MSPCodes.MSP_NAME, false, false, function (resp) { var name = resp.data.readString(); |