mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Support for MSP_NAME
This commit is contained in:
parent
f5a34f7a9d
commit
aab0035d92
5 changed files with 75 additions and 5 deletions
|
@ -1751,10 +1751,17 @@
|
||||||
},
|
},
|
||||||
"pidTuningRatesTip": {
|
"pidTuningRatesTip": {
|
||||||
"message": "Play with the rates and see how those affect the stick curve"
|
"message": "Play with the rates and see how those affect the stick curve"
|
||||||
|
},
|
||||||
|
"configurationMisc": {
|
||||||
|
"message": "Misc"
|
||||||
|
},
|
||||||
|
"configurationVesselName": {
|
||||||
|
"message": "Vessel name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
3
js/fc.js
3
js/fc.js
|
@ -58,7 +58,8 @@ var FC = {
|
||||||
mode: 0,
|
mode: 0,
|
||||||
profile: 0,
|
profile: 0,
|
||||||
uid: [0, 0, 0],
|
uid: [0, 0, 0],
|
||||||
accelerometerTrims: [0, 0]
|
accelerometerTrims: [0, 0],
|
||||||
|
name: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
BF_CONFIG = {
|
BF_CONFIG = {
|
||||||
|
|
28
js/msp.js
28
js/msp.js
|
@ -8,6 +8,9 @@ var MSP_codes = {
|
||||||
MSP_BOARD_INFO: 4,
|
MSP_BOARD_INFO: 4,
|
||||||
MSP_BUILD_INFO: 5,
|
MSP_BUILD_INFO: 5,
|
||||||
|
|
||||||
|
MSP_NAME: 10,
|
||||||
|
MSP_SET_NAME: 11,
|
||||||
|
|
||||||
// MSP commands for Cleanflight original features
|
// MSP commands for Cleanflight original features
|
||||||
MSP_CHANNEL_FORWARDING: 32,
|
MSP_CHANNEL_FORWARDING: 32,
|
||||||
MSP_SET_CHANNEL_FORWARDING: 33,
|
MSP_SET_CHANNEL_FORWARDING: 33,
|
||||||
|
@ -731,6 +734,19 @@ var MSP = {
|
||||||
offset+=2;
|
offset+=2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSP_codes.MSP_NAME:
|
||||||
|
var offset = 0;
|
||||||
|
var name = '';
|
||||||
|
var letter;
|
||||||
|
do {
|
||||||
|
letter = String.fromCharCode(data.getUint8(offset++));
|
||||||
|
if (letter != '\0') {
|
||||||
|
name += letter;
|
||||||
|
}
|
||||||
|
} while (letter != '\0' && offset < 100);
|
||||||
|
CONFIG.name = name;
|
||||||
|
break;
|
||||||
|
|
||||||
case MSP_codes.MSP_SET_CHANNEL_FORWARDING:
|
case MSP_codes.MSP_SET_CHANNEL_FORWARDING:
|
||||||
console.log('Channel forwarding saved');
|
console.log('Channel forwarding saved');
|
||||||
break;
|
break;
|
||||||
|
@ -1082,6 +1098,10 @@ var MSP = {
|
||||||
break;
|
break;
|
||||||
case MSP_codes.MSP_SET_VTX_CONFIG:
|
case MSP_codes.MSP_SET_VTX_CONFIG:
|
||||||
break;
|
break;
|
||||||
|
case MSP_codes.MSP_SET_NAME:
|
||||||
|
console.log('Name set');
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log('Unknown code detected: ' + code);
|
console.log('Unknown code detected: ' + code);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1485,6 +1505,14 @@ MSP.crunch = function (code) {
|
||||||
buffer.push(SENSOR_CONFIG.baro_hardware);
|
buffer.push(SENSOR_CONFIG.baro_hardware);
|
||||||
buffer.push(SENSOR_CONFIG.mag_hardware);
|
buffer.push(SENSOR_CONFIG.mag_hardware);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSP_codes.MSP_SET_NAME:
|
||||||
|
for (var i = 0; i<32; i++) {
|
||||||
|
buffer.push(CONFIG.name.charCodeAt(i));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,6 +485,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="gui_box grey">
|
||||||
|
<div class="gui_box_titlebar">
|
||||||
|
<div class="spacer_box_title" i18n="configurationMisc"></div>
|
||||||
|
</div>
|
||||||
|
<div class="spacer_box">
|
||||||
|
<div class="number">
|
||||||
|
<label> <input type="text" name="vesselName"/> <span
|
||||||
|
i18n="configurationVesselName"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="rightWrapper other">
|
<div class="rightWrapper other">
|
||||||
<div class="gui_box grey">
|
<div class="gui_box grey">
|
||||||
|
|
|
@ -89,7 +89,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_advanced_tuning() {
|
function load_advanced_tuning() {
|
||||||
var next_callback = load_html;
|
var next_callback = load_name;
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
MSP.send_message(MSP_codes.MSP_ADVANCED_TUNING, false, false, next_callback);
|
MSP.send_message(MSP_codes.MSP_ADVANCED_TUNING, false, false, next_callback);
|
||||||
} else {
|
} else {
|
||||||
|
@ -97,6 +97,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function load_name() {
|
||||||
|
var next_callback = load_html;
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
|
MSP.send_message(MSP_codes.MSP_NAME, false, false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Update Analog/Battery Data
|
//Update Analog/Battery Data
|
||||||
|
@ -388,6 +396,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
$('.hardwareSelection').hide();
|
$('.hardwareSelection').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('input[name="vesselName"]').val(CONFIG.name);
|
||||||
|
|
||||||
|
|
||||||
// generate GPS
|
// generate GPS
|
||||||
var gpsProtocols = [
|
var gpsProtocols = [
|
||||||
|
@ -711,7 +721,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_advanced_tuning() {
|
function save_advanced_tuning() {
|
||||||
var next_callback = save_to_eeprom;
|
var next_callback = save_name;
|
||||||
|
|
||||||
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "2.8.1")) {
|
||||||
|
|
||||||
|
@ -723,6 +733,17 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_name() {
|
||||||
|
var next_callback = save_to_eeprom;
|
||||||
|
|
||||||
|
if (CONFIG.flightControllerIdentifier == "BTFL" && semver.gte(CONFIG.flightControllerVersion, "3.0.0")) {
|
||||||
|
CONFIG.name = $.trim($('input[name="vesselName"]').val());
|
||||||
|
MSP.send_message(MSP_codes.MSP_SET_NAME, MSP.crunch(MSP_codes.MSP_SET_NAME), false, next_callback);
|
||||||
|
} else {
|
||||||
|
next_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function save_to_eeprom() {
|
function save_to_eeprom() {
|
||||||
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
|
||||||
}
|
}
|
||||||
|
@ -754,7 +775,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
// MSP.send_message(MSP_codes.MSP_SET_BF_CONFIG, MSP.crunch(MSP_codes.MSP_SET_BF_CONFIG), false, save_serial_config);
|
||||||
|
save_name();
|
||||||
});
|
});
|
||||||
|
|
||||||
// status data pulled via separate timer with static speed
|
// status data pulled via separate timer with static speed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue