mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Add MCU_INFO MSP support (#4306)
* Add MCU_INFO MSP support * Remove MCU table * add missing initializer
This commit is contained in:
parent
9e2dfa362b
commit
b4a9fabe31
7 changed files with 36 additions and 32 deletions
|
@ -956,6 +956,9 @@
|
|||
"initialSetupRSSIValue": {
|
||||
"message": "$1 dBm"
|
||||
},
|
||||
"initialSetupMCU": {
|
||||
"message": "MCU:"
|
||||
},
|
||||
"initialSetupSensorHardware": {
|
||||
"message": "Sensors:"
|
||||
},
|
||||
|
|
36
src/js/fc.js
36
src/js/fc.js
|
@ -165,6 +165,7 @@ const FC = {
|
|||
LED_MODE_COLORS: null,
|
||||
LED_STRIP: null,
|
||||
LED_CONFIG_VALUES: [],
|
||||
MCU_INFO: null,
|
||||
MISC: null, // DEPRECATED
|
||||
MIXER_CONFIG: null,
|
||||
MODE_RANGES: null,
|
||||
|
@ -595,6 +596,11 @@ const FC = {
|
|||
|
||||
this.SENSOR_CONFIG_ACTIVE = { gyro_hardware: 0, ...this.SENSOR_CONFIG };
|
||||
|
||||
this.MCU_INFO = {
|
||||
id: 0,
|
||||
name: 0,
|
||||
};
|
||||
|
||||
this.RX_CONFIG = {
|
||||
serialrx_provider: 0,
|
||||
stick_max: 0,
|
||||
|
@ -868,36 +874,6 @@ const FC = {
|
|||
this.CONFIG.hardwareName = name;
|
||||
},
|
||||
|
||||
MCU_TYPES: {
|
||||
0: "SIMULATOR",
|
||||
1: "F40X",
|
||||
2: "F411",
|
||||
3: "F446",
|
||||
4: "F722",
|
||||
5: "F745",
|
||||
6: "F746",
|
||||
7: "F765",
|
||||
8: "H750",
|
||||
9: "H743_REV_UNKNOWN",
|
||||
10: "H743_REV_Y",
|
||||
11: "H743_REV_X",
|
||||
12: "H743_REV_V",
|
||||
13: "H7A3",
|
||||
14: "H723_725",
|
||||
15: "G474",
|
||||
16: "H730",
|
||||
17: "AT32F435G",
|
||||
18: "APM32F405",
|
||||
19: "APM32F407",
|
||||
20: "AT32F435M",
|
||||
21: "RP2350B",
|
||||
255: "Unknown MCU",
|
||||
},
|
||||
|
||||
getMcuType() {
|
||||
return this.MCU_TYPES[this.CONFIG.mcuTypeId];
|
||||
},
|
||||
|
||||
CONFIGURATION_STATES: {
|
||||
DEFAULTS_BARE: 0,
|
||||
DEFAULTS_CUSTOM: 1,
|
||||
|
|
|
@ -199,6 +199,7 @@ const MSPCodes = {
|
|||
MSP2_GET_LED_STRIP_CONFIG_VALUES: 0x3008,
|
||||
MSP2_SET_LED_STRIP_CONFIG_VALUES: 0x3009,
|
||||
MSP2_SENSOR_CONFIG_ACTIVE: 0x300a,
|
||||
MSP2_MCU_INFO: 0x300c,
|
||||
|
||||
// MSP2_GET_TEXT and MSP2_SET_TEXT variable types
|
||||
PILOT_NAME: 1,
|
||||
|
|
|
@ -1219,6 +1219,14 @@ MspHelper.prototype.process_data = function (dataHandler) {
|
|||
FC.SENSOR_CONFIG_ACTIVE.sonar_hardware = data.readU8();
|
||||
}
|
||||
break;
|
||||
case MSPCodes.MSP2_MCU_INFO:
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
|
||||
FC.MCU_INFO = {
|
||||
id: data.readU8(),
|
||||
name: self.getText(data),
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_LED_STRIP_CONFIG:
|
||||
FC.LED_STRIP = [];
|
||||
|
|
|
@ -453,7 +453,7 @@ function processBoardInfo() {
|
|||
apiVersion: FC.CONFIG.apiVersion,
|
||||
flightControllerVersion: FC.CONFIG.flightControllerVersion,
|
||||
flightControllerIdentifier: FC.CONFIG.flightControllerIdentifier,
|
||||
mcu: FC.getMcuType(),
|
||||
mcu: FC.CONFIG.targetName,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,11 @@ setup.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function load_status() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false, load_mixer_config);
|
||||
MSP.send_message(MSPCodes.MSP_STATUS_EX, false, false, mcu_info);
|
||||
}
|
||||
|
||||
function mcu_info() {
|
||||
MSP.send_message(MSPCodes.MSP2_MCU_INFO, false, false, load_mixer_config);
|
||||
}
|
||||
|
||||
function load_mixer_config() {
|
||||
|
@ -195,6 +199,8 @@ setup.initialize = function (callback) {
|
|||
pitch_e = $("dd.pitch"),
|
||||
heading_e = $("dd.heading"),
|
||||
sonar_e = $(".sonarAltitude"),
|
||||
// MCU info
|
||||
mcu_e = $(".mcu"),
|
||||
// Sensor info
|
||||
sensor_gyro_e = $(".sensor_gyro_hw"),
|
||||
sensor_acc_e = $(".sensor_acc_hw"),
|
||||
|
@ -602,6 +608,12 @@ setup.initialize = function (callback) {
|
|||
cputemp_e.text(i18n.getMessage("initialSetupCpuTempNotSupported"));
|
||||
}
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_47)) {
|
||||
mcu_e.text(FC.MCU_INFO.name);
|
||||
} else {
|
||||
mcu_e.parent().hide();
|
||||
}
|
||||
|
||||
// GPS info is acquired in the background using update_live_status() in serial_backend.js
|
||||
gpsFix_e.text(FC.GPS_DATA.fix ? i18n.getMessage("gpsFixTrue") : i18n.getMessage("gpsFixFalse"));
|
||||
gpsFix_e.toggleClass("ready", FC.GPS_DATA.fix != 0);
|
||||
|
|
|
@ -163,6 +163,10 @@
|
|||
<td i18n="initialSetupRSSI"></td>
|
||||
<td class="rssi">0 %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="mcu" i18n="initialSetupMCU"></td>
|
||||
<td class="mcu"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="cpu-temp" i18n="initialSetupCpuTemp"></td>
|
||||
<td class="cpu-temp">0 ℃</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue