Merge pull request #80 from NightHawk32/NewPIDFunctions

New pid functions
10.3.x-maintenance
Albert Kravcov 2015-12-28 01:08:01 +01:00
commit 3a1471e03a
4 changed files with 26 additions and 26 deletions

View File

@ -25,11 +25,11 @@ function configuration_backup(callback) {
function update_profile_specific_data_list() {
if (semver.lt(CONFIG.apiVersion, "1.12.0")) {
profileSpecificData.push(MSP_codes.MSP_CHANNEL_FORWARDING);
} else {
} else {
profileSpecificData.push(MSP_codes.MSP_SERVO_MIX_RULES);
}
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
profileSpecificData.push(MSP_codes.MSP_RC_READBAND);
profileSpecificData.push(MSP_codes.MSP_RC_DEADBAND);
}
}
@ -72,7 +72,7 @@ function configuration_backup(callback) {
});
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
configuration.profiles[fetchingProfile].RCreadband = jQuery.extend(true, {}, RC_readband);
configuration.profiles[fetchingProfile].RCdeadband = jQuery.extend(true, {}, RC_deadband);
}
codeKey = 0;
fetchingProfile++;
@ -529,12 +529,12 @@ function configuration_restore(callback) {
if (compareVersions(migratedVersion, '0.66.0') && !compareVersions(configuration.apiVersion, '1.15.0')) {
// api 1.15 exposes RCreadband and sensor alignment
// api 1.15 exposes RCdeadband and sensor alignment
for (var profileIndex = 0; profileIndex < configuration.profiles.length; profileIndex++) {
if (configuration.profiles[profileIndex].RCreadband == undefined) {
configuration.profiles[profileIndex].RCreadband = {
if (configuration.profiles[profileIndex].RCdeadband == undefined) {
configuration.profiles[profileIndex].RCdeadband = {
deadband: 0,
yaw_deadband: 0,
alt_hold_deadband: 40,
@ -613,7 +613,7 @@ function configuration_restore(callback) {
];
if (semver.gte(CONFIG.apiVersion, "1.15.0")) {
profileSpecificData.push(MSP_codes.MSP_SET_RC_READBAND);
profileSpecificData.push(MSP_codes.MSP_SET_RC_DEADBAND);
}
MSP.send_message(MSP_codes.MSP_STATUS, false, false, function () {
@ -642,7 +642,7 @@ function configuration_restore(callback) {
SERVO_RULES = configuration.profiles[profile].ServoRules;
MODE_RANGES = configuration.profiles[profile].ModeRanges;
ADJUSTMENT_RANGES = configuration.profiles[profile].AdjustmentRanges;
RC_readband = configuration.profiles[profile].RCreadband;
RC_deadband = configuration.profiles[profile].RCdeadband;
}
function upload_using_specific_commands() {

View File

@ -179,7 +179,7 @@ var DATAFLASH = {
usedSize: 0
};
var RC_readband = {
var RC_deadband = {
deadband: 0,
yaw_deadband: 0,
alt_hold_deadband: 0

View File

@ -59,7 +59,7 @@ var MSP_codes = {
MSP_BOXIDS: 119,
MSP_SERVO_CONFIGURATIONS: 120,
MSP_3D: 124,
MSP_RC_READBAND: 125,
MSP_RC_DEADBAND: 125,
MSP_SENSOR_ALIGNMENT: 126,
MSP_SET_RAW_RC: 200,
@ -77,7 +77,7 @@ var MSP_codes = {
MSP_SET_SERVO_CONFIGURATION: 212,
MSP_SET_MOTOR: 214,
MSP_SET_3D: 217,
MSP_SET_RC_READBAND: 218,
MSP_SET_RC_DEADBAND: 218,
MSP_SET_RESET_CURR_PID: 219,
MSP_SET_SENSOR_ALIGNMENT: 220,
@ -525,11 +525,11 @@ var MSP = {
}
}
break;
case MSP_codes.MSP_RC_READBAND:
case MSP_codes.MSP_RC_DEADBAND:
var offset = 0;
RC_readband.deadband = data.getUint8(offset++, 1);
RC_readband.yaw_deadband = data.getUint8(offset++, 1);
RC_readband.alt_hold_deadband = data.getUint8(offset++, 1);
RC_deadband.deadband = data.getUint8(offset++, 1);
RC_deadband.yaw_deadband = data.getUint8(offset++, 1);
RC_deadband.alt_hold_deadband = data.getUint8(offset++, 1);
break;
case MSP_codes.MSP_SENSOR_ALIGNMENT:
var offset = 0;
@ -932,7 +932,7 @@ var MSP = {
case MSP_codes.MSP_SET_3D:
console.log('3D settings saved');
break;
case MSP_codes.MSP_SET_RC_READBAND:
case MSP_codes.MSP_SET_RC_DEADBAND:
console.log('Rc controls settings saved');
break;
case MSP_codes.MSP_SET_SENSOR_ALIGNMENT:
@ -1280,10 +1280,10 @@ MSP.crunch = function (code) {
buffer.push(highByte(_3D.deadband3d_throttle));
break;
case MSP_codes.MSP_SET_RC_READBAND:
buffer.push(RC_readband.deadband);
buffer.push(RC_readband.yaw_deadband);
buffer.push(RC_readband.alt_hold_deadband);
case MSP_codes.MSP_SET_RC_DEADBAND:
buffer.push(RC_deadband.deadband);
buffer.push(RC_deadband.yaw_deadband);
buffer.push(RC_deadband.alt_hold_deadband);
break;
case MSP_codes.MSP_SET_SENSOR_ALIGNMENT:

View File

@ -32,7 +32,7 @@ TABS.receiver.initialize = function (callback) {
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);
MSP.send_message(MSP_codes.MSP_RC_DEADBAND, false, false, next_callback);
} else {
next_callback();
}
@ -71,8 +71,8 @@ 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);
$('.deadband input[name="yaw_deadband"]').val(RC_deadband.yaw_deadband);
$('.deadband input[name="deadband"]').val(RC_deadband.deadband);
}
// generate bars
@ -309,8 +309,8 @@ TABS.receiver.initialize = function (callback) {
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());
RC_deadband.yaw_deadband = parseInt($('.deadband input[name="yaw_deadband"]').val());
RC_deadband.deadband = parseInt($('.deadband input[name="deadband"]').val());
}
// catch rc map
@ -335,7 +335,7 @@ TABS.receiver.initialize = function (callback) {
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);
MSP.send_message(MSP_codes.MSP_SET_RC_DEADBAND, MSP.crunch(MSP_codes.MSP_SET_RC_DEADBAND), false, next_callback);
} else {
next_callback();
}