mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-13 11:29:56 +03:00
Get setting default values from settings.yaml (#6595)
* Get setting default values from settings.yaml * settings: Make the generator more robust and versatile - Add support for resolving types and values in multiple compilers - Add support for resolving types and values in clang 10 - Add support for using the host compiler for resolving the settings This allows us to run the generator for the unit tests, since they now need the settings_generated.h file to get the default setting values from it. * Fix regexps in settings.rb and add execution bit * Fix git revision issue * Fix issue with settings validation * Fix issue with targets not defining USE_MAG Co-authored-by: Alberto García Hierro <alberto@garciahierro.com>
This commit is contained in:
parent
7b705bccac
commit
fc0e5e2741
85 changed files with 1708 additions and 1875 deletions
|
@ -22,6 +22,14 @@ endif()
|
|||
|
||||
option(COMPILER_VERSION_CHECK "Ensure the compiler matches the expected version" ON)
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
string(SUBSTRING ${GIT_SHA1} 0 8 GIT_REV)
|
||||
|
||||
# Load settings related functions, so the tests can use them
|
||||
include(main)
|
||||
include(settings)
|
||||
|
||||
if(TOOLCHAIN STREQUAL none)
|
||||
add_subdirectory(src/test)
|
||||
else()
|
||||
|
@ -49,10 +57,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI
|
|||
set(IS_RELEASE_BUILD ON)
|
||||
endif()
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
string(SUBSTRING ${GIT_SHA1} 0 8 GIT_REV)
|
||||
|
||||
set(FIRMWARE_VERSION ${PROJECT_VERSION})
|
||||
|
||||
option(WARNINGS_AS_ERRORS "Make all warnings into errors")
|
||||
|
@ -64,10 +68,8 @@ set(COMMON_COMPILE_DEFINITIONS
|
|||
FC_VERSION_PATCH_LEVEL=${CMAKE_PROJECT_VERSION_PATCH}
|
||||
)
|
||||
|
||||
include(settings)
|
||||
include(openocd)
|
||||
include(svd)
|
||||
include(main)
|
||||
include(stm32)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -4,6 +4,7 @@ set(SETTINGS_GENERATED_H "${SETTINGS_GENERATED}.h")
|
|||
set(SETTINGS_FILE "${MAIN_SRC_DIR}/fc/settings.yaml")
|
||||
set(SETTINGS_GENERATOR "${MAIN_UTILS_DIR}/settings.rb")
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(enable_settings exe name)
|
||||
get_generated_files_dir(dir ${name})
|
||||
|
@ -15,11 +16,26 @@ function(enable_settings exe name)
|
|||
list(APPEND cflags ${options})
|
||||
list(APPEND cflags ${includes})
|
||||
list(APPEND cflags ${defs})
|
||||
|
||||
cmake_parse_arguments(
|
||||
args
|
||||
# Boolean arguments
|
||||
""
|
||||
# Single value arguments
|
||||
"OUTPUTS;SETTINGS_CXX"
|
||||
# Multi-value arguments
|
||||
""
|
||||
# Start parsing after the known arguments
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
set(output ${dir}/${SETTINGS_GENERATED_H} ${dir}/${SETTINGS_GENERATED_C})
|
||||
add_custom_command(
|
||||
OUTPUT ${dir}/${SETTINGS_GENERATED_H} ${dir}/${SETTINGS_GENERATED_C}
|
||||
OUTPUT ${output}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E env CFLAGS="${cflags}" TARGET=${name} PATH=$ENV{PATH}
|
||||
${CMAKE_COMMAND} -E env CFLAGS="${cflags}" TARGET=${name} PATH=$ENV{PATH} SETTINGS_CXX=${args_SETTINGS_CXX}
|
||||
${RUBY_EXECUTABLE} ${SETTINGS_GENERATOR} ${MAIN_DIR} ${SETTINGS_FILE} -o "${dir}"
|
||||
DEPENDS ${SETTINGS_GENERATOR} ${SETTINGS_FILE}
|
||||
)
|
||||
set(${args_OUTPUTS} ${output} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
|
346
docs/Settings.md
346
docs/Settings.md
|
@ -12,8 +12,8 @@
|
|||
| acc_hardware | AUTO | Selection of acc hardware. See Wiki Sensor auto detect and hardware failure detection for more info |
|
||||
| acc_lpf_hz | 15 | Software-based filter to remove mechanical vibrations from the accelerometer measurements. Value is cutoff frequency (Hz). For larger frames with bigger props set to lower value. |
|
||||
| acc_lpf_type | BIQUAD | Specifies the type of the software LPF of the acc signals. BIQUAD gives better filtering and more delay, PT1 less filtering and less delay, so use only on clean builds. |
|
||||
| acc_notch_cutoff | | |
|
||||
| acc_notch_hz | | |
|
||||
| acc_notch_cutoff | 1 | |
|
||||
| acc_notch_hz | 0 | |
|
||||
| accgain_x | 4096 | Calculated value after '6 position avanced calibration'. Uncalibrated value is 4096. See Wiki page. |
|
||||
| accgain_y | 4096 | Calculated value after '6 position avanced calibration'. Uncalibrated value is 4096. See Wiki page. |
|
||||
| accgain_z | 4096 | Calculated value after '6 position avanced calibration'. Uncalibrated value is 4096. See Wiki page. |
|
||||
|
@ -22,17 +22,17 @@
|
|||
| acczero_z | 0 | Calculated value after '6 position avanced calibration'. See Wiki page. |
|
||||
| airmode_throttle_threshold | 1300 | Defines airmode THROTTLE activation threshold when `airmode_type` **THROTTLE_THRESHOLD** is used |
|
||||
| airmode_type | STICK_CENTER | Defines the Airmode state handling type. Default **STICK_CENTER** is the classical approach in which Airmode is always active if enabled, but when the throttle is low and ROLL/PITCH/YAW sticks are centered, Iterms is not allowed to grow (ANTI_WINDUP). **THROTTLE_THRESHOLD** is the Airmode behavior known from Betaflight. In this mode, Airmode is active as soon THROTTLE position is above `airmode_throttle_threshold` and stays active until disarm. ANTI_WINDUP is never triggered. For small Multirotors (up to 7-inch propellers) it is suggested to switch to **THROTTLE_THRESHOLD** since it keeps full stabilization no matter what pilot does with the sticks. Fixed Wings always use **STICK_CENTER_ONCE** or **STICK_CENTER** modes. |
|
||||
| airspeed_adc_channel | 0 | ADC channel to use for analog pitot tube (airspeed) sensor. If board doesn't have a dedicated connector for analog airspeed sensor will default to 0 |
|
||||
| airspeed_adc_channel | :target | ADC channel to use for analog pitot tube (airspeed) sensor. If board doesn't have a dedicated connector for analog airspeed sensor will default to 0 |
|
||||
| align_acc | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_board_pitch | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_roll | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_yaw | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_pitch | :zero | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_roll | :zero | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_yaw | :zero | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_gyro | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_mag | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_mag_pitch | 0 | Same as align_mag_roll, but for the pitch axis. |
|
||||
| align_mag_roll | 0 | Set the external mag alignment on the roll axis (in 0.1 degree steps). If this value is non-zero, the compass is assumed to be externally mounted and both the board and on-board compass alignent (align_mag) are ignored. See also align_mag_pitch and align_mag_yaw. |
|
||||
| align_mag_yaw | 0 | Same as align_mag_roll, but for the yaw axis. |
|
||||
| align_opflow | 5 | Optical flow module alignment (default CW0_DEG_FLIP) |
|
||||
| align_opflow | CW0FLIP | Optical flow module alignment (default CW0_DEG_FLIP) |
|
||||
| alt_hold_deadband | 50 | Defines the deadband of throttle during alt_hold [r/c points] |
|
||||
| antigravity_accelerator | 1 | |
|
||||
| antigravity_cutoff_lpf_hz | 15 | Antigravity cutoff frequenct for Throtte filter. Antigravity is based on the difference between actual and filtered throttle input. The bigger is the difference, the bigger Antigravity gain |
|
||||
|
@ -40,73 +40,73 @@
|
|||
| applied_defaults | 0 | Internal (configurator) hint. Should not be changed manually |
|
||||
| baro_cal_tolerance | 150 | Baro calibration tolerance in cm. The default should allow the noisiest baro to complete calibration [cm]. |
|
||||
| baro_hardware | AUTO | Selection of baro hardware. See Wiki Sensor auto detect and hardware failure detection for more info |
|
||||
| baro_median_filter | ON | 3-point median filtering for barometer readouts. No reason to change this setting |
|
||||
| baro_median_filter | True | 3-point median filtering for barometer readouts. No reason to change this setting |
|
||||
| bat_cells | 0 | Number of cells of the battery (0 = autodetect), see battery documentation. 7S, 9S and 11S batteries cannot be autodetected. |
|
||||
| bat_voltage_src | RAW | Chose between raw and sag compensated battery voltage to use for battery alarms and telemetry. Possible values are `RAW` and `SAG_COMP` |
|
||||
| battery_capacity | 0 | Set the battery capacity in mAh or mWh (see `battery_capacity_unit`). Used to calculate the remaining battery capacity. |
|
||||
| battery_capacity_critical | 0 | If the remaining battery capacity goes below this threshold the battery is considered empty and the beeper will emit long beeps. |
|
||||
| battery_capacity_unit | MAH | Unit used for `battery_capacity`, `battery_capacity_warning` and `battery_capacity_critical` [MAH/MWH] (milliAmpere hour / milliWatt hour). |
|
||||
| battery_capacity_warning | 0 | If the remaining battery capacity goes below this threshold the beeper will emit short beeps and the relevant OSD items will blink. |
|
||||
| blackbox_device | SPIFLASH | Selection of where to write blackbox data |
|
||||
| blackbox_device | :target | Selection of where to write blackbox data |
|
||||
| blackbox_rate_denom | 1 | Blackbox logging rate denominator. See blackbox_rate_num. |
|
||||
| blackbox_rate_num | 1 | Blackbox logging rate numerator. Use num/denom settings to decide if a frame should be logged, allowing control of the portion of logged loop iterations |
|
||||
| cpu_underclock | OFF | This option is only available on certain architectures (F3 CPUs at the moment). It makes CPU clock lower to reduce interference to long-range RC systems working at 433MHz |
|
||||
| cpu_underclock | False | This option is only available on certain architectures (F3 CPUs at the moment). It makes CPU clock lower to reduce interference to long-range RC systems working at 433MHz |
|
||||
| cruise_power | 0 | Power draw at cruise throttle used for remaining flight time/distance estimation in 0.01W unit |
|
||||
| current_adc_channel | - | ADC channel to use for analog current sensor input. Defaults to board CURRENT sensor input (if available). 0 = disabled |
|
||||
| current_meter_offset | 0 | This sets the output offset voltage of the current sensor in millivolts. |
|
||||
| current_meter_scale | 400 | This sets the output voltage to current scaling for the current sensor in 0.1 mV/A steps. 400 is 40mV/A such as the ACS756 sensor outputs. 183 is the setting for the uberdistro with a 0.25mOhm shunt. |
|
||||
| current_adc_channel | :target | ADC channel to use for analog current sensor input. Defaults to board CURRENT sensor input (if available). 0 = disabled |
|
||||
| current_meter_offset | :target | This sets the output offset voltage of the current sensor in millivolts. |
|
||||
| current_meter_scale | :target | This sets the output voltage to current scaling for the current sensor in 0.1 mV/A steps. 400 is 40mV/A such as the ACS756 sensor outputs. 183 is the setting for the uberdistro with a 0.25mOhm shunt. |
|
||||
| current_meter_type | ADC | ADC , VIRTUAL, NONE. The virtual current sensor, once calibrated, estimates the current value from throttle position. |
|
||||
| d_boost_factor | | |
|
||||
| d_boost_gyro_delta_lpf_hz | | |
|
||||
| d_boost_max_at_acceleration | | |
|
||||
| d_boost_factor | 1.25 | |
|
||||
| d_boost_gyro_delta_lpf_hz | 80 | |
|
||||
| d_boost_max_at_acceleration | 7500 | |
|
||||
| deadband | 5 | These are values (in us) by how much RC input can be different before it's considered valid. For transmitters with jitter on outputs, this value can be increased. Defaults are zero, but can be increased up to 10 or so if rc inputs twitch while idle. |
|
||||
| debug_mode | NONE | Defines debug values exposed in debug variables (developer / debugging setting) |
|
||||
| disarm_kill_switch | ON | Disarms the motors independently of throttle value. Setting to OFF reverts to the old behaviour of disarming only when the throttle is low. Only applies when arming and disarming with an AUX channel. |
|
||||
| display_force_sw_blink | OFF | OFF = OSD hardware blink / ON = OSD software blink. If OSD warning text/values are invisible, try setting this to ON |
|
||||
| disarm_kill_switch | True | Disarms the motors independently of throttle value. Setting to OFF reverts to the old behaviour of disarming only when the throttle is low. Only applies when arming and disarming with an AUX channel. |
|
||||
| display_force_sw_blink | False | OFF = OSD hardware blink / ON = OSD software blink. If OSD warning text/values are invisible, try setting this to ON |
|
||||
| dji_esc_temp_source | ESC | Re-purpose the ESC temperature field for IMU/BARO temperature |
|
||||
| dji_speed_source | GROUND | Sets the speed type displayed by the DJI OSD: GROUND, 3D, AIR |
|
||||
| dji_use_name_for_messages | ON | Re-purpose the craft name field for messages. Replace craft name with :WTSED for Warnings|Throttle|Speed|Efficiency|Trip distance |
|
||||
| dji_workarounds | | Enables workarounds for different versions of MSP protocol used |
|
||||
| dji_use_name_for_messages | True | Re-purpose the craft name field for messages. Replace craft name with :WTSED for Warnings|Throttle|Speed|Efficiency|Trip distance |
|
||||
| dji_workarounds | 1 | Enables workarounds for different versions of MSP protocol used |
|
||||
| dterm_lpf2_hz | 0 | Cutoff frequency for stage 2 D-term low pass filter |
|
||||
| dterm_lpf2_type | `BIQUAD` | Defines the type of stage 1 D-term LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| dterm_lpf2_type | BIQUAD | Defines the type of stage 1 D-term LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| dterm_lpf_hz | 40 | Dterm low pass filter cutoff frequency. Default setting is very conservative and small multirotors should use higher value between 80 and 100Hz. 80 seems like a gold spot for 7-inch builds while 100 should work best with 5-inch machines. If motors are getting too hot, lower the value |
|
||||
| dterm_lpf_type | `BIQUAD` | Defines the type of stage 1 D-term LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| dynamic_gyro_notch_enabled | `OFF` | Enable/disable dynamic gyro notch also known as Matrix Filter |
|
||||
| dterm_lpf_type | BIQUAD | Defines the type of stage 1 D-term LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| dynamic_gyro_notch_enabled | False | Enable/disable dynamic gyro notch also known as Matrix Filter |
|
||||
| dynamic_gyro_notch_min_hz | 150 | Minimum frequency for dynamic notches. Default value of `150` works best with 5" multirors. Should be lowered with increased size of propellers. Values around `100` work fine on 7" drones. 10" can go down to `60` - `70` |
|
||||
| dynamic_gyro_notch_q | 120 | Q factor for dynamic notches |
|
||||
| dynamic_gyro_notch_range | `MEDIUM` | Range for dynamic gyro notches. `MEDIUM` for 5", `HIGH` for 3" and `MEDIUM`/`LOW` for 7" and bigger propellers |
|
||||
| eleres_freq | | |
|
||||
| eleres_loc_delay | | |
|
||||
| eleres_loc_en | | |
|
||||
| eleres_loc_power | | |
|
||||
| eleres_signature | | |
|
||||
| eleres_telemetry_en | | |
|
||||
| eleres_telemetry_power | | |
|
||||
| esc_sensor_listen_only | OFF | Enable when BLHeli32 Auto Telemetry function is used. Disable in every other case |
|
||||
| dynamic_gyro_notch_range | MEDIUM | Range for dynamic gyro notches. `MEDIUM` for 5", `HIGH` for 3" and `MEDIUM`/`LOW` for 7" and bigger propellers |
|
||||
| eleres_freq | 435 | |
|
||||
| eleres_loc_delay | 240 | |
|
||||
| eleres_loc_en | False | |
|
||||
| eleres_loc_power | 7 | |
|
||||
| eleres_signature | :zero | |
|
||||
| eleres_telemetry_en | False | |
|
||||
| eleres_telemetry_power | 7 | |
|
||||
| esc_sensor_listen_only | False | Enable when BLHeli32 Auto Telemetry function is used. Disable in every other case |
|
||||
| failsafe_delay | 5 | Time in deciseconds to wait before activating failsafe when signal is lost. See [Failsafe documentation](Failsafe.md#failsafe_delay). |
|
||||
| failsafe_fw_pitch_angle | 100 | Amount of dive/climb when `SET-THR` failsafe is active on a fixed-wing machine. In 1/10 deg (deci-degrees). Negative values = climb |
|
||||
| failsafe_fw_roll_angle | -200 | Amount of banking when `SET-THR` failsafe is active on a fixed-wing machine. In 1/10 deg (deci-degrees). Negative values = left roll |
|
||||
| failsafe_fw_yaw_rate | -45 | Requested yaw rate to execute when `SET-THR` failsafe is active on a fixed-wing machine. In deg/s. Negative values = left turn |
|
||||
| failsafe_lights | ON | Enable or disable the lights when the `FAILSAFE` flight mode is enabled. The target needs to be compiled with `USE_LIGHTS` [ON/OFF]. |
|
||||
| failsafe_lights | True | Enable or disable the lights when the `FAILSAFE` flight mode is enabled. The target needs to be compiled with `USE_LIGHTS` [ON/OFF]. |
|
||||
| failsafe_lights_flash_on_time | 100 | Flash lights ON time in milliseconds when `failsafe_lights` is ON and `FAILSAFE` flight mode is enabled. [20-65535]. |
|
||||
| failsafe_lights_flash_period | 1000 | Time in milliseconds between two flashes when `failsafe_lights` is ON and `FAILSAFE` flight mode is enabled [40-65535]. |
|
||||
| failsafe_min_distance | 0 | If failsafe happens when craft is closer than this distance in centimeters from home, failsafe will not execute regular failsafe_procedure, but will execute procedure specified in failsafe_min_distance_procedure instead. 0 = Normal failsafe_procedure always taken. |
|
||||
| failsafe_min_distance_procedure | DROP | What failsafe procedure to initiate in Stage 2 when craft is closer to home than failsafe_min_distance. See [Failsafe documentation](Failsafe.md#failsafe_throttle). |
|
||||
| failsafe_mission | ON | If set to `OFF` the failsafe procedure won't be triggered and the mission will continue if the FC is in WP (automatic mission) mode |
|
||||
| failsafe_mission | True | If set to `OFF` the failsafe procedure won't be triggered and the mission will continue if the FC is in WP (automatic mission) mode |
|
||||
| failsafe_off_delay | 200 | Time in deciseconds to wait before turning off motors when failsafe is activated. 0 = No timeout. See [Failsafe documentation](Failsafe.md#failsafe_off_delay). |
|
||||
| failsafe_procedure | SET-THR | What failsafe procedure to initiate in Stage 2. See [Failsafe documentation](Failsafe.md#failsafe_throttle). |
|
||||
| failsafe_recovery_delay | 5 | Time in deciseconds to wait before aborting failsafe when signal is recovered. See [Failsafe documentation](Failsafe.md#failsafe_recovery_delay). |
|
||||
| failsafe_stick_threshold | 50 | Threshold for stick motion to consider failsafe condition resolved. If non-zero failsafe won't clear even if RC link is restored - you have to move sticks to exit failsafe. |
|
||||
| failsafe_throttle | 1000 | Throttle level used for landing when failsafe is enabled. See [Failsafe documentation](Failsafe.md#failsafe_throttle). |
|
||||
| failsafe_throttle_low_delay | 100 | If failsafe activated when throttle is low for this much time - bypass failsafe and disarm, in 10th of seconds. 0 = No timeout |
|
||||
| fixed_wing_auto_arm | OFF | Auto-arm fixed wing aircraft on throttle above min_check, and disarming with stick commands are disabled, so power cycle is required to disarm. Requires enabled motorstop and no arm switch configured. |
|
||||
| failsafe_throttle_low_delay | 0 | If failsafe activated when throttle is low for this much time - bypass failsafe and disarm, in 10th of seconds. 0 = No timeout |
|
||||
| fixed_wing_auto_arm | False | Auto-arm fixed wing aircraft on throttle above min_check, and disarming with stick commands are disabled, so power cycle is required to disarm. Requires enabled motorstop and no arm switch configured. |
|
||||
| flaperon_throw_offset | 200 | Defines throw range in us for both ailerons that will be passed to servo mixer via input source 14 (`FEATURE FLAPS`) when FLAPERON mode is activated. |
|
||||
| flip_over_after_crash_power_factor | 65 | flip over after crash power factor |
|
||||
| fpv_mix_degrees | | |
|
||||
| fpv_mix_degrees | 0 | |
|
||||
| frsky_coordinates_format | 0 | D-Series telemetry only: FRSKY_FORMAT_DMS (default), FRSKY_FORMAT_NMEA |
|
||||
| frsky_default_latitude | 0.000 | D-Series telemetry only: OpenTX needs a valid set of coordinates to show compass value. A fake value defined in this setting is sent while no fix is acquired. |
|
||||
| frsky_default_longitude | 0.000 | D-Series telemetry only: OpenTX needs a valid set of coordinates to show compass value. A fake value defined in this setting is sent while no fix is acquired. |
|
||||
| frsky_pitch_roll | OFF | S.Port and D-Series telemetry: Send pitch and roll degrees*10 instead of raw accelerometer data |
|
||||
| frsky_default_latitude | 0 | D-Series telemetry only: OpenTX needs a valid set of coordinates to show compass value. A fake value defined in this setting is sent while no fix is acquired. |
|
||||
| frsky_default_longitude | 0 | D-Series telemetry only: OpenTX needs a valid set of coordinates to show compass value. A fake value defined in this setting is sent while no fix is acquired. |
|
||||
| frsky_pitch_roll | False | S.Port and D-Series telemetry: Send pitch and roll degrees*10 instead of raw accelerometer data |
|
||||
| frsky_unit | METRIC | Not used? [METRIC/IMPERIAL] |
|
||||
| frsky_vfas_precision | 0 | D-Series telemetry only: Set to 1 to send raw VBat value in 0.1V resolution for receivers that can handle it, or 0 (default) to use the standard method |
|
||||
| fw_autotune_ff_to_i_tc | 600 | FF to I time (defines time for I to reach the same level of response as FF) [ms] |
|
||||
|
@ -139,27 +139,27 @@
|
|||
| fw_turn_assist_pitch_gain | 1 | Gain required to keep constant pitch angle during coordinated turns (in TURN_ASSIST mode). Value significantly different from 1.0 indicates a problem with the airspeed calibration (if present) or value of `fw_reference_airspeed` parameter |
|
||||
| fw_turn_assist_yaw_gain | 1 | Gain required to keep the yaw rate consistent with the turn rate for a coordinated turn (in TURN_ASSIST mode). Value significantly different from 1.0 indicates a problem with the airspeed calibration (if present) or value of `fw_reference_airspeed` parameter |
|
||||
| fw_yaw_iterm_freeze_bank_angle | 0 | Yaw Iterm is frozen when bank angle is above this threshold [degrees]. This solves the problem of the rudder counteracting turns by partially disabling yaw stabilization when making banked turns. Setting to 0 (the default) disables this feature. Only applies when autopilot is not active and TURN ASSIST is disabled. |
|
||||
| gps_auto_baud | ON | Automatic configuration of GPS baudrate(The specified baudrate in configured in ports will be used) when used with UBLOX GPS. When used with NAZA/DJI it will automatic detect GPS baudrate and change to it, ignoring the selected baudrate set in ports |
|
||||
| gps_auto_config | ON | Enable automatic configuration of UBlox GPS receivers. |
|
||||
| gps_auto_baud | True | Automatic configuration of GPS baudrate(The specified baudrate in configured in ports will be used) when used with UBLOX GPS. When used with NAZA/DJI it will automatic detect GPS baudrate and change to it, ignoring the selected baudrate set in ports |
|
||||
| gps_auto_config | True | Enable automatic configuration of UBlox GPS receivers. |
|
||||
| gps_dyn_model | AIR_1G | GPS navigation model: Pedestrian, Air_1g, Air_4g. Default is AIR_1G. Use pedestrian with caution, can cause flyaways with fast flying. |
|
||||
| gps_min_sats | 6 | Minimum number of GPS satellites in view to acquire GPS_FIX and consider GPS position valid. Some GPS receivers appeared to be very inaccurate with low satellite count. |
|
||||
| gps_provider | UBLOX | Which GPS protocol to be used, note that UBLOX is 5Hz and UBLOX7 is 10Hz (M8N). |
|
||||
| gps_sbas_mode | NONE | Which SBAS mode to be used |
|
||||
| gps_ublox_use_galileo | OFF | Enable use of Galileo satellites. This is at the expense of other regional constellations, so benefit may also be regional. Requires M8N and Ublox firmware 3.x (or later) [OFF/ON]. |
|
||||
| gps_ublox_use_galileo | False | Enable use of Galileo satellites. This is at the expense of other regional constellations, so benefit may also be regional. Requires M8N and Ublox firmware 3.x (or later) [OFF/ON]. |
|
||||
| gyro_dyn_lpf_curve_expo | 5 | Expo value for the throttle-to-frequency mapping for Dynamic LPF |
|
||||
| gyro_dyn_lpf_max_hz | 500 | Maximum frequency of the gyro Dynamic LPF |
|
||||
| gyro_dyn_lpf_min_hz | 200 | Minimum frequency of the gyro Dynamic LPF |
|
||||
| gyro_hardware_lpf | 256HZ | Hardware lowpass filter for gyro. This value should never be changed without a very strong reason! If you have to set gyro lpf below 256HZ, it means the frame is vibrating too much, and that should be fixed first. |
|
||||
| gyro_lpf_hz | 60 | Software-based filter to remove mechanical vibrations from the gyro signal. Value is cutoff frequency (Hz). For larger frames with bigger props set to lower value. |
|
||||
| gyro_lpf_type | BIQUAD | Specifies the type of the software LPF of the gyro signals. BIQUAD gives better filtering and more delay, PT1 less filtering and less delay, so use only on clean builds. |
|
||||
| gyro_notch_cutoff | | |
|
||||
| gyro_notch_hz | | |
|
||||
| gyro_notch_cutoff | 1 | |
|
||||
| gyro_notch_hz | 0 | |
|
||||
| gyro_stage2_lowpass_hz | 0 | Software based second stage lowpass filter for gyro. Value is cutoff frequency (Hz) |
|
||||
| gyro_stage2_lowpass_type | `BIQUAD` | Defines the type of stage 2 gyro LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| gyro_sync | OFF | This option enables gyro_sync feature. In this case the loop will be synced to gyro refresh rate. Loop will always wait for the newest gyro measurement. Maximum gyro refresh rate is determined by gyro_hardware_lpf |
|
||||
| gyro_to_use | | |
|
||||
| gyro_use_dyn_lpf | OFF | Use Dynamic LPF instead of static gyro stage1 LPF. Dynamic Gyro LPF updates gyro LPF based on the throttle position. |
|
||||
| has_flaps | OFF | Defines is UAV is capable of having flaps. If ON and AIRPLANE `platform_type` is used, **FLAPERON** flight mode will be available for the pilot |
|
||||
| gyro_stage2_lowpass_type | BIQUAD | Defines the type of stage 2 gyro LPF filter. Possible values: `PT1`, `BIQUAD`. `PT1` offers faster filter response while `BIQUAD` better attenuation. |
|
||||
| gyro_sync | True | This option enables gyro_sync feature. In this case the loop will be synced to gyro refresh rate. Loop will always wait for the newest gyro measurement. Maximum gyro refresh rate is determined by gyro_hardware_lpf |
|
||||
| gyro_to_use | 0 | |
|
||||
| gyro_use_dyn_lpf | False | Use Dynamic LPF instead of static gyro stage1 LPF. Dynamic Gyro LPF updates gyro LPF based on the throttle position. |
|
||||
| has_flaps | False | Defines is UAV is capable of having flaps. If ON and AIRPLANE `platform_type` is used, **FLAPERON** flight mode will be available for the pilot |
|
||||
| heading_hold_rate_limit | 90 | This setting limits yaw rotation rate that HEADING_HOLD controller can request from PID inner loop controller. It is independent from manual yaw rate and used only when HEADING_HOLD flight mode is enabled by pilot, RTH or WAYPOINT modes. |
|
||||
| hott_alarm_sound_interval | 5 | Battery alarm delay in seconds for Hott telemetry |
|
||||
| i2c_speed | 400KHZ | This setting controls the clock speed of I2C bus. 400KHZ is the default that most setups are able to use. Some noise-free setups may be overclocked to 800KHZ. Some sensor chips or setups with long wires may work unreliably at 400KHZ - user can try lowering the clock speed to 200KHZ or even 100KHZ. User need to bear in mind that lower clock speeds might require higher looptimes (lower looptime rate) |
|
||||
|
@ -177,65 +177,65 @@
|
|||
| imu2_hardware | NONE | Selection of a Secondary IMU hardware type. NONE disables this functionality |
|
||||
| imu2_radius_acc | 0 | Secondary IMU MAG calibration data |
|
||||
| imu2_radius_mag | 0 | Secondary IMU MAG calibration data |
|
||||
| imu2_use_for_osd_ahi | OFF | If set to ON, Secondary IMU data will be used for Analog OSD Artificial Horizon |
|
||||
| imu2_use_for_osd_heading | OFF | If set to ON, Secondary IMU data will be used for Analog OSD heading |
|
||||
| imu2_use_for_stabilized | OFF | If set to ON, Secondary IMU data will be used for Angle, Horizon and all other modes that control attitude (PosHold, WP, RTH) |
|
||||
| imu2_use_for_osd_ahi | False | If set to ON, Secondary IMU data will be used for Analog OSD Artificial Horizon |
|
||||
| imu2_use_for_osd_heading | False | If set to ON, Secondary IMU data will be used for Analog OSD heading |
|
||||
| imu2_use_for_stabilized | False | If set to ON, Secondary IMU data will be used for Angle, Horizon and all other modes that control attitude (PosHold, WP, RTH) |
|
||||
| imu_acc_ignore_rate | 0 | Total gyro rotation rate threshold [deg/s] to consider accelerometer trustworthy on airplanes |
|
||||
| imu_acc_ignore_slope | 0 | Half-width of the interval to gradually reduce accelerometer weight. Centered at `imu_acc_ignore_rate` (exactly 50% weight) |
|
||||
| imu_dcm_ki | 50 | Inertial Measurement Unit KI Gain for accelerometer measurements |
|
||||
| imu_dcm_ki_mag | 0 | Inertial Measurement Unit KI Gain for compass measurements |
|
||||
| imu_dcm_kp | 2500 | Inertial Measurement Unit KP Gain for accelerometer measurements |
|
||||
| imu_dcm_kp_mag | 10000 | Inertial Measurement Unit KP Gain for compass measurements |
|
||||
| inav_allow_dead_reckoning | OFF | Defines if inav will dead-reckon over short GPS outages. May also be useful for indoors OPFLOW navigation |
|
||||
| inav_auto_mag_decl | ON | Automatic setting of magnetic declination based on GPS position. When used manual magnetic declination is ignored. |
|
||||
| inav_baro_epv | 100.000 | Uncertainty value for barometric sensor [cm] |
|
||||
| inav_allow_dead_reckoning | False | Defines if inav will dead-reckon over short GPS outages. May also be useful for indoors OPFLOW navigation |
|
||||
| inav_auto_mag_decl | True | Automatic setting of magnetic declination based on GPS position. When used manual magnetic declination is ignored. |
|
||||
| inav_baro_epv | 100 | Uncertainty value for barometric sensor [cm] |
|
||||
| inav_gravity_cal_tolerance | 5 | Unarmed gravity calibration tolerance level. Won't finish the calibration until estimated gravity error falls below this value. |
|
||||
| inav_max_eph_epv | 1000.000 | Maximum uncertainty value until estimated position is considered valid and is used for navigation [cm] |
|
||||
| inav_max_eph_epv | 1000 | Maximum uncertainty value until estimated position is considered valid and is used for navigation [cm] |
|
||||
| inav_max_surface_altitude | 200 | Max allowed altitude for surface following mode. [cm] |
|
||||
| inav_reset_altitude | FIRST_ARM | Defines when relative estimated altitude is reset to zero. Variants - `NEVER` (once reference is acquired it's used regardless); `FIRST_ARM` (keep altitude at zero until firstly armed), `EACH_ARM` (altitude is reset to zero on each arming) |
|
||||
| inav_reset_home | FIRST_ARM | Allows to chose when the home position is reset. Can help prevent resetting home position after accidental mid-air disarm. Possible values are: NEVER, FIRST_ARM and EACH_ARM |
|
||||
| inav_use_gps_no_baro | | |
|
||||
| inav_use_gps_velned | ON | Defined if iNav should use velocity data provided by GPS module for doing position and speed estimation. If set to OFF iNav will fallback to calculating velocity from GPS coordinates. Using native velocity data may improve performance on some GPS modules. Some GPS modules introduce significant delay and using native velocity may actually result in much worse performance. |
|
||||
| inav_w_acc_bias | 0.010 | Weight for accelerometer drift estimation |
|
||||
| inav_w_xy_flow_p | | |
|
||||
| inav_w_xy_flow_v | | |
|
||||
| inav_w_xy_gps_p | 1.000 | Weight of GPS coordinates in estimated UAV position and speed. |
|
||||
| inav_w_xy_gps_v | 2.000 | Weight of GPS velocity data in estimated UAV speed |
|
||||
| inav_w_xy_res_v | 0.500 | Decay coefficient for estimated velocity when GPS reference for position is lost |
|
||||
| inav_w_xyz_acc_p | | |
|
||||
| inav_w_z_baro_p | 0.350 | Weight of barometer measurements in estimated altitude and climb rate |
|
||||
| inav_w_z_gps_p | 0.200 | Weight of GPS altitude measurements in estimated altitude. Setting is used only of airplanes |
|
||||
| inav_w_z_gps_v | 0.500 | Weight of GPS climb rate measurements in estimated climb rate. Setting is used on both airplanes and multirotors. If GPS doesn't support native climb rate reporting (i.e. NMEA GPS) you may consider setting this to zero |
|
||||
| inav_w_z_res_v | 0.500 | Decay coefficient for estimated climb rate when baro/GPS reference for altitude is lost |
|
||||
| inav_w_z_surface_p | | |
|
||||
| inav_w_z_surface_v | | |
|
||||
| inav_use_gps_no_baro | False | |
|
||||
| inav_use_gps_velned | True | Defined if iNav should use velocity data provided by GPS module for doing position and speed estimation. If set to OFF iNav will fallback to calculating velocity from GPS coordinates. Using native velocity data may improve performance on some GPS modules. Some GPS modules introduce significant delay and using native velocity may actually result in much worse performance. |
|
||||
| inav_w_acc_bias | 0.01 | Weight for accelerometer drift estimation |
|
||||
| inav_w_xy_flow_p | 1.0 | |
|
||||
| inav_w_xy_flow_v | 2.0 | |
|
||||
| inav_w_xy_gps_p | 1.0 | Weight of GPS coordinates in estimated UAV position and speed. |
|
||||
| inav_w_xy_gps_v | 2.0 | Weight of GPS velocity data in estimated UAV speed |
|
||||
| inav_w_xy_res_v | 0.5 | Decay coefficient for estimated velocity when GPS reference for position is lost |
|
||||
| inav_w_xyz_acc_p | 1.0 | |
|
||||
| inav_w_z_baro_p | 0.35 | Weight of barometer measurements in estimated altitude and climb rate |
|
||||
| inav_w_z_gps_p | 0.2 | Weight of GPS altitude measurements in estimated altitude. Setting is used only of airplanes |
|
||||
| inav_w_z_gps_v | 0.1 | Weight of GPS climb rate measurements in estimated climb rate. Setting is used on both airplanes and multirotors. If GPS doesn't support native climb rate reporting (i.e. NMEA GPS) you may consider setting this to zero |
|
||||
| inav_w_z_res_v | 0.5 | Decay coefficient for estimated climb rate when baro/GPS reference for altitude is lost |
|
||||
| inav_w_z_surface_p | 3.5 | |
|
||||
| inav_w_z_surface_v | 6.1 | |
|
||||
| iterm_windup | 50 | Used to prevent Iterm accumulation on during maneuvers. Iterm will be dampened when motors are reaching it's limit (when requested motor correction range is above percentage specified by this parameter) |
|
||||
| ledstrip_visual_beeper | OFF | |
|
||||
| log_level | `ERROR` | Defines serial debugging log level. See `docs/development/serial_printf_debugging.md` for usage. |
|
||||
| ledstrip_visual_beeper | False | |
|
||||
| log_level | ERROR | Defines serial debugging log level. See `docs/development/serial_printf_debugging.md` for usage. |
|
||||
| log_topics | 0 | Defines serial debugging log topic. See `docs/development/serial_printf_debugging.md` for usage. |
|
||||
| looptime | 1000 | This is the main loop time (in us). Changing this affects PID effect with some PID controllers (see PID section for details). A very conservative value of 3500us/285Hz should work for everyone. Setting it to zero does not limit loop time, so it will go as fast as possible. |
|
||||
| ltm_update_rate | NORMAL | Defines the LTM update rate (use of bandwidth [NORMAL/MEDIUM/SLOW]). See Telemetry.md, LTM section for details. |
|
||||
| mag_calibration_time | 30 | Adjust how long time the Calibration of mag will last. |
|
||||
| mag_declination | 0 | Current location magnetic declination in format. For example, -6deg 37min = -637 for Japan. Leading zero in ddd not required. Get your local magnetic declination here: http://magnetic-declination.com/ . Not in use if inav_auto_mag_decl is turned on and you acquire valid GPS fix. |
|
||||
| mag_hardware | AUTO | Selection of mag hardware. See Wiki Sensor auto detect and hardware failure detection for more info |
|
||||
| mag_to_use | | Allow to chose between built-in and external compass sensor if they are connected to separate buses. Currently only for REVO target |
|
||||
| mag_to_use | 0 | Allow to chose between built-in and external compass sensor if they are connected to separate buses. Currently only for REVO target |
|
||||
| maggain_x | 1024 | Magnetometer calibration X gain. If 1024, no calibration or calibration failed |
|
||||
| maggain_y | 1024 | Magnetometer calibration Y gain. If 1024, no calibration or calibration failed |
|
||||
| maggain_z | 1024 | Magnetometer calibration Z gain. If 1024, no calibration or calibration failed |
|
||||
| magzero_x | 0 | Magnetometer calibration X offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| magzero_y | 0 | Magnetometer calibration Y offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| magzero_z | 0 | Magnetometer calibration Z offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| magzero_x | :zero | Magnetometer calibration X offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| magzero_y | :zero | Magnetometer calibration Y offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| magzero_z | :zero | Magnetometer calibration Z offset. If its 0 none offset has been applied and calibration is failed. |
|
||||
| manual_pitch_rate | 100 | Servo travel multiplier for the PITCH axis in `MANUAL` flight mode [0-100]% |
|
||||
| manual_rc_expo | 70 | Exposition value used for the PITCH/ROLL axes by the `MANUAL` flight mode [0-100] |
|
||||
| manual_rc_yaw_expo | 20 | Exposition value used for the YAW axis by the `MANUAL` flight mode [0-100] |
|
||||
| manual_roll_rate | 100 | Servo travel multiplier for the ROLL axis in `MANUAL` flight mode [0-100]% |
|
||||
| manual_yaw_rate | 100 | Servo travel multiplier for the YAW axis in `MANUAL` flight mode [0-100]% |
|
||||
| mavlink_ext_status_rate | | |
|
||||
| mavlink_extra1_rate | | |
|
||||
| mavlink_extra2_rate | | |
|
||||
| mavlink_extra3_rate | | |
|
||||
| mavlink_pos_rate | | |
|
||||
| mavlink_rc_chan_rate | | |
|
||||
| mavlink_ext_status_rate | 2 | |
|
||||
| mavlink_extra1_rate | 10 | |
|
||||
| mavlink_extra2_rate | 2 | |
|
||||
| mavlink_extra3_rate | 1 | |
|
||||
| mavlink_pos_rate | 2 | |
|
||||
| mavlink_rc_chan_rate | 5 | |
|
||||
| max_angle_inclination_pit | 300 | Maximum inclination in level (angle) mode (PITCH axis). 100=10° |
|
||||
| max_angle_inclination_rll | 300 | Maximum inclination in level (angle) mode (ROLL axis). 100=10° |
|
||||
| max_check | 1900 | These are min/max values (in us) which, when a channel is smaller (min) or larger (max) than the value will activate various RC commands, such as arming, or stick configuration. Normally, every RC channel should be set so that min = 1000us, max = 2000us. On most transmitters this usually means 125% endpoints. Default check values are 100us above/below this value. |
|
||||
|
@ -252,8 +252,8 @@
|
|||
| mc_i_pitch | 30 | Multicopter rate stabilisation I-gain for PITCH |
|
||||
| mc_i_roll | 30 | Multicopter rate stabilisation I-gain for ROLL |
|
||||
| mc_i_yaw | 45 | Multicopter rate stabilisation I-gain for YAW |
|
||||
| mc_iterm_relax | | |
|
||||
| mc_iterm_relax_cutoff | | |
|
||||
| mc_iterm_relax | RP | |
|
||||
| mc_iterm_relax_cutoff | 15 | |
|
||||
| mc_p_level | 20 | Multicopter attitude stabilisation P-gain |
|
||||
| mc_p_pitch | 40 | Multicopter rate stabilisation P-gain for PITCH |
|
||||
| mc_p_roll | 40 | Multicopter rate stabilisation P-gain for ROLL |
|
||||
|
@ -265,19 +265,19 @@
|
|||
| moron_threshold | 32 | When powering up, gyro bias is calculated. If the model is shaking/moving during this initial calibration, offsets are calculated incorrectly, and could lead to poor flying performance. This threshold means how much average gyro reading could differ before re-calibration is triggered. |
|
||||
| motor_accel_time | 0 | Minimum time for the motor(s) to accelerate from 0 to 100% throttle (ms) [0-1000] |
|
||||
| motor_decel_time | 0 | Minimum time for the motor(s) to deccelerate from 100 to 0% throttle (ms) [0-1000] |
|
||||
| motor_direction_inverted | OFF | Use if you need to inverse yaw motor direction. |
|
||||
| motor_direction_inverted | False | Use if you need to inverse yaw motor direction. |
|
||||
| motor_poles | 14 | The number of motor poles. Required to compute motor RPM |
|
||||
| motor_pwm_protocol | ONESHOT125 | Protocol that is used to send motor updates to ESCs. Possible values - STANDARD, ONESHOT125, ONESHOT42, MULTISHOT, DSHOT150, DSHOT300, DSHOT600, DSHOT1200, BRUSHED |
|
||||
| motor_pwm_rate | 400 | Output frequency (in Hz) for motor pins. Default is 400Hz for motor with motor_pwm_protocol set to STANDARD. For *SHOT (e.g. ONESHOT125) values of 1000 and 2000 have been tested by the development team and are supported. It may be possible to use higher values. For BRUSHED values of 8000 and above should be used. Setting to 8000 will use brushed mode at 8kHz switching frequency. Up to 32kHz is supported for brushed. Default is 16000 for boards with brushed motors. Note, that in brushed mode, minthrottle is offset to zero. For brushed mode, set max_throttle to 2000. |
|
||||
| msp_override_channels | 0 | Mask of RX channels that may be overridden by MSP `SET_RAW_RC`. Note that this requires custom firmware with `USE_RX_MSP` and `USE_MSP_RC_OVERRIDE` compile options and the `MSP RC Override` flight mode. |
|
||||
| name | Empty string | Craft name |
|
||||
| name | | Craft name |
|
||||
| nav_auto_climb_rate | 500 | Maximum climb/descent rate that UAV is allowed to reach during navigation modes. [cm/s] |
|
||||
| nav_auto_speed | 300 | Maximum velocity firmware is allowed in full auto modes (RTH, WP) [cm/s] [Multirotor only] |
|
||||
| nav_disarm_on_landing | OFF | If set to ON, iNav disarms the FC after landing |
|
||||
| nav_disarm_on_landing | False | If set to ON, iNav disarms the FC after landing |
|
||||
| nav_emerg_landing_speed | 500 | Rate of descent UAV will try to maintain when doing emergency descent sequence [cm/s] |
|
||||
| nav_extra_arming_safety | ON | If set to ON drone won't arm if no GPS fix and any navigation mode like RTH or POSHOLD is configured. ALLOW_BYPASS allows the user to momentarily disable this check by holding yaw high (left stick held at the bottom right in mode 2) when switch arming is used |
|
||||
| nav_fw_allow_manual_thr_increase | OFF | Enable the possibility to manually increase the throttle in auto throttle controlled modes for fixed wing |
|
||||
| nav_fw_bank_angle | 20 | Max roll angle when rolling / turning in GPS assisted modes, is also restrained by global max_angle_inclination_rll |
|
||||
| nav_fw_allow_manual_thr_increase | False | Enable the possibility to manually increase the throttle in auto throttle controlled modes for fixed wing |
|
||||
| nav_fw_bank_angle | 35 | Max roll angle when rolling / turning in GPS assisted modes, is also restrained by global max_angle_inclination_rll |
|
||||
| nav_fw_climb_angle | 20 | Max pitch angle when climbing in GPS assisted modes, is also restrained by global max_angle_inclination_pit |
|
||||
| nav_fw_control_smoothness | 0 | How smoothly the autopilot controls the airplane to correct the navigation error |
|
||||
| nav_fw_cruise_speed | 0 | Speed for the plane/wing at cruise throttle used for remaining flight time/distance estimation in cm/s |
|
||||
|
@ -289,7 +289,7 @@
|
|||
| nav_fw_launch_accel | 1863 | Forward acceleration threshold for bungee launch of throw launch [cm/s/s], 1G = 981 cm/s/s |
|
||||
| nav_fw_launch_climb_angle | 18 | Climb angle for launch sequence (degrees), is also restrained by global max_angle_inclination_pit |
|
||||
| nav_fw_launch_detect_time | 40 | Time for which thresholds have to breached to consider launch happened [ms] |
|
||||
| nav_fw_launch_end_time | 2000 | Time for the transition of throttle and pitch angle, between the launch state and the subsequent flight mode [ms] |
|
||||
| nav_fw_launch_end_time | 3000 | Time for the transition of throttle and pitch angle, between the launch state and the subsequent flight mode [ms] |
|
||||
| nav_fw_launch_idle_thr | 1000 | Launch idle throttle - throttle to be set before launch sequence is initiated. If set below minimum throttle it will force motor stop or at idle throttle (depending if the MOTOR_STOP is enabled). If set above minimum throttle it will force throttle to this value (if MOTOR_STOP is enabled it will be handled according to throttle stick position) |
|
||||
| nav_fw_launch_max_altitude | 0 | Altitude (centimeters) at which LAUNCH mode will be turned off and regular flight mode will take over [0-60000]. |
|
||||
| nav_fw_launch_max_angle | 45 | Max tilt angle (pitch/roll combined) to consider launch successful. Set to 180 to disable completely [deg] |
|
||||
|
@ -306,15 +306,15 @@
|
|||
| nav_fw_pitch2thr_smoothing | 6 | How smoothly the autopilot makes pitch to throttle correction inside a deadband defined by pitch_to_throttle_thresh. |
|
||||
| nav_fw_pitch2thr_threshold | 50 | Threshold from average pitch where momentary pitch_to_throttle correction kicks in. [decidegrees] |
|
||||
| nav_fw_pos_hdg_d | 0 | D gain of heading trajectory PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_hdg_i | 0 | I gain of heading trajectory PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_hdg_p | 60 | P gain of heading PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_hdg_i | 2 | I gain of heading trajectory PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_hdg_p | 30 | P gain of heading PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_hdg_pidsum_limit | 350 | Output limit for heading trajectory PID controller. (Fixedwing, rovers, boats) |
|
||||
| nav_fw_pos_xy_d | 8 | D gain of 2D trajectory PID controller. Too high and there will be overshoot in trajectory. Better start tuning with zero |
|
||||
| nav_fw_pos_xy_i | 5 | I gain of 2D trajectory PID controller. Too high and there will be overshoot in trajectory. Better start tuning with zero |
|
||||
| nav_fw_pos_xy_p | 75 | P gain of 2D trajectory PID controller. Play with this to get a straight line between waypoints or a straight RTH |
|
||||
| nav_fw_pos_z_d | 0 | D gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_pos_z_i | 0 | I gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_pos_z_p | 50 | P gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_pos_z_d | 10 | D gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_pos_z_i | 5 | I gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_pos_z_p | 40 | P gain of altitude PID controller (Fixedwing) |
|
||||
| nav_fw_yaw_deadband | 0 | Deadband for heading trajectory PID controller. When heading error is below the deadband, controller assumes that vehicle is on course |
|
||||
| nav_land_slowdown_maxalt | 2000 | Defines at what altitude the descent velocity should start to ramp down from 100% nav_landing_speed to 25% nav_landing_speed. [cm] |
|
||||
| nav_land_slowdown_minalt | 500 | Defines at what altitude the descent velocity should start to be 25% of nav_landing_speed [cm] |
|
||||
|
@ -341,15 +341,15 @@
|
|||
| nav_mc_vel_xy_d | 100 | D gain of Position-Rate (Velocity to Acceleration) PID controller. It can damp P and I. Increasing D might help when drone overshoots target. |
|
||||
| nav_mc_vel_xy_dterm_attenuation | 90 | Maximum D-term attenution percentage for horizontal velocity PID controller (Multirotor). It allows to smooth the PosHold CRUISE, WP and RTH when Multirotor is traveling at full speed. Dterm is not attenuated at low speeds, breaking and accelerating. |
|
||||
| nav_mc_vel_xy_dterm_attenuation_end | 60 | A point (in percent of both target and current horizontal velocity) where nav_mc_vel_xy_dterm_attenuation reaches maximum |
|
||||
| nav_mc_vel_xy_dterm_attenuation_start | 10" | A point (in percent of both target and current horizontal velocity) where nav_mc_vel_xy_dterm_attenuation begins |
|
||||
| nav_mc_vel_xy_dterm_lpf_hz | | |
|
||||
| nav_mc_vel_xy_ff | | |
|
||||
| nav_mc_vel_xy_dterm_attenuation_start | 10 | A point (in percent of both target and current horizontal velocity) where nav_mc_vel_xy_dterm_attenuation begins |
|
||||
| nav_mc_vel_xy_dterm_lpf_hz | 2 | |
|
||||
| nav_mc_vel_xy_ff | 40 | |
|
||||
| nav_mc_vel_xy_i | 15 | I gain of Position-Rate (Velocity to Acceleration) PID controller. Used for drift compensation (caused by wind for example). Higher I means stronger response to drift. Too much I gain might cause target overshot |
|
||||
| nav_mc_vel_xy_p | 40 | P gain of Position-Rate (Velocity to Acceleration) PID controller. Higher P means stronger response when position error occurs. Too much P might cause "nervous" behavior and oscillations |
|
||||
| nav_mc_vel_z_d | 10 | D gain of velocity PID controller |
|
||||
| nav_mc_vel_z_i | 50 | I gain of velocity PID controller |
|
||||
| nav_mc_vel_z_p | 100 | P gain of velocity PID controller |
|
||||
| nav_mc_wp_slowdown | ON | When ON, NAV engine will slow down when switching to the next waypoint. This prioritizes turning over forward movement. When OFF, NAV engine will continue to the next waypoint and turn as it goes. |
|
||||
| nav_mc_wp_slowdown | True | When ON, NAV engine will slow down when switching to the next waypoint. This prioritizes turning over forward movement. When OFF, NAV engine will continue to the next waypoint and turn as it goes. |
|
||||
| nav_min_rth_distance | 500 | Minimum distance from homepoint when RTH full procedure will be activated [cm]. Below this distance, the mode will activate at the current location and the final phase is executed (loiter / land). Above this distance, the full procedure is activated, which may include initial climb and flying directly to the homepoint before entering the loiter / land phase. |
|
||||
| nav_overrides_motor_stop | ALL_NAV | When set to OFF the navigation system will not take over the control of the motor if the throttle is low (motor will stop). When set to OFF_ALWAYS the navigation system will not take over the control of the motor if the throttle was low even when failsafe is triggered. When set to AUTO_ONLY the navigation system will only take over the control of the throttle in autonomous navigation modes (NAV WP and NAV RTH). When set to ALL_NAV (default) the navigation system will take over the control of the motor completely and never allow the motor to stop even when the throttle is low. This setting only has an effect on NAV modes which take control of the throttle when combined with MOTOR_STOP and is likely to cause a stall if fw_min_throttle_down_pitch isn't set correctly or the pitch estimation is wrong for fixed wing models when not set to ALL_NAV |
|
||||
| nav_position_timeout | 5 | If GPS fails wait for this much seconds before switching to emergency landing mode (0 - disable) |
|
||||
|
@ -357,23 +357,23 @@
|
|||
| nav_rth_allow_landing | ALWAYS | If set to ON drone will land as a last phase of RTH. |
|
||||
| nav_rth_alt_mode | AT_LEAST | Configure how the aircraft will manage altitude on the way home, see Navigation modes on wiki for more details |
|
||||
| nav_rth_altitude | 1000 | Used in EXTRA, FIXED and AT_LEAST rth alt modes [cm] (Default 1000 means 10 meters) |
|
||||
| nav_rth_climb_first | ON | If set to ON drone will climb to nav_rth_altitude first and head home afterwards. If set to OFF drone will head home instantly and climb on the way. |
|
||||
| nav_rth_climb_ignore_emerg | OFF | If set to ON, aircraft will execute initial climb regardless of position sensor (GPS) status. |
|
||||
| nav_rth_climb_first | True | If set to ON drone will climb to nav_rth_altitude first and head home afterwards. If set to OFF drone will head home instantly and climb on the way. |
|
||||
| nav_rth_climb_ignore_emerg | False | If set to ON, aircraft will execute initial climb regardless of position sensor (GPS) status. |
|
||||
| nav_rth_home_altitude | 0 | Aircraft will climb/descend to this altitude after reaching home if landing is not enabled. Set to 0 to stay at `nav_rth_altitude` (default) [cm] |
|
||||
| nav_rth_tail_first | OFF | If set to ON drone will return tail-first. Obviously meaningless for airplanes. |
|
||||
| nav_use_fw_yaw_control | OFF | Enables or Disables the use of the heading PID controller on fixed wing. Heading PID controller is always enabled for rovers and boats |
|
||||
| nav_use_midthr_for_althold | OFF | If set to OFF, the FC remembers your throttle stick position when enabling ALTHOLD and treats it as a neutral midpoint for holding altitude |
|
||||
| nav_rth_tail_first | False | If set to ON drone will return tail-first. Obviously meaningless for airplanes. |
|
||||
| nav_use_fw_yaw_control | False | Enables or Disables the use of the heading PID controller on fixed wing. Heading PID controller is always enabled for rovers and boats |
|
||||
| nav_use_midthr_for_althold | False | If set to OFF, the FC remembers your throttle stick position when enabling ALTHOLD and treats it as a neutral midpoint for holding altitude |
|
||||
| nav_user_control_mode | ATTI | Defines how Pitch/Roll input from RC receiver affects flight in POSHOLD mode: ATTI - pitch/roll controls attitude like in ANGLE mode; CRUISE - pitch/roll controls velocity in forward and right direction. |
|
||||
| nav_wp_radius | 100 | Waypoint radius [cm]. Waypoint would be considered reached if machine is within this radius |
|
||||
| nav_wp_safe_distance | 10000 | First waypoint in the mission should be closer than this value [cm]. A value of 0 disables this check. |
|
||||
| opflow_hardware | | Selection of OPFLOW hardware. |
|
||||
| opflow_scale | | |
|
||||
| osd_ahi_bordered | OFF | Shows a border/corners around the AHI region (pixel OSD only) |
|
||||
| opflow_hardware | NONE | Selection of OPFLOW hardware. |
|
||||
| opflow_scale | 10.5 | |
|
||||
| osd_ahi_bordered | False | Shows a border/corners around the AHI region (pixel OSD only) |
|
||||
| osd_ahi_height | 162 | AHI height in pixels (pixel OSD only) |
|
||||
| osd_ahi_max_pitch | 20 | Max pitch, in degrees, for OSD artificial horizon |
|
||||
| osd_ahi_reverse_roll | | |
|
||||
| osd_ahi_reverse_roll | False | |
|
||||
| osd_ahi_style | DEFAULT | Sets OSD Artificial Horizon style "DEFAULT" or "LINE" for the FrSky Graphical OSD. |
|
||||
| osd_ahi_vertical_offset | 0 | AHI vertical offset from center (pixel OSD only) |
|
||||
| osd_ahi_vertical_offset | -18 | AHI vertical offset from center (pixel OSD only) |
|
||||
| osd_ahi_width | 132 | AHI width in pixels (pixel OSD only) |
|
||||
| osd_alt_alarm | 100 | Value above which to make the OSD relative altitude indicator blink (meters) |
|
||||
| osd_baro_temp_alarm_max | 600 | Temperature above which the baro temperature OSD element will start blinking (decidegrees centigrade) |
|
||||
|
@ -381,155 +381,155 @@
|
|||
| osd_camera_fov_h | 135 | Horizontal field of view for the camera in degres |
|
||||
| osd_camera_fov_v | 85 | Vertical field of view for the camera in degres |
|
||||
| osd_camera_uptilt | 0 | Set the camera uptilt for the FPV camera in degres, positive is up, negative is down, relative to the horizontal |
|
||||
| osd_coordinate_digits | | |
|
||||
| osd_coordinate_digits | 9 | |
|
||||
| osd_crosshairs_style | DEFAULT | To set the visual type for the crosshair |
|
||||
| osd_crsf_lq_format | TYPE1 | To select LQ format |
|
||||
| osd_current_alarm | 0 | Value above which the OSD current consumption element will start blinking. Measured in full Amperes. |
|
||||
| osd_dist_alarm | 1000 | Value above which to make the OSD distance from home indicator blink (meters) |
|
||||
| osd_esc_temp_alarm_max | 900 | Temperature above which the IMU temperature OSD element will start blinking (decidegrees centigrade) |
|
||||
| osd_esc_temp_alarm_min | -200 | Temperature under which the IMU temperature OSD element will start blinking (decidegrees centigrade) |
|
||||
| osd_estimations_wind_compensation | ON | Use wind estimation for remaining flight time/distance estimation |
|
||||
| osd_failsafe_switch_layout | OFF | If enabled the OSD automatically switches to the first layout during failsafe |
|
||||
| osd_force_grid | OFF | Force OSD to work in grid mode even if the OSD device supports pixel level access (mainly used for development) |
|
||||
| osd_estimations_wind_compensation | True | Use wind estimation for remaining flight time/distance estimation |
|
||||
| osd_failsafe_switch_layout | False | If enabled the OSD automatically switches to the first layout during failsafe |
|
||||
| osd_force_grid | False | Force OSD to work in grid mode even if the OSD device supports pixel level access (mainly used for development) |
|
||||
| osd_gforce_alarm | 5 | Value above which the OSD g force indicator will blink (g) |
|
||||
| osd_gforce_axis_alarm_max | 5 | Value above which the OSD axis g force indicators will blink (g) |
|
||||
| osd_gforce_axis_alarm_min | -5 | Value under which the OSD axis g force indicators will blink (g) |
|
||||
| osd_home_position_arm_screen | ON | Should home position coordinates be displayed on the arming screen. |
|
||||
| osd_home_position_arm_screen | True | Should home position coordinates be displayed on the arming screen. |
|
||||
| osd_horizon_offset | 0 | To vertically adjust the whole OSD and AHI and scrolling bars |
|
||||
| osd_hud_homepoint | 0 | To 3D-display the home point location in the hud |
|
||||
| osd_hud_homing | 0 | To display little arrows around the crossair showing where the home point is in the hud |
|
||||
| osd_hud_homepoint | False | To 3D-display the home point location in the hud |
|
||||
| osd_hud_homing | False | To display little arrows around the crossair showing where the home point is in the hud |
|
||||
| osd_hud_margin_h | 3 | Left and right margins for the hud area |
|
||||
| osd_hud_margin_v | 3 | Top and bottom margins for the hud area |
|
||||
| osd_hud_radar_disp | 0 | Maximum count of nearby aircrafts or points of interest to display in the hud, as sent from an ESP32 LoRa module. Set to 0 to disable (show nothing). The nearby aircrafts will appear as markers A, B, C, etc |
|
||||
| osd_hud_radar_nearest | 0 | To display an extra bar of informations at the bottom of the hud area for the closest radar aircraft found, if closest than the set value, in meters. Shows relative altitude (meters or feet, with an up or down arrow to indicate if above or below), speed (in m/s or f/s), and absolute heading (in °, 0 is north, 90 is east, 180 is south, 270 is west). Set to 0 (zero) to disable. |
|
||||
| osd_hud_radar_range_max | 4000" | In meters, radar aircrafts further away than this will not be displayed in the hud |
|
||||
| osd_hud_radar_range_max | 4000 | In meters, radar aircrafts further away than this will not be displayed in the hud |
|
||||
| osd_hud_radar_range_min | 3 | In meters, radar aircrafts closer than this will not be displayed in the hud |
|
||||
| osd_hud_wp_disp | 0 | How many navigation waypoints are displayed, set to 0 (zero) to disable. As sample, if set to 2, and you just passed the 3rd waypoint of the mission, you'll see markers for the 4th waypoint (marked 1) and the 5th waypoint (marked 2) |
|
||||
| osd_imu_temp_alarm_max | 600 | Temperature above which the IMU temperature OSD element will start blinking (decidegrees centigrade) |
|
||||
| osd_imu_temp_alarm_min | -200 | Temperature under which the IMU temperature OSD element will start blinking (decidegrees centigrade) |
|
||||
| osd_left_sidebar_scroll | | |
|
||||
| osd_left_sidebar_scroll | NONE | |
|
||||
| osd_left_sidebar_scroll_step | 0 | How many units each sidebar step represents. 0 means the default value for the scroll type. |
|
||||
| osd_link_quality_alarm | 70 | LQ % indicator blinks below this value. For Crossfire use 70%, for Tracer use 50% |
|
||||
| osd_main_voltage_decimals | 1 | Number of decimals for the battery voltages displayed in the OSD [1-2]. |
|
||||
| osd_neg_alt_alarm | 5 | Value below which (negative altitude) to make the OSD relative altitude indicator blink (meters) |
|
||||
| osd_pan_servo_index | | Index of the pan servo to adjust osd home heading direction based on camera pan. Note that this feature does not work with continiously rotating servos. |
|
||||
| osd_pan_servo_index | 0 | Index of the pan servo to adjust osd home heading direction based on camera pan. Note that this feature does not work with continiously rotating servos. |
|
||||
| osd_pan_servo_pwm2centideg | 0 | Centidegrees of pan servo rotation us PWM signal. A servo with 180 degrees of rotation from 1000 to 2000 us PWM typically needs `18` for this setting. Change sign to inverse direction. |
|
||||
| osd_plus_code_digits | 10 | Numer of plus code digits before shortening with `osd_plus_code_short`. Precision at the equator: 10=13.9x13.9m; 11=2.8x3.5m; 12=56x87cm; 13=11x22cm. |
|
||||
| osd_plus_code_digits | 11 | Numer of plus code digits before shortening with `osd_plus_code_short`. Precision at the equator: 10=13.9x13.9m; 11=2.8x3.5m; 12=56x87cm; 13=11x22cm. |
|
||||
| osd_plus_code_short | 0 | Number of leading digits removed from plus code. Removing 2, 4 and 6 digits requires a reference location within, respectively, ~800km, ~40 km and ~2km to recover the original coordinates. |
|
||||
| osd_right_sidebar_scroll | | |
|
||||
| osd_right_sidebar_scroll | NONE | |
|
||||
| osd_right_sidebar_scroll_step | 0 | Same as left_sidebar_scroll_step, but for the right sidebar |
|
||||
| osd_row_shiftdown | 0 | Number of rows to shift the OSD display (increase if top rows are cut off) |
|
||||
| osd_rssi_alarm | 20 | Value below which to make the OSD RSSI indicator blink |
|
||||
| osd_sidebar_horizontal_offset | 0 | Sidebar horizontal offset from default position. Positive values move the sidebars closer to the edges. |
|
||||
| osd_sidebar_scroll_arrows | | |
|
||||
| osd_sidebar_scroll_arrows | False | |
|
||||
| osd_snr_alarm | 4 | Value below which Crossfire SNR Alarm pops-up. (dB) |
|
||||
| osd_stats_energy_unit | MAH | Unit used for the drawn energy in the OSD stats [MAH/WH] (milliAmpere hour/ Watt hour) |
|
||||
| osd_temp_label_align | LEFT | Allows to chose between left and right alignment for the OSD temperature sensor labels. Valid values are `LEFT` and `RIGHT` |
|
||||
| osd_time_alarm | 10 | Value above which to make the OSD flight time indicator blink (minutes) |
|
||||
| osd_units | METRIC | IMPERIAL, METRIC, UK |
|
||||
| osd_video_system | AUTO | Video system used. Possible values are `AUTO`, `PAL` and `NTSC` |
|
||||
| pid_type | | Allows to set type of PID controller used in control loop. Possible values: `NONE`, `PID`, `PIFF`, `AUTO`. Change only in case of experimental platforms like VTOL, tailsitters, rovers, boats, etc. Airplanes should always use `PIFF` and multirotors `PID` |
|
||||
| pid_type | AUTO | Allows to set type of PID controller used in control loop. Possible values: `NONE`, `PID`, `PIFF`, `AUTO`. Change only in case of experimental platforms like VTOL, tailsitters, rovers, boats, etc. Airplanes should always use `PIFF` and multirotors `PID` |
|
||||
| pidsum_limit | 500 | A limitation to overall amount of correction Flight PID can request on each axis (Roll/Pitch). If when doing a hard maneuver on one axis machine looses orientation on other axis - reducing this parameter may help |
|
||||
| pidsum_limit_yaw | 400 | A limitation to overall amount of correction Flight PID can request on each axis (Yaw). If when doing a hard maneuver on one axis machine looses orientation on other axis - reducing this parameter may help |
|
||||
| pinio_box1 | target specific | Mode assignment for PINIO#1 |
|
||||
| pinio_box2 | target specific | Mode assignment for PINIO#1 |
|
||||
| pinio_box3 | target specific | Mode assignment for PINIO#1 |
|
||||
| pinio_box4 | target specific | Mode assignment for PINIO#1 |
|
||||
| pidsum_limit_yaw | 350 | A limitation to overall amount of correction Flight PID can request on each axis (Yaw). If when doing a hard maneuver on one axis machine looses orientation on other axis - reducing this parameter may help |
|
||||
| pinio_box1 | :BOX_PERMANENT_ID_NONE | Mode assignment for PINIO#1 |
|
||||
| pinio_box2 | :BOX_PERMANENT_ID_NONE | Mode assignment for PINIO#1 |
|
||||
| pinio_box3 | :BOX_PERMANENT_ID_NONE | Mode assignment for PINIO#1 |
|
||||
| pinio_box4 | :BOX_PERMANENT_ID_NONE | Mode assignment for PINIO#1 |
|
||||
| pitch_rate | 20 | Defines rotation rate on PITCH axis that UAV will try to archive on max. stick deflection. Rates are defined in tens of degrees (deca-degrees) per second [rate = dps/10]. That means, rate 20 represents 200dps rotation speed. Default 20 (200dps) is more less equivalent of old Cleanflight/Baseflight rate 0. Max. 180 (1800dps) is what gyro can measure. |
|
||||
| pitot_hardware | NONE | Selection of pitot hardware. |
|
||||
| pitot_lpf_milli_hz | | |
|
||||
| pitot_scale | | |
|
||||
| platform_type | "MULTIROTOR" | Defines UAV platform type. Allowed values: "MULTIROTOR", "AIRPLANE", "HELICOPTER", "TRICOPTER", "ROVER", "BOAT". Currently only MULTIROTOR, AIRPLANE and TRICOPTER types are implemented |
|
||||
| pos_hold_deadband | 20 | Stick deadband in [r/c points], applied after r/c deadband and expo |
|
||||
| pitot_lpf_milli_hz | 350 | |
|
||||
| pitot_scale | 1.0 | |
|
||||
| platform_type | MULTIROTOR | Defines UAV platform type. Allowed values: "MULTIROTOR", "AIRPLANE", "HELICOPTER", "TRICOPTER", "ROVER", "BOAT". Currently only MULTIROTOR, AIRPLANE and TRICOPTER types are implemented |
|
||||
| pos_hold_deadband | 10 | Stick deadband in [r/c points], applied after r/c deadband and expo |
|
||||
| prearm_timeout | 10000 | Duration (ms) for which Prearm being activated is valid. after this, Prearm needs to be reset. 0 means Prearm does not timeout. |
|
||||
| rangefinder_hardware | NONE | Selection of rangefinder hardware. |
|
||||
| rangefinder_median_filter | OFF | 3-point median filtering for rangefinder readouts |
|
||||
| rangefinder_median_filter | False | 3-point median filtering for rangefinder readouts |
|
||||
| rate_accel_limit_roll_pitch | 0 | Limits acceleration of ROLL/PITCH rotation speed that can be requested by stick input. In degrees-per-second-squared. Small and powerful UAV flies great with high acceleration limit ( > 5000 dps^2 and even > 10000 dps^2). Big and heavy multirotors will benefit from low acceleration limit (~ 360 dps^2). When set correctly, it greatly improves stopping performance. Value of 0 disables limiting. |
|
||||
| rate_accel_limit_yaw | 10000 | Limits acceleration of YAW rotation speed that can be requested by stick input. In degrees-per-second-squared. Small and powerful UAV flies great with high acceleration limit ( > 10000 dps^2). Big and heavy multirotors will benefit from low acceleration limit (~ 180 dps^2). When set correctly, it greatly improves stopping performance and general stability during yaw turns. Value of 0 disables limiting. |
|
||||
| rc_expo | 70 | Exposition value used for the PITCH/ROLL axes by all the stabilized flights modes (all but `MANUAL`) |
|
||||
| rc_filter_frequency | 50 | RC data biquad filter cutoff frequency. Lower cutoff frequencies result in smoother response at expense of command control delay. Practical values are 20-50. Set to zero to disable entirely and use unsmoothed RC stick values |
|
||||
| rc_yaw_expo | 20 | Exposition value used for the YAW axis by all the stabilized flights modes (all but `MANUAL`) |
|
||||
| reboot_character | 82 | Special character used to trigger reboot |
|
||||
| receiver_type | `TARGET dependent` | Selection of receiver (RX) type. Additional configuration of a `serialrx_provider` and a UART will be needed for `SERIAL` |
|
||||
| report_cell_voltage | OFF | S.Port, D-Series, and IBUS telemetry: Send the average cell voltage if set to ON |
|
||||
| receiver_type | :target | Selection of receiver (RX) type. Additional configuration of a `serialrx_provider` and a UART will be needed for `SERIAL` |
|
||||
| report_cell_voltage | False | S.Port, D-Series, and IBUS telemetry: Send the average cell voltage if set to ON |
|
||||
| roll_rate | 20 | Defines rotation rate on ROLL axis that UAV will try to archive on max. stick deflection. Rates are defined in tens of degrees (deca-degrees) per second [rate = dps/10]. That means, rate 20 represents 200dps rotation speed. Default 20 (200dps) is more less equivalent of old Cleanflight/Baseflight rate 0. Max. 180 (1800dps) is what gyro can measure. |
|
||||
| rpm_gyro_filter_enabled | `OFF` | Enables gyro RPM filtere. Set to `ON` only when ESC telemetry is working and rotation speed of the motors is correctly reported to INAV |
|
||||
| rpm_gyro_filter_enabled | False | Enables gyro RPM filtere. Set to `ON` only when ESC telemetry is working and rotation speed of the motors is correctly reported to INAV |
|
||||
| rpm_gyro_harmonics | 1 | Number of harmonic frequences to be covered by gyro RPM filter. Default value of `1` usually works just fine |
|
||||
| rpm_gyro_min_hz | 150 | The lowest frequency for gyro RPM filtere. Default `150` is fine for 5" mini-quads. On 7-inch drones you can lower even down to `60`-`70` |
|
||||
| rpm_gyro_min_hz | 100 | The lowest frequency for gyro RPM filtere. Default `150` is fine for 5" mini-quads. On 7-inch drones you can lower even down to `60`-`70` |
|
||||
| rpm_gyro_q | 500 | Q factor for gyro RPM filter. Lower values give softer, wider attenuation. Usually there is no need to change this setting |
|
||||
| rssi_adc_channel | - | ADC channel to use for analog RSSI input. Defaults to board RSSI input (if available). 0 = disabled |
|
||||
| rssi_adc_channel | :target | ADC channel to use for analog RSSI input. Defaults to board RSSI input (if available). 0 = disabled |
|
||||
| rssi_channel | 0 | RX channel containing the RSSI signal |
|
||||
| rssi_max | 100 | The maximum RSSI value sent by the receiver, in %. For example, if your receiver's maximum RSSI value shows as 83% in the configurator/OSD set this parameter to 83. See also rssi_min. |
|
||||
| rssi_min | 0 | The minimum RSSI value sent by the receiver, in %. For example, if your receiver's minimum RSSI value shows as 42% in the configurator/OSD set this parameter to 42. See also rssi_max. Note that rssi_min can be set to a value bigger than rssi_max to invert the RSSI calculation (i.e. bigger values mean lower RSSI). |
|
||||
| rssi_source | `AUTO` | Source of RSSI input. Possible values: `NONE`, `AUTO`, `ADC`, `CHANNEL`, `PROTOCOL`, `MSP` |
|
||||
| rssi_source | AUTO | Source of RSSI input. Possible values: `NONE`, `AUTO`, `ADC`, `CHANNEL`, `PROTOCOL`, `MSP` |
|
||||
| rth_energy_margin | 5 | Energy margin wanted after getting home (percent of battery energy capacity). Use for the remaining flight time/distance calculation |
|
||||
| rx_max_usec | 2115 | Defines the longest pulse width value used when ensuring the channel value is valid. If the receiver gives a pulse value higher than this value then the channel will be marked as bad and will default to the value of mid_rc. |
|
||||
| rx_min_usec | 885 | Defines the shortest pulse width value used when ensuring the channel value is valid. If the receiver gives a pulse value lower than this value then the channel will be marked as bad and will default to the value of mid_rc. |
|
||||
| rx_spi_id | | |
|
||||
| rx_spi_protocol | | |
|
||||
| rx_spi_rf_channel_count | | |
|
||||
| rx_spi_id | :zero | |
|
||||
| rx_spi_protocol | :target | |
|
||||
| rx_spi_rf_channel_count | :zero | |
|
||||
| safehome_max_distance | 20000 | In order for a safehome to be used, it must be less than this distance (in cm) from the arming point. |
|
||||
| sbus_sync_interval | | |
|
||||
| sdcard_detect_inverted | `TARGET dependent` | This setting drives the way SD card is detected in card slot. On some targets (AnyFC F7 clone) different card slot was used and depending of hardware revision ON or OFF setting might be required. If card is not detected, change this value. |
|
||||
| sbus_sync_interval | 3000 | |
|
||||
| sdcard_detect_inverted | :target | This setting drives the way SD card is detected in card slot. On some targets (AnyFC F7 clone) different card slot was used and depending of hardware revision ON or OFF setting might be required. If card is not detected, change this value. |
|
||||
| serialrx_halfduplex | AUTO | Allow serial receiver to operate on UART TX pin. With some receivers will allow control and telemetry over a single wire. |
|
||||
| serialrx_inverted | OFF | Reverse the serial inversion of the serial RX protocol. When this value is OFF, each protocol will use its default signal (e.g. SBUS will use an inverted signal). Some OpenLRS receivers produce a non-inverted SBUS signal. This setting supports this type of receivers (including modified FrSKY). |
|
||||
| serialrx_provider | SPEK1024 | When feature SERIALRX is enabled, this allows connection to several receivers which output data via digital interface resembling serial. See RX section. |
|
||||
| serialrx_inverted | False | Reverse the serial inversion of the serial RX protocol. When this value is OFF, each protocol will use its default signal (e.g. SBUS will use an inverted signal). Some OpenLRS receivers produce a non-inverted SBUS signal. This setting supports this type of receivers (including modified FrSKY). |
|
||||
| serialrx_provider | :target | When feature SERIALRX is enabled, this allows connection to several receivers which output data via digital interface resembling serial. See RX section. |
|
||||
| servo_center_pulse | 1500 | Servo midpoint |
|
||||
| servo_lpf_hz | 20 | Selects the servo PWM output cutoff frequency. Value is in [Hz] |
|
||||
| servo_protocol | PWM | An option to chose the protocol/option that would be used to output servo data. Possible options `PWM` (FC servo outputs), `SERVO_DRIVER` (I2C PCA9685 peripheral), `SBUS` (S.Bus protocol output via a configured serial port) |
|
||||
| servo_pwm_rate | 50 | Output frequency (in Hz) servo pins. When using tricopters or gimbal with digital servo, this rate can be increased. Max of 498Hz (for 500Hz pwm period), and min of 50Hz. Most digital servos will support for example 330Hz. |
|
||||
| setpoint_kalman_enabled | OFF | Enable Kalman filter on the PID controller setpoint |
|
||||
| setpoint_kalman_enabled | False | Enable Kalman filter on the PID controller setpoint |
|
||||
| setpoint_kalman_q | 100 | Quality factor of the setpoint Kalman filter. Higher values means less filtering and lower phase delay. On 3-7 inch multirotors can be usually increased to 200-300 or even higher of clean builds |
|
||||
| setpoint_kalman_sharpness | 100 | Dynamic factor for the setpoint Kalman filter. In general, the higher the value, the more dynamic Kalman filter gets |
|
||||
| setpoint_kalman_w | 4 | Window size for the setpoint Kalman filter. Wider the window, more samples are used to compute variance. In general, wider window results in smoother filter response |
|
||||
| sim_ground_station_number | Empty string | Number of phone that is used to communicate with SIM module. Messages / calls from other numbers are ignored. If undefined, can be set by calling or sending a message to the module. |
|
||||
| sim_low_altitude | 0 | Threshold for low altitude warning messages sent by SIM module when the 'L' transmit flag is set in `sim_transmit_flags`. |
|
||||
| sim_pin | Empty string | PIN code for the SIM module |
|
||||
| sim_transmit_flags | F | String specifying text message transmit condition flags for the SIM module. Flags can be given in any order. Empty string means the module only sends response messages. `A`: acceleration events, `T`: continuous transmission, `F`: continuous transmission in failsafe mode, `L`: continuous transmission when altitude is below `sim_low_altitude`, `G`: continuous transmission when GPS signal quality is low |
|
||||
| sim_ground_station_number | | Number of phone that is used to communicate with SIM module. Messages / calls from other numbers are ignored. If undefined, can be set by calling or sending a message to the module. |
|
||||
| sim_low_altitude | -32767 | Threshold for low altitude warning messages sent by SIM module when the 'L' transmit flag is set in `sim_transmit_flags`. |
|
||||
| sim_pin | 0000 | PIN code for the SIM module |
|
||||
| sim_transmit_flags | :SIM_TX_FLAG_FAILSAFE | Bitmask specifying text message transmit condition flags for the SIM module. 1: continuous transmission, 2: continuous transmission in failsafe mode, 4: continuous transmission when GPS signal quality is low, 8: acceleration events, 16: continuous transmission when altitude is below `sim_low_altitude` |
|
||||
| sim_transmit_interval | 60 | Text message transmission interval in seconds for SIM module. Minimum value: 10 |
|
||||
| small_angle | 25 | If the aircraft tilt angle exceed this value the copter will refuse to arm. |
|
||||
| smartport_fuel_unit | MAH | S.Port telemetry only: Unit of the value sent with the `FUEL` ID (FrSky D-Series always sends percent). [PERCENT/MAH/MWH] |
|
||||
| smartport_master_halfduplex | | |
|
||||
| smartport_master_inverted | | |
|
||||
| spektrum_sat_bind | 0 | 0 = disabled. Used to bind the spektrum satellite to RX |
|
||||
| srxl2_baud_fast | | |
|
||||
| srxl2_unit_id | | |
|
||||
| stats | OFF | General switch of the statistics recording feature (a.k.a. odometer) |
|
||||
| smartport_master_halfduplex | True | |
|
||||
| smartport_master_inverted | False | |
|
||||
| spektrum_sat_bind | :SPEKTRUM_SAT_BIND_DISABLED | 0 = disabled. Used to bind the spektrum satellite to RX |
|
||||
| srxl2_baud_fast | True | |
|
||||
| srxl2_unit_id | 1 | |
|
||||
| stats | False | General switch of the statistics recording feature (a.k.a. odometer) |
|
||||
| stats_total_dist | 0 | Total flight distance [in meters]. The value is updated on every disarm when "stats" are enabled. |
|
||||
| stats_total_energy | | |
|
||||
| stats_total_energy | 0 | |
|
||||
| stats_total_time | 0 | Total flight time [in seconds]. The value is updated on every disarm when "stats" are enabled. |
|
||||
| switch_disarm_delay | 250 | Delay before disarming when requested by switch (ms) [0-1000] |
|
||||
| telemetry_halfduplex | OFF | S.Port telemetry only: Turn UART into UNIDIR for usage on F1 and F4 target. See Telemetry.md for details |
|
||||
| telemetry_inverted | OFF | Determines if the telemetry protocol default signal inversion is reversed. This should be OFF in most cases unless a custom or hacked RX is used. |
|
||||
| telemetry_switch | OFF | Which aux channel to use to change serial output & baud rate (MSP / Telemetry). It disables automatic switching to Telemetry when armed. |
|
||||
| thr_comp_weight | 0.692 | Weight used for the throttle compensation based on battery voltage. See the [battery documentation](Battery.md#automatic-throttle-compensation-based-on-battery-voltage) |
|
||||
| telemetry_halfduplex | True | S.Port telemetry only: Turn UART into UNIDIR for usage on F1 and F4 target. See Telemetry.md for details |
|
||||
| telemetry_inverted | False | Determines if the telemetry protocol default signal inversion is reversed. This should be OFF in most cases unless a custom or hacked RX is used. |
|
||||
| telemetry_switch | False | Which aux channel to use to change serial output & baud rate (MSP / Telemetry). It disables automatic switching to Telemetry when armed. |
|
||||
| thr_comp_weight | 1 | Weight used for the throttle compensation based on battery voltage. See the [battery documentation](Battery.md#automatic-throttle-compensation-based-on-battery-voltage) |
|
||||
| thr_expo | 0 | Throttle exposition value |
|
||||
| thr_mid | 50 | Throttle value when the stick is set to mid-position. Used in the throttle curve calculation. |
|
||||
| throttle_idle | 15 | The percentage of the throttle range (`max_throttle` - `min_command`) above `min_command` used for minimum / idle throttle. |
|
||||
| throttle_scale | 1.000 | Throttle scaling factor. `1` means no throttle scaling. `0.5` means throttle scaled down by 50% |
|
||||
| throttle_scale | 1.0 | Throttle scaling factor. `1` means no throttle scaling. `0.5` means throttle scaled down by 50% |
|
||||
| throttle_tilt_comp_str | 0 | Can be used in ANGLE and HORIZON mode and will automatically boost throttle when banking. Setting is in percentage, 0=disabled. |
|
||||
| tpa_breakpoint | 1500 | See tpa_rate. |
|
||||
| tpa_rate | 0 | Throttle PID attenuation reduces influence of P on ROLL and PITCH as throttle increases. For every 1% throttle after the TPA breakpoint, P is reduced by the TPA rate. |
|
||||
| tri_unarmed_servo | ON | On tricopter mix only, if this is set to ON, servo will always be correcting regardless of armed state. to disable this, set it to OFF. |
|
||||
| tri_unarmed_servo | True | On tricopter mix only, if this is set to ON, servo will always be correcting regardless of armed state. to disable this, set it to OFF. |
|
||||
| tz_automatic_dst | OFF | Automatically add Daylight Saving Time to the GPS time when needed or simply ignore it. Includes presets for EU and the USA - if you live outside these areas it is suggested to manage DST manually via `tz_offset`. |
|
||||
| tz_offset | 0 | Time zone offset from UTC, in minutes. This is applied to the GPS time for logging and time-stamping of Blackbox logs |
|
||||
| vbat_adc_channel | - | ADC channel to use for battery voltage sensor. Defaults to board VBAT input (if available). 0 = disabled |
|
||||
| vbat_adc_channel | :target | ADC channel to use for battery voltage sensor. Defaults to board VBAT input (if available). 0 = disabled |
|
||||
| vbat_cell_detect_voltage | 425 | Maximum voltage per cell, used for auto-detecting the number of cells of the battery in 0.01V units, default is 4.30V. |
|
||||
| vbat_max_cell_voltage | 420 | Maximum voltage per cell in 0.01V units, default is 4.20V |
|
||||
| vbat_meter_type | `ADC` | Vbat voltage source. Possible values: `NONE`, `ADC`, `ESC`. `ESC` required ESC telemetry enebled and running |
|
||||
| vbat_meter_type | ADC | Vbat voltage source. Possible values: `NONE`, `ADC`, `ESC`. `ESC` required ESC telemetry enebled and running |
|
||||
| vbat_min_cell_voltage | 330 | Minimum voltage per cell, this triggers battery out alarms, in 0.01V units, default is 330 (3.3V) |
|
||||
| vbat_scale | 1100 | Battery voltage calibration value. 1100 = 11:1 voltage divider (10k:1k) x 100. Adjust this slightly if reported pack voltage is different from multimeter reading. You can get current voltage by typing "status" in cli. |
|
||||
| vbat_scale | :target | Battery voltage calibration value. 1100 = 11:1 voltage divider (10k:1k) x 100. Adjust this slightly if reported pack voltage is different from multimeter reading. You can get current voltage by typing "status" in cli. |
|
||||
| vbat_warning_cell_voltage | 350 | Warning voltage per cell, this triggers battery-warning alarms, in 0.01V units, default is 350 (3.5V) |
|
||||
| vtx_band | 4 | Configure the VTX band. Set to zero to use `vtx_freq`. Bands: 1: A, 2: B, 3: E, 4: F, 5: Race. |
|
||||
| vtx_channel | 1 | Channel to use within the configured `vtx_band`. Valid values are [1, 8]. |
|
||||
| vtx_halfduplex | ON | Use half duplex UART to communicate with the VTX, using only a TX pin in the FC. |
|
||||
| vtx_halfduplex | True | Use half duplex UART to communicate with the VTX, using only a TX pin in the FC. |
|
||||
| vtx_low_power_disarm | OFF | When the craft is disarmed, set the VTX to its lowest power. `ON` will set the power to its minimum value on startup, increase it to `vtx_power` when arming and change it back to its lowest setting after disarming. `UNTIL_FIRST_ARM` will start with minimum power, but once the craft is armed it will increase to `vtx_power` and it will never decrease until the craft is power cycled. |
|
||||
| vtx_max_power_override | 0 | Some VTXes may report max power incorrectly (i.e. 200mW for a 600mW VTX). Use this to override max supported power. 0 to disable and use whatever VTX reports as its capabilities |
|
||||
| vtx_pit_mode_chan | | |
|
||||
| vtx_pit_mode_chan | 1 | |
|
||||
| vtx_power | 1 | VTX RF power level to use. The exact number of mw depends on the VTX hardware. |
|
||||
| vtx_smartaudio_early_akk_workaround | ON | Enable workaround for early AKK SAudio-enabled VTX bug. |
|
||||
| vtx_smartaudio_early_akk_workaround | True | Enable workaround for early AKK SAudio-enabled VTX bug. |
|
||||
| yaw_deadband | 5 | These are values (in us) by how much RC input can be different before it's considered valid. For transmitters with jitter on outputs, this value can be increased. Defaults are zero, but can be increased up to 10 or so if rc inputs twitch while idle. |
|
||||
| yaw_lpf_hz | 30 | Yaw low pass filter cutoff frequency. Should be disabled (set to `0`) on small multirotors (7 inches and below) |
|
||||
| yaw_lpf_hz | 0 | Yaw low pass filter cutoff frequency. Should be disabled (set to `0`) on small multirotors (7 inches and below) |
|
||||
| yaw_rate | 20 | Defines rotation rate on YAW axis that UAV will try to archive on max. stick deflection. Rates are defined in tens of degrees (deca-degrees) per second [rate = dps/10]. That means, rate 20 represents 200dps rotation speed. Default 20 (200dps) is more less equivalent of old Cleanflight/Baseflight rate 0. Max. 180 (1800dps) is what gyro can measure. |
|
||||
|
||||
> Note: this table is autogenerated. Do not edit it manually.
|
|
@ -52,6 +52,7 @@
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
#include "flight/imu.h"
|
||||
|
@ -91,18 +92,18 @@
|
|||
#endif
|
||||
|
||||
#ifdef SDCARD_DETECT_INVERTED
|
||||
#define BLACKBOX_INTERVED_CARD_DETECTION 1
|
||||
#define BLACKBOX_INVERTED_CARD_DETECTION 1
|
||||
#else
|
||||
#define BLACKBOX_INTERVED_CARD_DETECTION 0
|
||||
#define BLACKBOX_INVERTED_CARD_DETECTION 0
|
||||
#endif
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig,
|
||||
.device = DEFAULT_BLACKBOX_DEVICE,
|
||||
.rate_num = 1,
|
||||
.rate_denom = 1,
|
||||
.invertedCardDetection = BLACKBOX_INTERVED_CARD_DETECTION,
|
||||
.rate_num = SETTING_BLACKBOX_RATE_NUM_DEFAULT,
|
||||
.rate_denom = SETTING_BLACKBOX_RATE_DENOM_DEFAULT,
|
||||
.invertedCardDetection = BLACKBOX_INVERTED_CARD_DETECTION,
|
||||
);
|
||||
|
||||
#define BLACKBOX_SHUTDOWN_TIMEOUT_MILLIS 200
|
||||
|
@ -1656,6 +1657,7 @@ static bool blackboxWriteSysinfo(void)
|
|||
BLACKBOX_PRINT_HEADER_LINE("motorOutput", "%d,%d", getThrottleIdleValue(),motorConfig()->maxthrottle);
|
||||
BLACKBOX_PRINT_HEADER_LINE("acc_1G", "%u", acc.dev.acc_1G);
|
||||
|
||||
#ifdef USE_ADC
|
||||
BLACKBOX_PRINT_HEADER_LINE_CUSTOM(
|
||||
if (testBlackboxCondition(FLIGHT_LOG_FIELD_CONDITION_VBAT)) {
|
||||
blackboxPrintfHeaderLine("vbat_scale", "%u", batteryMetersConfig()->voltage.scale / 10);
|
||||
|
@ -1667,6 +1669,7 @@ static bool blackboxWriteSysinfo(void)
|
|||
currentBatteryProfile->voltage.cellWarning / 10,
|
||||
currentBatteryProfile->voltage.cellMax / 10);
|
||||
BLACKBOX_PRINT_HEADER_LINE("vbatref", "%u", vbatReference);
|
||||
#endif
|
||||
|
||||
BLACKBOX_PRINT_HEADER_LINE_CUSTOM(
|
||||
//Note: Log even if this is a virtual current meter, since the virtual meter uses these parameters too:
|
||||
|
@ -1723,17 +1726,25 @@ static bool blackboxWriteSysinfo(void)
|
|||
BLACKBOX_PRINT_HEADER_LINE("gyro_lpf_hz", "%d", gyroConfig()->gyro_soft_lpf_hz);
|
||||
BLACKBOX_PRINT_HEADER_LINE("gyro_lpf_type", "%d", gyroConfig()->gyro_soft_lpf_type);
|
||||
BLACKBOX_PRINT_HEADER_LINE("gyro_lpf2_hz", "%d", gyroConfig()->gyro_stage2_lowpass_hz);
|
||||
#ifdef USE_DYNAMIC_FILTERS
|
||||
BLACKBOX_PRINT_HEADER_LINE("dynamicGyroNotchRange", "%d", gyroConfig()->dynamicGyroNotchRange);
|
||||
BLACKBOX_PRINT_HEADER_LINE("dynamicGyroNotchQ", "%d", gyroConfig()->dynamicGyroNotchQ);
|
||||
BLACKBOX_PRINT_HEADER_LINE("dynamicGyroNotchMinHz", "%d", gyroConfig()->dynamicGyroNotchMinHz);
|
||||
#endif
|
||||
BLACKBOX_PRINT_HEADER_LINE("gyro_notch_hz", "%d,%d", gyroConfig()->gyro_notch_hz,
|
||||
0);
|
||||
BLACKBOX_PRINT_HEADER_LINE("gyro_notch_cutoff", "%d,%d", gyroConfig()->gyro_notch_cutoff,
|
||||
1);
|
||||
BLACKBOX_PRINT_HEADER_LINE("acc_lpf_hz", "%d", accelerometerConfig()->acc_lpf_hz);
|
||||
BLACKBOX_PRINT_HEADER_LINE("acc_hardware", "%d", accelerometerConfig()->acc_hardware);
|
||||
#ifdef USE_BARO
|
||||
BLACKBOX_PRINT_HEADER_LINE("baro_hardware", "%d", barometerConfig()->baro_hardware);
|
||||
#endif
|
||||
#ifdef USE_MAG
|
||||
BLACKBOX_PRINT_HEADER_LINE("mag_hardware", "%d", compassConfig()->mag_hardware);
|
||||
#else
|
||||
BLACKBOX_PRINT_HEADER_LINE("mag_hardware", "%d", MAG_NONE);
|
||||
#endif
|
||||
BLACKBOX_PRINT_HEADER_LINE("serialrx_provider", "%d", rxConfig()->serialrx_provider);
|
||||
BLACKBOX_PRINT_HEADER_LINE("motor_pwm_protocol", "%d", motorConfig()->motorPwmProtocol);
|
||||
BLACKBOX_PRINT_HEADER_LINE("motor_pwm_rate", "%d", motorConfig()->motorPwmRate);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "io/serial.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "msp/msp.h"
|
||||
#include "msp/msp_serial.h"
|
||||
|
@ -54,6 +55,11 @@ static mspPort_t * mspLogPort = NULL;
|
|||
|
||||
PG_REGISTER(logConfig_t, logConfig, PG_LOG_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(logConfig_t, logConfig,
|
||||
.level = SETTING_LOG_LEVEL_DEFAULT,
|
||||
.topics = SETTING_LOG_TOPICS_DEFAULT
|
||||
);
|
||||
|
||||
void logInit(void)
|
||||
{
|
||||
const serialPortConfig_t *portConfig = findSerialPortConfig(FUNCTION_LOG);
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
// For the "modulo 4" arithmetic to work, we need a leap base year
|
||||
#define REFERENCE_YEAR 2000
|
||||
// Offset (seconds) from the UNIX epoch (1970-01-01) to 2000-01-01
|
||||
|
@ -55,8 +57,8 @@ static const uint16_t days[4][12] =
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(timeConfig_t, timeConfig, PG_TIME_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(timeConfig_t, timeConfig,
|
||||
.tz_offset = 0,
|
||||
.tz_automatic_dst = TZ_AUTO_DST_OFF,
|
||||
.tz_offset = SETTING_TZ_OFFSET_DEFAULT,
|
||||
.tz_automatic_dst = SETTING_TZ_AUTOMATIC_DST_DEFAULT,
|
||||
);
|
||||
|
||||
static rtcTime_t dateTimeToRtcTime(const dateTime_t *dt)
|
||||
|
|
|
@ -28,8 +28,10 @@
|
|||
|
||||
#include "config/general_settings.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(generalSettings_t, generalSettings, PG_GENERAL_SETTINGS, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(generalSettings_t, generalSettings,
|
||||
.appliedDefaults = APPLIED_DEFAULTS_NONE,
|
||||
.appliedDefaults = SETTING_APPLIED_DEFAULTS_DEFAULT,
|
||||
);
|
|
@ -30,6 +30,7 @@
|
|||
#include "drivers/display_font_metadata.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
#define SW_BLINK_CYCLE_MS 200 // 200ms on / 200ms off
|
||||
|
||||
|
@ -43,7 +44,7 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(displayConfig_t, displayConfig, PG_DISPLAY_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(displayConfig_t, displayConfig,
|
||||
.force_sw_blink = false,
|
||||
.force_sw_blink = SETTING_DISPLAY_FORCE_SW_BLINK_DEFAULT
|
||||
);
|
||||
|
||||
static bool displayAttributesRequireEmulation(displayPort_t *instance, textAttributes_t attr)
|
||||
|
|
|
@ -112,11 +112,15 @@ PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG,
|
|||
PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
||||
.current_profile_index = 0,
|
||||
.current_battery_profile_index = 0,
|
||||
.debug_mode = DEBUG_NONE,
|
||||
.i2c_speed = I2C_SPEED_400KHZ,
|
||||
.cpuUnderclock = 0,
|
||||
.throttle_tilt_compensation_strength = 0, // 0-100, 0 - disabled
|
||||
.name = { 0 }
|
||||
.debug_mode = SETTING_DEBUG_MODE_DEFAULT,
|
||||
#ifdef USE_I2C
|
||||
.i2c_speed = SETTING_I2C_SPEED_DEFAULT,
|
||||
#endif
|
||||
#ifdef USE_UNDERCLOCK
|
||||
.cpuUnderclock = SETTING_CPU_UNDERCLOCK_DEFAULT,
|
||||
#endif
|
||||
.throttle_tilt_compensation_strength = SETTING_THROTTLE_TILT_COMP_STR_DEFAULT, // 0-100, 0 - disabled
|
||||
.name = SETTING_NAME_DEFAULT
|
||||
);
|
||||
|
||||
PG_REGISTER(beeperConfig_t, beeperConfig, PG_BEEPER_CONFIG, 0);
|
||||
|
|
|
@ -73,8 +73,12 @@ typedef struct systemConfig_s {
|
|||
uint8_t current_profile_index;
|
||||
uint8_t current_battery_profile_index;
|
||||
uint8_t debug_mode;
|
||||
#ifdef USE_I2C
|
||||
uint8_t i2c_speed;
|
||||
#endif
|
||||
#ifdef USE_UNDERCLOCK
|
||||
uint8_t cpuUnderclock;
|
||||
#endif
|
||||
uint8_t throttle_tilt_compensation_strength; // the correction that will be applied at throttle_correction_angle.
|
||||
char name[MAX_NAME_LENGTH + 1];
|
||||
} systemConfig_t;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "fc/config.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
#include "fc/rc_curves.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
const controlRateConfig_t *currentControlRateProfile;
|
||||
|
||||
|
@ -40,31 +41,31 @@ void pgResetFn_controlRateProfiles(controlRateConfig_t *instance)
|
|||
for (int i = 0; i < MAX_CONTROL_RATE_PROFILE_COUNT; i++) {
|
||||
RESET_CONFIG(controlRateConfig_t, &instance[i],
|
||||
.throttle = {
|
||||
.rcMid8 = 50,
|
||||
.rcExpo8 = 0,
|
||||
.dynPID = 0,
|
||||
.pa_breakpoint = 1500,
|
||||
.fixedWingTauMs = 0
|
||||
.rcMid8 = SETTING_THR_MID_DEFAULT,
|
||||
.rcExpo8 = SETTING_THR_EXPO_DEFAULT,
|
||||
.dynPID = SETTING_TPA_RATE_DEFAULT,
|
||||
.pa_breakpoint = SETTING_TPA_BREAKPOINT_DEFAULT,
|
||||
.fixedWingTauMs = SETTING_FW_TPA_TIME_CONSTANT_DEFAULT
|
||||
},
|
||||
|
||||
.stabilized = {
|
||||
.rcExpo8 = 70,
|
||||
.rcYawExpo8 = 20,
|
||||
.rates[FD_ROLL] = CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_DEFAULT,
|
||||
.rates[FD_PITCH] = CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_DEFAULT,
|
||||
.rates[FD_YAW] = CONTROL_RATE_CONFIG_YAW_RATE_DEFAULT,
|
||||
.rcExpo8 = SETTING_RC_EXPO_DEFAULT,
|
||||
.rcYawExpo8 = SETTING_RC_YAW_EXPO_DEFAULT,
|
||||
.rates[FD_ROLL] = SETTING_ROLL_RATE_DEFAULT,
|
||||
.rates[FD_PITCH] = SETTING_PITCH_RATE_DEFAULT,
|
||||
.rates[FD_YAW] = SETTING_YAW_RATE_DEFAULT,
|
||||
},
|
||||
|
||||
.manual = {
|
||||
.rcExpo8 = 70,
|
||||
.rcYawExpo8 = 20,
|
||||
.rates[FD_ROLL] = 100,
|
||||
.rates[FD_PITCH] = 100,
|
||||
.rates[FD_YAW] = 100
|
||||
.rcExpo8 = SETTING_MANUAL_RC_EXPO_DEFAULT,
|
||||
.rcYawExpo8 = SETTING_MANUAL_RC_YAW_EXPO_DEFAULT,
|
||||
.rates[FD_ROLL] = SETTING_MANUAL_ROLL_RATE_DEFAULT,
|
||||
.rates[FD_PITCH] = SETTING_MANUAL_PITCH_RATE_DEFAULT,
|
||||
.rates[FD_YAW] = SETTING_MANUAL_YAW_RATE_DEFAULT
|
||||
},
|
||||
|
||||
.misc = {
|
||||
.fpvCamAngleDegrees = 0,
|
||||
.fpvCamAngleDegrees = SETTING_FPV_MIX_DEGREES_DEFAULT
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -33,10 +33,8 @@ and so on.
|
|||
*/
|
||||
#define CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MAX 180
|
||||
#define CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_MIN 6
|
||||
#define CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_DEFAULT 20
|
||||
#define CONTROL_RATE_CONFIG_YAW_RATE_MAX 180
|
||||
#define CONTROL_RATE_CONFIG_YAW_RATE_MIN 2
|
||||
#define CONTROL_RATE_CONFIG_YAW_RATE_DEFAULT 20
|
||||
|
||||
#define CONTROL_RATE_CONFIG_TPA_MAX 100
|
||||
|
||||
|
|
|
@ -417,9 +417,11 @@ void disarm(disarmReason_t disarmReason)
|
|||
#endif
|
||||
statsOnDisarm();
|
||||
logicConditionReset();
|
||||
|
||||
#ifdef USE_PROGRAMMING_FRAMEWORK
|
||||
programmingPidReset();
|
||||
#endif
|
||||
|
||||
beeper(BEEPER_DISARMING); // emit disarm tone
|
||||
|
||||
prearmWasReset = false;
|
||||
|
@ -531,6 +533,7 @@ void tryArm(void)
|
|||
#ifdef USE_PROGRAMMING_FRAMEWORK
|
||||
programmingPidReset();
|
||||
#endif
|
||||
|
||||
headFreeModeHold = DECIDEGREES_TO_DEGREES(attitude.values.yaw);
|
||||
|
||||
resetHeadingHoldTarget(DECIDEGREES_TO_DEGREES(attitude.values.yaw));
|
||||
|
|
|
@ -220,8 +220,12 @@ void init(void)
|
|||
ensureEEPROMContainsValidData();
|
||||
readEEPROM();
|
||||
|
||||
#ifdef USE_UNDERCLOCK
|
||||
// Re-initialize system clock to their final values (if necessary)
|
||||
systemClockSetup(systemConfig()->cpuUnderclock);
|
||||
#else
|
||||
systemClockSetup(false);
|
||||
#endif
|
||||
|
||||
#ifdef USE_I2C
|
||||
i2cSetSpeed(systemConfig()->i2c_speed);
|
||||
|
|
|
@ -487,7 +487,11 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, gyroRateDps(i));
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
#ifdef USE_MAG
|
||||
sbufWriteU16(dst, mag.magADC[i]);
|
||||
#else
|
||||
sbufWriteU16(dst, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -785,12 +789,23 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU8(dst, rxConfig()->rssi_channel);
|
||||
sbufWriteU8(dst, 0);
|
||||
|
||||
#ifdef USE_MAG
|
||||
sbufWriteU16(dst, compassConfig()->mag_declination / 10);
|
||||
#else
|
||||
sbufWriteU16(dst, 0);
|
||||
#endif
|
||||
|
||||
#ifdef USE_ADC
|
||||
sbufWriteU8(dst, batteryMetersConfig()->voltage.scale / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellMin / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellMax / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellWarning / 10);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MSP2_INAV_MISC:
|
||||
|
@ -813,8 +828,13 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
#endif
|
||||
sbufWriteU8(dst, rxConfig()->rssi_channel);
|
||||
|
||||
#ifdef USE_MAG
|
||||
sbufWriteU16(dst, compassConfig()->mag_declination / 10);
|
||||
#else
|
||||
sbufWriteU16(dst, 0);
|
||||
#endif
|
||||
|
||||
#ifdef USE_ADC
|
||||
sbufWriteU16(dst, batteryMetersConfig()->voltage.scale);
|
||||
sbufWriteU8(dst, batteryMetersConfig()->voltageSource);
|
||||
sbufWriteU8(dst, currentBatteryProfile->cells);
|
||||
|
@ -822,6 +842,15 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellMin);
|
||||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellMax);
|
||||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellWarning);
|
||||
#else
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
#endif
|
||||
|
||||
sbufWriteU32(dst, currentBatteryProfile->capacity.value);
|
||||
sbufWriteU32(dst, currentBatteryProfile->capacity.warning);
|
||||
|
@ -841,6 +870,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
break;
|
||||
|
||||
case MSP2_INAV_BATTERY_CONFIG:
|
||||
#ifdef USE_ADC
|
||||
sbufWriteU16(dst, batteryMetersConfig()->voltage.scale);
|
||||
sbufWriteU8(dst, batteryMetersConfig()->voltageSource);
|
||||
sbufWriteU8(dst, currentBatteryProfile->cells);
|
||||
|
@ -848,6 +878,15 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellMin);
|
||||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellMax);
|
||||
sbufWriteU16(dst, currentBatteryProfile->voltage.cellWarning);
|
||||
#else
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
sbufWriteU16(dst, 0);
|
||||
#endif
|
||||
|
||||
sbufWriteU16(dst, batteryMetersConfig()->current.offset);
|
||||
sbufWriteU16(dst, batteryMetersConfig()->current.scale);
|
||||
|
@ -947,10 +986,17 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
break;
|
||||
|
||||
case MSP_VOLTAGE_METER_CONFIG:
|
||||
#ifdef USE_ADC
|
||||
sbufWriteU8(dst, batteryMetersConfig()->voltage.scale / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellMin / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellMax / 10);
|
||||
sbufWriteU8(dst, currentBatteryProfile->voltage.cellWarning / 10);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MSP_CURRENT_METER_CONFIG:
|
||||
|
@ -969,15 +1015,25 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, rxConfig()->maxcheck);
|
||||
sbufWriteU16(dst, PWM_RANGE_MIDDLE);
|
||||
sbufWriteU16(dst, rxConfig()->mincheck);
|
||||
#ifdef USE_SPEKTRUM_BIND
|
||||
sbufWriteU8(dst, rxConfig()->spektrum_sat_bind);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
sbufWriteU16(dst, rxConfig()->rx_min_usec);
|
||||
sbufWriteU16(dst, rxConfig()->rx_max_usec);
|
||||
sbufWriteU8(dst, 0); // for compatibility with betaflight (rcInterpolation)
|
||||
sbufWriteU8(dst, 0); // for compatibility with betaflight (rcInterpolationInterval)
|
||||
sbufWriteU16(dst, 0); // for compatibility with betaflight (airModeActivateThreshold)
|
||||
#ifdef USE_RX_SPI
|
||||
sbufWriteU8(dst, rxConfig()->rx_spi_protocol);
|
||||
sbufWriteU32(dst, rxConfig()->rx_spi_id);
|
||||
sbufWriteU8(dst, rxConfig()->rx_spi_rf_channel_count);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
sbufWriteU32(dst, 0);
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
sbufWriteU8(dst, 0); // for compatibility with betaflight (fpvCamAngleDegrees)
|
||||
sbufWriteU8(dst, rxConfig()->receiverType);
|
||||
break;
|
||||
|
@ -1154,7 +1210,11 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
case MSP_SENSOR_ALIGNMENT:
|
||||
sbufWriteU8(dst, gyroConfig()->gyro_align);
|
||||
sbufWriteU8(dst, accelerometerConfig()->acc_align);
|
||||
#ifdef USE_MAG
|
||||
sbufWriteU8(dst, compassConfig()->mag_align);
|
||||
#else
|
||||
sbufWriteU8(dst, 0);
|
||||
#endif
|
||||
#ifdef USE_OPFLOW
|
||||
sbufWriteU8(dst, opticalFlowConfig()->opflow_align);
|
||||
#else
|
||||
|
@ -1831,10 +1891,17 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
sbufReadU16(src);
|
||||
#endif
|
||||
|
||||
#ifdef USE_ADC
|
||||
batteryMetersConfigMutable()->voltage.scale = sbufReadU8(src) * 10;
|
||||
currentBatteryProfileMutable->voltage.cellMin = sbufReadU8(src) * 10; // vbatlevel_warn1 in MWC2.3 GUI
|
||||
currentBatteryProfileMutable->voltage.cellMax = sbufReadU8(src) * 10; // vbatlevel_warn2 in MWC2.3 GUI
|
||||
currentBatteryProfileMutable->voltage.cellWarning = sbufReadU8(src) * 10; // vbatlevel when buzzer starts to alert
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
} else
|
||||
return MSP_RESULT_ERROR;
|
||||
break;
|
||||
|
@ -1869,6 +1936,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
sbufReadU16(src);
|
||||
#endif
|
||||
|
||||
#ifdef USE_ADC
|
||||
batteryMetersConfigMutable()->voltage.scale = sbufReadU16(src);
|
||||
batteryMetersConfigMutable()->voltageSource = sbufReadU8(src);
|
||||
currentBatteryProfileMutable->cells = sbufReadU8(src);
|
||||
|
@ -1876,6 +1944,15 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
currentBatteryProfileMutable->voltage.cellMin = sbufReadU16(src);
|
||||
currentBatteryProfileMutable->voltage.cellMax = sbufReadU16(src);
|
||||
currentBatteryProfileMutable->voltage.cellWarning = sbufReadU16(src);
|
||||
#else
|
||||
sbufReadU16(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
#endif
|
||||
|
||||
currentBatteryProfileMutable->capacity.value = sbufReadU32(src);
|
||||
currentBatteryProfileMutable->capacity.warning = sbufReadU32(src);
|
||||
|
@ -1895,6 +1972,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
|
||||
case MSP2_INAV_SET_BATTERY_CONFIG:
|
||||
if (dataSize == 29) {
|
||||
#ifdef USE_ADC
|
||||
batteryMetersConfigMutable()->voltage.scale = sbufReadU16(src);
|
||||
batteryMetersConfigMutable()->voltageSource = sbufReadU8(src);
|
||||
currentBatteryProfileMutable->cells = sbufReadU8(src);
|
||||
|
@ -1902,6 +1980,15 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
currentBatteryProfileMutable->voltage.cellMin = sbufReadU16(src);
|
||||
currentBatteryProfileMutable->voltage.cellMax = sbufReadU16(src);
|
||||
currentBatteryProfileMutable->voltage.cellWarning = sbufReadU16(src);
|
||||
#else
|
||||
sbufReadU16(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
sbufReadU16(src);
|
||||
#endif
|
||||
|
||||
batteryMetersConfigMutable()->current.offset = sbufReadU16(src);
|
||||
batteryMetersConfigMutable()->current.scale = sbufReadU16(src);
|
||||
|
@ -2538,10 +2625,17 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
|
||||
case MSP_SET_VOLTAGE_METER_CONFIG:
|
||||
if (dataSize >= 4) {
|
||||
#ifdef USE_ADC
|
||||
batteryMetersConfigMutable()->voltage.scale = sbufReadU8(src) * 10;
|
||||
currentBatteryProfileMutable->voltage.cellMin = sbufReadU8(src) * 10;
|
||||
currentBatteryProfileMutable->voltage.cellMax = sbufReadU8(src) * 10;
|
||||
currentBatteryProfileMutable->voltage.cellWarning = sbufReadU8(src) * 10;
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
} else
|
||||
return MSP_RESULT_ERROR;
|
||||
break;
|
||||
|
@ -2570,15 +2664,25 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
rxConfigMutable()->maxcheck = sbufReadU16(src);
|
||||
sbufReadU16(src); // midrc
|
||||
rxConfigMutable()->mincheck = sbufReadU16(src);
|
||||
#ifdef USE_SPEKTRUM_BIND
|
||||
rxConfigMutable()->spektrum_sat_bind = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
rxConfigMutable()->rx_min_usec = sbufReadU16(src);
|
||||
rxConfigMutable()->rx_max_usec = sbufReadU16(src);
|
||||
sbufReadU8(src); // for compatibility with betaflight (rcInterpolation)
|
||||
sbufReadU8(src); // for compatibility with betaflight (rcInterpolationInterval)
|
||||
sbufReadU16(src); // for compatibility with betaflight (airModeActivateThreshold)
|
||||
#ifdef USE_RX_SPI
|
||||
rxConfigMutable()->rx_spi_protocol = sbufReadU8(src);
|
||||
rxConfigMutable()->rx_spi_id = sbufReadU32(src);
|
||||
rxConfigMutable()->rx_spi_rf_channel_count = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
sbufReadU32(src);
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
sbufReadU8(src); // for compatibility with betaflight (fpvCamAngleDegrees)
|
||||
rxConfigMutable()->receiverType = sbufReadU8(src); // Won't be modified if buffer is not large enough
|
||||
} else
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
#include "fc/rc_modes.h"
|
||||
|
||||
#define BOX_PERMANENT_ID_USER1 47
|
||||
#define BOX_PERMANENT_ID_USER2 48
|
||||
#define BOX_PERMANENT_ID_NONE 255 // A permanent ID for no box mode
|
||||
#include "io/piniobox.h"
|
||||
|
||||
typedef struct box_s {
|
||||
const uint8_t boxId; // see boxId_e
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "fc/rc_curves.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/pid.h"
|
||||
#include "flight/failsafe.h"
|
||||
|
@ -73,22 +74,22 @@ FASTRAM int16_t rcCommand[4]; // interval [1000;2000] for THROTTLE and
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig, PG_RC_CONTROLS_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(rcControlsConfig_t, rcControlsConfig,
|
||||
.deadband = 5,
|
||||
.yaw_deadband = 5,
|
||||
.pos_hold_deadband = 10,
|
||||
.alt_hold_deadband = 50,
|
||||
.mid_throttle_deadband = 50,
|
||||
.airmodeHandlingType = STICK_CENTER,
|
||||
.airmodeThrottleThreshold = AIRMODE_THROTTLE_THRESHOLD,
|
||||
.deadband = SETTING_DEADBAND_DEFAULT,
|
||||
.yaw_deadband = SETTING_YAW_DEADBAND_DEFAULT,
|
||||
.pos_hold_deadband = SETTING_POS_HOLD_DEADBAND_DEFAULT,
|
||||
.alt_hold_deadband = SETTING_ALT_HOLD_DEADBAND_DEFAULT,
|
||||
.mid_throttle_deadband = SETTING_3D_DEADBAND_THROTTLE_DEFAULT,
|
||||
.airmodeHandlingType = SETTING_AIRMODE_TYPE_DEFAULT,
|
||||
.airmodeThrottleThreshold = SETTING_AIRMODE_THROTTLE_THRESHOLD_DEFAULT,
|
||||
);
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(armingConfig_t, armingConfig, PG_ARMING_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(armingConfig_t, armingConfig,
|
||||
.fixed_wing_auto_arm = 0,
|
||||
.disarm_kill_switch = 1,
|
||||
.switchDisarmDelayMs = DEFAULT_RC_SWITCH_DISARM_DELAY_MS,
|
||||
.prearmTimeoutMs = DEFAULT_PREARM_TIMEOUT,
|
||||
.fixed_wing_auto_arm = SETTING_FIXED_WING_AUTO_ARM_DEFAULT,
|
||||
.disarm_kill_switch = SETTING_DISARM_KILL_SWITCH_DEFAULT,
|
||||
.switchDisarmDelayMs = SETTING_SWITCH_DISARM_DELAY_DEFAULT,
|
||||
.prearmTimeoutMs = SETTING_PREARM_TIMEOUT_DEFAULT,
|
||||
);
|
||||
|
||||
bool areSticksInApModePosition(uint16_t ap_mode)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "fc/config.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
|
||||
|
@ -56,6 +57,10 @@ boxBitmask_t rcModeActivationMask; // one bit per mode defined in boxId_e
|
|||
PG_REGISTER_ARRAY(modeActivationCondition_t, MAX_MODE_ACTIVATION_CONDITION_COUNT, modeActivationConditions, PG_MODE_ACTIVATION_PROFILE, 0);
|
||||
PG_REGISTER(modeActivationOperatorConfig_t, modeActivationOperatorConfig, PG_MODE_ACTIVATION_OPERATOR_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(modeActivationOperatorConfig_t, modeActivationOperatorConfig,
|
||||
.modeActivationOperator = SETTING_MODE_RANGE_LOGIC_OPERATOR_DEFAULT
|
||||
);
|
||||
|
||||
static void processAirmodeAirplane(void) {
|
||||
if (feature(FEATURE_AIRMODE) || IS_RC_MODE_ACTIVE(BOXAIRMODE)) {
|
||||
ENABLE_STATE(AIRMODE_ACTIVE);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@
|
|||
|
||||
#ifdef USE_STATS
|
||||
|
||||
#include "fc/settings.h"
|
||||
#include "fc/stats.h"
|
||||
|
||||
#include "sensors/battery.h"
|
||||
|
@ -20,11 +21,11 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(statsConfig_t, statsConfig, PG_STATS_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(statsConfig_t, statsConfig,
|
||||
.stats_enabled = 0,
|
||||
.stats_total_time = 0,
|
||||
.stats_total_dist = 0,
|
||||
.stats_enabled = SETTING_STATS_DEFAULT,
|
||||
.stats_total_time = SETTING_STATS_TOTAL_TIME_DEFAULT,
|
||||
.stats_total_dist = SETTING_STATS_TOTAL_DIST_DEFAULT,
|
||||
#ifdef USE_ADC
|
||||
.stats_total_energy = 0
|
||||
.stats_total_energy = SETTING_STATS_TOTAL_ENERGY_DEFAULT
|
||||
#endif
|
||||
);
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
#include "flight/mixer.h"
|
||||
|
@ -67,19 +68,19 @@ static failsafeState_t failsafeState;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig, PG_FAILSAFE_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(failsafeConfig_t, failsafeConfig,
|
||||
.failsafe_delay = 5, // 0.5 sec
|
||||
.failsafe_recovery_delay = 5, // 0.5 seconds (plus 200ms explicit delay)
|
||||
.failsafe_off_delay = 200, // 20sec
|
||||
.failsafe_throttle = 1000, // default throttle off.
|
||||
.failsafe_throttle_low_delay = 0, // default throttle low delay for "just disarm" on failsafe condition
|
||||
.failsafe_procedure = FAILSAFE_PROCEDURE_AUTO_LANDING, // default full failsafe procedure
|
||||
.failsafe_fw_roll_angle = -200, // 20 deg left
|
||||
.failsafe_fw_pitch_angle = 100, // 10 deg dive (yes, positive means dive)
|
||||
.failsafe_fw_yaw_rate = -45, // 45 deg/s left yaw (left is negative, 8s for full turn)
|
||||
.failsafe_stick_motion_threshold = 50,
|
||||
.failsafe_min_distance = 0, // No minimum distance for failsafe by default
|
||||
.failsafe_min_distance_procedure = FAILSAFE_PROCEDURE_DROP_IT, // default minimum distance failsafe procedure
|
||||
.failsafe_mission = true, // Enable failsafe in WP mode or not
|
||||
.failsafe_delay = SETTING_FAILSAFE_DELAY_DEFAULT, // 0.5 sec
|
||||
.failsafe_recovery_delay = SETTING_FAILSAFE_RECOVERY_DELAY_DEFAULT, // 0.5 seconds (plus 200ms explicit delay)
|
||||
.failsafe_off_delay = SETTING_FAILSAFE_OFF_DELAY_DEFAULT, // 20sec
|
||||
.failsafe_throttle = SETTING_FAILSAFE_THROTTLE_DEFAULT, // default throttle off.
|
||||
.failsafe_throttle_low_delay = SETTING_FAILSAFE_THROTTLE_LOW_DELAY_DEFAULT, // default throttle low delay for "just disarm" on failsafe condition
|
||||
.failsafe_procedure = SETTING_FAILSAFE_PROCEDURE_DEFAULT, // default full failsafe procedure
|
||||
.failsafe_fw_roll_angle = SETTING_FAILSAFE_FW_ROLL_ANGLE_DEFAULT, // 20 deg left
|
||||
.failsafe_fw_pitch_angle = SETTING_FAILSAFE_FW_PITCH_ANGLE_DEFAULT, // 10 deg dive (yes, positive means dive)
|
||||
.failsafe_fw_yaw_rate = SETTING_FAILSAFE_FW_YAW_RATE_DEFAULT, // 45 deg/s left yaw (left is negative, 8s for full turn)
|
||||
.failsafe_stick_motion_threshold = SETTING_FAILSAFE_STICK_THRESHOLD_DEFAULT,
|
||||
.failsafe_min_distance = SETTING_FAILSAFE_MIN_DISTANCE_DEFAULT, // No minimum distance for failsafe by default
|
||||
.failsafe_min_distance_procedure = SETTING_FAILSAFE_MIN_DISTANCE_PROCEDURE_DEFAULT, // default minimum distance failsafe procedure
|
||||
.failsafe_mission = SETTING_FAILSAFE_MISSION_DEFAULT, // Enable failsafe in WP mode or not
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -45,6 +45,7 @@ FILE_COMPILE_FOR_SPEED
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/hil.h"
|
||||
#include "flight/imu.h"
|
||||
|
@ -99,13 +100,13 @@ STATIC_FASTRAM bool gpsHeadingInitialized;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(imuConfig_t, imuConfig, PG_IMU_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(imuConfig_t, imuConfig,
|
||||
.dcm_kp_acc = 2500, // 0.25 * 10000
|
||||
.dcm_ki_acc = 50, // 0.005 * 10000
|
||||
.dcm_kp_mag = 10000, // 1.00 * 10000
|
||||
.dcm_ki_mag = 0, // 0.00 * 10000
|
||||
.small_angle = 25,
|
||||
.acc_ignore_rate = 0,
|
||||
.acc_ignore_slope = 0
|
||||
.dcm_kp_acc = SETTING_IMU_DCM_KP_DEFAULT, // 0.25 * 10000
|
||||
.dcm_ki_acc = SETTING_IMU_DCM_KI_DEFAULT, // 0.005 * 10000
|
||||
.dcm_kp_mag = SETTING_IMU_DCM_KP_MAG_DEFAULT, // 1.00 * 10000
|
||||
.dcm_ki_mag = SETTING_IMU_DCM_KI_MAG_DEFAULT, // 0.00 * 10000
|
||||
.small_angle = SETTING_SMALL_ANGLE_DEFAULT,
|
||||
.acc_ignore_rate = SETTING_IMU_ACC_IGNORE_RATE_DEFAULT,
|
||||
.acc_ignore_slope = SETTING_IMU_ACC_IGNORE_SLOPE_DEFAULT
|
||||
);
|
||||
|
||||
STATIC_UNIT_TESTED void imuComputeRotationMatrix(void)
|
||||
|
@ -156,8 +157,13 @@ void imuInit(void)
|
|||
gpsHeadingInitialized = false;
|
||||
|
||||
// Create magnetic declination matrix
|
||||
#ifdef USE_MAG
|
||||
const int deg = compassConfig()->mag_declination / 100;
|
||||
const int min = compassConfig()->mag_declination % 100;
|
||||
#else
|
||||
const int deg = 0;
|
||||
const int min = 0;
|
||||
#endif
|
||||
imuSetMagneticDeclination(deg + min / 60.0f);
|
||||
|
||||
quaternionInitUnit(&orientation);
|
||||
|
|
|
@ -43,6 +43,7 @@ FILE_COMPILE_FOR_SPEED
|
|||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
#include "flight/imu.h"
|
||||
|
@ -75,19 +76,19 @@ static EXTENDED_FASTRAM int8_t motorYawMultiplier = 1;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(reversibleMotorsConfig_t, reversibleMotorsConfig, PG_REVERSIBLE_MOTORS_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(reversibleMotorsConfig_t, reversibleMotorsConfig,
|
||||
.deadband_low = 1406,
|
||||
.deadband_high = 1514,
|
||||
.neutral = 1460
|
||||
.deadband_low = SETTING_3D_DEADBAND_LOW_DEFAULT,
|
||||
.deadband_high = SETTING_3D_DEADBAND_HIGH_DEFAULT,
|
||||
.neutral = SETTING_3D_NEUTRAL_DEFAULT
|
||||
);
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(mixerConfig_t, mixerConfig, PG_MIXER_CONFIG, 3);
|
||||
|
||||
PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig,
|
||||
.motorDirectionInverted = 0,
|
||||
.platformType = PLATFORM_MULTIROTOR,
|
||||
.hasFlaps = false,
|
||||
.appliedMixerPreset = -1, //This flag is not available in CLI and used by Configurator only
|
||||
.fwMinThrottleDownPitchAngle = 0
|
||||
.motorDirectionInverted = SETTING_MOTOR_DIRECTION_INVERTED_DEFAULT,
|
||||
.platformType = SETTING_PLATFORM_TYPE_DEFAULT,
|
||||
.hasFlaps = SETTING_HAS_FLAPS_DEFAULT,
|
||||
.appliedMixerPreset = SETTING_MODEL_PREVIEW_TYPE_DEFAULT, //This flag is not available in CLI and used by Configurator only
|
||||
.fwMinThrottleDownPitchAngle = SETTING_FW_MIN_THROTTLE_DOWN_PITCH_DEFAULT
|
||||
);
|
||||
|
||||
#ifdef BRUSHED_MOTORS
|
||||
|
@ -103,16 +104,18 @@ PG_RESET_TEMPLATE(mixerConfig_t, mixerConfig,
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(motorConfig_t, motorConfig, PG_MOTOR_CONFIG, 7);
|
||||
|
||||
PG_RESET_TEMPLATE(motorConfig_t, motorConfig,
|
||||
.motorPwmProtocol = DEFAULT_PWM_PROTOCOL,
|
||||
.motorPwmRate = DEFAULT_PWM_RATE,
|
||||
.maxthrottle = DEFAULT_MAX_THROTTLE,
|
||||
.mincommand = 1000,
|
||||
.motorAccelTimeMs = 0,
|
||||
.motorDecelTimeMs = 0,
|
||||
.throttleIdle = 15.0f,
|
||||
.throttleScale = 1.0f,
|
||||
.motorPoleCount = 14, // Most brushless motors that we use are 14 poles
|
||||
.flipOverAfterPowerFactor = 65
|
||||
.motorPwmProtocol = SETTING_MOTOR_PWM_PROTOCOL_DEFAULT,
|
||||
.motorPwmRate = SETTING_MOTOR_PWM_RATE_DEFAULT,
|
||||
.maxthrottle = SETTING_MAX_THROTTLE_DEFAULT,
|
||||
.mincommand = SETTING_MIN_COMMAND_DEFAULT,
|
||||
.motorAccelTimeMs = SETTING_MOTOR_ACCEL_TIME_DEFAULT,
|
||||
.motorDecelTimeMs = SETTING_MOTOR_DECEL_TIME_DEFAULT,
|
||||
.throttleIdle = SETTING_THROTTLE_IDLE_DEFAULT,
|
||||
.throttleScale = SETTING_THROTTLE_SCALE_DEFAULT,
|
||||
.motorPoleCount = SETTING_MOTOR_POLES_DEFAULT, // Most brushless motors that we use are 14 poles
|
||||
#ifdef USE_DSHOT
|
||||
.flipOverAfterPowerFactor = SETTING_FLIP_OVER_AFTER_CRASH_POWER_FACTOR_DEFAULT,
|
||||
#endif
|
||||
);
|
||||
|
||||
PG_REGISTER_ARRAY(motorMixer_t, MAX_SUPPORTED_MOTORS, primaryMotorMixer, PG_MOTOR_MIXER, 0);
|
||||
|
|
|
@ -40,6 +40,7 @@ FILE_COMPILE_FOR_SPEED
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/pid.h"
|
||||
#include "flight/imu.h"
|
||||
|
@ -163,38 +164,38 @@ PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE
|
|||
PG_RESET_TEMPLATE(pidProfile_t, pidProfile,
|
||||
.bank_mc = {
|
||||
.pid = {
|
||||
[PID_ROLL] = { 40, 30, 23, 60 },
|
||||
[PID_PITCH] = { 40, 30, 23, 60 },
|
||||
[PID_YAW] = { 85, 45, 0, 60 },
|
||||
[PID_ROLL] = { SETTING_MC_P_ROLL_DEFAULT, SETTING_MC_I_ROLL_DEFAULT, SETTING_MC_D_ROLL_DEFAULT, SETTING_MC_CD_ROLL_DEFAULT },
|
||||
[PID_PITCH] = { SETTING_MC_P_PITCH_DEFAULT, SETTING_MC_I_PITCH_DEFAULT, SETTING_MC_D_PITCH_DEFAULT, SETTING_MC_CD_PITCH_DEFAULT },
|
||||
[PID_YAW] = { SETTING_MC_P_YAW_DEFAULT, SETTING_MC_I_YAW_DEFAULT, SETTING_MC_D_YAW_DEFAULT, SETTING_MC_CD_YAW_DEFAULT },
|
||||
[PID_LEVEL] = {
|
||||
.P = 20, // Self-level strength
|
||||
.I = 15, // Self-leveing low-pass frequency (0 - disabled)
|
||||
.D = 75, // 75% horizon strength
|
||||
.P = SETTING_MC_P_LEVEL_DEFAULT, // Self-level strength
|
||||
.I = SETTING_MC_I_LEVEL_DEFAULT, // Self-leveing low-pass frequency (0 - disabled)
|
||||
.D = SETTING_MC_D_LEVEL_DEFAULT, // 75% horizon strength
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_HEADING] = { 60, 0, 0, 0 },
|
||||
[PID_HEADING] = { SETTING_NAV_MC_HEADING_P_DEFAULT, 0, 0, 0 },
|
||||
[PID_POS_XY] = {
|
||||
.P = 65, // NAV_POS_XY_P * 100
|
||||
.P = SETTING_NAV_MC_POS_XY_P_DEFAULT, // NAV_POS_XY_P * 100
|
||||
.I = 0,
|
||||
.D = 0,
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_VEL_XY] = {
|
||||
.P = 40, // NAV_VEL_XY_P * 20
|
||||
.I = 15, // NAV_VEL_XY_I * 100
|
||||
.D = 100, // NAV_VEL_XY_D * 100
|
||||
.FF = 40, // NAV_VEL_XY_D * 100
|
||||
.P = SETTING_NAV_MC_VEL_XY_P_DEFAULT, // NAV_VEL_XY_P * 20
|
||||
.I = SETTING_NAV_MC_VEL_XY_I_DEFAULT, // NAV_VEL_XY_I * 100
|
||||
.D = SETTING_NAV_MC_VEL_XY_D_DEFAULT, // NAV_VEL_XY_D * 100
|
||||
.FF = SETTING_NAV_MC_VEL_XY_FF_DEFAULT, // NAV_VEL_XY_D * 100
|
||||
},
|
||||
[PID_POS_Z] = {
|
||||
.P = 50, // NAV_POS_Z_P * 100
|
||||
.P = SETTING_NAV_MC_POS_Z_P_DEFAULT, // NAV_POS_Z_P * 100
|
||||
.I = 0, // not used
|
||||
.D = 0, // not used
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_VEL_Z] = {
|
||||
.P = 100, // NAV_VEL_Z_P * 66.7
|
||||
.I = 50, // NAV_VEL_Z_I * 20
|
||||
.D = 10, // NAV_VEL_Z_D * 100
|
||||
.P = SETTING_NAV_MC_VEL_Z_P_DEFAULT, // NAV_VEL_Z_P * 66.7
|
||||
.I = SETTING_NAV_MC_VEL_Z_I_DEFAULT, // NAV_VEL_Z_I * 20
|
||||
.D = SETTING_NAV_MC_VEL_Z_D_DEFAULT, // NAV_VEL_Z_D * 100
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_POS_HEADING] = {
|
||||
|
@ -208,83 +209,94 @@ PG_RESET_TEMPLATE(pidProfile_t, pidProfile,
|
|||
|
||||
.bank_fw = {
|
||||
.pid = {
|
||||
[PID_ROLL] = { 5, 7, 0, 50 },
|
||||
[PID_PITCH] = { 5, 7, 0, 50 },
|
||||
[PID_YAW] = { 6, 10, 0, 60 },
|
||||
[PID_ROLL] = { SETTING_FW_P_ROLL_DEFAULT, SETTING_FW_I_ROLL_DEFAULT, 0, SETTING_FW_FF_ROLL_DEFAULT },
|
||||
[PID_PITCH] = { SETTING_FW_P_PITCH_DEFAULT, SETTING_FW_I_PITCH_DEFAULT, 0, SETTING_FW_FF_PITCH_DEFAULT },
|
||||
[PID_YAW] = { SETTING_FW_P_YAW_DEFAULT, SETTING_FW_I_YAW_DEFAULT, 0, SETTING_FW_FF_YAW_DEFAULT },
|
||||
[PID_LEVEL] = {
|
||||
.P = 20, // Self-level strength
|
||||
.I = 5, // Self-leveing low-pass frequency (0 - disabled)
|
||||
.D = 75, // 75% horizon strength
|
||||
.P = SETTING_FW_P_LEVEL_DEFAULT, // Self-level strength
|
||||
.I = SETTING_FW_I_LEVEL_DEFAULT, // Self-leveing low-pass frequency (0 - disabled)
|
||||
.D = SETTING_FW_D_LEVEL_DEFAULT, // 75% horizon strength
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_HEADING] = { 60, 0, 0, 0 },
|
||||
[PID_HEADING] = { SETTING_NAV_FW_HEADING_P_DEFAULT, 0, 0, 0 },
|
||||
[PID_POS_Z] = {
|
||||
.P = 40, // FW_POS_Z_P * 10
|
||||
.I = 5, // FW_POS_Z_I * 10
|
||||
.D = 10, // FW_POS_Z_D * 10
|
||||
.P = SETTING_NAV_FW_POS_Z_P_DEFAULT, // FW_POS_Z_P * 10
|
||||
.I = SETTING_NAV_FW_POS_Z_I_DEFAULT, // FW_POS_Z_I * 10
|
||||
.D = SETTING_NAV_FW_POS_Z_D_DEFAULT, // FW_POS_Z_D * 10
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_POS_XY] = {
|
||||
.P = 75, // FW_POS_XY_P * 100
|
||||
.I = 5, // FW_POS_XY_I * 100
|
||||
.D = 8, // FW_POS_XY_D * 100
|
||||
.P = SETTING_NAV_FW_POS_XY_P_DEFAULT, // FW_POS_XY_P * 100
|
||||
.I = SETTING_NAV_FW_POS_XY_I_DEFAULT, // FW_POS_XY_I * 100
|
||||
.D = SETTING_NAV_FW_POS_XY_D_DEFAULT, // FW_POS_XY_D * 100
|
||||
.FF = 0,
|
||||
},
|
||||
[PID_POS_HEADING] = {
|
||||
.P = 30,
|
||||
.I = 2,
|
||||
.D = 0,
|
||||
.P = SETTING_NAV_FW_POS_HDG_P_DEFAULT,
|
||||
.I = SETTING_NAV_FW_POS_HDG_I_DEFAULT,
|
||||
.D = SETTING_NAV_FW_POS_HDG_D_DEFAULT,
|
||||
.FF = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
.dterm_lpf_type = 1, //Default to BIQUAD
|
||||
.dterm_lpf_hz = 40,
|
||||
.dterm_lpf2_type = 1, //Default to BIQUAD
|
||||
.dterm_lpf2_hz = 0, // Off by default
|
||||
.yaw_lpf_hz = 0,
|
||||
.dterm_lpf_type = SETTING_DTERM_LPF_TYPE_DEFAULT,
|
||||
.dterm_lpf_hz = SETTING_DTERM_LPF_HZ_DEFAULT,
|
||||
.dterm_lpf2_type = SETTING_DTERM_LPF2_TYPE_DEFAULT,
|
||||
.dterm_lpf2_hz = SETTING_DTERM_LPF2_HZ_DEFAULT,
|
||||
.yaw_lpf_hz = SETTING_YAW_LPF_HZ_DEFAULT,
|
||||
|
||||
.itermWindupPointPercent = 50, // Percent
|
||||
.itermWindupPointPercent = SETTING_ITERM_WINDUP_DEFAULT,
|
||||
|
||||
.axisAccelerationLimitYaw = 10000, // dps/s
|
||||
.axisAccelerationLimitRollPitch = 0, // dps/s
|
||||
.axisAccelerationLimitYaw = SETTING_RATE_ACCEL_LIMIT_YAW_DEFAULT,
|
||||
.axisAccelerationLimitRollPitch = SETTING_RATE_ACCEL_LIMIT_ROLL_PITCH_DEFAULT,
|
||||
|
||||
.heading_hold_rate_limit = HEADING_HOLD_RATE_LIMIT_DEFAULT,
|
||||
.heading_hold_rate_limit = SETTING_HEADING_HOLD_RATE_LIMIT_DEFAULT,
|
||||
|
||||
.max_angle_inclination[FD_ROLL] = 300, // 30 degrees
|
||||
.max_angle_inclination[FD_PITCH] = 300, // 30 degrees
|
||||
.pidSumLimit = PID_SUM_LIMIT_DEFAULT,
|
||||
.pidSumLimitYaw = PID_SUM_LIMIT_YAW_DEFAULT,
|
||||
.max_angle_inclination[FD_ROLL] = SETTING_MAX_ANGLE_INCLINATION_RLL_DEFAULT,
|
||||
.max_angle_inclination[FD_PITCH] = SETTING_MAX_ANGLE_INCLINATION_PIT_DEFAULT,
|
||||
.pidSumLimit = SETTING_PIDSUM_LIMIT_DEFAULT,
|
||||
.pidSumLimitYaw = SETTING_PIDSUM_LIMIT_YAW_DEFAULT,
|
||||
|
||||
.fixedWingItermThrowLimit = FW_ITERM_THROW_LIMIT_DEFAULT,
|
||||
.fixedWingReferenceAirspeed = 1000,
|
||||
.fixedWingCoordinatedYawGain = 1.0f,
|
||||
.fixedWingCoordinatedPitchGain = 1.0f,
|
||||
.fixedWingItermLimitOnStickPosition = 0.5f,
|
||||
.fixedWingYawItermBankFreeze = 0,
|
||||
.fixedWingItermThrowLimit = SETTING_FW_ITERM_THROW_LIMIT_DEFAULT,
|
||||
.fixedWingReferenceAirspeed = SETTING_FW_REFERENCE_AIRSPEED_DEFAULT,
|
||||
.fixedWingCoordinatedYawGain = SETTING_FW_TURN_ASSIST_YAW_GAIN_DEFAULT,
|
||||
.fixedWingCoordinatedPitchGain = SETTING_FW_TURN_ASSIST_PITCH_GAIN_DEFAULT,
|
||||
.fixedWingItermLimitOnStickPosition = SETTING_FW_ITERM_LIMIT_STICK_POSITION_DEFAULT,
|
||||
.fixedWingYawItermBankFreeze = SETTING_FW_YAW_ITERM_FREEZE_BANK_ANGLE_DEFAULT,
|
||||
|
||||
.loiter_direction = NAV_LOITER_RIGHT,
|
||||
.navVelXyDTermLpfHz = NAV_ACCEL_CUTOFF_FREQUENCY_HZ,
|
||||
.navVelXyDtermAttenuation = 90,
|
||||
.navVelXyDtermAttenuationStart = 10,
|
||||
.navVelXyDtermAttenuationEnd = 60,
|
||||
.iterm_relax_cutoff = MC_ITERM_RELAX_CUTOFF_DEFAULT,
|
||||
.iterm_relax = ITERM_RELAX_RP,
|
||||
.dBoostFactor = 1.25f,
|
||||
.dBoostMaxAtAlleceleration = 7500.0f,
|
||||
.dBoostGyroDeltaLpfHz = D_BOOST_GYRO_LPF_HZ,
|
||||
.antigravityGain = 1.0f,
|
||||
.antigravityAccelerator = 1.0f,
|
||||
.antigravityCutoff = ANTI_GRAVITY_THROTTLE_FILTER_CUTOFF,
|
||||
.pidControllerType = PID_TYPE_AUTO,
|
||||
.navFwPosHdgPidsumLimit = PID_SUM_LIMIT_YAW_DEFAULT,
|
||||
.controlDerivativeLpfHz = 30,
|
||||
.kalman_q = 100,
|
||||
.kalman_w = 4,
|
||||
.kalman_sharpness = 100,
|
||||
.kalmanEnabled = 0,
|
||||
.fixedWingLevelTrim = 0,
|
||||
.loiter_direction = SETTING_FW_LOITER_DIRECTION_DEFAULT,
|
||||
.navVelXyDTermLpfHz = SETTING_NAV_MC_VEL_XY_DTERM_LPF_HZ_DEFAULT,
|
||||
.navVelXyDtermAttenuation = SETTING_NAV_MC_VEL_XY_DTERM_ATTENUATION_DEFAULT,
|
||||
.navVelXyDtermAttenuationStart = SETTING_NAV_MC_VEL_XY_DTERM_ATTENUATION_START_DEFAULT,
|
||||
.navVelXyDtermAttenuationEnd = SETTING_NAV_MC_VEL_XY_DTERM_ATTENUATION_END_DEFAULT,
|
||||
.iterm_relax_cutoff = SETTING_MC_ITERM_RELAX_CUTOFF_DEFAULT,
|
||||
.iterm_relax = SETTING_MC_ITERM_RELAX_DEFAULT,
|
||||
|
||||
#ifdef USE_D_BOOST
|
||||
.dBoostFactor = SETTING_D_BOOST_FACTOR_DEFAULT,
|
||||
.dBoostMaxAtAlleceleration = SETTING_D_BOOST_MAX_AT_ACCELERATION_DEFAULT,
|
||||
.dBoostGyroDeltaLpfHz = SETTING_D_BOOST_GYRO_DELTA_LPF_HZ_DEFAULT,
|
||||
#endif
|
||||
|
||||
#ifdef USE_ANTIGRAVITY
|
||||
.antigravityGain = SETTING_ANTIGRAVITY_GAIN_DEFAULT,
|
||||
.antigravityAccelerator = SETTING_ANTIGRAVITY_ACCELERATOR_DEFAULT,
|
||||
.antigravityCutoff = SETTING_ANTIGRAVITY_CUTOFF_LPF_HZ_DEFAULT,
|
||||
#endif
|
||||
|
||||
.pidControllerType = SETTING_PID_TYPE_DEFAULT,
|
||||
.navFwPosHdgPidsumLimit = SETTING_NAV_FW_POS_HDG_PIDSUM_LIMIT_DEFAULT,
|
||||
.controlDerivativeLpfHz = SETTING_MC_CD_LPF_HZ_DEFAULT,
|
||||
|
||||
#ifdef USE_GYRO_KALMAN
|
||||
.kalman_q = SETTING_SETPOINT_KALMAN_Q_DEFAULT,
|
||||
.kalman_w = SETTING_SETPOINT_KALMAN_W_DEFAULT,
|
||||
.kalman_sharpness = SETTING_SETPOINT_KALMAN_SHARPNESS_DEFAULT,
|
||||
.kalmanEnabled = SETTING_SETPOINT_KALMAN_ENABLED_DEFAULT,
|
||||
#endif
|
||||
|
||||
.fixedWingLevelTrim = SETTING_FW_LEVEL_PITCH_TRIM_DEFAULT,
|
||||
);
|
||||
|
||||
bool pidInitFilters(void)
|
||||
|
|
|
@ -138,19 +138,27 @@ typedef struct pidProfile_s {
|
|||
uint8_t iterm_relax_cutoff; // This cutoff frequency specifies a low pass filter which predicts average response of the quad to setpoint
|
||||
uint8_t iterm_relax; // Enable iterm suppression during stick input
|
||||
|
||||
#ifdef USE_D_BOOST
|
||||
float dBoostFactor;
|
||||
float dBoostMaxAtAlleceleration;
|
||||
uint8_t dBoostGyroDeltaLpfHz;
|
||||
#endif
|
||||
|
||||
#ifdef USE_ANTIGRAVITY
|
||||
float antigravityGain;
|
||||
float antigravityAccelerator;
|
||||
uint8_t antigravityCutoff;
|
||||
#endif
|
||||
|
||||
uint16_t navFwPosHdgPidsumLimit;
|
||||
uint8_t controlDerivativeLpfHz;
|
||||
|
||||
#ifdef USE_GYRO_KALMAN
|
||||
uint16_t kalman_q;
|
||||
uint16_t kalman_w;
|
||||
uint16_t kalman_sharpness;
|
||||
uint8_t kalmanEnabled;
|
||||
#endif
|
||||
|
||||
float fixedWingLevelTrim;
|
||||
} pidProfile_t;
|
||||
|
|
|
@ -40,11 +40,10 @@
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_adjustments.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/pid.h"
|
||||
|
||||
#define AUTOTUNE_FIXED_WING_OVERSHOOT_TIME 100
|
||||
#define AUTOTUNE_FIXED_WING_UNDERSHOOT_TIME 200
|
||||
#define AUTOTUNE_FIXED_WING_INTEGRATOR_TC 600
|
||||
#define AUTOTUNE_FIXED_WING_DECREASE_STEP 8 // 8%
|
||||
#define AUTOTUNE_FIXED_WING_INCREASE_STEP 5 // 5%
|
||||
|
@ -54,11 +53,11 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(pidAutotuneConfig_t, pidAutotuneConfig, PG_PID_AUTOTUNE_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(pidAutotuneConfig_t, pidAutotuneConfig,
|
||||
.fw_overshoot_time = AUTOTUNE_FIXED_WING_OVERSHOOT_TIME,
|
||||
.fw_undershoot_time = AUTOTUNE_FIXED_WING_UNDERSHOOT_TIME,
|
||||
.fw_max_rate_threshold = 50,
|
||||
.fw_ff_to_p_gain = 10,
|
||||
.fw_ff_to_i_time_constant = AUTOTUNE_FIXED_WING_INTEGRATOR_TC,
|
||||
.fw_overshoot_time = SETTING_FW_AUTOTUNE_OVERSHOOT_TIME_DEFAULT,
|
||||
.fw_undershoot_time = SETTING_FW_AUTOTUNE_UNDERSHOOT_TIME_DEFAULT,
|
||||
.fw_max_rate_threshold = SETTING_FW_AUTOTUNE_THRESHOLD_DEFAULT,
|
||||
.fw_ff_to_p_gain = SETTING_FW_AUTOTUNE_FF_TO_P_GAIN_DEFAULT,
|
||||
.fw_ff_to_i_time_constant = SETTING_FW_AUTOTUNE_FF_TO_I_TC_DEFAULT,
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "flight/mixer.h"
|
||||
#include "sensors/esc_sensor.h"
|
||||
#include "fc/config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#ifdef USE_RPM_FILTER
|
||||
|
||||
|
@ -48,10 +49,10 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(rpmFilterConfig_t, rpmFilterConfig, PG_RPM_FILTER_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(rpmFilterConfig_t, rpmFilterConfig,
|
||||
.gyro_filter_enabled = 0,
|
||||
.gyro_harmonics = 1,
|
||||
.gyro_min_hz = 100,
|
||||
.gyro_q = 500, );
|
||||
.gyro_filter_enabled = SETTING_RPM_GYRO_FILTER_ENABLED_DEFAULT,
|
||||
.gyro_harmonics = SETTING_RPM_GYRO_HARMONICS_DEFAULT,
|
||||
.gyro_min_hz = SETTING_RPM_GYRO_MIN_HZ_DEFAULT,
|
||||
.gyro_q = SETTING_RPM_GYRO_Q_DEFAULT, );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -21,19 +21,26 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
#include "stdint.h"
|
||||
#include "common/utils.h"
|
||||
#include "common/axis.h"
|
||||
#include "flight/secondary_imu.h"
|
||||
#include "config/parameter_group_ids.h"
|
||||
#include "sensors/boardalignment.h"
|
||||
#include "sensors/compass.h"
|
||||
|
||||
#include "build/debug.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
#include "common/axis.h"
|
||||
|
||||
#include "config/parameter_group_ids.h"
|
||||
|
||||
#include "drivers/sensor.h"
|
||||
#include "drivers/accgyro/accgyro_bno055.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/secondary_imu.h"
|
||||
|
||||
#include "sensors/boardalignment.h"
|
||||
#include "sensors/compass.h"
|
||||
|
||||
PG_REGISTER_WITH_RESET_FN(secondaryImuConfig_t, secondaryImuConfig, PG_SECONDARY_IMU, 1);
|
||||
|
||||
EXTENDED_FASTRAM secondaryImuState_t secondaryImuState;
|
||||
|
@ -62,8 +69,13 @@ void secondaryImuInit(void)
|
|||
{
|
||||
secondaryImuState.active = false;
|
||||
// Create magnetic declination matrix
|
||||
#ifdef USE_MAG
|
||||
const int deg = compassConfig()->mag_declination / 100;
|
||||
const int min = compassConfig()->mag_declination % 100;
|
||||
#else
|
||||
const int deg = 0;
|
||||
const int min = 0;
|
||||
#endif
|
||||
|
||||
secondaryImuSetMagneticDeclination(deg + min / 60.0f);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/imu.h"
|
||||
#include "flight/mixer.h"
|
||||
|
@ -57,12 +58,12 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(servoConfig_t, servoConfig, PG_SERVO_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(servoConfig_t, servoConfig,
|
||||
.servoCenterPulse = 1500,
|
||||
.servoPwmRate = 50, // Default for analog servos
|
||||
.servo_lowpass_freq = 20, // Default servo update rate is 50Hz, everything above Nyquist frequency (25Hz) is going to fold and cause distortions
|
||||
.servo_protocol = SERVO_TYPE_PWM,
|
||||
.flaperon_throw_offset = FLAPERON_THROW_DEFAULT,
|
||||
.tri_unarmed_servo = 1
|
||||
.servoCenterPulse = SETTING_SERVO_CENTER_PULSE_DEFAULT,
|
||||
.servoPwmRate = SETTING_SERVO_PWM_RATE_DEFAULT, // Default for analog servos
|
||||
.servo_lowpass_freq = SETTING_SERVO_LPF_HZ_DEFAULT, // Default servo update rate is 50Hz, everything above Nyquist frequency (25Hz) is going to fold and cause distortions
|
||||
.servo_protocol = SETTING_SERVO_PROTOCOL_DEFAULT,
|
||||
.flaperon_throw_offset = SETTING_FLAPERON_THROW_OFFSET_DEFAULT,
|
||||
.tri_unarmed_servo = SETTING_TRI_UNARMED_SERVO_DEFAULT
|
||||
);
|
||||
|
||||
PG_REGISTER_ARRAY_WITH_RESET_FN(servoMixer_t, MAX_SERVO_RULES, customServoMixers, PG_SERVO_MIXER, 1);
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
typedef struct {
|
||||
bool isDriverBased;
|
||||
|
@ -125,13 +126,13 @@ static gpsProviderDescriptor_t gpsProviders[GPS_PROVIDER_COUNT] = {
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(gpsConfig_t, gpsConfig, PG_GPS_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(gpsConfig_t, gpsConfig,
|
||||
.provider = GPS_UBLOX,
|
||||
.sbasMode = SBAS_NONE,
|
||||
.autoConfig = GPS_AUTOCONFIG_ON,
|
||||
.autoBaud = GPS_AUTOBAUD_ON,
|
||||
.dynModel = GPS_DYNMODEL_AIR_1G,
|
||||
.gpsMinSats = 6,
|
||||
.ubloxUseGalileo = false
|
||||
.provider = SETTING_GPS_PROVIDER_DEFAULT,
|
||||
.sbasMode = SETTING_GPS_SBAS_MODE_DEFAULT,
|
||||
.autoConfig = SETTING_GPS_AUTO_CONFIG_DEFAULT,
|
||||
.autoBaud = SETTING_GPS_AUTO_BAUD_DEFAULT,
|
||||
.dynModel = SETTING_GPS_DYN_MODEL_DEFAULT,
|
||||
.gpsMinSats = SETTING_GPS_MIN_SATS_DEFAULT,
|
||||
.ubloxUseGalileo = SETTING_GPS_UBLOX_USE_GALILEO_DEFAULT
|
||||
);
|
||||
|
||||
void gpsSetState(gpsState_e state)
|
||||
|
|
|
@ -31,9 +31,9 @@ PG_REGISTER_WITH_RESET_TEMPLATE(lightsConfig_t, lightsConfig, PG_LIGHTS_CONFIG,
|
|||
|
||||
PG_RESET_TEMPLATE(lightsConfig_t, lightsConfig,
|
||||
.failsafe = {
|
||||
.enabled = true,
|
||||
.flash_period = 1000,
|
||||
.flash_on_time = 100
|
||||
.enabled = SETTING_FAILSAFE_LIGHTS_DEFAULT,
|
||||
.flash_period = SETTING_FAILSAFE_LIGHTS_FLASH_PERIOD_DEFAULT,
|
||||
.flash_on_time = SETTING_FAILSAFE_LIGHTS_FLASH_ON_TIME_DEFAULT
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1615,7 +1615,11 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
timeUs_t currentTimeUs = micros();
|
||||
static int32_t timeSeconds = -1;
|
||||
if (cmpTimeUs(currentTimeUs, updatedTimestamp) >= 1000000) {
|
||||
#ifdef USE_WIND_ESTIMATOR
|
||||
timeSeconds = calculateRemainingFlightTimeBeforeRTH(osdConfig()->estimations_wind_compensation);
|
||||
#else
|
||||
timeSeconds = calculateRemainingFlightTimeBeforeRTH(false);
|
||||
#endif
|
||||
updatedTimestamp = currentTimeUs;
|
||||
}
|
||||
if ((!ARMING_FLAG(ARMED)) || (timeSeconds == -1)) {
|
||||
|
@ -1642,7 +1646,11 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
timeUs_t currentTimeUs = micros();
|
||||
static int32_t distanceMeters = -1;
|
||||
if (cmpTimeUs(currentTimeUs, updatedTimestamp) >= 1000000) {
|
||||
#ifdef USE_WIND_ESTIMATOR
|
||||
distanceMeters = calculateRemainingDistanceBeforeRTH(osdConfig()->estimations_wind_compensation);
|
||||
#else
|
||||
distanceMeters = calculateRemainingDistanceBeforeRTH(false);
|
||||
#endif
|
||||
updatedTimestamp = currentTimeUs;
|
||||
}
|
||||
buff[0] = SYM_TRIP_DIST;
|
||||
|
@ -2659,71 +2667,84 @@ void osdDrawNextElement(void)
|
|||
}
|
||||
|
||||
PG_RESET_TEMPLATE(osdConfig_t, osdConfig,
|
||||
.rssi_alarm = 20,
|
||||
.time_alarm = 10,
|
||||
.alt_alarm = 100,
|
||||
.dist_alarm = 1000,
|
||||
.neg_alt_alarm = 5,
|
||||
.current_alarm = 0,
|
||||
.imu_temp_alarm_min = -200,
|
||||
.imu_temp_alarm_max = 600,
|
||||
.esc_temp_alarm_min = -200,
|
||||
.esc_temp_alarm_max = 900,
|
||||
.gforce_alarm = 5,
|
||||
.gforce_axis_alarm_min = -5,
|
||||
.gforce_axis_alarm_max = 5,
|
||||
.rssi_alarm = SETTING_OSD_RSSI_ALARM_DEFAULT,
|
||||
.time_alarm = SETTING_OSD_TIME_ALARM_DEFAULT,
|
||||
.alt_alarm = SETTING_OSD_ALT_ALARM_DEFAULT,
|
||||
.dist_alarm = SETTING_OSD_DIST_ALARM_DEFAULT,
|
||||
.neg_alt_alarm = SETTING_OSD_NEG_ALT_ALARM_DEFAULT,
|
||||
.current_alarm = SETTING_OSD_CURRENT_ALARM_DEFAULT,
|
||||
.imu_temp_alarm_min = SETTING_OSD_IMU_TEMP_ALARM_MIN_DEFAULT,
|
||||
.imu_temp_alarm_max = SETTING_OSD_IMU_TEMP_ALARM_MAX_DEFAULT,
|
||||
.esc_temp_alarm_min = SETTING_OSD_ESC_TEMP_ALARM_MIN_DEFAULT,
|
||||
.esc_temp_alarm_max = SETTING_OSD_ESC_TEMP_ALARM_MAX_DEFAULT,
|
||||
.gforce_alarm = SETTING_OSD_GFORCE_ALARM_DEFAULT,
|
||||
.gforce_axis_alarm_min = SETTING_OSD_GFORCE_AXIS_ALARM_MIN_DEFAULT,
|
||||
.gforce_axis_alarm_max = SETTING_OSD_GFORCE_AXIS_ALARM_MAX_DEFAULT,
|
||||
#ifdef USE_BARO
|
||||
.baro_temp_alarm_min = -200,
|
||||
.baro_temp_alarm_max = 600,
|
||||
.baro_temp_alarm_min = SETTING_OSD_BARO_TEMP_ALARM_MIN_DEFAULT,
|
||||
.baro_temp_alarm_max = SETTING_OSD_BARO_TEMP_ALARM_MAX_DEFAULT,
|
||||
#endif
|
||||
#ifdef USE_SERIALRX_CRSF
|
||||
.snr_alarm = 4,
|
||||
.crsf_lq_format = OSD_CRSF_LQ_TYPE1,
|
||||
.link_quality_alarm = 70,
|
||||
.snr_alarm = SETTING_OSD_SNR_ALARM_DEFAULT,
|
||||
.crsf_lq_format = SETTING_OSD_CRSF_LQ_FORMAT_DEFAULT,
|
||||
.link_quality_alarm = SETTING_OSD_LINK_QUALITY_ALARM_DEFAULT,
|
||||
#endif
|
||||
#ifdef USE_TEMPERATURE_SENSOR
|
||||
.temp_label_align = OSD_ALIGN_LEFT,
|
||||
.temp_label_align = SETTING_OSD_TEMP_LABEL_ALIGN_DEFAULT,
|
||||
#endif
|
||||
|
||||
.video_system = VIDEO_SYSTEM_AUTO,
|
||||
.video_system = SETTING_OSD_VIDEO_SYSTEM_DEFAULT,
|
||||
.row_shiftdown = SETTING_OSD_ROW_SHIFTDOWN_DEFAULT,
|
||||
|
||||
.ahi_reverse_roll = 0,
|
||||
.ahi_max_pitch = AH_MAX_PITCH_DEFAULT,
|
||||
.crosshairs_style = OSD_CROSSHAIRS_STYLE_DEFAULT,
|
||||
.horizon_offset = 0,
|
||||
.camera_uptilt = 0,
|
||||
.camera_fov_h = 135,
|
||||
.camera_fov_v = 85,
|
||||
.hud_margin_h = 3,
|
||||
.hud_margin_v = 3,
|
||||
.hud_homing = 0,
|
||||
.hud_homepoint = 0,
|
||||
.hud_radar_disp = 0,
|
||||
.hud_radar_range_min = 3,
|
||||
.hud_radar_range_max = 4000,
|
||||
.hud_radar_nearest = 0,
|
||||
.hud_wp_disp = 0,
|
||||
.left_sidebar_scroll = OSD_SIDEBAR_SCROLL_NONE,
|
||||
.right_sidebar_scroll = OSD_SIDEBAR_SCROLL_NONE,
|
||||
.sidebar_scroll_arrows = 0,
|
||||
.osd_home_position_arm_screen = true,
|
||||
.pan_servo_index = 0,
|
||||
.pan_servo_pwm2centideg = 0,
|
||||
.ahi_reverse_roll = SETTING_OSD_AHI_REVERSE_ROLL_DEFAULT,
|
||||
.ahi_max_pitch = SETTING_OSD_AHI_MAX_PITCH_DEFAULT,
|
||||
.crosshairs_style = SETTING_OSD_CROSSHAIRS_STYLE_DEFAULT,
|
||||
.horizon_offset = SETTING_OSD_HORIZON_OFFSET_DEFAULT,
|
||||
.camera_uptilt = SETTING_OSD_CAMERA_UPTILT_DEFAULT,
|
||||
.camera_fov_h = SETTING_OSD_CAMERA_FOV_H_DEFAULT,
|
||||
.camera_fov_v = SETTING_OSD_CAMERA_FOV_V_DEFAULT,
|
||||
.hud_margin_h = SETTING_OSD_HUD_MARGIN_H_DEFAULT,
|
||||
.hud_margin_v = SETTING_OSD_HUD_MARGIN_V_DEFAULT,
|
||||
.hud_homing = SETTING_OSD_HUD_HOMING_DEFAULT,
|
||||
.hud_homepoint = SETTING_OSD_HUD_HOMEPOINT_DEFAULT,
|
||||
.hud_radar_disp = SETTING_OSD_HUD_RADAR_DISP_DEFAULT,
|
||||
.hud_radar_range_min = SETTING_OSD_HUD_RADAR_RANGE_MIN_DEFAULT,
|
||||
.hud_radar_range_max = SETTING_OSD_HUD_RADAR_RANGE_MAX_DEFAULT,
|
||||
.hud_radar_nearest = SETTING_OSD_HUD_RADAR_NEAREST_DEFAULT,
|
||||
.hud_wp_disp = SETTING_OSD_HUD_WP_DISP_DEFAULT,
|
||||
.left_sidebar_scroll = SETTING_OSD_LEFT_SIDEBAR_SCROLL_DEFAULT,
|
||||
.right_sidebar_scroll = SETTING_OSD_RIGHT_SIDEBAR_SCROLL_DEFAULT,
|
||||
.sidebar_scroll_arrows = SETTING_OSD_SIDEBAR_SCROLL_ARROWS_DEFAULT,
|
||||
.sidebar_horizontal_offset = SETTING_OSD_SIDEBAR_HORIZONTAL_OFFSET_DEFAULT,
|
||||
.left_sidebar_scroll_step = SETTING_OSD_LEFT_SIDEBAR_SCROLL_STEP_DEFAULT,
|
||||
.right_sidebar_scroll_step = SETTING_OSD_RIGHT_SIDEBAR_SCROLL_STEP_DEFAULT,
|
||||
.osd_home_position_arm_screen = SETTING_OSD_HOME_POSITION_ARM_SCREEN_DEFAULT,
|
||||
.pan_servo_index = SETTING_OSD_PAN_SERVO_INDEX_DEFAULT,
|
||||
.pan_servo_pwm2centideg = SETTING_OSD_PAN_SERVO_PWM2CENTIDEG_DEFAULT,
|
||||
|
||||
.units = OSD_UNIT_METRIC,
|
||||
.main_voltage_decimals = 1,
|
||||
.units = SETTING_OSD_UNITS_DEFAULT,
|
||||
.main_voltage_decimals = SETTING_OSD_MAIN_VOLTAGE_DECIMALS_DEFAULT,
|
||||
|
||||
.estimations_wind_compensation = true,
|
||||
.coordinate_digits = 9,
|
||||
#ifdef USE_WIND_ESTIMATOR
|
||||
.estimations_wind_compensation = SETTING_OSD_ESTIMATIONS_WIND_COMPENSATION_DEFAULT,
|
||||
#endif
|
||||
|
||||
.osd_failsafe_switch_layout = false,
|
||||
.coordinate_digits = SETTING_OSD_COORDINATE_DIGITS_DEFAULT,
|
||||
|
||||
.plus_code_digits = 11,
|
||||
.plus_code_short = 0,
|
||||
.osd_failsafe_switch_layout = SETTING_OSD_FAILSAFE_SWITCH_LAYOUT_DEFAULT,
|
||||
|
||||
.ahi_width = OSD_AHI_WIDTH * OSD_CHAR_WIDTH,
|
||||
.ahi_height = OSD_AHI_HEIGHT * OSD_CHAR_HEIGHT,
|
||||
.ahi_vertical_offset = -OSD_CHAR_HEIGHT,
|
||||
.plus_code_digits = SETTING_OSD_PLUS_CODE_DIGITS_DEFAULT,
|
||||
.plus_code_short = SETTING_OSD_PLUS_CODE_SHORT_DEFAULT,
|
||||
|
||||
.ahi_width = SETTING_OSD_AHI_WIDTH_DEFAULT,
|
||||
.ahi_height = SETTING_OSD_AHI_HEIGHT_DEFAULT,
|
||||
.ahi_vertical_offset = SETTING_OSD_AHI_VERTICAL_OFFSET_DEFAULT,
|
||||
.ahi_bordered = SETTING_OSD_AHI_BORDERED_DEFAULT,
|
||||
.ahi_style = SETTING_OSD_AHI_STYLE_DEFAULT,
|
||||
|
||||
.force_grid = SETTING_OSD_FORCE_GRID_DEFAULT,
|
||||
|
||||
.stats_energy_unit = SETTING_OSD_STATS_ENERGY_UNIT_DEFAULT
|
||||
);
|
||||
|
||||
void pgResetFn_osdLayoutsConfig(osdLayoutsConfig_t *osdLayoutsConfig)
|
||||
|
|
|
@ -333,13 +333,16 @@ typedef struct osdConfig_s {
|
|||
uint8_t units; // from osd_unit_e
|
||||
uint8_t stats_energy_unit; // from osd_stats_energy_unit_e
|
||||
|
||||
#ifdef USE_WIND_ESTIMATOR
|
||||
bool estimations_wind_compensation; // use wind compensation for estimated remaining flight/distance
|
||||
#endif
|
||||
|
||||
uint8_t coordinate_digits;
|
||||
|
||||
bool osd_failsafe_switch_layout;
|
||||
uint8_t plus_code_digits; // Number of digits to use in OSD_PLUS_CODE
|
||||
uint8_t plus_code_short;
|
||||
uint8_t osd_ahi_style;
|
||||
uint8_t ahi_style;
|
||||
uint8_t force_grid; // Force a pixel based OSD to use grid mode.
|
||||
uint8_t ahi_bordered; // Only used by the AHI widget
|
||||
uint8_t ahi_width; // In pixels, only used by the AHI widget
|
||||
|
|
|
@ -354,7 +354,7 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
|
|||
}
|
||||
if (!configured) {
|
||||
widgetAHIStyle_e ahiStyle = 0;
|
||||
switch ((osd_ahi_style_e)osdConfig()->osd_ahi_style) {
|
||||
switch ((osd_ahi_style_e)osdConfig()->ahi_style) {
|
||||
case OSD_AHI_STYLE_DEFAULT:
|
||||
ahiStyle = DISPLAY_WIDGET_AHI_STYLE_STAIRCASE;
|
||||
break;
|
||||
|
@ -381,7 +381,7 @@ static bool osdCanvasDrawArtificialHorizonWidget(displayPort_t *display, display
|
|||
// so that's 135degs each direction. Map that to the configured limit.
|
||||
const float halfRange = 135.0f;
|
||||
const float limit = halfRange / 180.0f * M_PIf;
|
||||
float multiplier = osdConfig()->osd_ahi_style == OSD_AHI_STYLE_DEFAULT ? 1.0f : halfRange / osdConfig()->ahi_max_pitch;
|
||||
float multiplier = osdConfig()->ahi_style == OSD_AHI_STYLE_DEFAULT ? 1.0f : halfRange / osdConfig()->ahi_max_pitch;
|
||||
widgetAHIData_t data = {
|
||||
.pitch = constrainf(pitchAngle * multiplier, -limit, limit),
|
||||
.roll = rollAngle,
|
||||
|
@ -413,7 +413,7 @@ void osdCanvasDrawArtificialHorizon(displayPort_t *display, displayCanvas_t *can
|
|||
if ((now > nextDrawMinMs && totalError > 0.05f)|| now > nextDrawMaxMs) {
|
||||
|
||||
if (!osdCanvasDrawArtificialHorizonWidget(display, canvas, p, pitchAngle, rollAngle)) {
|
||||
switch ((osd_ahi_style_e)osdConfig()->osd_ahi_style) {
|
||||
switch ((osd_ahi_style_e)osdConfig()->ahi_style) {
|
||||
case OSD_AHI_STYLE_DEFAULT:
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
|
|
@ -122,10 +122,10 @@
|
|||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(djiOsdConfig_t, djiOsdConfig, PG_DJI_OSD_CONFIG, 2);
|
||||
PG_RESET_TEMPLATE(djiOsdConfig_t, djiOsdConfig,
|
||||
.use_name_for_messages = true,
|
||||
.esc_temperature_source = DJI_OSD_TEMP_ESC,
|
||||
.proto_workarounds = DJI_OSD_USE_NON_STANDARD_MSP_ESC_SENSOR_DATA,
|
||||
.speedSource = DJI_OSD_SPEED_GROUND,
|
||||
.use_name_for_messages = SETTING_DJI_USE_NAME_FOR_MESSAGES_DEFAULT,
|
||||
.esc_temperature_source = SETTING_DJI_ESC_TEMP_SOURCE_DEFAULT,
|
||||
.proto_workarounds = SETTING_DJI_WORKAROUNDS_DEFAULT,
|
||||
.speedSource = SETTING_DJI_SPEED_SOURCE_DEFAULT,
|
||||
);
|
||||
|
||||
// External dependency on looptime
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "fc/fc_msp.h"
|
||||
#include "fc/fc_msp_box.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/piniobox.h"
|
||||
|
||||
|
@ -40,7 +41,7 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(pinioBoxConfig_t, pinioBoxConfig, PG_PINIOBOX_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(pinioBoxConfig_t, pinioBoxConfig,
|
||||
{ BOX_PERMANENT_ID_NONE, BOX_PERMANENT_ID_NONE, BOX_PERMANENT_ID_NONE, BOX_PERMANENT_ID_NONE }
|
||||
{ SETTING_PINIO_BOX1_DEFAULT, SETTING_PINIO_BOX2_DEFAULT, SETTING_PINIO_BOX3_DEFAULT, SETTING_PINIO_BOX4_DEFAULT }
|
||||
);
|
||||
|
||||
typedef struct pinioBoxRuntimeConfig_s {
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
#include "common/time.h"
|
||||
#include "drivers/pinio.h"
|
||||
|
||||
|
||||
#define BOX_PERMANENT_ID_USER1 47
|
||||
#define BOX_PERMANENT_ID_USER2 48
|
||||
#define BOX_PERMANENT_ID_NONE 255 // A permanent ID for no box mode
|
||||
|
||||
|
||||
typedef struct pinioBoxConfig_s {
|
||||
uint8_t permanentId[PINIO_COUNT];
|
||||
} pinioBoxConfig_t;
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "io/serial.h"
|
||||
|
||||
#include "fc/cli.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "msp/msp_serial.h"
|
||||
|
||||
|
@ -147,7 +148,7 @@ void pgResetFn_serialConfig(serialConfig_t *serialConfig)
|
|||
}
|
||||
#endif
|
||||
|
||||
serialConfig->reboot_character = 'R';
|
||||
serialConfig->reboot_character = SETTING_REBOOT_CHARACTER_DEFAULT;
|
||||
}
|
||||
|
||||
baudRate_e lookupBaudRateIndex(uint32_t baudRate)
|
||||
|
|
|
@ -34,6 +34,8 @@ FILE_COMPILE_FOR_SPEED
|
|||
#include "drivers/serial.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
#include "io/smartport_master.h"
|
||||
|
||||
|
@ -137,8 +139,8 @@ typedef struct {
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(smartportMasterConfig_t, smartportMasterConfig, PG_SMARTPORT_MASTER_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(smartportMasterConfig_t, smartportMasterConfig,
|
||||
.halfDuplex = true,
|
||||
.inverted = false
|
||||
.halfDuplex = SETTING_SMARTPORT_MASTER_HALFDUPLEX_DEFAULT,
|
||||
.inverted = SETTING_SMARTPORT_MASTER_INVERTED_DEFAULT
|
||||
);
|
||||
|
||||
static serialPort_t *smartportMasterSerialPort = NULL;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "fc/config.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
|
||||
|
@ -46,12 +47,12 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(vtxSettingsConfig_t, vtxSettingsConfig, PG_VTX_SETTINGS_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(vtxSettingsConfig_t, vtxSettingsConfig,
|
||||
.band = VTX_SETTINGS_DEFAULT_BAND,
|
||||
.channel = VTX_SETTINGS_DEFAULT_CHANNEL,
|
||||
.power = VTX_SETTINGS_DEFAULT_POWER,
|
||||
.pitModeChan = VTX_SETTINGS_DEFAULT_PITMODE_CHANNEL,
|
||||
.lowPowerDisarm = VTX_LOW_POWER_DISARM_OFF,
|
||||
.maxPowerOverride = 0,
|
||||
.band = SETTING_VTX_BAND_DEFAULT,
|
||||
.channel = SETTING_VTX_CHANNEL_DEFAULT,
|
||||
.power = SETTING_VTX_POWER_DEFAULT,
|
||||
.pitModeChan = SETTING_VTX_PIT_MODE_CHAN_DEFAULT,
|
||||
.lowPowerDisarm = SETTING_VTX_LOW_POWER_DISARM_DEFAULT,
|
||||
.maxPowerOverride = SETTING_VTX_MAX_POWER_OVERRIDE_DEFAULT,
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/osd.h"
|
||||
|
@ -42,8 +43,8 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(vtxConfig_t, vtxConfig, PG_VTX_CONFIG, 3);
|
||||
|
||||
PG_RESET_TEMPLATE(vtxConfig_t, vtxConfig,
|
||||
.halfDuplex = true,
|
||||
.smartAudioEarlyAkkWorkaroundEnable = true,
|
||||
.halfDuplex = SETTING_VTX_HALFDUPLEX_DEFAULT,
|
||||
.smartAudioEarlyAkkWorkaroundEnable = SETTING_VTX_SMARTAUDIO_EARLY_AKK_WORKAROUND_DEFAULT,
|
||||
);
|
||||
|
||||
static uint8_t locked = 0;
|
||||
|
@ -182,4 +183,3 @@ void vtxCyclePower(const uint8_t powerStep)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "drivers/time.h"
|
||||
#include "drivers/vtx_common.h"
|
||||
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
#include "io/vtx.h"
|
||||
#include "io/vtx_control.h"
|
||||
|
@ -129,8 +131,8 @@ saPowerTable_t saPowerTable[VTX_SMARTAUDIO_MAX_POWER_COUNT] = {
|
|||
|
||||
smartAudioDevice_t saDevice = {
|
||||
.version = SA_UNKNOWN,
|
||||
.channel = -1,
|
||||
.power = -1,
|
||||
.channel = SETTING_VTX_CHANNEL_DEFAULT,
|
||||
.power = SETTING_VTX_POWER_DEFAULT,
|
||||
.mode = 0,
|
||||
.freq = 0,
|
||||
.orfreq = 0,
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/imu.h"
|
||||
#include "flight/mixer.h"
|
||||
|
@ -97,92 +98,96 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
|
|||
.general = {
|
||||
|
||||
.flags = {
|
||||
.use_thr_mid_for_althold = 0,
|
||||
.extra_arming_safety = NAV_EXTRA_ARMING_SAFETY_ON,
|
||||
.user_control_mode = NAV_GPS_ATTI,
|
||||
.rth_alt_control_mode = NAV_RTH_AT_LEAST_ALT,
|
||||
.rth_climb_first = 1, // Climb first, turn after reaching safe altitude
|
||||
.rth_climb_ignore_emerg = 0, // Ignore GPS loss on initial climb
|
||||
.rth_tail_first = 0,
|
||||
.disarm_on_landing = 0,
|
||||
.rth_allow_landing = NAV_RTH_ALLOW_LANDING_ALWAYS,
|
||||
.nav_overrides_motor_stop = NOMS_ALL_NAV,
|
||||
.use_thr_mid_for_althold = SETTING_NAV_USE_MIDTHR_FOR_ALTHOLD_DEFAULT,
|
||||
.extra_arming_safety = SETTING_NAV_EXTRA_ARMING_SAFETY_DEFAULT,
|
||||
.user_control_mode = SETTING_NAV_USER_CONTROL_MODE_DEFAULT,
|
||||
.rth_alt_control_mode = SETTING_NAV_RTH_ALT_MODE_DEFAULT,
|
||||
.rth_climb_first = SETTING_NAV_RTH_CLIMB_FIRST_DEFAULT, // Climb first, turn after reaching safe altitude
|
||||
.rth_climb_ignore_emerg = SETTING_NAV_RTH_CLIMB_IGNORE_EMERG_DEFAULT, // Ignore GPS loss on initial climb
|
||||
.rth_tail_first = SETTING_NAV_RTH_TAIL_FIRST_DEFAULT,
|
||||
.disarm_on_landing = SETTING_NAV_DISARM_ON_LANDING_DEFAULT,
|
||||
.rth_allow_landing = SETTING_NAV_RTH_ALLOW_LANDING_DEFAULT,
|
||||
.nav_overrides_motor_stop = SETTING_NAV_OVERRIDES_MOTOR_STOP_DEFAULT,
|
||||
},
|
||||
|
||||
// General navigation parameters
|
||||
.pos_failure_timeout = 5, // 5 sec
|
||||
.waypoint_radius = 100, // 2m diameter
|
||||
.waypoint_safe_distance = 10000, // centimeters - first waypoint should be closer than this
|
||||
.max_auto_speed = 300, // 3 m/s = 10.8 km/h
|
||||
.max_auto_climb_rate = 500, // 5 m/s
|
||||
.max_manual_speed = 500,
|
||||
.max_manual_climb_rate = 200,
|
||||
.land_descent_rate = 200, // centimeters/s
|
||||
.land_slowdown_minalt = 500, // altitude in centimeters
|
||||
.land_slowdown_maxalt = 2000, // altitude in meters
|
||||
.emerg_descent_rate = 500, // centimeters/s
|
||||
.min_rth_distance = 500, // centimeters, if closer than this land immediately
|
||||
.rth_altitude = 1000, // altitude in centimeters
|
||||
.rth_home_altitude = 0, // altitude in centimeters
|
||||
.rth_abort_threshold = 50000, // centimeters - 500m should be safe for all aircraft
|
||||
.max_terrain_follow_altitude = 100, // max altitude in centimeters in terrain following mode
|
||||
.safehome_max_distance = 20000, // Max distance that a safehome is from the arming point
|
||||
.pos_failure_timeout = SETTING_NAV_POSITION_TIMEOUT_DEFAULT, // 5 sec
|
||||
.waypoint_radius = SETTING_NAV_WP_RADIUS_DEFAULT, // 2m diameter
|
||||
.waypoint_safe_distance = SETTING_NAV_WP_SAFE_DISTANCE_DEFAULT, // centimeters - first waypoint should be closer than this
|
||||
.max_auto_speed = SETTING_NAV_AUTO_SPEED_DEFAULT, // 3 m/s = 10.8 km/h
|
||||
.max_auto_climb_rate = SETTING_NAV_AUTO_CLIMB_RATE_DEFAULT, // 5 m/s
|
||||
.max_manual_speed = SETTING_NAV_MANUAL_SPEED_DEFAULT,
|
||||
.max_manual_climb_rate = SETTING_NAV_MANUAL_CLIMB_RATE_DEFAULT,
|
||||
.land_descent_rate = SETTING_NAV_LANDING_SPEED_DEFAULT, // centimeters/s
|
||||
.land_slowdown_minalt = SETTING_NAV_LAND_SLOWDOWN_MINALT_DEFAULT, // altitude in centimeters
|
||||
.land_slowdown_maxalt = SETTING_NAV_LAND_SLOWDOWN_MAXALT_DEFAULT, // altitude in meters
|
||||
.emerg_descent_rate = SETTING_NAV_EMERG_LANDING_SPEED_DEFAULT, // centimeters/s
|
||||
.min_rth_distance = SETTING_NAV_MIN_RTH_DISTANCE_DEFAULT, // centimeters, if closer than this land immediately
|
||||
.rth_altitude = SETTING_NAV_RTH_ALTITUDE_DEFAULT, // altitude in centimeters
|
||||
.rth_home_altitude = SETTING_NAV_RTH_HOME_ALTITUDE_DEFAULT, // altitude in centimeters
|
||||
.rth_abort_threshold = SETTING_NAV_RTH_ABORT_THRESHOLD_DEFAULT, // centimeters - 500m should be safe for all aircraft
|
||||
.max_terrain_follow_altitude = SETTING_NAV_MAX_TERRAIN_FOLLOW_ALT_DEFAULT, // max altitude in centimeters in terrain following mode
|
||||
.safehome_max_distance = SETTING_SAFEHOME_MAX_DISTANCE_DEFAULT, // Max distance that a safehome is from the arming point
|
||||
},
|
||||
|
||||
// MC-specific
|
||||
.mc = {
|
||||
.max_bank_angle = 30, // degrees
|
||||
.hover_throttle = 1500,
|
||||
.auto_disarm_delay = 2000, // milliseconds - time before disarming when auto disarm is enabled and landing is confirmed
|
||||
.braking_speed_threshold = 100, // Braking can become active above 1m/s
|
||||
.braking_disengage_speed = 75, // Stop when speed goes below 0.75m/s
|
||||
.braking_timeout = 2000, // Timeout barking after 2s
|
||||
.braking_boost_factor = 100, // A 100% boost by default
|
||||
.braking_boost_timeout = 750, // Timout boost after 750ms
|
||||
.braking_boost_speed_threshold = 150, // Boost can happen only above 1.5m/s
|
||||
.braking_boost_disengage_speed = 100, // Disable boost at 1m/s
|
||||
.braking_bank_angle = 40, // Max braking angle
|
||||
.posDecelerationTime = 120, // posDecelerationTime * 100
|
||||
.posResponseExpo = 10, // posResponseExpo * 100
|
||||
.slowDownForTurning = true,
|
||||
.max_bank_angle = SETTING_NAV_MC_BANK_ANGLE_DEFAULT, // degrees
|
||||
.hover_throttle = SETTING_NAV_MC_HOVER_THR_DEFAULT,
|
||||
.auto_disarm_delay = SETTING_NAV_MC_AUTO_DISARM_DELAY_DEFAULT, // milliseconds - time before disarming when auto disarm is enabled and landing is confirmed
|
||||
|
||||
#ifdef USE_MR_BRAKING_MODE
|
||||
.braking_speed_threshold = SETTING_NAV_MC_BRAKING_SPEED_THRESHOLD_DEFAULT, // Braking can become active above 1m/s
|
||||
.braking_disengage_speed = SETTING_NAV_MC_BRAKING_DISENGAGE_SPEED_DEFAULT, // Stop when speed goes below 0.75m/s
|
||||
.braking_timeout = SETTING_NAV_MC_BRAKING_TIMEOUT_DEFAULT, // Timeout barking after 2s
|
||||
.braking_boost_factor = SETTING_NAV_MC_BRAKING_BOOST_FACTOR_DEFAULT, // A 100% boost by default
|
||||
.braking_boost_timeout = SETTING_NAV_MC_BRAKING_BOOST_TIMEOUT_DEFAULT, // Timout boost after 750ms
|
||||
.braking_boost_speed_threshold = SETTING_NAV_MC_BRAKING_BOOST_SPEED_THRESHOLD_DEFAULT, // Boost can happen only above 1.5m/s
|
||||
.braking_boost_disengage_speed = SETTING_NAV_MC_BRAKING_BOOST_DISENGAGE_SPEED_DEFAULT, // Disable boost at 1m/s
|
||||
.braking_bank_angle = SETTING_NAV_MC_BRAKING_BANK_ANGLE_DEFAULT, // Max braking angle
|
||||
#endif
|
||||
|
||||
.posDecelerationTime = SETTING_NAV_MC_POS_DECELERATION_TIME_DEFAULT, // posDecelerationTime * 100
|
||||
.posResponseExpo = SETTING_NAV_MC_POS_EXPO_DEFAULT, // posResponseExpo * 100
|
||||
.slowDownForTurning = SETTING_NAV_MC_WP_SLOWDOWN_DEFAULT,
|
||||
},
|
||||
|
||||
// Fixed wing
|
||||
.fw = {
|
||||
.max_bank_angle = 35, // degrees
|
||||
.max_climb_angle = 20, // degrees
|
||||
.max_dive_angle = 15, // degrees
|
||||
.cruise_throttle = 1400,
|
||||
.cruise_speed = 0, // cm/s
|
||||
.control_smoothness = 0,
|
||||
.max_throttle = 1700,
|
||||
.min_throttle = 1200,
|
||||
.pitch_to_throttle = 10, // pwm units per degree of pitch (10pwm units ~ 1% throttle)
|
||||
.pitch_to_throttle_smooth = 6,
|
||||
.pitch_to_throttle_thresh = 50,
|
||||
.loiter_radius = 7500, // 75m
|
||||
.max_bank_angle = SETTING_NAV_FW_BANK_ANGLE_DEFAULT, // degrees
|
||||
.max_climb_angle = SETTING_NAV_FW_CLIMB_ANGLE_DEFAULT, // degrees
|
||||
.max_dive_angle = SETTING_NAV_FW_DIVE_ANGLE_DEFAULT, // degrees
|
||||
.cruise_throttle = SETTING_NAV_FW_CRUISE_THR_DEFAULT,
|
||||
.cruise_speed = SETTING_NAV_FW_CRUISE_SPEED_DEFAULT, // cm/s
|
||||
.control_smoothness = SETTING_NAV_FW_CONTROL_SMOOTHNESS_DEFAULT,
|
||||
.max_throttle = SETTING_NAV_FW_MAX_THR_DEFAULT,
|
||||
.min_throttle = SETTING_NAV_FW_MIN_THR_DEFAULT,
|
||||
.pitch_to_throttle = SETTING_NAV_FW_PITCH2THR_DEFAULT, // pwm units per degree of pitch (10pwm units ~ 1% throttle)
|
||||
.pitch_to_throttle_smooth = SETTING_NAV_FW_PITCH2THR_SMOOTHING_DEFAULT,
|
||||
.pitch_to_throttle_thresh = SETTING_NAV_FW_PITCH2THR_THRESHOLD_DEFAULT,
|
||||
.loiter_radius = SETTING_NAV_FW_LOITER_RADIUS_DEFAULT, // 75m
|
||||
|
||||
//Fixed wing landing
|
||||
.land_dive_angle = 2, // 2 degrees dive by default
|
||||
.land_dive_angle = SETTING_NAV_FW_LAND_DIVE_ANGLE_DEFAULT, // 2 degrees dive by default
|
||||
|
||||
// Fixed wing launch
|
||||
.launch_velocity_thresh = 300, // 3 m/s
|
||||
.launch_accel_thresh = 1.9f * 981, // cm/s/s (1.9*G)
|
||||
.launch_time_thresh = 40, // 40ms
|
||||
.launch_throttle = 1700,
|
||||
.launch_idle_throttle = 1000, // Motor idle or MOTOR_STOP
|
||||
.launch_motor_timer = 500, // ms
|
||||
.launch_motor_spinup_time = 100, // ms, time to gredually increase throttle from idle to launch
|
||||
.launch_end_time = 3000, // ms, time to gradually decrease/increase throttle and decrease pitch angle from launch to the current flight mode
|
||||
.launch_min_time = 0, // ms, min time in launch mode
|
||||
.launch_timeout = 5000, // ms, timeout for launch procedure
|
||||
.launch_max_altitude = 0, // cm, altitude where to consider launch ended
|
||||
.launch_climb_angle = 18, // 18 degrees
|
||||
.launch_max_angle = 45, // 45 deg
|
||||
.cruise_yaw_rate = 20, // 20dps
|
||||
.allow_manual_thr_increase = false,
|
||||
.useFwNavYawControl = 0,
|
||||
.yawControlDeadband = 0,
|
||||
.launch_velocity_thresh = SETTING_NAV_FW_LAUNCH_VELOCITY_DEFAULT, // 3 m/s
|
||||
.launch_accel_thresh = SETTING_NAV_FW_LAUNCH_ACCEL_DEFAULT, // cm/s/s (1.9*G)
|
||||
.launch_time_thresh = SETTING_NAV_FW_LAUNCH_DETECT_TIME_DEFAULT, // 40ms
|
||||
.launch_throttle = SETTING_NAV_FW_LAUNCH_THR_DEFAULT,
|
||||
.launch_idle_throttle = SETTING_NAV_FW_LAUNCH_IDLE_THR_DEFAULT, // Motor idle or MOTOR_STOP
|
||||
.launch_motor_timer = SETTING_NAV_FW_LAUNCH_MOTOR_DELAY_DEFAULT, // ms
|
||||
.launch_motor_spinup_time = SETTING_NAV_FW_LAUNCH_SPINUP_TIME_DEFAULT, // ms, time to gredually increase throttle from idle to launch
|
||||
.launch_end_time = SETTING_NAV_FW_LAUNCH_END_TIME_DEFAULT, // ms, time to gradually decrease/increase throttle and decrease pitch angle from launch to the current flight mode
|
||||
.launch_min_time = SETTING_NAV_FW_LAUNCH_MIN_TIME_DEFAULT, // ms, min time in launch mode
|
||||
.launch_timeout = SETTING_NAV_FW_LAUNCH_TIMEOUT_DEFAULT, // ms, timeout for launch procedure
|
||||
.launch_max_altitude = SETTING_NAV_FW_LAUNCH_MAX_ALTITUDE_DEFAULT, // cm, altitude where to consider launch ended
|
||||
.launch_climb_angle = SETTING_NAV_FW_LAUNCH_CLIMB_ANGLE_DEFAULT, // 18 degrees
|
||||
.launch_max_angle = SETTING_NAV_FW_LAUNCH_MAX_ANGLE_DEFAULT, // 45 deg
|
||||
.cruise_yaw_rate = SETTING_NAV_FW_CRUISE_YAW_RATE_DEFAULT, // 20dps
|
||||
.allow_manual_thr_increase = SETTING_NAV_FW_ALLOW_MANUAL_THR_INCREASE_DEFAULT,
|
||||
.useFwNavYawControl = SETTING_NAV_USE_FW_YAW_CONTROL_DEFAULT,
|
||||
.yawControlDeadband = SETTING_NAV_FW_YAW_DEADBAND_DEFAULT,
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -3432,7 +3437,10 @@ void navigationUsePIDs(void)
|
|||
multicopterPosXyCoefficients.dTermAttenuation = pidProfile()->navVelXyDtermAttenuation / 100.0f;
|
||||
multicopterPosXyCoefficients.dTermAttenuationStart = pidProfile()->navVelXyDtermAttenuationStart / 100.0f;
|
||||
multicopterPosXyCoefficients.dTermAttenuationEnd = pidProfile()->navVelXyDtermAttenuationEnd / 100.0f;
|
||||
|
||||
#ifdef USE_MR_BRAKING_MODE
|
||||
multicopterPosXyCoefficients.breakingBoostFactor = (float) navConfig()->mc.braking_boost_factor / 100.0f;
|
||||
#endif
|
||||
|
||||
// Initialize altitude hold PID-controllers (pos_z, vel_z, acc_z
|
||||
navPidInit(
|
||||
|
|
|
@ -209,6 +209,8 @@ typedef struct navConfig_s {
|
|||
uint8_t max_bank_angle; // multicopter max banking angle (deg)
|
||||
uint16_t hover_throttle; // multicopter hover throttle
|
||||
uint16_t auto_disarm_delay; // multicopter safety delay for landing detector
|
||||
|
||||
#ifdef USE_MR_BRAKING_MODE
|
||||
uint16_t braking_speed_threshold; // above this speed braking routine might kick in
|
||||
uint16_t braking_disengage_speed; // below this speed braking will be disengaged
|
||||
uint16_t braking_timeout; // Timeout for braking mode
|
||||
|
@ -217,6 +219,8 @@ typedef struct navConfig_s {
|
|||
uint16_t braking_boost_speed_threshold; // Above this speed braking boost mode can engage
|
||||
uint16_t braking_boost_disengage_speed; // Below this speed braking boost will disengage
|
||||
uint8_t braking_bank_angle; // Max angle [deg] that MR is allowed duing braking boost phase
|
||||
#endif
|
||||
|
||||
uint8_t posDecelerationTime; // Brake time parameter
|
||||
uint8_t posResponseExpo; // Position controller expo (taret vel expo for MC)
|
||||
bool slowDownForTurning; // Slow down during WP missions when changing heading on next waypoint
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/imu.h"
|
||||
#include "flight/secondary_imu.h"
|
||||
|
@ -59,39 +60,39 @@ PG_REGISTER_WITH_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationCo
|
|||
|
||||
PG_RESET_TEMPLATE(positionEstimationConfig_t, positionEstimationConfig,
|
||||
// Inertial position estimator parameters
|
||||
.automatic_mag_declination = 1,
|
||||
.reset_altitude_type = NAV_RESET_ON_FIRST_ARM,
|
||||
.reset_home_type = NAV_RESET_ON_FIRST_ARM,
|
||||
.gravity_calibration_tolerance = 5, // 5 cm/s/s calibration error accepted (0.5% of gravity)
|
||||
.use_gps_velned = 1, // "Disabled" is mandatory with gps_dyn_model = Pedestrian
|
||||
.use_gps_no_baro = 0, // Use GPS altitude if no baro is available on all aircrafts
|
||||
.allow_dead_reckoning = 0,
|
||||
.automatic_mag_declination = SETTING_INAV_AUTO_MAG_DECL_DEFAULT,
|
||||
.reset_altitude_type = SETTING_INAV_RESET_ALTITUDE_DEFAULT,
|
||||
.reset_home_type = SETTING_INAV_RESET_HOME_DEFAULT,
|
||||
.gravity_calibration_tolerance = SETTING_INAV_GRAVITY_CAL_TOLERANCE_DEFAULT, // 5 cm/s/s calibration error accepted (0.5% of gravity)
|
||||
.use_gps_velned = SETTING_INAV_USE_GPS_VELNED_DEFAULT, // "Disabled" is mandatory with gps_dyn_model = Pedestrian
|
||||
.use_gps_no_baro = SETTING_INAV_USE_GPS_NO_BARO_DEFAULT, // Use GPS altitude if no baro is available on all aircrafts
|
||||
.allow_dead_reckoning = SETTING_INAV_ALLOW_DEAD_RECKONING_DEFAULT,
|
||||
|
||||
.max_surface_altitude = 200,
|
||||
.max_surface_altitude = SETTING_INAV_MAX_SURFACE_ALTITUDE_DEFAULT,
|
||||
|
||||
.w_xyz_acc_p = 1.0f,
|
||||
.w_xyz_acc_p = SETTING_INAV_W_XYZ_ACC_P_DEFAULT,
|
||||
|
||||
.w_z_baro_p = 0.35f,
|
||||
.w_z_baro_p = SETTING_INAV_W_Z_BARO_P_DEFAULT,
|
||||
|
||||
.w_z_surface_p = 3.500f,
|
||||
.w_z_surface_v = 6.100f,
|
||||
.w_z_surface_p = SETTING_INAV_W_Z_SURFACE_P_DEFAULT,
|
||||
.w_z_surface_v = SETTING_INAV_W_Z_SURFACE_V_DEFAULT,
|
||||
|
||||
.w_z_gps_p = 0.2f,
|
||||
.w_z_gps_v = 0.1f,
|
||||
.w_z_gps_p = SETTING_INAV_W_Z_GPS_P_DEFAULT,
|
||||
.w_z_gps_v = SETTING_INAV_W_Z_GPS_V_DEFAULT,
|
||||
|
||||
.w_xy_gps_p = 1.0f,
|
||||
.w_xy_gps_v = 2.0f,
|
||||
.w_xy_gps_p = SETTING_INAV_W_XY_GPS_P_DEFAULT,
|
||||
.w_xy_gps_v = SETTING_INAV_W_XY_GPS_V_DEFAULT,
|
||||
|
||||
.w_xy_flow_p = 1.0f,
|
||||
.w_xy_flow_v = 2.0f,
|
||||
.w_xy_flow_p = SETTING_INAV_W_XY_FLOW_P_DEFAULT,
|
||||
.w_xy_flow_v = SETTING_INAV_W_XY_FLOW_V_DEFAULT,
|
||||
|
||||
.w_z_res_v = 0.5f,
|
||||
.w_xy_res_v = 0.5f,
|
||||
.w_z_res_v = SETTING_INAV_W_Z_RES_V_DEFAULT,
|
||||
.w_xy_res_v = SETTING_INAV_W_XY_RES_V_DEFAULT,
|
||||
|
||||
.w_acc_bias = 0.01f,
|
||||
.w_acc_bias = SETTING_INAV_W_ACC_BIAS_DEFAULT,
|
||||
|
||||
.max_eph_epv = 1000.0f,
|
||||
.baro_epv = 100.0f
|
||||
.max_eph_epv = SETTING_INAV_MAX_EPH_EPV_DEFAULT,
|
||||
.baro_epv = SETTING_INAV_BARO_EPV_DEFAULT
|
||||
);
|
||||
|
||||
#define resetTimer(tim, currentTimeUs) { (tim)->deltaTime = 0; (tim)->lastTriggeredTime = currentTimeUs; }
|
||||
|
|
|
@ -72,12 +72,12 @@
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(eleresConfig_t, eleresConfig, PG_ELERES_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(eleresConfig_t, eleresConfig,
|
||||
.eleresFreq = 435,
|
||||
.eleresTelemetryEn = 0,
|
||||
.eleresTelemetryPower = 7,
|
||||
.eleresLocEn = 0,
|
||||
.eleresLocPower = 7,
|
||||
.eleresLocDelay = 240
|
||||
.eleresFreq = SETTING_ELERES_FREQ_DEFAULT,
|
||||
.eleresTelemetryEn = SETTING_ELERES_TELEMETRY_EN_DEFAULT,
|
||||
.eleresTelemetryPower = SETTING_ELERES_TELEMETRY_POWER_DEFAULT,
|
||||
.eleresLocEn = SETTING_ELERES_LOC_EN_DEFAULT,
|
||||
.eleresLocPower = SETTING_ELERES_LOC_POWER_DEFAULT,
|
||||
.eleresLocDelay = SETTING_ELERES_LOC_DELAY_DEFAULT
|
||||
);
|
||||
|
||||
static uint8_t hoppingChannel = 1;
|
||||
|
@ -784,8 +784,6 @@ void eleresInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig)
|
|||
channelHopping(1);
|
||||
rfMode = RECEIVE;
|
||||
localizerTime = millis() + (1000L * eleresConfig()->eleresLocDelay);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t eleresBind(void)
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "fc/config.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/failsafe.h"
|
||||
|
||||
|
@ -125,26 +126,32 @@ PG_REGISTER_WITH_RESET_TEMPLATE(rxConfig_t, rxConfig, PG_RX_CONFIG, 9);
|
|||
PG_RESET_TEMPLATE(rxConfig_t, rxConfig,
|
||||
.receiverType = DEFAULT_RX_TYPE,
|
||||
.rcmap = {0, 1, 3, 2}, // Default to AETR map
|
||||
.halfDuplex = TRISTATE_AUTO,
|
||||
.halfDuplex = SETTING_SERIALRX_HALFDUPLEX_DEFAULT,
|
||||
.serialrx_provider = SERIALRX_PROVIDER,
|
||||
#ifdef USE_RX_SPI
|
||||
.rx_spi_protocol = RX_SPI_DEFAULT_PROTOCOL,
|
||||
.spektrum_sat_bind = 0,
|
||||
.serialrx_inverted = 0,
|
||||
.mincheck = 1100,
|
||||
.maxcheck = 1900,
|
||||
.rx_min_usec = RX_MIN_USEX, // any of first 4 channels below this value will trigger rx loss detection
|
||||
.rx_max_usec = 2115, // any of first 4 channels above this value will trigger rx loss detection
|
||||
.rssi_channel = 0,
|
||||
.rssiMin = RSSI_VISIBLE_VALUE_MIN,
|
||||
.rssiMax = RSSI_VISIBLE_VALUE_MAX,
|
||||
.sbusSyncInterval = SBUS_DEFAULT_INTERFRAME_DELAY_US,
|
||||
.rcFilterFrequency = 50,
|
||||
#if defined(USE_RX_MSP) && defined(USE_MSP_RC_OVERRIDE)
|
||||
.mspOverrideChannels = 15,
|
||||
#endif
|
||||
.rssi_source = RSSI_SOURCE_AUTO,
|
||||
.srxl2_unit_id = 1,
|
||||
.srxl2_baud_fast = 1,
|
||||
#ifdef USE_SPEKTRUM_BIND
|
||||
.spektrum_sat_bind = SETTING_SPEKTRUM_SAT_BIND_DEFAULT,
|
||||
#endif
|
||||
.serialrx_inverted = SETTING_SERIALRX_INVERTED_DEFAULT,
|
||||
.mincheck = SETTING_MIN_CHECK_DEFAULT,
|
||||
.maxcheck = SETTING_MAX_CHECK_DEFAULT,
|
||||
.rx_min_usec = SETTING_RX_MIN_USEC_DEFAULT, // any of first 4 channels below this value will trigger rx loss detection
|
||||
.rx_max_usec = SETTING_RX_MAX_USEC_DEFAULT, // any of first 4 channels above this value will trigger rx loss detection
|
||||
.rssi_channel = SETTING_RSSI_CHANNEL_DEFAULT,
|
||||
.rssiMin = SETTING_RSSI_MIN_DEFAULT,
|
||||
.rssiMax = SETTING_RSSI_MAX_DEFAULT,
|
||||
.sbusSyncInterval = SETTING_SBUS_SYNC_INTERVAL_DEFAULT,
|
||||
.rcFilterFrequency = SETTING_RC_FILTER_FREQUENCY_DEFAULT,
|
||||
#if defined(USE_RX_MSP) && defined(USE_MSP_RC_OVERRIDE)
|
||||
.mspOverrideChannels = SETTING_MSP_OVERRIDE_CHANNELS_DEFAULT,
|
||||
#endif
|
||||
.rssi_source = SETTING_RSSI_SOURCE_DEFAULT,
|
||||
#ifdef USE_SERIALRX_SRXL2
|
||||
.srxl2_unit_id = SETTING_SRXL2_UNIT_ID_DEFAULT,
|
||||
.srxl2_baud_fast = SETTING_SRXL2_BAUD_FAST_DEFAULT,
|
||||
#endif
|
||||
);
|
||||
|
||||
void resetAllRxChannelRangeConfigurations(void)
|
||||
|
|
|
@ -114,11 +114,15 @@ typedef struct rxConfig_s {
|
|||
uint8_t serialrx_provider; // Type of UART-based receiver (rxSerialReceiverType_e enum). Only used if receiverType is RX_TYPE_SERIAL
|
||||
uint8_t serialrx_inverted; // Flip the default inversion of the protocol - e.g. sbus (Futaba, FrSKY) is inverted if this is false, uninverted if it's true. Support for uninverted OpenLRS (and modified FrSKY) receivers.
|
||||
uint8_t halfDuplex; // allow rx to operate in half duplex mode. From tristate_e.
|
||||
#ifdef USE_RX_SPI
|
||||
uint8_t rx_spi_protocol; // type of SPI receiver protocol (rx_spi_protocol_e enum). Only used if receiverType is RX_TYPE_SPI
|
||||
uint32_t rx_spi_id;
|
||||
uint8_t rx_spi_rf_channel_count;
|
||||
#endif
|
||||
#ifdef USE_SPEKTRUM_BIND
|
||||
uint8_t spektrum_sat_bind; // number of bind pulses for Spektrum satellite receivers
|
||||
uint8_t spektrum_sat_bind_autoreset; // whenever we will reset (exit) binding mode after hard reboot
|
||||
#endif
|
||||
uint8_t rssi_channel;
|
||||
uint8_t rssiMin; // minimum RSSI sent by the RX - [RSSI_VISIBLE_VALUE_MIN, RSSI_VISIBLE_VALUE_MAX]
|
||||
uint8_t rssiMax; // maximum RSSI sent by the RX - [RSSI_VISIBLE_VALUE_MIN, RSSI_VISIBLE_VALUE_MAX]
|
||||
|
@ -130,8 +134,10 @@ typedef struct rxConfig_s {
|
|||
uint8_t rcFilterFrequency; // RC filter cutoff frequency (smoothness vs response sharpness)
|
||||
uint16_t mspOverrideChannels; // Channels to override with MSP RC when BOXMSPRCOVERRIDE is active
|
||||
uint8_t rssi_source;
|
||||
#ifdef USE_SERIALRX_SRXL2
|
||||
uint8_t srxl2_unit_id;
|
||||
uint8_t srxl2_baud_fast;
|
||||
#endif
|
||||
} rxConfig_t;
|
||||
|
||||
PG_DECLARE(rxConfig_t, rxConfig);
|
||||
|
|
|
@ -58,6 +58,7 @@ FILE_COMPILE_FOR_SPEED
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
|
||||
|
@ -93,22 +94,22 @@ PG_REGISTER_WITH_RESET_FN(accelerometerConfig_t, accelerometerConfig, PG_ACCELER
|
|||
void pgResetFn_accelerometerConfig(accelerometerConfig_t *instance)
|
||||
{
|
||||
RESET_CONFIG_2(accelerometerConfig_t, instance,
|
||||
.acc_align = ALIGN_DEFAULT,
|
||||
.acc_hardware = ACC_AUTODETECT,
|
||||
.acc_lpf_hz = 15,
|
||||
.acc_notch_hz = 0,
|
||||
.acc_notch_cutoff = 1,
|
||||
.acc_soft_lpf_type = FILTER_BIQUAD
|
||||
.acc_align = SETTING_ALIGN_ACC_DEFAULT,
|
||||
.acc_hardware = SETTING_ACC_HARDWARE_DEFAULT,
|
||||
.acc_lpf_hz = SETTING_ACC_LPF_HZ_DEFAULT,
|
||||
.acc_notch_hz = SETTING_ACC_NOTCH_HZ_DEFAULT,
|
||||
.acc_notch_cutoff = SETTING_ACC_NOTCH_CUTOFF_DEFAULT,
|
||||
.acc_soft_lpf_type = SETTING_ACC_LPF_TYPE_DEFAULT
|
||||
);
|
||||
RESET_CONFIG_2(flightDynamicsTrims_t, &instance->accZero,
|
||||
.raw[X] = 0,
|
||||
.raw[Y] = 0,
|
||||
.raw[Z] = 0
|
||||
.raw[X] = SETTING_ACCZERO_X_DEFAULT,
|
||||
.raw[Y] = SETTING_ACCZERO_Y_DEFAULT,
|
||||
.raw[Z] = SETTING_ACCZERO_Z_DEFAULT
|
||||
);
|
||||
RESET_CONFIG_2(flightDynamicsTrims_t, &instance->accGain,
|
||||
.raw[X] = 4096,
|
||||
.raw[Y] = 4096,
|
||||
.raw[Z] = 4096
|
||||
.raw[X] = SETTING_ACCGAIN_X_DEFAULT,
|
||||
.raw[Y] = SETTING_ACCGAIN_Y_DEFAULT,
|
||||
.raw[Z] = SETTING_ACCGAIN_Z_DEFAULT
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "drivers/time.h"
|
||||
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "sensors/barometer.h"
|
||||
#include "sensors/sensors.h"
|
||||
|
@ -56,21 +57,16 @@
|
|||
|
||||
baro_t baro; // barometer access functions
|
||||
|
||||
#ifdef USE_BARO
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(barometerConfig_t, barometerConfig, PG_BAROMETER_CONFIG, 3);
|
||||
|
||||
#ifdef USE_BARO
|
||||
#define BARO_HARDWARE_DEFAULT BARO_AUTODETECT
|
||||
#else
|
||||
#define BARO_HARDWARE_DEFAULT BARO_NONE
|
||||
#endif
|
||||
PG_RESET_TEMPLATE(barometerConfig_t, barometerConfig,
|
||||
.baro_hardware = BARO_HARDWARE_DEFAULT,
|
||||
.use_median_filtering = 1,
|
||||
.baro_calibration_tolerance = 150
|
||||
.baro_hardware = SETTING_BARO_HARDWARE_DEFAULT,
|
||||
.use_median_filtering = SETTING_BARO_MEDIAN_FILTER_DEFAULT,
|
||||
.baro_calibration_tolerance = SETTING_BARO_CAL_TOLERANCE_DEFAULT
|
||||
);
|
||||
|
||||
#ifdef USE_BARO
|
||||
|
||||
static zeroCalibrationScalar_t zeroCalibration;
|
||||
static float baroGroundAltitude = 0;
|
||||
static float baroGroundPressure = 101325.0f; // 101325 pascal, 1 standard atmosphere
|
||||
|
|
|
@ -37,14 +37,6 @@ typedef enum {
|
|||
BARO_MAX = BARO_FAKE
|
||||
} baroSensor_e;
|
||||
|
||||
typedef struct barometerConfig_s {
|
||||
uint8_t baro_hardware; // Barometer hardware to use
|
||||
uint8_t use_median_filtering; // Use 3-point median filtering
|
||||
uint16_t baro_calibration_tolerance; // Baro calibration tolerance (cm at sea level)
|
||||
} barometerConfig_t;
|
||||
|
||||
PG_DECLARE(barometerConfig_t, barometerConfig);
|
||||
|
||||
typedef struct baro_s {
|
||||
baroDev_t dev;
|
||||
int32_t BaroAlt;
|
||||
|
@ -54,6 +46,17 @@ typedef struct baro_s {
|
|||
|
||||
extern baro_t baro;
|
||||
|
||||
#ifdef USE_BARO
|
||||
|
||||
typedef struct barometerConfig_s {
|
||||
uint8_t baro_hardware; // Barometer hardware to use
|
||||
uint8_t use_median_filtering; // Use 3-point median filtering
|
||||
uint16_t baro_calibration_tolerance; // Baro calibration tolerance (cm at sea level)
|
||||
} barometerConfig_t;
|
||||
|
||||
PG_DECLARE(barometerConfig_t, barometerConfig);
|
||||
|
||||
|
||||
bool baroInit(void);
|
||||
bool baroIsCalibrationComplete(void);
|
||||
void baroStartCalibration(void);
|
||||
|
@ -62,3 +65,5 @@ int32_t baroCalculateAltitude(void);
|
|||
int32_t baroGetLatestAltitude(void);
|
||||
int16_t baroGetTemperature(void);
|
||||
bool baroIsHealthy(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "fc/fc_core.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/stats.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "flight/imu.h"
|
||||
#include "flight/mixer.h"
|
||||
|
@ -97,20 +98,22 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance)
|
|||
{
|
||||
for (int i = 0; i < MAX_BATTERY_PROFILE_COUNT; i++) {
|
||||
RESET_CONFIG(batteryProfile_t, &instance[i],
|
||||
.cells = 0,
|
||||
#ifdef USE_ADC
|
||||
.cells = SETTING_BAT_CELLS_DEFAULT,
|
||||
|
||||
.voltage = {
|
||||
.cellDetect = 425,
|
||||
.cellMax = 420,
|
||||
.cellMin = 330,
|
||||
.cellWarning = 350
|
||||
.cellDetect = SETTING_VBAT_CELL_DETECT_VOLTAGE_DEFAULT,
|
||||
.cellMax = SETTING_VBAT_MAX_CELL_VOLTAGE_DEFAULT,
|
||||
.cellMin = SETTING_VBAT_MIN_CELL_VOLTAGE_DEFAULT,
|
||||
.cellWarning = SETTING_VBAT_WARNING_CELL_VOLTAGE_DEFAULT
|
||||
},
|
||||
#endif
|
||||
|
||||
.capacity = {
|
||||
.value = 0,
|
||||
.warning = 0,
|
||||
.critical = 0,
|
||||
.unit = BAT_CAPACITY_UNIT_MAH,
|
||||
.value = SETTING_BATTERY_CAPACITY_DEFAULT,
|
||||
.warning = SETTING_BATTERY_CAPACITY_WARNING_DEFAULT,
|
||||
.critical = SETTING_BATTERY_CAPACITY_CRITICAL_DEFAULT,
|
||||
.unit = SETTING_BATTERY_CAPACITY_UNIT_DEFAULT,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -120,24 +123,26 @@ PG_REGISTER_WITH_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig, PG_B
|
|||
|
||||
PG_RESET_TEMPLATE(batteryMetersConfig_t, batteryMetersConfig,
|
||||
|
||||
#ifdef USE_ADC
|
||||
.voltage = {
|
||||
.type = VOLTAGE_SENSOR_ADC,
|
||||
.type = SETTING_VBAT_METER_TYPE_DEFAULT,
|
||||
.scale = VBAT_SCALE_DEFAULT,
|
||||
},
|
||||
#endif
|
||||
|
||||
.current = {
|
||||
.type = CURRENT_SENSOR_ADC,
|
||||
.type = SETTING_CURRENT_METER_TYPE_DEFAULT,
|
||||
.scale = CURRENT_METER_SCALE,
|
||||
.offset = CURRENT_METER_OFFSET
|
||||
},
|
||||
|
||||
.voltageSource = BAT_VOLTAGE_RAW,
|
||||
.voltageSource = SETTING_BAT_VOLTAGE_SRC_DEFAULT,
|
||||
|
||||
.cruise_power = 0,
|
||||
.idle_power = 0,
|
||||
.rth_energy_margin = 5,
|
||||
.cruise_power = SETTING_CRUISE_POWER_DEFAULT,
|
||||
.idle_power = SETTING_IDLE_POWER_DEFAULT,
|
||||
.rth_energy_margin = SETTING_RTH_ENERGY_MARGIN_DEFAULT,
|
||||
|
||||
.throttle_compensation_weight = 1.0f
|
||||
.throttle_compensation_weight = SETTING_THR_COMP_WEIGHT_DEFAULT
|
||||
|
||||
);
|
||||
|
||||
|
@ -150,6 +155,7 @@ void batteryInit(void)
|
|||
batteryCriticalVoltage = 0;
|
||||
}
|
||||
|
||||
#ifdef USE_ADC
|
||||
// profileDetect() profile sorting compare function
|
||||
static int profile_compare(profile_comp_t *a, profile_comp_t *b) {
|
||||
if (a->max_voltage < b->max_voltage)
|
||||
|
@ -182,6 +188,7 @@ static int8_t profileDetect(void) {
|
|||
// No matching profile found
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void setBatteryProfile(uint8_t profileIndex)
|
||||
{
|
||||
|
@ -202,6 +209,7 @@ void activateBatteryProfile(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_ADC
|
||||
static void updateBatteryVoltage(timeUs_t timeDelta, bool justConnected)
|
||||
{
|
||||
static pt1Filter_t vbatFilterState;
|
||||
|
@ -342,6 +350,7 @@ void batteryUpdate(timeUs_t timeDelta)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
batteryState_e getBatteryState(void)
|
||||
{
|
||||
|
|
|
@ -69,10 +69,12 @@ typedef enum {
|
|||
|
||||
typedef struct batteryMetersConfig_s {
|
||||
|
||||
#ifdef USE_ADC
|
||||
struct {
|
||||
uint16_t scale;
|
||||
voltageSensor_e type;
|
||||
} voltage;
|
||||
#endif
|
||||
|
||||
struct {
|
||||
int16_t scale; // scale the current sensor output voltage to milliamps. Value in 1/10th mV/A
|
||||
|
@ -92,6 +94,7 @@ typedef struct batteryMetersConfig_s {
|
|||
|
||||
typedef struct batteryProfile_s {
|
||||
|
||||
#ifdef USE_ADC
|
||||
uint8_t cells;
|
||||
|
||||
struct {
|
||||
|
@ -100,6 +103,7 @@ typedef struct batteryProfile_s {
|
|||
uint16_t cellMin; // minimum voltage per cell, this triggers battery critical alarm, in 0.01V units, default is 330 (3.3V)
|
||||
uint16_t cellWarning; // warning voltage per cell, this triggers battery warning alarm, in 0.01V units, default is 350 (3.5V)
|
||||
} voltage;
|
||||
#endif
|
||||
|
||||
struct {
|
||||
uint32_t value; // mAh or mWh (see capacity.unit)
|
||||
|
@ -151,10 +155,13 @@ int32_t getPower(void);
|
|||
int32_t getMAhDrawn(void);
|
||||
int32_t getMWhDrawn(void);
|
||||
|
||||
#ifdef USE_ADC
|
||||
void batteryUpdate(timeUs_t timeDelta);
|
||||
void currentMeterUpdate(timeUs_t timeDelta);
|
||||
void sagCompensatedVBatUpdate(timeUs_t currentTime, timeUs_t timeDelta);
|
||||
void powerMeterUpdate(timeUs_t timeDelta);
|
||||
#endif
|
||||
|
||||
void currentMeterUpdate(timeUs_t timeDelta);
|
||||
|
||||
uint8_t calculateBatteryPercentage(void);
|
||||
float calculateThrottleCompensationFactor(void);
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/gps.h"
|
||||
#include "io/beeper.h"
|
||||
|
@ -59,27 +60,24 @@
|
|||
|
||||
mag_t mag; // mag access functions
|
||||
|
||||
#ifdef USE_MAG
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(compassConfig_t, compassConfig, PG_COMPASS_CONFIG, 4);
|
||||
|
||||
#ifdef USE_MAG
|
||||
#define MAG_HARDWARE_DEFAULT MAG_AUTODETECT
|
||||
#else
|
||||
#define MAG_HARDWARE_DEFAULT MAG_NONE
|
||||
#endif
|
||||
PG_RESET_TEMPLATE(compassConfig_t, compassConfig,
|
||||
.mag_align = ALIGN_DEFAULT,
|
||||
.mag_hardware = MAG_HARDWARE_DEFAULT,
|
||||
.mag_declination = 0,
|
||||
.mag_to_use = 0,
|
||||
.magCalibrationTimeLimit = 30,
|
||||
.rollDeciDegrees = 0,
|
||||
.pitchDeciDegrees = 0,
|
||||
.yawDeciDegrees = 0,
|
||||
.magGain = {1024, 1024, 1024},
|
||||
.mag_align = SETTING_ALIGN_MAG_DEFAULT,
|
||||
.mag_hardware = SETTING_MAG_HARDWARE_DEFAULT,
|
||||
.mag_declination = SETTING_MAG_DECLINATION_DEFAULT,
|
||||
#ifdef USE_DUAL_MAG
|
||||
.mag_to_use = SETTING_MAG_TO_USE_DEFAULT,
|
||||
#endif
|
||||
.magCalibrationTimeLimit = SETTING_MAG_CALIBRATION_TIME_DEFAULT,
|
||||
.rollDeciDegrees = SETTING_ALIGN_MAG_ROLL_DEFAULT,
|
||||
.pitchDeciDegrees = SETTING_ALIGN_MAG_PITCH_DEFAULT,
|
||||
.yawDeciDegrees = SETTING_ALIGN_MAG_YAW_DEFAULT,
|
||||
.magGain = {SETTING_MAGGAIN_X_DEFAULT, SETTING_MAGGAIN_Y_DEFAULT, SETTING_MAGGAIN_Z_DEFAULT},
|
||||
);
|
||||
|
||||
#ifdef USE_MAG
|
||||
|
||||
static uint8_t magUpdatedAtLeastOnce = 0;
|
||||
|
||||
bool compassDetect(magDev_t *dev, magSensor_e magHardwareToUse)
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "sensors/sensors.h"
|
||||
|
||||
|
||||
// Type of magnetometer used/detected
|
||||
typedef enum {
|
||||
MAG_NONE = 0,
|
||||
|
@ -54,6 +53,8 @@ typedef struct mag_s {
|
|||
|
||||
extern mag_t mag;
|
||||
|
||||
#ifdef USE_MAG
|
||||
|
||||
typedef struct compassConfig_s {
|
||||
int16_t mag_declination; // Get your magnetic declination from here : http://magnetic-declination.com/
|
||||
// For example, -6deg 37min, = -637 Japan, format is [sign]dddmm (degreesminutes) default is zero.
|
||||
|
@ -61,7 +62,9 @@ typedef struct compassConfig_s {
|
|||
uint8_t mag_hardware; // Which mag hardware to use on boards with more than one device
|
||||
flightDynamicsTrims_t magZero;
|
||||
int16_t magGain[XYZ_AXIS_COUNT];
|
||||
#ifdef USE_DUAL_MAG
|
||||
uint8_t mag_to_use;
|
||||
#endif
|
||||
uint8_t magCalibrationTimeLimit; // Time for compass calibration (seconds)
|
||||
int16_t rollDeciDegrees; // Alignment for external mag on the roll (X) axis (0.1deg)
|
||||
int16_t pitchDeciDegrees; // Alignment for external mag on the pitch (Y) axis (0.1deg)
|
||||
|
@ -75,3 +78,5 @@ bool compassInit(void);
|
|||
void compassUpdate(timeUs_t currentTimeUs);
|
||||
bool compassIsReady(void);
|
||||
bool compassIsHealthy(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "io/serial.h"
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
|
||||
#if defined(USE_ESC_SENSOR)
|
||||
|
@ -80,7 +81,7 @@ static bool escSensorDataNeedsUpdate;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(escSensorConfig_t, escSensorConfig, PG_ESC_SENSOR_CONFIG, 1);
|
||||
PG_RESET_TEMPLATE(escSensorConfig_t, escSensorConfig,
|
||||
.currentOffset = 0, // UNUSED
|
||||
.listenOnly = 0,
|
||||
.listenOnly = SETTING_ESC_SENSOR_LISTEN_ONLY_DEFAULT,
|
||||
);
|
||||
|
||||
static int getTelemetryMotorCount(void)
|
||||
|
|
|
@ -61,6 +61,7 @@ FILE_COMPILE_FOR_SPEED
|
|||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/rc_controls.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/statusindicator.h"
|
||||
|
@ -106,26 +107,30 @@ EXTENDED_FASTRAM dynamicGyroNotchState_t dynamicGyroNotchState;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(gyroConfig_t, gyroConfig, PG_GYRO_CONFIG, 11);
|
||||
|
||||
PG_RESET_TEMPLATE(gyroConfig_t, gyroConfig,
|
||||
.gyro_lpf = GYRO_LPF_256HZ,
|
||||
.gyro_soft_lpf_hz = 60,
|
||||
.gyro_soft_lpf_type = FILTER_BIQUAD,
|
||||
.gyro_align = ALIGN_DEFAULT,
|
||||
.gyroMovementCalibrationThreshold = 32,
|
||||
.looptime = 1000,
|
||||
.gyroSync = 1,
|
||||
.gyro_to_use = 0,
|
||||
.gyro_notch_hz = 0,
|
||||
.gyro_notch_cutoff = 1,
|
||||
.gyro_stage2_lowpass_hz = 0,
|
||||
.gyro_stage2_lowpass_type = FILTER_BIQUAD,
|
||||
.useDynamicLpf = 0,
|
||||
.gyroDynamicLpfMinHz = 200,
|
||||
.gyroDynamicLpfMaxHz = 500,
|
||||
.gyroDynamicLpfCurveExpo = 5,
|
||||
.dynamicGyroNotchRange = DYN_NOTCH_RANGE_MEDIUM,
|
||||
.dynamicGyroNotchQ = 120,
|
||||
.dynamicGyroNotchMinHz = 150,
|
||||
.dynamicGyroNotchEnabled = 0,
|
||||
.gyro_lpf = SETTING_GYRO_HARDWARE_LPF_DEFAULT,
|
||||
.gyro_soft_lpf_hz = SETTING_GYRO_LPF_HZ_DEFAULT,
|
||||
.gyro_soft_lpf_type = SETTING_GYRO_LPF_TYPE_DEFAULT,
|
||||
.gyro_align = SETTING_ALIGN_GYRO_DEFAULT,
|
||||
.gyroMovementCalibrationThreshold = SETTING_MORON_THRESHOLD_DEFAULT,
|
||||
.looptime = SETTING_LOOPTIME_DEFAULT,
|
||||
.gyroSync = SETTING_GYRO_SYNC_DEFAULT,
|
||||
#ifdef USE_DUAL_GYRO
|
||||
.gyro_to_use = SETTING_GYRO_TO_USE_DEFAULT,
|
||||
#endif
|
||||
.gyro_notch_hz = SETTING_GYRO_NOTCH_HZ_DEFAULT,
|
||||
.gyro_notch_cutoff = SETTING_GYRO_NOTCH_CUTOFF_DEFAULT,
|
||||
.gyro_stage2_lowpass_hz = SETTING_GYRO_STAGE2_LOWPASS_HZ_DEFAULT,
|
||||
.gyro_stage2_lowpass_type = SETTING_GYRO_STAGE2_LOWPASS_TYPE_DEFAULT,
|
||||
.useDynamicLpf = SETTING_GYRO_USE_DYN_LPF_DEFAULT,
|
||||
.gyroDynamicLpfMinHz = SETTING_GYRO_DYN_LPF_MIN_HZ_DEFAULT,
|
||||
.gyroDynamicLpfMaxHz = SETTING_GYRO_DYN_LPF_MAX_HZ_DEFAULT,
|
||||
.gyroDynamicLpfCurveExpo = SETTING_GYRO_DYN_LPF_CURVE_EXPO_DEFAULT,
|
||||
#ifdef USE_DYNAMIC_FILTERS
|
||||
.dynamicGyroNotchRange = SETTING_DYNAMIC_GYRO_NOTCH_RANGE_DEFAULT,
|
||||
.dynamicGyroNotchQ = SETTING_DYNAMIC_GYRO_NOTCH_Q_DEFAULT,
|
||||
.dynamicGyroNotchMinHz = SETTING_DYNAMIC_GYRO_NOTCH_MIN_HZ_DEFAULT,
|
||||
.dynamicGyroNotchEnabled = SETTING_DYNAMIC_GYRO_NOTCH_ENABLED_DEFAULT,
|
||||
#endif
|
||||
);
|
||||
|
||||
STATIC_UNIT_TESTED gyroSensor_e gyroDetect(gyroDev_t *dev, gyroSensor_e gyroHardware)
|
||||
|
|
|
@ -61,12 +61,14 @@ extern gyro_t gyro;
|
|||
typedef struct gyroConfig_s {
|
||||
sensor_align_e gyro_align; // gyro alignment
|
||||
uint8_t gyroMovementCalibrationThreshold; // people keep forgetting that moving model while init results in wrong gyro offsets. and then they never reset gyro. so this is now on by default.
|
||||
uint8_t gyroSync; // Enable interrupt based loop
|
||||
bool gyroSync; // Enable interrupt based loop
|
||||
uint16_t looptime; // imu loop time in us
|
||||
uint8_t gyro_lpf; // gyro LPF setting - values are driver specific, in case of invalid number, a reasonable default ~30-40HZ is chosen.
|
||||
uint8_t gyro_soft_lpf_hz;
|
||||
uint8_t gyro_soft_lpf_type;
|
||||
#ifdef USE_DUAL_GYRO
|
||||
uint8_t gyro_to_use;
|
||||
#endif
|
||||
uint16_t gyro_notch_hz;
|
||||
uint16_t gyro_notch_cutoff;
|
||||
uint16_t gyro_stage2_lowpass_hz;
|
||||
|
@ -75,10 +77,12 @@ typedef struct gyroConfig_s {
|
|||
uint16_t gyroDynamicLpfMinHz;
|
||||
uint16_t gyroDynamicLpfMaxHz;
|
||||
uint8_t gyroDynamicLpfCurveExpo;
|
||||
#ifdef USE_DYNAMIC_FILTERS
|
||||
uint8_t dynamicGyroNotchRange;
|
||||
uint16_t dynamicGyroNotchQ;
|
||||
uint16_t dynamicGyroNotchMinHz;
|
||||
uint8_t dynamicGyroNotchEnabled;
|
||||
#endif
|
||||
} gyroConfig_t;
|
||||
|
||||
PG_DECLARE(gyroConfig_t, gyroConfig);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "sensors/boardalignment.h"
|
||||
#include "sensors/gyro.h"
|
||||
|
@ -78,9 +79,9 @@ static float opflowCalibrationFlowAcc;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(opticalFlowConfig_t, opticalFlowConfig, PG_OPFLOW_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(opticalFlowConfig_t, opticalFlowConfig,
|
||||
.opflow_hardware = OPFLOW_NONE,
|
||||
.opflow_align = CW0_DEG_FLIP,
|
||||
.opflow_scale = 10.5f,
|
||||
.opflow_hardware = SETTING_OPFLOW_HARDWARE_DEFAULT,
|
||||
.opflow_align = SETTING_ALIGN_OPFLOW_DEFAULT,
|
||||
.opflow_scale = SETTING_OPFLOW_SCALE_DEFAULT,
|
||||
);
|
||||
|
||||
static bool opflowDetect(opflowDev_t * dev, uint8_t opflowHardwareToUse)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "scheduler/protothreads.h"
|
||||
|
||||
|
@ -58,9 +59,9 @@ PG_REGISTER_WITH_RESET_TEMPLATE(pitotmeterConfig_t, pitotmeterConfig, PG_PITOTME
|
|||
#define PITOT_HARDWARE_DEFAULT PITOT_NONE
|
||||
#endif
|
||||
PG_RESET_TEMPLATE(pitotmeterConfig_t, pitotmeterConfig,
|
||||
.pitot_hardware = PITOT_HARDWARE_DEFAULT,
|
||||
.pitot_lpf_milli_hz = 350,
|
||||
.pitot_scale = 1.00f
|
||||
.pitot_hardware = SETTING_PITOT_HARDWARE_DEFAULT,
|
||||
.pitot_lpf_milli_hz = SETTING_PITOT_LPF_MILLI_HZ_DEFAULT,
|
||||
.pitot_scale = SETTING_PITOT_SCALE_DEFAULT
|
||||
);
|
||||
|
||||
bool pitotDetect(pitotDev_t *dev, uint8_t pitotHardwareToUse)
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "fc/config.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/rangefinder.h"
|
||||
|
@ -65,8 +66,8 @@ rangefinder_t rangefinder;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(rangefinderConfig_t, rangefinderConfig, PG_RANGEFINDER_CONFIG, 1);
|
||||
|
||||
PG_RESET_TEMPLATE(rangefinderConfig_t, rangefinderConfig,
|
||||
.rangefinder_hardware = RANGEFINDER_NONE,
|
||||
.use_median_filtering = 0,
|
||||
.rangefinder_hardware = SETTING_RANGEFINDER_HARDWARE_DEFAULT,
|
||||
.use_median_filtering = SETTING_RANGEFINDER_MEDIAN_FILTER_DEFAULT,
|
||||
);
|
||||
|
||||
const rangefinderHardwarePins_t * rangefinderGetHardwarePins(void)
|
||||
|
@ -287,4 +288,3 @@ bool rangefinderIsHealthy(void)
|
|||
return (millis() - rangefinder.lastValidResponseTimeMs) < RANGEFINDER_HARDWARE_TIMEOUT_MS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -63,9 +63,6 @@ void targetConfiguration(void)
|
|||
pidProfileMutable()->bank_mc.pid[PITCH].P = 36;
|
||||
failsafeConfigMutable()->failsafe_delay = 2;
|
||||
failsafeConfigMutable()->failsafe_off_delay = 0;
|
||||
controlRateProfilesMutable(0)->stabilized.rates[FD_PITCH] = CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_DEFAULT;
|
||||
controlRateProfilesMutable(0)->stabilized.rates[FD_ROLL] = CONTROL_RATE_CONFIG_ROLL_PITCH_RATE_DEFAULT;
|
||||
controlRateProfilesMutable(0)->stabilized.rates[FD_YAW] = CONTROL_RATE_CONFIG_YAW_RATE_DEFAULT;
|
||||
parseRcChannels("TAER1234");
|
||||
|
||||
*primaryMotorMixerMutable(0) = (motorMixer_t){ 1.0f, -0.414178f, 1.0f, -1.0f }; // REAR_R
|
||||
|
|
|
@ -110,8 +110,8 @@
|
|||
//#define SBUS_TELEMETRY_UART SERIAL_PORT_USART1 // XXX
|
||||
#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_CURRENT_METER | FEATURE_TELEMETRY ) // XXX
|
||||
|
||||
#define USE_SPEKTRUM_BIND
|
||||
#define BIND_PIN UART2_RX_PIN
|
||||
//#define USE_SPEKTRUM_BIND
|
||||
//#define BIND_PIN UART2_RX_PIN
|
||||
|
||||
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define L3GD20_CS_PIN PE3
|
||||
|
||||
#define IMU_L3GD20_ALIGN CW270_DEG
|
||||
#define IMU_LSM303DLHC_ALIGN CW0_DEG
|
||||
#define IMU_MPU6050_ALIGN CW0_DEG
|
||||
|
||||
#define USE_BARO
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
target_stm32f303xc(KFC32F3_INAV SKIP_RELEASES)
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
#include "drivers/time.h"
|
||||
#include "drivers/bus_spi.h"
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/io_impl.h"
|
||||
|
||||
void initialisePreBootHardware(void)
|
||||
{
|
||||
// setup CS pins
|
||||
IOInit(DEFIO_IO(PB5), OWNER_SYSTEM, RESOURCE_OUTPUT, 0);
|
||||
IOConfigGPIO(DEFIO_IO(PB5), IOCFG_OUT_PP);
|
||||
IOHi(DEFIO_IO(PB5));
|
||||
|
||||
IOInit(DEFIO_IO(PC15), OWNER_SYSTEM, RESOURCE_OUTPUT, 0);
|
||||
IOConfigGPIO(DEFIO_IO(PC15), IOCFG_OUT_PP);
|
||||
IOHi(DEFIO_IO(PC15));
|
||||
|
||||
IOInit(DEFIO_IO(PB12), OWNER_SYSTEM, RESOURCE_OUTPUT, 0);
|
||||
IOConfigGPIO(DEFIO_IO(PB12), IOCFG_OUT_PP);
|
||||
IOHi(DEFIO_IO(PB12));
|
||||
|
||||
IOInit(DEFIO_IO(PB2), OWNER_SYSTEM, RESOURCE_OUTPUT, 0);
|
||||
IOConfigGPIO(DEFIO_IO(PB2), IOCFG_OUT_PP);
|
||||
IOHi(DEFIO_IO(PB2));
|
||||
|
||||
IOInit(DEFIO_IO(PA7), OWNER_SYSTEM, RESOURCE_OUTPUT, 0);
|
||||
IOConfigGPIO(DEFIO_IO(PA7), IOCFG_OUT_PP);
|
||||
IOHi(DEFIO_IO(PA7));
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/pwm_mapping.h"
|
||||
#include "drivers/timer.h"
|
||||
|
||||
const timerHardware_t timerHardware[] =
|
||||
{
|
||||
DEF_TIM(TIM2, CH1, PA0, TIM_USE_PPM, 0), // PPM
|
||||
|
||||
DEF_TIM(TIM8, CH3, PB9, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0), // PWM1
|
||||
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM2
|
||||
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM3
|
||||
DEF_TIM(TIM4, CH2, PB7, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM4
|
||||
DEF_TIM(TIM4, CH3, PB8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM5
|
||||
DEF_TIM(TIM4, CH1, PB6, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM6
|
||||
DEF_TIM(TIM2, CH3, PB10, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM7
|
||||
DEF_TIM(TIM2, CH4, PB11, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM8
|
||||
|
||||
DEF_TIM(TIM1, CH1, PA8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // S1_out
|
||||
DEF_TIM(TIM2, CH2, PA1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // S2_out
|
||||
};
|
||||
|
||||
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "KFCi"
|
||||
#define USE_HARDWARE_PREBOOT_SETUP
|
||||
|
||||
#define USE_DJI_HD_OSD
|
||||
|
||||
#define LED0 PC13
|
||||
#define LED0_INVERTED
|
||||
|
||||
#define LED1 PC14
|
||||
#define LED1_INVERTED
|
||||
|
||||
#define BEEPER PA13
|
||||
#define BEEPER_INVERTED
|
||||
|
||||
#define USE_EXTI
|
||||
#define GYRO_INT_EXTI PC5
|
||||
#define USE_MPU_DATA_READY_SIGNAL
|
||||
#define ENSURE_MPU_DATA_READY_IS_LOW
|
||||
|
||||
#define BUS_SPI_SPEED_MAX BUS_SPEED_SLOW
|
||||
|
||||
#define USE_IMU_MPU6000
|
||||
#define IMU_MPU6000_ALIGN CW90_DEG
|
||||
#define MPU6000_CS_PIN PB5
|
||||
#define MPU6000_SPI_BUS BUS_SPI2
|
||||
|
||||
|
||||
#define USE_MAG
|
||||
#define MAG_I2C_BUS BUS_I2C1
|
||||
#define USE_MAG_HMC5883
|
||||
#define USE_MAG_QMC5883
|
||||
#define USE_MAG_IST8310
|
||||
#define USE_MAG_IST8308
|
||||
#define USE_MAG_MAG3110
|
||||
#define USE_MAG_LIS3MDL
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
|
||||
|
||||
#define SPI2_NSS_PIN PB12
|
||||
#define SPI2_SCK_PIN PB13
|
||||
#define SPI2_MISO_PIN PB14
|
||||
#define SPI2_MOSI_PIN PB15
|
||||
|
||||
#define USE_FLASHFS
|
||||
|
||||
#define USE_FLASH_M25P16
|
||||
#define M25P16_CS_PIN PB12
|
||||
#define M25P16_SPI_BUS BUS_SPI2
|
||||
#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
|
||||
|
||||
#define USE_BARO
|
||||
#define USE_BARO_MS5611
|
||||
#define MS5611_SPI_BUS BUS_SPI2
|
||||
#define MS5611_CS_PIN PB2
|
||||
|
||||
#define USE_OSD
|
||||
#define USE_MAX7456
|
||||
#define MAX7456_SPI_BUS BUS_SPI2
|
||||
#define MAX7456_CS_PIN PA7
|
||||
|
||||
//#define RFM_SPI SPI2
|
||||
//#define RFM_SPI_CS_PIN PC15
|
||||
//#define RFM_IRQ_PIN PB3
|
||||
//#define RFM_SPI_CLK (SPI_CLOCK_STANDARD*2)
|
||||
//#define RFM_RESTORE_CLK (SPI_CLOCK_FAST)
|
||||
|
||||
#define USE_RX_SPI
|
||||
#define USE_RX_ELERES
|
||||
#define RX_NSS_PIN PC15
|
||||
#define RX_NSS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOC
|
||||
#define RX_SCK_PIN PB13
|
||||
#define RX_MOSI_PIN PB15
|
||||
#define RX_MISO_PIN PB14
|
||||
#define RX_SPI_INSTANCE SPI2
|
||||
#define RX_IRQ_PIN PB3
|
||||
|
||||
#define USE_VCP
|
||||
#define USE_UART1
|
||||
#define USE_UART2
|
||||
#define SERIAL_PORT_COUNT 3
|
||||
|
||||
#define UART1_TX_PIN PA9
|
||||
#define UART1_RX_PIN PA10
|
||||
|
||||
#define UART2_TX_PIN PA2
|
||||
#define UART2_RX_PIN PA3
|
||||
|
||||
#define USE_I2C
|
||||
#define USE_I2C_DEVICE_1
|
||||
|
||||
#define I2C1_SCL PA15
|
||||
#define I2C1_SDA PA14
|
||||
|
||||
#define USE_PITOT_MS4525
|
||||
#define PITOT_I2C_BUS BUS_I2C1
|
||||
|
||||
#define BOARD_HAS_VOLTAGE_DIVIDER
|
||||
#define USE_ADC
|
||||
#define ADC_INSTANCE ADC2
|
||||
#define ADC_CHANNEL_1_PIN PA4
|
||||
#define ADC_CHANNEL_2_PIN PA6
|
||||
#define ADC_CHANNEL_3_PIN PA5
|
||||
#define VBAT_ADC_CHANNEL ADC_CHN_1
|
||||
#define RSSI_ADC_CHANNEL ADC_CHN_2
|
||||
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_3
|
||||
|
||||
//#define USE_LED_STRIP
|
||||
//#define WS2811_PIN PA8
|
||||
//#define WS2811_DMA_STREAM DMA1_Channel2
|
||||
//#define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
|
||||
|
||||
#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_OSD | FEATURE_VBAT)
|
||||
#define DEFAULT_RX_TYPE RX_TYPE_PPM
|
||||
|
||||
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
// Number of available PWM outputs
|
||||
#define MAX_PWM_OUTPUT_PORTS 10
|
||||
#define TARGET_MOTOR_COUNT 10
|
||||
|
||||
// IO - stm32f303cc in 48pin package
|
||||
#define TARGET_IO_PORTA 0xffff
|
||||
#define TARGET_IO_PORTB 0xffff
|
||||
#define TARGET_IO_PORTC 0xffff
|
||||
#define TARGET_IO_PORTD 0xffff
|
||||
#define TARGET_IO_PORTF (BIT(4))
|
|
@ -119,8 +119,8 @@
|
|||
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
|
||||
#define RSSI_ADC_CHANNEL ADC_CHN_3
|
||||
|
||||
#define USE_LED_STRIP
|
||||
#define WS2811_PIN PA8
|
||||
//#define USE_LED_STRIP
|
||||
//#define WS2811_PIN PA8
|
||||
|
||||
//#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
#define VBAT_ADC_CHANNEL ADC_CHN_2
|
||||
#define RSSI_ADC_CHANNEL ADC_CHN_3
|
||||
|
||||
#define USE_LED_STRIP
|
||||
#define WS2811_PIN PB8 // TIM16_CH1
|
||||
//#define USE_LED_STRIP
|
||||
//#define WS2811_PIN PB8 // TIM16_CH1
|
||||
|
||||
// #define USE_TRANSPONDER
|
||||
// #define TRANSPONDER_PIN PA8
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
target_stm32f303xc(RMDO COMPILE_DEFINITIONS "SPRACINGF3" SKIP_RELEASES)
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/pwm_mapping.h"
|
||||
#include "drivers/timer.h"
|
||||
|
||||
const timerHardware_t timerHardware[] = {
|
||||
DEF_TIM(TIM16, CH1, PA6, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0), // PWM1 - PA6 - TIM3_CH1, TIM8_BKIN, TIM1_BKIN, *TIM16_CH1
|
||||
DEF_TIM(TIM17, CH1, PA7, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0), // PWM2 - PA7 - TIM3_CH2, *TIM17_CH1, TIM1_CH1N, TIM8_CH1
|
||||
DEF_TIM(TIM4, CH1, PA11, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM3 - PA11
|
||||
DEF_TIM(TIM4, CH2, PA12, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM4 - PA12
|
||||
DEF_TIM(TIM4, CH3, PB8, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM5 - PB8
|
||||
DEF_TIM(TIM4, CH4, PB9, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // PWM6 - PB9
|
||||
DEF_TIM(TIM15, CH1, PA2, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0), // PWM7 - PA2
|
||||
DEF_TIM(TIM15, CH2, PA3, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0), // PWM8 - PA3
|
||||
|
||||
DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0), // GPIO_TIMER / LED_STRIP
|
||||
|
||||
DEF_TIM(TIM2, CH1, PA0, TIM_USE_PWM | TIM_USE_PPM, 0), // RC_CH1 - PA0 - *TIM2_CH1
|
||||
DEF_TIM(TIM2, CH2, PA1, TIM_USE_PWM, 0), // RC_CH2 - PA1 - *TIM2_CH2, TIM15_CH1N
|
||||
DEF_TIM(TIM2, CH4, PB11, TIM_USE_PWM, 0), // RC_CH3 - PB11 - *TIM2_CH4, UART3_RX (AF7)
|
||||
DEF_TIM(TIM2, CH3, PB10, TIM_USE_PWM, 0), // RC_CH4 - PB10 - *TIM2_CH3, UART3_TX (AF7)
|
||||
DEF_TIM(TIM3, CH1, PB4, TIM_USE_PWM, 0), // RC_CH5 - PB4 - *TIM3_CH1
|
||||
DEF_TIM(TIM3, CH2, PB5, TIM_USE_PWM, 0), // RC_CH6 - PB5 - *TIM3_CH2
|
||||
DEF_TIM(TIM3, CH3, PB0, TIM_USE_PWM, 0), // RC_CH7 - PB0 - *TIM3_CH3, TIM1_CH2N, TIM8_CH2N
|
||||
DEF_TIM(TIM3, CH4, PB1, TIM_USE_PWM, 0), // RC_CH8 - PB1 - *TIM3_CH4, TIM1_CH3N, TIM8_CH3N
|
||||
};
|
||||
|
||||
|
||||
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "RMDO" // Ready Made RC DoDo
|
||||
|
||||
#define LED0 PB3
|
||||
|
||||
#define BEEPER PC15
|
||||
#define BEEPER_INVERTED
|
||||
|
||||
#define USE_EXTI
|
||||
#define USE_MPU_DATA_READY_SIGNAL
|
||||
#define ENSURE_MPU_DATA_READY_IS_LOW
|
||||
|
||||
#define USE_IMU_MPU6050
|
||||
#define IMU_MPU6050_ALIGN CW270_DEG
|
||||
#define MPU6050_I2C_BUS BUS_I2C1
|
||||
|
||||
|
||||
#define USE_BARO
|
||||
#define BARO_I2C_BUS BUS_I2C1
|
||||
#define USE_BARO_BMP280
|
||||
|
||||
#define USE_MAG
|
||||
#define MAG_I2C_BUS BUS_I2C1
|
||||
#define USE_MAG_AK8975
|
||||
#define USE_MAG_HMC5883
|
||||
#define USE_MAG_QMC5883
|
||||
#define USE_MAG_IST8310
|
||||
#define USE_MAG_IST8308
|
||||
#define USE_MAG_MAG3110
|
||||
#define USE_MAG_LIS3MDL
|
||||
|
||||
#define USE_FLASHFS
|
||||
#define USE_FLASH_M25P16
|
||||
|
||||
#define USE_RANGEFINDER
|
||||
#define USE_RANGEFINDER_HCSR04
|
||||
#define RANGEFINDER_HCSR04_TRIGGER_PIN PB0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
|
||||
#define RANGEFINDER_HCSR04_ECHO_PIN PB1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
|
||||
|
||||
#define USE_UART1
|
||||
#define USE_UART2
|
||||
#define USE_UART3
|
||||
#define USE_SOFTSERIAL1
|
||||
#define USE_SOFTSERIAL2
|
||||
#define SERIAL_PORT_COUNT 5
|
||||
|
||||
#define UART1_TX_PIN PA9
|
||||
#define UART1_RX_PIN PA10
|
||||
|
||||
#define UART2_TX_PIN PA14 // PA14 / SWCLK
|
||||
#define UART2_RX_PIN PA15 // PA15
|
||||
|
||||
#define UART3_TX_PIN PB10 // PB10 (AF7)
|
||||
#define UART3_RX_PIN PB11 // PB11 (AF7)
|
||||
|
||||
#define SOFTSERIAL_1_RX_PIN PB4
|
||||
#define SOFTSERIAL_1_TX_PIN PB5
|
||||
#define SOFTSERIAL_2_RX_PIN PB0
|
||||
#define SOFTSERIAL_2_TX_PIN PB1
|
||||
|
||||
#define USE_I2C
|
||||
#define USE_I2C_DEVICE_1
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
|
||||
|
||||
#define M25P16_CS_GPIO GPIOB
|
||||
#define M25P16_CS_PIN PB12
|
||||
#define M25P16_SPI_BUS BUS_SPI2
|
||||
|
||||
#define BOARD_HAS_VOLTAGE_DIVIDER
|
||||
#define USE_ADC
|
||||
#define ADC_INSTANCE ADC2
|
||||
#define ADC_CHANNEL_1_PIN PA4
|
||||
#define ADC_CHANNEL_2_PIN PA5
|
||||
#define ADC_CHANNEL_3_PIN PB2
|
||||
#define VBAT_ADC_CHANNEL ADC_CHN_1
|
||||
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
|
||||
#define RSSI_ADC_CHANNEL ADC_CHN_3
|
||||
|
||||
#define USE_LED_STRIP
|
||||
|
||||
#define USE_LED_STRIP_ON_DMA1_CHANNEL2
|
||||
#define WS2811_PIN PA8
|
||||
|
||||
#undef NAV_MAX_WAYPOINTS
|
||||
#define NAV_MAX_WAYPOINTS 30
|
||||
|
||||
#define USE_SPEKTRUM_BIND
|
||||
// USART3,
|
||||
#define BIND_PIN PB11
|
||||
|
||||
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
#undef USE_GPS_PROTO_NAZA
|
||||
#undef USE_TELEMETRY_HOTT
|
||||
#undef USE_TELEMETRY_SMARTPORT
|
||||
#undef USE_TELEMETRY_IBUS
|
||||
|
||||
// Number of available PWM outputs
|
||||
#define MAX_PWM_OUTPUT_PORTS 12
|
||||
|
||||
// IO - stm32f303cc in 48pin package
|
||||
#define TARGET_IO_PORTA 0xffff
|
||||
#define TARGET_IO_PORTB 0xffff
|
||||
#define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
|
||||
#define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
|
|
@ -1 +0,0 @@
|
|||
target_stm32f303xc(SPRACINGF3NEO SKIP_RELEASES)
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/compass.h"
|
||||
#include "sensors/barometer.h"
|
||||
|
||||
#include "telemetry/telemetry.h"
|
||||
|
||||
void targetConfiguration(void)
|
||||
{
|
||||
barometerConfigMutable()->baro_hardware = BARO_AUTODETECT;
|
||||
compassConfigMutable()->mag_hardware = MAG_AUTODETECT;
|
||||
serialConfigMutable()->portConfigs[1].functionMask = FUNCTION_MSP; // So Bluetooth users don't have to change anything.
|
||||
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(TELEMETRY_UART)].functionMask = FUNCTION_TELEMETRY_SMARTPORT;
|
||||
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(GPS_UART)].functionMask = FUNCTION_GPS;
|
||||
//telemetryConfigMutable()->halfDuplex = 1;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <platform.h>
|
||||
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/pwm_mapping.h"
|
||||
#include "drivers/timer.h"
|
||||
|
||||
const timerHardware_t timerHardware[] = {
|
||||
DEF_TIM(TIM15, CH2, PA3, TIM_USE_PWM | TIM_USE_PPM, 0), // PWM1 / PPM / UART2 RX
|
||||
DEF_TIM(TIM15, CH1, PA2, TIM_USE_PWM, 0), // PWM2
|
||||
|
||||
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // ESC1
|
||||
DEF_TIM(TIM3, CH2, PC7, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // ESC2
|
||||
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // ESC3
|
||||
DEF_TIM(TIM3, CH1, PC6, TIM_USE_MC_MOTOR | TIM_USE_FW_SERVO, 0), // ESC4
|
||||
|
||||
DEF_TIM(TIM8, CH3, PC8, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0), // ESC5 (FW motor)
|
||||
DEF_TIM(TIM8, CH4, PC9, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0), // ESC6 (FW motor)
|
||||
|
||||
|
||||
DEF_TIM(TIM2, CH3, PB10, TIM_USE_PWM, 0), // PWM3 - PB10 - *TIM2_CH3, UART3_TX (AF7)
|
||||
DEF_TIM(TIM2, CH4, PB11, TIM_USE_PWM, 0), // PWM4 - PB11 - *TIM2_CH4, UART3_RX (AF7)
|
||||
|
||||
DEF_TIM(TIM16, CH1, PB8, TIM_USE_ANY, 0),
|
||||
DEF_TIM(TIM1, CH1, PA8, TIM_USE_LED, 0),
|
||||
};
|
||||
|
||||
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
|
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "SP3N"
|
||||
|
||||
#define LED0 PB9
|
||||
#define LED1 PB2
|
||||
|
||||
#define BEEPER PC15
|
||||
#define BEEPER_INVERTED
|
||||
|
||||
#define USE_EXTI
|
||||
#define GYRO_INT_EXTI PC13
|
||||
#define USE_MPU_DATA_READY_SIGNAL
|
||||
#define ENSURE_MPU_DATA_READY_IS_LOW
|
||||
|
||||
#define USE_IMU_MPU6500
|
||||
#define IMU_MPU6500_ALIGN CW0_DEG
|
||||
|
||||
#define USE_IMU_MPU9250
|
||||
#define IMU_MPU9250_ALIGN CW0_DEG
|
||||
|
||||
#define MPU6500_CS_PIN SPI1_NSS_PIN
|
||||
#define MPU6500_SPI_BUS BUS_SPI1
|
||||
|
||||
#define MPU9250_CS_PIN SPI1_NSS_PIN
|
||||
#define MPU9250_SPI_BUS BUS_SPI1
|
||||
|
||||
#define USE_BARO
|
||||
#define BARO_I2C_BUS BUS_I2C1
|
||||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_MS5611
|
||||
|
||||
#define USE_MAG
|
||||
#define MAG_I2C_BUS BUS_I2C1
|
||||
#define USE_MAG_MPU9250
|
||||
#define USE_MAG_HMC5883
|
||||
#define USE_MAG_QMC5883
|
||||
#define USE_MAG_IST8310
|
||||
#define USE_MAG_IST8308
|
||||
#define USE_MAG_MAG3110
|
||||
#define USE_MAG_LIS3MDL
|
||||
|
||||
#define USE_VCP
|
||||
#define USE_UART1
|
||||
#define USE_UART2
|
||||
#define USE_UART3
|
||||
#define USE_UART4
|
||||
#define USE_UART5
|
||||
//#define USE_SOFTSERIAL1
|
||||
//#define USE_SOFTSERIAL2
|
||||
//#define SERIAL_PORT_COUNT 8
|
||||
#define SERIAL_PORT_COUNT 6
|
||||
|
||||
#define UART1_TX_PIN PA9
|
||||
#define UART1_RX_PIN PA10
|
||||
|
||||
#define UART2_TX_PIN PA2
|
||||
#define UART2_RX_PIN PA3
|
||||
|
||||
#define UART3_TX_PIN PB10
|
||||
#define UART3_RX_PIN PB11
|
||||
|
||||
#define USE_I2C
|
||||
#define USE_I2C_DEVICE_1
|
||||
|
||||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_1 // MPU
|
||||
#define USE_SPI_DEVICE_2 // SDCard
|
||||
#define USE_SPI_DEVICE_3 // External (MAX7456 & RTC6705)
|
||||
|
||||
#define SPI1_NSS_PIN PA4
|
||||
#define SPI1_SCK_PIN PA5
|
||||
#define SPI1_MISO_PIN PA6
|
||||
#define SPI1_MOSI_PIN PA7
|
||||
|
||||
#define SPI2_NSS_PIN PB12
|
||||
#define SPI2_SCK_PIN PB13
|
||||
#define SPI2_MISO_PIN PB14
|
||||
#define SPI2_MOSI_PIN PB15
|
||||
|
||||
#define SPI3_NSS_PIN PA15
|
||||
#define SPI3_SCK_PIN PB3
|
||||
#define SPI3_MISO_PIN PB4
|
||||
#define SPI3_MOSI_PIN PB5
|
||||
|
||||
#undef USE_VTX_FFPV
|
||||
#undef USE_VTX_SMARTAUDIO // Disabled due to flash size
|
||||
#undef USE_VTX_TRAMP // Disabled due to flash size
|
||||
|
||||
#undef USE_PITOT // Disabled due to RAM size
|
||||
#undef USE_PITOT_ADC // Disabled due to RAM size
|
||||
|
||||
#define USE_MAX7456
|
||||
#define MAX7456_SPI_BUS BUS_SPI3
|
||||
#define MAX7456_CS_PIN PA15
|
||||
|
||||
#define USE_SDCARD
|
||||
#define USE_SDCARD_SPI
|
||||
#define SDCARD_DETECT_INVERTED
|
||||
#define SDCARD_DETECT_PIN PC14
|
||||
#define SDCARD_SPI_BUS BUS_SPI2
|
||||
#define SDCARD_CS_PIN SPI2_NSS_PIN
|
||||
|
||||
#define USE_ADC
|
||||
#define ADC_INSTANCE ADC1
|
||||
#define ADC_CHANNEL_1_PIN PC1
|
||||
#define ADC_CHANNEL_2_PIN PC2
|
||||
#define ADC_CHANNEL_3_PIN PC0
|
||||
#define VBAT_ADC_CHANNEL ADC_CHN_1
|
||||
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
|
||||
#define RSSI_ADC_CHANNEL ADC_CHN_3
|
||||
|
||||
#define USE_LED_STRIP
|
||||
#define WS2811_PIN PA8
|
||||
|
||||
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
||||
|
||||
#define USE_OSD
|
||||
|
||||
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
|
||||
#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_TRANSPONDER | FEATURE_RSSI_ADC | FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_LED_STRIP)
|
||||
#define SERIALRX_UART SERIAL_PORT_USART2
|
||||
#define GPS_UART SERIAL_PORT_USART3
|
||||
#define TELEMETRY_UART SERIAL_PORT_USART5
|
||||
#define SERIALRX_PROVIDER SERIALRX_SBUS
|
||||
|
||||
#define BUTTONS
|
||||
#define BUTTON_A_PIN PD2
|
||||
|
||||
#define SPEKTRUM_BIND_PIN UART2_RX_PIN
|
||||
|
||||
#define BINDPLUG_PIN PD2
|
||||
|
||||
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
|
||||
// Number of available PWM outputs
|
||||
#define MAX_PWM_OUTPUT_PORTS 10
|
||||
|
||||
// IO - assuming 303 in 64pin package, TODO
|
||||
#define TARGET_IO_PORTA 0xffff
|
||||
#define TARGET_IO_PORTB 0xffff
|
||||
#define TARGET_IO_PORTC 0xffff
|
||||
#define TARGET_IO_PORTD (BIT(2))
|
||||
#define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
|
||||
|
||||
#undef USE_TELEMETRY_FRSKY
|
|
@ -124,7 +124,6 @@
|
|||
|
||||
#define USE_PWM_DRIVER_PCA9685
|
||||
|
||||
#define USE_TELEMETRY_SIM
|
||||
#define USE_FRSKYOSD
|
||||
#define USE_DJI_HD_OSD
|
||||
#define USE_SMARTPORT_MASTER
|
||||
|
@ -138,7 +137,19 @@
|
|||
|
||||
#define USE_I2C_IO_EXPANDER
|
||||
|
||||
#define USE_GPS_PROTO_NMEA
|
||||
#define USE_GPS_PROTO_MTK
|
||||
|
||||
#define USE_TELEMETRY_SIM
|
||||
#define USE_TELEMETRY_HOTT
|
||||
#define USE_TELEMETRY_MAVLINK
|
||||
#define USE_MSP_OVER_TELEMETRY
|
||||
|
||||
#define USE_SERIALRX_SRXL2 // Spektrum SRXL2 protocol
|
||||
#define USE_SERIALRX_SUMD
|
||||
#define USE_SERIALRX_SUMH
|
||||
#define USE_SERIALRX_XBUS
|
||||
#define USE_SERIALRX_JETIEXBUS
|
||||
#define USE_TELEMETRY_SRXL
|
||||
#define USE_SPEKTRUM_CMS_TELEMETRY
|
||||
//#define USE_SPEKTRUM_VTX_CONTROL //Some functions from betaflight still not implemented
|
||||
|
@ -164,23 +175,14 @@
|
|||
#define USE_STATS
|
||||
#define USE_CMS
|
||||
#define CMS_MENU_OSD
|
||||
#define USE_GPS_PROTO_NMEA
|
||||
#define USE_GPS_PROTO_MTK
|
||||
#define NAV_GPS_GLITCH_DETECTION
|
||||
#define NAV_NON_VOLATILE_WAYPOINT_STORAGE
|
||||
#define USE_TELEMETRY_HOTT
|
||||
#define USE_TELEMETRY_IBUS
|
||||
#define USE_TELEMETRY_MAVLINK
|
||||
#define USE_TELEMETRY_SMARTPORT
|
||||
#define USE_TELEMETRY_CRSF
|
||||
#define USE_MSP_OVER_TELEMETRY
|
||||
// These are rather exotic serial protocols
|
||||
#define USE_RX_MSP
|
||||
//#define USE_MSP_RC_OVERRIDE
|
||||
#define USE_SERIALRX_SUMD
|
||||
#define USE_SERIALRX_SUMH
|
||||
#define USE_SERIALRX_XBUS
|
||||
#define USE_SERIALRX_JETIEXBUS
|
||||
#define USE_SERIALRX_CRSF
|
||||
#define USE_PWM_SERVO_DRIVER
|
||||
#define USE_SERIAL_PASSTHROUGH
|
||||
|
|
|
@ -63,15 +63,6 @@
|
|||
#define SIM_RESPONSE_CODE_CMT ('C' << 24 | 'M' << 16 | 'T' << 8 | ':')
|
||||
|
||||
|
||||
typedef enum {
|
||||
SIM_TX_FLAG = (1 << 0),
|
||||
SIM_TX_FLAG_FAILSAFE = (1 << 1),
|
||||
SIM_TX_FLAG_GPS = (1 << 2),
|
||||
SIM_TX_FLAG_ACC = (1 << 3),
|
||||
SIM_TX_FLAG_LOW_ALT = (1 << 4),
|
||||
SIM_TX_FLAG_RESPONSE = (1 << 5)
|
||||
} simTxFlags_e;
|
||||
|
||||
typedef enum {
|
||||
SIM_MODULE_NOT_DETECTED = 0,
|
||||
SIM_MODULE_NOT_REGISTERED,
|
||||
|
@ -124,7 +115,6 @@ static uint8_t simResponse[SIM_RESPONSE_BUFFER_SIZE + 1];
|
|||
static int atCommandStatus = SIM_AT_OK;
|
||||
static bool simWaitAfterResponse = false;
|
||||
static uint8_t readState = SIM_READSTATE_RESPONSE;
|
||||
static uint8_t transmitFlags = 0;
|
||||
static timeMs_t t_lastMessageSent = 0;
|
||||
static uint8_t lastMessageTriggeredBy = 0;
|
||||
static uint8_t simModuleState = SIM_MODULE_NOT_DETECTED;
|
||||
|
@ -146,7 +136,7 @@ static bool isGroundStationNumberDefined(void) {
|
|||
static bool checkGroundStationNumber(uint8_t* rv)
|
||||
{
|
||||
int i;
|
||||
const uint8_t* gsn = telemetryConfig()->simGroundStationNumber;
|
||||
const char* gsn = telemetryConfig()->simGroundStationNumber;
|
||||
|
||||
int digitsToCheck = strlen((char*)gsn);
|
||||
if (gsn[0] == '+') {
|
||||
|
@ -177,7 +167,7 @@ static bool checkGroundStationNumber(uint8_t* rv)
|
|||
static void readOriginatingNumber(uint8_t* rv)
|
||||
{
|
||||
int i;
|
||||
uint8_t* gsn = telemetryConfigMutable()->simGroundStationNumber;
|
||||
char* gsn = telemetryConfigMutable()->simGroundStationNumber;
|
||||
if (gsn[0] != '\0')
|
||||
return;
|
||||
for (i = 0; i < 15 && rv[i] != '\"'; i++)
|
||||
|
@ -189,7 +179,7 @@ static void readTransmitFlags(const uint8_t* fs)
|
|||
{
|
||||
int i;
|
||||
|
||||
transmitFlags = 0;
|
||||
uint8_t transmitFlags = 0;
|
||||
for (i = 0; i < SIM_N_TX_FLAGS && fs[i] != '\0'; i++) {
|
||||
switch (fs[i]) {
|
||||
case 'T': case 't':
|
||||
|
@ -209,6 +199,8 @@ static void readTransmitFlags(const uint8_t* fs)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
telemetryConfigMutable()->simTransmitFlags = transmitFlags;
|
||||
}
|
||||
|
||||
static void requestSendSMS(uint8_t trigger)
|
||||
|
@ -337,7 +329,7 @@ static void transmit(void)
|
|||
if (gpsSol.fixType != GPS_NO_FIX && FLIGHT_MODE(SIM_LOW_ALT_WARNING_MODES) && getAltitudeMeters() < telemetryConfig()->simLowAltitude)
|
||||
triggers |= SIM_TX_FLAG_LOW_ALT;
|
||||
|
||||
triggers &= transmitFlags;
|
||||
triggers &= telemetryConfig()->simTransmitFlags;
|
||||
|
||||
if (!triggers)
|
||||
return;
|
||||
|
@ -508,7 +500,6 @@ static void configureSimTelemetryPort(void)
|
|||
sim_t_stateChange = millis() + SIM_STARTUP_DELAY_MS;
|
||||
simTelemetryState = SIM_STATE_INIT;
|
||||
readState = SIM_READSTATE_RESPONSE;
|
||||
readTransmitFlags(telemetryConfig()->simTransmitFlags);
|
||||
simEnabled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,15 @@
|
|||
#define SIM_DEFAULT_TX_FLAGS "f"
|
||||
#define SIM_PIN "0000"
|
||||
|
||||
typedef enum {
|
||||
SIM_TX_FLAG = (1 << 0),
|
||||
SIM_TX_FLAG_FAILSAFE = (1 << 1),
|
||||
SIM_TX_FLAG_GPS = (1 << 2),
|
||||
SIM_TX_FLAG_ACC = (1 << 3),
|
||||
SIM_TX_FLAG_LOW_ALT = (1 << 4),
|
||||
SIM_TX_FLAG_RESPONSE = (1 << 5)
|
||||
} simTxFlags_e;
|
||||
|
||||
|
||||
void handleSimTelemetry(void);
|
||||
void initSimTelemetry(void);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "fc/rc_controls.h"
|
||||
#include "fc/rc_modes.h"
|
||||
#include "fc/runtime_config.h"
|
||||
#include "fc/settings.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
|
||||
|
@ -53,38 +54,43 @@
|
|||
#include "telemetry/ghst.h"
|
||||
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(telemetryConfig_t, telemetryConfig, PG_TELEMETRY_CONFIG, 4);
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(telemetryConfig_t, telemetryConfig, PG_TELEMETRY_CONFIG, 5);
|
||||
|
||||
PG_RESET_TEMPLATE(telemetryConfig_t, telemetryConfig,
|
||||
.gpsNoFixLatitude = 0,
|
||||
.gpsNoFixLongitude = 0,
|
||||
.telemetry_switch = 0,
|
||||
.telemetry_inverted = 0,
|
||||
.frsky_coordinate_format = FRSKY_FORMAT_DMS,
|
||||
.frsky_unit = FRSKY_UNIT_METRICS,
|
||||
.frsky_vfas_precision = 0,
|
||||
.frsky_pitch_roll = 0,
|
||||
.report_cell_voltage = 0,
|
||||
.hottAlarmSoundInterval = 5,
|
||||
.halfDuplex = 1,
|
||||
.smartportFuelUnit = SMARTPORT_FUEL_UNIT_MAH,
|
||||
.ibusTelemetryType = 0,
|
||||
.ltmUpdateRate = LTM_RATE_NORMAL,
|
||||
.simTransmitInterval = SIM_DEFAULT_TRANSMIT_INTERVAL,
|
||||
.simTransmitFlags = SIM_DEFAULT_TX_FLAGS,
|
||||
.simLowAltitude = INT16_MIN,
|
||||
.simPin = SIM_PIN,
|
||||
.accEventThresholdHigh = 0,
|
||||
.accEventThresholdLow = 0,
|
||||
.accEventThresholdNegX = 0,
|
||||
.gpsNoFixLatitude = SETTING_FRSKY_DEFAULT_LATITUDE_DEFAULT,
|
||||
.gpsNoFixLongitude = SETTING_FRSKY_DEFAULT_LONGITUDE_DEFAULT,
|
||||
.telemetry_switch = SETTING_TELEMETRY_SWITCH_DEFAULT,
|
||||
.telemetry_inverted = SETTING_TELEMETRY_INVERTED_DEFAULT,
|
||||
.frsky_coordinate_format = SETTING_FRSKY_COORDINATES_FORMAT_DEFAULT,
|
||||
.frsky_unit = SETTING_FRSKY_UNIT_DEFAULT,
|
||||
.frsky_vfas_precision = SETTING_FRSKY_VFAS_PRECISION_DEFAULT,
|
||||
.frsky_pitch_roll = SETTING_FRSKY_PITCH_ROLL_DEFAULT,
|
||||
.report_cell_voltage = SETTING_REPORT_CELL_VOLTAGE_DEFAULT,
|
||||
.hottAlarmSoundInterval = SETTING_HOTT_ALARM_SOUND_INTERVAL_DEFAULT,
|
||||
.halfDuplex = SETTING_TELEMETRY_HALFDUPLEX_DEFAULT,
|
||||
.smartportFuelUnit = SETTING_SMARTPORT_FUEL_UNIT_DEFAULT,
|
||||
.ibusTelemetryType = SETTING_IBUS_TELEMETRY_TYPE_DEFAULT,
|
||||
.ltmUpdateRate = SETTING_LTM_UPDATE_RATE_DEFAULT,
|
||||
|
||||
#ifdef USE_TELEMETRY_SIM
|
||||
.simTransmitInterval = SETTING_SIM_TRANSMIT_INTERVAL_DEFAULT,
|
||||
.simTransmitFlags = SETTING_SIM_TRANSMIT_FLAGS_DEFAULT,
|
||||
.simLowAltitude = SETTING_SIM_LOW_ALTITUDE_DEFAULT,
|
||||
.simPin = SETTING_SIM_PIN_DEFAULT,
|
||||
.simGroundStationNumber = SETTING_SIM_GROUND_STATION_NUMBER_DEFAULT,
|
||||
|
||||
.accEventThresholdHigh = SETTING_ACC_EVENT_THRESHOLD_HIGH_DEFAULT,
|
||||
.accEventThresholdLow = SETTING_ACC_EVENT_THRESHOLD_LOW_DEFAULT,
|
||||
.accEventThresholdNegX = SETTING_ACC_EVENT_THRESHOLD_NEG_X_DEFAULT,
|
||||
#endif
|
||||
|
||||
.mavlink = {
|
||||
.extended_status_rate = 2,
|
||||
.rc_channels_rate = 5,
|
||||
.position_rate = 2,
|
||||
.extra1_rate = 10,
|
||||
.extra2_rate = 2,
|
||||
.extra3_rate = 1
|
||||
.extended_status_rate = SETTING_MAVLINK_EXT_STATUS_RATE_DEFAULT,
|
||||
.rc_channels_rate = SETTING_MAVLINK_RC_CHAN_RATE_DEFAULT,
|
||||
.position_rate = SETTING_MAVLINK_POS_RATE_DEFAULT,
|
||||
.extra1_rate = SETTING_MAVLINK_EXTRA1_RATE_DEFAULT,
|
||||
.extra2_rate = SETTING_MAVLINK_EXTRA2_RATE_DEFAULT,
|
||||
.extra3_rate = SETTING_MAVLINK_EXTRA3_RATE_DEFAULT
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -68,14 +68,18 @@ typedef struct telemetryConfig_s {
|
|||
smartportFuelUnit_e smartportFuelUnit;
|
||||
uint8_t ibusTelemetryType;
|
||||
uint8_t ltmUpdateRate;
|
||||
|
||||
#ifdef USE_TELEMETRY_SIM
|
||||
int16_t simLowAltitude;
|
||||
char simGroundStationNumber[16];
|
||||
char simPin[8];
|
||||
uint16_t simTransmitInterval;
|
||||
uint8_t simTransmitFlags[4];
|
||||
uint8_t simTransmitFlags;
|
||||
|
||||
uint16_t accEventThresholdHigh;
|
||||
uint16_t accEventThresholdLow;
|
||||
uint16_t accEventThresholdNegX;
|
||||
int16_t simLowAltitude;
|
||||
uint8_t simGroundStationNumber[16];
|
||||
uint8_t simPin[8];
|
||||
#endif
|
||||
struct {
|
||||
uint8_t extended_status_rate;
|
||||
uint8_t rc_channels_rate;
|
||||
|
@ -98,4 +102,3 @@ void telemetryCheckState(void);
|
|||
void telemetryProcess(timeUs_t currentTimeUs);
|
||||
|
||||
bool telemetryDetermineEnabledState(portSharing_e portSharing);
|
||||
|
||||
|
|
|
@ -43,9 +43,13 @@ function(unit_test src)
|
|||
endif()
|
||||
list(TRANSFORM deps PREPEND "${MAIN_DIR}/")
|
||||
add_executable(${name} ${src} ${deps})
|
||||
target_include_directories(${name} PRIVATE . ${MAIN_DIR})
|
||||
set(gen_name ${name}_gen)
|
||||
get_generated_files_dir(gen ${gen_name})
|
||||
target_include_directories(${name} PRIVATE . ${MAIN_DIR} ${gen})
|
||||
target_compile_definitions(${name} PRIVATE ${test_definitions})
|
||||
set_target_properties(${name} PROPERTIES COMPILE_FLAGS "-pthread -Wall -Wextra -Wno-extern-c-compat -ggdb3 -O0")
|
||||
target_compile_options(${name} PRIVATE -pthread -Wall -Wextra -Wno-extern-c-compat -ggdb3 -O0)
|
||||
enable_settings(${name} ${gen_name} OUTPUTS setting_files SETTINGS_CXX g++)
|
||||
target_sources(${name} PRIVATE ${setting_files})
|
||||
target_link_libraries(${name} gtest_main)
|
||||
gtest_discover_tests(${name})
|
||||
add_custom_target("run-${name}" "${name}" DEPENDS ${name})
|
||||
|
|
|
@ -36,7 +36,10 @@ class Compiler
|
|||
# on Windows if PATH contains spaces.
|
||||
#dirs = ((ENV["CPP_PATH"] || "") + File::PATH_SEPARATOR + (ENV["PATH"] || "")).split(File::PATH_SEPARATOR)
|
||||
dirs = ((ENV["CPP_PATH"] || "") + File::PATH_SEPARATOR + (ENV["PATH"] || "")).split(File::PATH_SEPARATOR)
|
||||
bin = ENV["SETTINGS_CXX"]
|
||||
if bin.empty?
|
||||
bin = "arm-none-eabi-g++"
|
||||
end
|
||||
dirs.each do |dir|
|
||||
p = File.join(dir, bin)
|
||||
['', '.exe'].each do |suffix|
|
||||
|
|
185
src/utils/settings.rb
Normal file → Executable file
185
src/utils/settings.rb
Normal file → Executable file
|
@ -299,9 +299,11 @@ class Generator
|
|||
|
||||
load_data
|
||||
|
||||
check_member_default_values_presence
|
||||
sanitize_fields
|
||||
initialize_name_encoder
|
||||
initialize_value_encoder
|
||||
validate_default_values
|
||||
|
||||
write_header_file(header_file)
|
||||
write_impl_file(impl_file)
|
||||
|
@ -417,8 +419,33 @@ class Generator
|
|||
ii = 0
|
||||
foreach_enabled_member do |group, member|
|
||||
name = member["name"]
|
||||
type = member["type"]
|
||||
default_value = member["default_value"]
|
||||
|
||||
case
|
||||
when %i[ zero target ].include?(default_value)
|
||||
default_value = nil
|
||||
|
||||
when member.has_key?("table")
|
||||
table_name = member["table"]
|
||||
table_values = @tables[table_name]["values"]
|
||||
if table_name == 'off_on' and [false, true].include? default_value
|
||||
default_value = { false => '0', true => '1' }[default_value]
|
||||
else
|
||||
default_value = table_values.index default_value
|
||||
end
|
||||
|
||||
when type == "string"
|
||||
default_value = "{ #{[*default_value.bytes, 0] * ', '} }"
|
||||
|
||||
when default_value.is_a?(Float)
|
||||
default_value = default_value.to_s + ?f
|
||||
|
||||
end
|
||||
|
||||
min, max = resolve_range(member)
|
||||
setting_name = "SETTING_#{name.upcase}"
|
||||
buf << "#define #{setting_name}_DEFAULT #{default_value}\n" unless default_value.nil?
|
||||
buf << "#define #{setting_name} #{ii}\n"
|
||||
buf << "#define #{setting_name}_MIN #{min}\n"
|
||||
buf << "#define #{setting_name}_MAX #{max}\n"
|
||||
|
@ -444,6 +471,12 @@ class Generator
|
|||
end
|
||||
end
|
||||
|
||||
# When this file is compiled in unit tests, some of the tables
|
||||
# are not used and generate warnings, causing the test to fail
|
||||
# with -Werror. Silence them
|
||||
|
||||
buf << "#pragma GCC diagnostic ignored \"-Wunused-const-variable\"\n"
|
||||
|
||||
# Write PGN arrays
|
||||
pgn_steps = []
|
||||
pgns = []
|
||||
|
@ -629,44 +662,47 @@ class Generator
|
|||
return !cond || @true_conditions.include?(cond)
|
||||
end
|
||||
|
||||
def foreach_enabled_member
|
||||
@data["groups"].each do |group|
|
||||
def foreach_enabled_member &block
|
||||
enum = Enumerator.new do |yielder|
|
||||
groups.each do |group|
|
||||
if is_condition_enabled(group["condition"])
|
||||
group["members"].each do |member|
|
||||
if is_condition_enabled(member["condition"])
|
||||
yield group, member
|
||||
yielder.yield group, member
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
block_given? ? enum.each(&block) : enum
|
||||
end
|
||||
|
||||
def foreach_enabled_group
|
||||
def foreach_enabled_group &block
|
||||
enum = Enumerator.new do |yielder|
|
||||
last = nil
|
||||
foreach_enabled_member do |group, member|
|
||||
if last != group
|
||||
last = group
|
||||
yield group
|
||||
yielder.yield group
|
||||
end
|
||||
end
|
||||
end
|
||||
block_given? ? enum.each(&block) : enum
|
||||
end
|
||||
|
||||
def foreach_member
|
||||
def foreach_member &block
|
||||
enum = Enumerator.new do |yielder|
|
||||
@data["groups"].each do |group|
|
||||
group["members"].each do |member|
|
||||
yield group, member
|
||||
yielder.yield group, member
|
||||
end
|
||||
end
|
||||
end
|
||||
block_given? ? enum.each(&block) : enum
|
||||
end
|
||||
|
||||
def foreach_group
|
||||
last = nil
|
||||
foreach_member do |group, member|
|
||||
if last != group
|
||||
last = group
|
||||
yield group
|
||||
end
|
||||
end
|
||||
def groups
|
||||
@data["groups"]
|
||||
end
|
||||
|
||||
def initialize_tables
|
||||
|
@ -795,25 +831,27 @@ class Generator
|
|||
if !group["name"]
|
||||
raise "Missing group name"
|
||||
end
|
||||
|
||||
if !member["name"]
|
||||
raise "Missing member name in group #{group["name"]}"
|
||||
end
|
||||
|
||||
table = member["table"]
|
||||
if table
|
||||
if !@tables[table]
|
||||
raise "Member #{member["name"]} references non-existing table #{table}"
|
||||
end
|
||||
|
||||
@used_tables << table
|
||||
end
|
||||
|
||||
if !member["field"]
|
||||
member["field"] = member["name"]
|
||||
end
|
||||
|
||||
typ = member["type"]
|
||||
if !typ
|
||||
pending_types[member] = group
|
||||
elsif typ == "bool"
|
||||
if typ == "bool"
|
||||
has_booleans = true
|
||||
member["type"] = "uint8_t"
|
||||
member["table"] = OFF_ON_TABLE["name"]
|
||||
end
|
||||
end
|
||||
|
@ -825,7 +863,7 @@ class Generator
|
|||
@used_tables << OFF_ON_TABLE["name"]
|
||||
end
|
||||
|
||||
resolve_types pending_types unless !pending_types
|
||||
resolve_all_types
|
||||
foreach_enabled_member do |group, member|
|
||||
@count += 1
|
||||
@max_name_length = [@max_name_length, member["name"].length].max
|
||||
|
@ -835,9 +873,82 @@ class Generator
|
|||
end
|
||||
end
|
||||
|
||||
def validate_default_values
|
||||
foreach_enabled_member do |_, member|
|
||||
name = member["name"]
|
||||
type = member["type"]
|
||||
default_value = member["default_value"]
|
||||
|
||||
next if %i[ zero target ].include? default_value
|
||||
|
||||
case
|
||||
when type == "bool"
|
||||
raise "Member #{name} has an invalid default value" unless [ false, true ].include? default_value
|
||||
|
||||
when member.has_key?("table")
|
||||
table_name = member["table"]
|
||||
table_values = @tables[table_name]["values"]
|
||||
raise "Member #{name} has an invalid default value" unless table_values.include? default_value
|
||||
|
||||
when type =~ /\A(?<unsigned>u?)int(?<bitsize>8|16|32|64)_t\Z/
|
||||
unsigned = !$~[:unsigned].empty?
|
||||
bitsize = $~[:bitsize].to_i
|
||||
type_range = unsigned ? 0..(2**bitsize-1) : (-2**(bitsize-1)+1)..(2**(bitsize-1)-1)
|
||||
raise "Numeric member #{name} doesn't have maximum value defined" unless member.has_key? 'max'
|
||||
raise "Member #{name} default value has an invalid type, integer or symbol expected" unless default_value.is_a? Integer or default_value.is_a? Symbol
|
||||
raise "Member #{name} default value is outside type's storage range, min #{type_range.min}, max #{type_range.max}" unless default_value.is_a? Symbol or type_range === default_value
|
||||
|
||||
when type == "float"
|
||||
raise "Numeric member #{name} doesn't have maximum value defined" unless member.has_key? 'max'
|
||||
raise "Member #{name} default value has an invalid type, numeric or symbol expected" unless default_value.is_a? Numeric or default_value.is_a? Symbol
|
||||
|
||||
when type == "string"
|
||||
max = member["max"].to_i
|
||||
raise "Member #{name} default value has an invalid type, string expected" unless default_value.is_a? String
|
||||
raise "Member #{name} default value is too long (max #{max} chars)" if default_value.bytesize > max
|
||||
|
||||
else
|
||||
raise "Unexpected type for member #{name}: #{type.inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def scan_types(stderr)
|
||||
types = Hash.new
|
||||
# gcc 6-9
|
||||
stderr.scan(/var_(\d+).*?['’], which is of non-class type ['‘](.*)['’]/).each do |m|
|
||||
member_idx = m[0].to_i
|
||||
type = m[1]
|
||||
types[member_idx] = type
|
||||
end
|
||||
# clang
|
||||
stderr.scan(/member reference base type '(.*?)'.*?is not a structure or union.*? var_(\d+)/m).each do |m|
|
||||
member_idx = m[1].to_i
|
||||
type = m[0]
|
||||
types[member_idx] = type
|
||||
end
|
||||
return types
|
||||
end
|
||||
|
||||
def resolve_all_types()
|
||||
loop do
|
||||
pending = Hash.new
|
||||
foreach_enabled_member do |group, member|
|
||||
if !member["type"]
|
||||
pending[member] = group
|
||||
end
|
||||
end
|
||||
|
||||
if pending.empty?
|
||||
# All types resolved
|
||||
break
|
||||
end
|
||||
|
||||
resolve_types(pending)
|
||||
end
|
||||
end
|
||||
|
||||
def resolve_types(pending)
|
||||
# TODO: Loop to avoid reaching the maximum number
|
||||
# of errors printed by the compiler.
|
||||
prog = StringIO.new
|
||||
prog << "int main() {\n"
|
||||
ii = 0
|
||||
|
@ -853,9 +964,13 @@ class Generator
|
|||
prog << "return 0;\n"
|
||||
prog << "};\n"
|
||||
stderr = compile_test_file(prog)
|
||||
stderr.scan(/var_(\d+).*?', which is of non-class type '(.*)'/).each do |m|
|
||||
member = members[m[0].to_i]
|
||||
case m[1]
|
||||
types = scan_types(stderr)
|
||||
if types.empty?
|
||||
raise "No types resolved from #{stderr}"
|
||||
end
|
||||
types.each do |idx, type|
|
||||
member = members[idx]
|
||||
case type
|
||||
when /^int8_t/ # {aka signed char}"
|
||||
typ = "int8_t"
|
||||
when /^uint8_t/ # {aka unsigned char}"
|
||||
|
@ -878,12 +993,6 @@ class Generator
|
|||
dputs "#{member["name"]} type is #{typ}"
|
||||
member["type"] = typ
|
||||
end
|
||||
# Make sure all types have been resolved
|
||||
foreach_enabled_member do |group, member|
|
||||
if !member["type"]
|
||||
raise "Could not resolve type for member #{member["name"]} in group #{group["name"]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_name_encoder
|
||||
|
@ -925,6 +1034,11 @@ class Generator
|
|||
@value_encoder = ValueEncoder.new(values, constantValues)
|
||||
end
|
||||
|
||||
def check_member_default_values_presence
|
||||
missing_default_value_names = foreach_member.inject([]) { |names, (_, member)| member.has_key?("default_value") ? names : names << member["name"] }
|
||||
raise "Missing default value for #{missing_default_value_names.count} member#{"s" unless missing_default_value_names.one?}: #{missing_default_value_names * ", "}" unless missing_default_value_names.empty?
|
||||
end
|
||||
|
||||
def resolve_constants(constants)
|
||||
return nil unless constants.length > 0
|
||||
s = Set.new
|
||||
|
@ -936,7 +1050,9 @@ class Generator
|
|||
# warnings to find these constants, the compiler
|
||||
# might reach the maximum number of errors and stop
|
||||
# compilation, so we might need multiple passes.
|
||||
re = /required from 'class expr_(.*?)<(.*)>'/
|
||||
gcc_re = /required from ['‘]class expr_(.*?)<(.*?)>['’]/ # gcc 6-9
|
||||
clang_re = / template class 'expr_(.*?)<(.*?)>'/ # clang
|
||||
res = [gcc_re, clang_re]
|
||||
values = Hash.new
|
||||
while s.length > 0
|
||||
buf = StringIO.new
|
||||
|
@ -956,7 +1072,12 @@ class Generator
|
|||
ii += 1
|
||||
end
|
||||
stderr = compile_test_file(buf)
|
||||
matches = []
|
||||
res.each do |re|
|
||||
if matches.length == 0
|
||||
matches = stderr.scan(re)
|
||||
end
|
||||
end
|
||||
if matches.length == 0
|
||||
puts stderr
|
||||
raise "No more matches looking for constants"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue