Added RC rate yaw and prepared filters

10.3.x-maintenance
U-DESKTOP-12PPI61\boris.bozic 2016-06-21 02:16:22 +02:00
parent f2fd1e1077
commit dca4dc97a1
5 changed files with 41 additions and 8 deletions

View File

@ -768,6 +768,12 @@
},
"pidTuningTPABreakPoint": {
"message": "TPA Breakpoint"
},
"pidTuningFilter": {
"message": "Filter"
},
"pidTuningFilterFrequency": {
"message": "Frequency"
},
"rcCurve": {
"message": "RC Curve"

View File

@ -260,7 +260,7 @@ var FC = {
};
TEMPORARY_COMMANDS = {
RC_YAW_RATE: 0
RC_RATE_YAW: 0
};
RX_CONFIG = {

View File

@ -902,7 +902,7 @@ var MSP = {
ADVANCED_TUNING.yaw_p_limit = data.getUint16(offset, 1);
break;
case MSP_codes.MSP_TEMPORARY_COMMANDS:
TEMPORARY_COMMANDS.RC_RATE_YAW = data.getUint8(0, 1);
TEMPORARY_COMMANDS.RC_RATE_YAW = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
break;
case MSP_codes.MSP_LED_STRIP_CONFIG:
LED_STRIP = [];
@ -1407,8 +1407,13 @@ MSP.crunch = function (code) {
buffer.push(lowByte(PID_ADVANCED_CONFIG.motor_pwm_rate));
buffer.push(highByte(PID_ADVANCED_CONFIG.motor_pwm_rate));
break;
case MSP_codes.MSP_TEMPORARY_COMMANDS:
buffer.push(TEMPORARY_COMMANDS.RC_RATE_YAW);
case MSP_codes.MSP_SET_FILTER_CONFIG:
buffer.push(FILTER_CONFIG.gyro_soft_lpf_hz);
buffer.push(FILTER_CONFIG.dterm_lpf_hz);
buffer.push(FILTER_CONFIG.yaw_lpf_hz);
break;
case MSP_codes.MSP_SET_TEMPORARY_COMMANDS:
buffer.push(Math.round(TEMPORARY_COMMANDS.RC_RATE_YAW * 100));
break;
default:
return false;

View File

@ -49,7 +49,7 @@
<td><input type="number" name="p" step="1" min="0" max="255" /></td>
<td><input type="number" name="i" step="1" min="0" max="255" /></td>
<td><input type="number" name="d" step="1" min="0" max="255" /></td>
<td rowspan="3"><input type="number" name="rc_rate" step="0.01" min="0" max="2.5" /></td>
<td rowspan="2"><input type="number" name="rc_rate" step="0.01" min="0" max="2.5" /></td>
<td class="roll_rate"><input type="number" name="roll_rate" step="0.01" min="0" max="1.00" /></td>
<td class="roll_pitch_rate" rowspan="2"><input type="number" name="roll_pitch_rate" step="0.01" min="0" max="1.00" /></td>
<td rowspan="2"><input type="number" name="rc_expo" step="0.01" min="0" max="1" /></td>
@ -69,6 +69,7 @@
<td><input type="number" name="p" step="1" min="0" max="255" /></td>
<td><input type="number" name="i" step="1" min="0" max="255" /></td>
<td><input type="number" name="d" step="1" min="0" max="255" /></td>
<td rowspan="1"><input type="number" name="rc_rate_yaw" step="0.01" min="0" max="2.5" /></td>
<td><input type="number" name="yaw_rate" step="0.01" min="0" max="2.55" /></td>
<td><input type="number" name="rc_yaw_expo" step="0.01" min="0" max="1" /></td>
</tr>

View File

@ -185,6 +185,7 @@ TABS.pid_tuning.initialize = function (callback) {
$('.pid_tuning input[name="yaw_rate"]').val(RC_tuning.yaw_rate.toFixed(2));
$('.pid_tuning input[name="rc_expo"]').val(RC_tuning.RC_EXPO.toFixed(2));
$('.pid_tuning input[name="rc_yaw_expo"]').val(RC_tuning.RC_YAW_EXPO.toFixed(2));
$('.pid_tuning input[name="rc_rate_yaw"]').val(TEMPORARY_COMMANDS.RC_RATE_YAW.toFixed(2));
$('.tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
$('.tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint);
@ -193,8 +194,10 @@ TABS.pid_tuning.initialize = function (callback) {
$('.pid_tuning input[name="rc_yaw_expo"]').hide();
$('.pid_tuning input[name="rc_expo"]').attr("rowspan", "3");
}
$('.pid_tuning input[name="gyro_soft_lpf"]').val(FILTER_CONFIG.gyro_soft_lpf_hz);
$('.pid_tuning input[name="dterm_lpf"]').val(FILTER_CONFIG.dterm_lpf_hz);
$('.pid_tuning input[name="yaw_lpf"]').val(FILTER_CONFIG.yaw_lpf_hz);
}
@ -258,9 +261,14 @@ TABS.pid_tuning.initialize = function (callback) {
RC_tuning.yaw_rate = parseFloat($('.pid_tuning input[name="yaw_rate"]').val());
RC_tuning.RC_EXPO = parseFloat($('.pid_tuning input[name="rc_expo"]').val());
RC_tuning.RC_YAW_EXPO = parseFloat($('.pid_tuning input[name="rc_yaw_expo"]').val());
TEMPORARY_COMMANDS.RC_RATE_YAW = parseFloat($('.pid_tuning input[name="rc_rate_yaw"]').val());
RC_tuning.dynamic_THR_PID = parseFloat($('.tpa input[name="tpa"]').val());
RC_tuning.dynamic_THR_breakpoint = parseInt($('.tpa input[name="tpa-breakpoint"]').val());
FILTER_CONFIG.gyro_soft_lpf_hz = parseInt($('.tpa input[name="gyro_soft_lpf"]').val());
FILTER_CONFIG.dterm_lpf_hz = parseInt($('.tpa input[name="dterm_lpf"]').val());
FILTER_CONFIG.yaw_lpf_hz = parseInt($('.tpa input[name="yaw_lpf"]').val());
}
function hideUnusedPids(sensors_detected) {
$('.tab-pid_tuning table.pid_tuning').hide();
@ -436,10 +444,23 @@ TABS.pid_tuning.initialize = function (callback) {
function send_pids() {
if (!TABS.pid_tuning.controllerChanged) {
MSP.send_message(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID), false, send_rc_tuning_changes);
MSP.send_message(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID), false, send_temporary);
}
}
function send_temporary() {
if (!TABS.pid_tuning.controllerChanged) {
MSP.send_message(MSP_codes.MSP_SET_TEMPORARY_COMMANDS, MSP.crunch(MSP_codes.MSP_SET_TEMPORARY_COMMANDS), false, send_rc_tuning_changes);
}
}
/* Uncomment when HTML layout added
function send_filters() {
if (!TABS.pid_tuning.controllerChanged) {
MSP.send_message(MSP_codes.MSP_SET_FILTER_CONFIG, MSP.crunch(MSP_codes.MSP_SET_FILTER_CONFIG), false, send_rc_tuning_changes);
}
}*/
function send_rc_tuning_changes() {
MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom);
}