mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 09:15:49 +03:00
Add support for 32bit OSD warnings bitmask; add missing warnings elements
Adds support for 32 warnings instead of just 16. Adds a warnings count to MSP to support future improvements to handle unknown warnings better. Added missing warnings where support was added to the firmware but not in the configurator.
This commit is contained in:
parent
c1a188f31d
commit
0c34272e52
2 changed files with 65 additions and 7 deletions
|
@ -3705,6 +3705,24 @@
|
|||
"osdWarningEscFail": {
|
||||
"message": "Enumerates a list with the ESCs/motors that are failing (RPM or temperature are out of the configured threshold)"
|
||||
},
|
||||
"osdWarningCoreTemperature": {
|
||||
"message": "Warns when MCU core temperature exceeds a configured threshold"
|
||||
},
|
||||
"osdWarningRcSmoothingFailure": {
|
||||
"message": "Warns when RC Smoothing initialization failed"
|
||||
},
|
||||
"osdWarningFailsafe": {
|
||||
"message": "Warns when failsafe occurs"
|
||||
},
|
||||
"osdWarningLaunchControl": {
|
||||
"message": "Warns when Launch Control mode is activated"
|
||||
},
|
||||
"osdWarningGpsRescueUnavailable": {
|
||||
"message": "Warns when GPS Rescue is not available and cannot be activated"
|
||||
},
|
||||
"osdWarningGpsRescueDisabled": {
|
||||
"message": "Warns when GPS Rescue is disabled"
|
||||
},
|
||||
|
||||
"osdSectionHelpElements": {
|
||||
"message": "Enable or disable OSD elements."
|
||||
|
|
|
@ -970,8 +970,32 @@ OSD.constants = {
|
|||
desc: 'osdWarningCrashFlipMode'
|
||||
},
|
||||
ESC_FAIL: {
|
||||
name: 'OSD_WARNING_ESC_FAIL',
|
||||
name: 'ESC_FAIL',
|
||||
desc: 'osdWarningEscFail'
|
||||
},
|
||||
CORE_TEMPERATURE: {
|
||||
name: 'CORE_TEMPERATURE',
|
||||
desc: 'osdWarningCoreTemperature'
|
||||
},
|
||||
RC_SMOOTHING_FAILURE: {
|
||||
name: 'RC_SMOOTHING_FAILURE',
|
||||
desc: 'osdWarningRcSmoothingFailure'
|
||||
},
|
||||
FAILSAFE: {
|
||||
name: 'FAILSAFE',
|
||||
desc: 'osdWarningFailsafe'
|
||||
},
|
||||
LAUNCH_CONTROL: {
|
||||
name: 'LAUNCH_CONTROL',
|
||||
desc: 'osdWarningLaunchControl'
|
||||
},
|
||||
GPS_RESCUE_UNAVAILABLE: {
|
||||
name: 'GPS_RESCUE_UNAVAILABLE',
|
||||
desc: 'osdWarningGpsRescueUnavailable'
|
||||
},
|
||||
GPS_RESCUE_DISABLED: {
|
||||
name: 'GPS_RESCUE_DISABLED',
|
||||
desc: 'osdWarningGpsRescueDisabled'
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -1201,7 +1225,17 @@ OSD.chooseFields = function () {
|
|||
];
|
||||
if (semver.gte(CONFIG.apiVersion, "1.39.0")) {
|
||||
OSD.constants.WARNINGS = OSD.constants.WARNINGS.concat([
|
||||
F.ESC_FAIL
|
||||
F.ESC_FAIL,
|
||||
F.CORE_TEMPERATURE,
|
||||
F.RC_SMOOTHING_FAILURE
|
||||
]);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
OSD.constants.WARNINGS = OSD.constants.WARNINGS.concat([
|
||||
F.FAILSAFE,
|
||||
F.LAUNCH_CONTROL,
|
||||
F.GPS_RESCUE_UNAVAILABLE,
|
||||
F.GPS_RESCUE_DISABLED
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
@ -1315,6 +1349,9 @@ OSD.msp = {
|
|||
}
|
||||
console.log(warningFlags);
|
||||
result.push16(warningFlags);
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
result.push32(warningFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1448,11 +1485,14 @@ OSD.msp = {
|
|||
}
|
||||
|
||||
// Parse enabled warnings
|
||||
if (view.offset + 2 <= view.byteLength) {
|
||||
var warningFlags = view.readU16();
|
||||
for (var i = 0; i < OSD.constants.WARNINGS.length; i++) {
|
||||
d.warnings.push($.extend(OSD.constants.WARNINGS[i], { enabled: (warningFlags & (1 << i)) != 0 }));
|
||||
}
|
||||
var warningFlags = view.readU16();
|
||||
if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
|
||||
var warningCount = view.readU8();
|
||||
// the flags were replaced with a 32bit version
|
||||
warningFlags = view.readU32();
|
||||
}
|
||||
for (var i = 0; i < OSD.constants.WARNINGS.length; i++) {
|
||||
d.warnings.push($.extend(OSD.constants.WARNINGS[i], { enabled: (warningFlags & (1 << i)) != 0 }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue