Merge pull request #63 from NightHawk32/deadband_yaw
MSP communication for deadband and yaw_deadband10.3.x-maintenance
commit
f53c1132e9
|
@ -99,6 +99,9 @@ function configuration_backup(callback) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_3D);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_RC_CONTROLS);
|
||||
}
|
||||
}
|
||||
|
||||
update_unique_data_list();
|
||||
|
@ -126,6 +129,9 @@ function configuration_backup(callback) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
configuration._3D = jQuery.extend(true, {}, _3D);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
configuration.RC_controls = jQuery.extend(true, {}, RC_controls);
|
||||
}
|
||||
|
||||
save();
|
||||
}
|
||||
|
@ -507,6 +513,20 @@ function configuration_restore(callback) {
|
|||
appliedMigrationsCount++;
|
||||
}
|
||||
|
||||
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) {
|
||||
// api 1.14 exposes deadband and yaw_deadband
|
||||
|
||||
if (configuration.RC_controls == undefined) {
|
||||
configuration.RC_controls = {
|
||||
deadband: 0,
|
||||
yaw_deadband: 0,
|
||||
alt_hold_deadband: 40,
|
||||
alt_hold_fast_change: 1
|
||||
};
|
||||
}
|
||||
appliedMigrationsCount++;
|
||||
}
|
||||
|
||||
if (appliedMigrationsCount > 0) {
|
||||
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
|
||||
}
|
||||
|
@ -617,6 +637,9 @@ function configuration_restore(callback) {
|
|||
if (semver.gte(CONFIG.apiVersion, "1.14.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SET_3D);
|
||||
}
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
uniqueData.push(MSP_codes.MSP_SET_RC_CONTROLS);
|
||||
}
|
||||
}
|
||||
|
||||
function load_objects() {
|
||||
|
@ -628,6 +651,7 @@ function configuration_restore(callback) {
|
|||
ARMING_CONFIG = configuration.ARMING_CONFIG;
|
||||
FC_CONFIG = configuration.FC_CONFIG;
|
||||
_3D = configuration._3D;
|
||||
RC_controls = configuration.RC_controls;
|
||||
}
|
||||
|
||||
function send_unique_data_item() {
|
||||
|
|
|
@ -178,3 +178,10 @@ var DATAFLASH = {
|
|||
totalSize: 0,
|
||||
usedSize: 0
|
||||
};
|
||||
|
||||
var RC_controls = {
|
||||
deadband: 0,
|
||||
yaw_deadband: 0,
|
||||
alt_hold_deadband: 0,
|
||||
alt_hold_fast_change: 0
|
||||
};
|
||||
|
|
16
js/msp.js
16
js/msp.js
|
@ -53,6 +53,7 @@ var MSP_codes = {
|
|||
MSP_BOXIDS: 119,
|
||||
MSP_SERVO_CONFIGURATIONS: 120,
|
||||
MSP_3D: 124,
|
||||
MSP_RC_CONTROLS: 125,
|
||||
|
||||
MSP_SET_RAW_RC: 200,
|
||||
MSP_SET_RAW_GPS: 201,
|
||||
|
@ -69,6 +70,7 @@ var MSP_codes = {
|
|||
MSP_SET_SERVO_CONFIGURATION: 212,
|
||||
MSP_SET_MOTOR: 214,
|
||||
MSP_SET_3D: 217,
|
||||
MSP_SET_RC_CONTROLS: 218,
|
||||
|
||||
// MSP_BIND: 240,
|
||||
|
||||
|
@ -514,6 +516,13 @@ var MSP = {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case MSP_codes.MSP_RC_CONTROLS:
|
||||
var offset = 0;
|
||||
RC_controls.deadband = data.getUint8(offset++, 1);
|
||||
RC_controls.yaw_deadband = data.getUint8(offset++, 1);
|
||||
RC_controls.alt_hold_deadband = data.getUint8(offset++, 1);
|
||||
RC_controls.alt_hold_fast_change = data.getUint8(offset++, 1);
|
||||
break;
|
||||
case MSP_codes.MSP_SET_RAW_RC:
|
||||
break;
|
||||
case MSP_codes.MSP_SET_RAW_GPS:
|
||||
|
@ -1155,6 +1164,13 @@ MSP.crunch = function (code) {
|
|||
buffer.push(highByte(_3D.deadband3d_throttle));
|
||||
break;
|
||||
|
||||
case MSP_codes.MSP_SET_RC_CONTROLS:
|
||||
buffer.push(RC_controls.deadband);
|
||||
buffer.push(RC_controls.yaw_deadband);
|
||||
buffer.push(RC_controls.alt_hold_deadband);
|
||||
buffer.push(RC_controls.alt_hold_fast_change);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
<th>YAW Deadband</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="number" name="deadband" step="1" min="0" max="50" /></td>
|
||||
<td><input type="number" name="yaw_deadband" step="1" min="0" max="50" /></td>
|
||||
<td><input type="number" name="deadband" step="1" min="0" max="32" /></td>
|
||||
<td><input type="number" name="yaw_deadband" step="1" min="0" max="100" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,16 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
// Fetch features so we can check if RX_MSP is enabled:
|
||||
function load_config() {
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_html);
|
||||
MSP.send_message(MSP_codes.MSP_BF_CONFIG, false, false, load_rc_configs);
|
||||
}
|
||||
|
||||
function load_rc_configs() {
|
||||
var next_callback = load_html;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_RC_CONTROLS, false, false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function load_html() {
|
||||
|
@ -59,6 +68,13 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
if (semver.lt(CONFIG.apiVersion, "1.15.0")) {
|
||||
$('.deadband').hide();
|
||||
} else {
|
||||
$('.deadband input[name="yaw_deadband"]').val(RC_controls.yaw_deadband);
|
||||
$('.deadband input[name="deadband"]').val(RC_controls.deadband);
|
||||
}
|
||||
|
||||
// generate bars
|
||||
var bar_names = [
|
||||
chrome.i18n.getMessage('controlAxisRoll'),
|
||||
|
@ -290,7 +306,12 @@ TABS.receiver.initialize = function (callback) {
|
|||
|
||||
RC_tuning.RC_RATE = parseFloat($('.tunings .rate input[name="rate"]').val());
|
||||
RC_tuning.RC_EXPO = parseFloat($('.tunings .rate input[name="expo"]').val());
|
||||
RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="yaw_expo"]').val());
|
||||
RC_tuning.RC_YAW_EXPO = parseFloat($('.tunings .yaw_rate input[name="yaw_expo"]').val());
|
||||
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
RC_controls.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
|
||||
RC_controls.deadband = parseInt($('.deadband input[name="deadband"]').val());
|
||||
}
|
||||
|
||||
// catch rc map
|
||||
var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4'];
|
||||
|
@ -308,7 +329,16 @@ TABS.receiver.initialize = function (callback) {
|
|||
}
|
||||
|
||||
function save_misc() {
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_to_eeprom);
|
||||
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_rc_configs);
|
||||
}
|
||||
|
||||
function save_rc_configs() {
|
||||
var next_callback = save_to_eeprom;
|
||||
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
|
||||
MSP.send_message(MSP_codes.MSP_SET_RC_CONTROLS, MSP.crunch(MSP_codes.MSP_SET_RC_CONTROLS), false, next_callback);
|
||||
} else {
|
||||
next_callback();
|
||||
}
|
||||
}
|
||||
|
||||
function save_to_eeprom() {
|
||||
|
|
Loading…
Reference in New Issue