mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 03:49:53 +03:00
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.
This commit is contained in:
parent
50d931f739
commit
cc09a8fe90
6 changed files with 188 additions and 7 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue