1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 17:25:16 +03:00

Added support for RSSI & Link Quality warning settings & Link Quality alarm setting.

This commit is contained in:
Ian Murphy 2019-04-14 12:17:58 +01:00
parent 2c7d47bbdc
commit 9463e08f10
2 changed files with 34 additions and 4 deletions

View file

@ -3961,6 +3961,12 @@
"osdWarningGpsRescueDisabled": { "osdWarningGpsRescueDisabled": {
"message": "Warns when GPS Rescue is disabled" "message": "Warns when GPS Rescue is disabled"
}, },
"osdWarningRSSI": {
"message": "Warns when RSSI is below alarm setting"
},
"osdWarningLinkQuality": {
"message": "Warns when Link Quality is below alarm setting"
},
"osdSectionHelpElements": { "osdSectionHelpElements": {
"message": "Enable or disable OSD elements." "message": "Enable or disable OSD elements."

View file

@ -263,7 +263,8 @@ OSD.initData = function () {
preview_logo: true, preview_logo: true,
preview: [], preview: [],
tooltips: [], tooltips: [],
osd_profiles: {} osd_profiles: {},
overlay_mode: null,
}; };
}; };
OSD.initData(); OSD.initData();
@ -1107,8 +1108,15 @@ OSD.constants = {
GPS_RESCUE_DISABLED: { GPS_RESCUE_DISABLED: {
name: 'GPS_RESCUE_DISABLED', name: 'GPS_RESCUE_DISABLED',
desc: 'osdWarningGpsRescueDisabled' desc: 'osdWarningGpsRescueDisabled'
} },
RSSI: {
name: 'RSSI',
desc: 'osdWarningRSSI'
},
LINK_QUALITY: {
name: 'LINK_QUALITY',
desc: 'osdWarningLinkQuality'
},
}, },
FONT_TYPES: [ FONT_TYPES: [
{ file: "default", name: "Default" }, { file: "default", name: "Default" },
@ -1365,6 +1373,12 @@ OSD.chooseFields = function () {
F.GPS_RESCUE_DISABLED F.GPS_RESCUE_DISABLED
]); ]);
} }
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
OSD.constants.WARNINGS = OSD.constants.WARNINGS.concat([
F.RSSI,
F.LINK_QUALITY
]);
}
}; };
OSD.updateDisplaySize = function () { OSD.updateDisplaySize = function () {
@ -1487,8 +1501,12 @@ OSD.msp = {
result.push16(warningFlags); result.push16(warningFlags);
if (semver.gte(CONFIG.apiVersion, "1.41.0")) { if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
result.push32(warningFlags); result.push32(warningFlags);
// NOTE: betaflight MSP does not expect result.push8(OSD.data.osd_profiles.number);
result.push8(OSD.data.osd_profiles.selected + 1); result.push8(OSD.data.osd_profiles.selected + 1);
result.push8(OSD.data.overlay_mode);
}
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
result.push8(OSD.data.alarms.link_quality.value);
} }
} }
@ -1636,11 +1654,17 @@ OSD.msp = {
if (semver.gte(CONFIG.apiVersion, "1.41.0")) { if (semver.gte(CONFIG.apiVersion, "1.41.0")) {
d.osd_profiles.number = view.readU8(); d.osd_profiles.number = view.readU8();
d.osd_profiles.selected = view.readU8() - 1; d.osd_profiles.selected = view.readU8() - 1;
d.overlay_mode = view.readU8();
} else { } else {
d.osd_profiles.number = 1; d.osd_profiles.number = 1;
d.osd_profiles.selected = 0; d.osd_profiles.selected = 0;
} }
// Link Quality Alarm
if (semver.gte(CONFIG.apiVersion, "1.42.0")) {
d.alarms['link_quality'] = { display_name: 'Link Quality', value: view.readU8() };
}
// Now we have the number of profiles, process the OSD elements // Now we have the number of profiles, process the OSD elements
for (let item of items_positions_read) { for (let item of items_positions_read) {
var j = d.display_items.length; var j = d.display_items.length;