1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 20:35:19 +03:00

Add highlighting for fields that change with profiles

- Added field arrays for control and battery profiles.
- Added highlight mechanism for **data-setting** fields
- Changed battery and control profile drop down text to match the field colours.
This commit is contained in:
Darren Lines 2022-02-19 18:34:37 +00:00
parent a31aa128f1
commit 0f27abf733
4 changed files with 187 additions and 26 deletions

158
js/fc.js
View file

@ -1408,5 +1408,163 @@ var FC = {
default: 0 default: 0
} }
} }
},
getBatteryProfileParameters: function () {
return [
'bat_cells',
'vbat_cell_detect_voltage',
'vbat_max_cell_voltage',
'vbat_min_cell_voltage',
'vbat_warning_cell_voltage',
'battery_capacity',
'battery_capacity_warning',
'battery_capacity_critical',
'battery_capacity_unit',
'controlrate_profile',
'throttle_scale',
'throttle_idle',
'turtle_mode_power_factor',
'failsafe_throttle',
'fw_min_throttle_down_pitch',
'nav_mc_hover_thr',
'nav_fw_cruise_thr',
'nav_fw_min_thr',
'nav_fw_max_thr',
'nav_fw_pitch2thr',
'nav_fw_launch_thr',
'nav_fw_launch_idle_thr',
'limit_cont_current',
'limit_burst_current',
'limit_burst_current_time',
'limit_burst_current_falldown_time',
'limit_cont_power',
'limit_burst_power',
'limit_burst_power_time',
'limit_burst_power_falldown_time'
];
},
isBatteryProfileParameter: function(paramName) {
return ($.inArray(paramName,this.getBatteryProfileParameters()) != -1);
//return true;
},
getControlProfileParameters: function () {
return [
'mc_p_pitch',
'mc_i_pitch',
'mc_d_pitch',
'mc_cd_pitch',
'mc_p_roll',
'mc_i_roll',
'mc_d_roll',
'mc_cd_roll',
'mc_p_yaw',
'mc_i_yaw',
'mc_d_yaw',
'mc_cd_yaw',
'mc_p_level',
'mc_i_level',
'mc_d_level',
'fw_p_pitch',
'fw_i_pitch',
'fw_d_pitch',
'fw_ff_pitch',
'fw_p_roll',
'fw_i_roll',
'fw_d_roll',
'fw_ff_roll',
'fw_p_yaw',
'fw_i_yaw',
'fw_d_yaw',
'fw_ff_yaw',
'fw_p_level',
'fw_i_level',
'fw_d_level',
'max_angle_inclination_rll',
'max_angle_inclination_pit',
'dterm_lpf_hz',
'dterm_lpf_type',
'dterm_lpf2_hz',
'dterm_lpf2_type',
'yaw_lpf_hz',
'fw_iterm_throw_limit',
'fw_loiter_direction',
'fw_reference_airspeed',
'fw_turn_assist_yaw_gain',
'fw_turn_assist_pitch_gain',
'fw_iterm_limit_stick_position',
'fw_yaw_iterm_freeze_bank_angle',
'pidsum_limit',
'pidsum_limit_yaw',
'iterm_windup',
'rate_accel_limit_roll_pitch',
'rate_accel_limit_yaw',
'heading_hold_rate_limit',
'nav_mc_pos_z_p',
'nav_mc_vel_z_p',
'nav_mc_vel_z_i',
'nav_mc_vel_z_d',
'nav_mc_pos_xy_p',
'nav_mc_vel_xy_p',
'nav_mc_vel_xy_i',
'nav_mc_vel_xy_d',
'nav_mc_vel_xy_ff',
'nav_mc_heading_p',
'nav_mc_vel_xy_dterm_lpf_hz',
'nav_mc_vel_xy_dterm_attenuation',
'nav_mc_vel_xy_dterm_attenuation_start',
'nav_mc_vel_xy_dterm_attenuation_end',
'nav_fw_pos_z_p',
'nav_fw_pos_z_i',
'nav_fw_pos_z_d',
'nav_fw_pos_xy_p',
'nav_fw_pos_xy_i',
'nav_fw_pos_xy_d',
'nav_fw_heading_p',
'nav_fw_pos_hdg_p',
'nav_fw_pos_hdg_i',
'nav_fw_pos_hdg_d',
'nav_fw_pos_hdg_pidsum_limit',
'mc_iterm_relax',
'mc_iterm_relax_cutoff',
'd_boost_min',
'd_boost_max',
'd_boost_max_at_acceleration',
'd_boost_gyro_delta_lpf_hz',
'antigravity_gain',
'antigravity_accelerator',
'antigravity_cutoff_lpf_hz',
'pid_type',
'mc_cd_lpf_hz',
'fw_level_pitch_trim',
'smith_predictor_strength',
'smith_predictor_delay',
'smith_predictor_lpf_hz',
'fw_level_pitch_gain',
'thr_mid',
'thr_expo',
'tpa_rate',
'tpa_breakpoint',
'fw_tpa_time_constant',
'rc_expo',
'rc_yaw_expo',
'roll_rate',
'pitch_rate',
'yaw_rate',
'manual_rc_expo',
'manual_rc_yaw_expo',
'manual_roll_rate',
'manual_pitch_rate',
'manual_yaw_rate',
'fpv_mix_degrees',
'rate_dynamics_center_sensitivity',
'rate_dynamics_end_sensitivity',
'rate_dynamics_center_correction',
'rate_dynamics_end_correction',
'rate_dynamics_center_weight',
'rate_dynamics_end_weight'
];
},
isControlProfileParameter: function(paramName) {
return ($.inArray(paramName, this.getControlProfileParameters()) != -1);
} }
}; };

View file

@ -12,6 +12,14 @@ var Settings = (function () {
var settingName = input.data('setting'); var settingName = input.data('setting');
var inputUnit = input.data('unit'); var inputUnit = input.data('unit');
if (FC.isBatteryProfileParameter(settingName)) {
input.css("background-color","#fef2d5");
}
if (FC.isControlProfileParameter(settingName)) {
input.css("background-color","#d5ebfe");
}
return mspHelper.getSetting(settingName).then(function (s) { return mspHelper.getSetting(settingName).then(function (s) {
// Check if the input declares a parent // Check if the input declares a parent
// to be hidden in case of the setting not being available. // to be hidden in case of the setting not being available.

View file

@ -124,10 +124,6 @@
box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2); box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
color:#a6a6a6; color:#a6a6a6;
text-shadow:0px 1px rgba(0, 0, 0, 0.25); text-shadow:0px 1px rgba(0, 0, 0, 0.25);
} }
.dropdown-dark:before { .dropdown-dark:before {
border-bottom-color: #aaa; border-bottom-color: #aaa;
@ -143,9 +139,17 @@
} }
.dropdown-dark .dropdown-select:focus { .dropdown-dark .dropdown-select:focus {
color: #fff; color: #fff !important;
} }
.dropdown-dark .dropdown-select > option { .dropdown-dark .dropdown-select > option {
background: #56ab1a; background: #56ab1a;
text-shadow: 0 1px rgba(0, 0, 0, 0.4); text-shadow: 0 1px rgba(0, 0, 0, 0.4);
} }
.dropdown-dark #profilechange {
color: #d5ebfe;
}
.dropdown-dark #batteryprofilechange {
color: #fef2d5;
}

View file

@ -178,24 +178,21 @@
<tr> <tr>
<th class="roll" data-i18n="pidTuningRollRate"></th> <th class="roll" data-i18n="pidTuningRollRate"></th>
<td class="roll"> <td class="roll">
<input type="number" id="rate-roll" class="rate-tpa_input" step="10" min="40" <input type="number" class="rate-tpa_input" data-setting="roll_rate" data-setting-unit="ddeg" />
max="1800" /> <input type="number" id="rate-roll" class="rate-tpa_input" step="10" min="40" max="1800" />
degrees per second degrees per second
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="pitch" data-i18n="pidTuningPitchRate"></th> <th class="pitch" data-i18n="pidTuningPitchRate"></th>
<td class="pitch"> <td class="pitch">
<input type="number" id="rate-pitch" class="rate-tpa_input" step="10" min="40" <input type="number" id="rate-pitch" class="rate-tpa_input" step="10" min="40" max="1800" /> degrees per second
max="1800" /> degrees per second
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="yaw" data-i18n="pidTuningYawRate"></th> <th class="yaw" data-i18n="pidTuningYawRate"></th>
<td class="yaw"> <td class="yaw">
<input type="number" id="rate-yaw" class="rate-tpa_input" step="10" min="10" <input type="number" id="rate-yaw" class="rate-tpa_input" step="10" min="10" max="1800" /> degrees per second
max="1800" />
degrees per second
</td> </td>
</tr> </tr>
<tr> <tr>
@ -213,46 +210,40 @@
<tr> <tr>
<th data-i18n="pidTuningMaxRollAngle"></th> <th data-i18n="pidTuningMaxRollAngle"></th>
<td> <td>
<input data-setting="max_angle_inclination_rll" data-setting-multiplier="10" <input type="number" class="rate-tpa_input" data-setting="max_angle_inclination_rll" data-setting-multiplier="10" /> degrees
type="number" class="rate-tpa_input" /> degrees
<div class="helpicon cf_tip" data-i18n_title="pidTuningMaxRollAngleHelp"></div> <div class="helpicon cf_tip" data-i18n_title="pidTuningMaxRollAngleHelp"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th data-i18n="pidTuningMaxPitchAngle"></th> <th data-i18n="pidTuningMaxPitchAngle"></th>
<td> <td>
<input data-setting="max_angle_inclination_pit" data-setting-multiplier="10" <input type="number" class="rate-tpa_input" data-setting="max_angle_inclination_pit" data-setting-multiplier="10" /> degrees
type="number" class="rate-tpa_input" /> degrees
<div class="helpicon cf_tip" data-i18n_title="pidTuningMaxPitchAngleHelp"></div> <div class="helpicon cf_tip" data-i18n_title="pidTuningMaxPitchAngleHelp"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th data-i18n="magHoldYawRate"></th> <th data-i18n="magHoldYawRate"></th>
<td> <td>
<input type="number" id="magHoldYawRate" class="rate-tpa_input" step="5" min="10" <input type="number" id="magHoldYawRate" class="rate-tpa_input" step="5" min="10" max="250" /> degrees per second
max="250" /> degrees per second
<div class="helpicon cf_tip" data-i18n_title="pidTuningMagHoldYawRateHelp"></div> <div class="helpicon cf_tip" data-i18n_title="pidTuningMagHoldYawRateHelp"></div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="roll" data-i18n="pidTuningManualRollRate"></th> <th class="roll" data-i18n="pidTuningManualRollRate"></th>
<td class="roll"> <td class="roll">
<input type="number" id="rate-manual-roll" class="rate-tpa_input" step="1" min="0" <input type="number" id="rate-manual-roll" class="rate-tpa_input" step="1" min="0" max="100" /> %
max="100" /> %
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="pitch" data-i18n="pidTuningManualPitchRate"></th> <th class="pitch" data-i18n="pidTuningManualPitchRate"></th>
<td class="pitch"> <td class="pitch">
<input type="number" id="rate-manual-pitch" class="rate-tpa_input" step="1" min="0" <input type="number" id="rate-manual-pitch" class="rate-tpa_input" step="1" min="0" max="100" /> %
max="100" /> %
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="yaw" data-i18n="pidTuningManualYawRate"></th> <th class="yaw" data-i18n="pidTuningManualYawRate"></th>
<td class="yaw"> <td class="yaw">
<input type="number" id="rate-manual-yaw" class="rate-tpa_input" step="1" min="0" <input type="number" id="rate-manual-yaw" class="rate-tpa_input" step="1" min="0" max="100" /> %
max="100" /> %
</td> </td>
</tr> </tr>
</tbody> </tbody>