User Tools

Site Tools


docs:config.h

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:config.h [2017/10/21 01:37]
silverxxx
docs:config.h [2017/10/31 11:50] (current)
silverxxx
Line 1: Line 1:
-==== Config.h settings ====+====== Config.h settings ======
  
-Settings found in config.h are used for customizing quadcopter flight settings and a number of software settings.+Settings found in config.h are used for customizing the quadcopter'flight settings and a number of software settings. It's not neccesary to change most options, mainly rate and channels as they are a matter of preference.
  
-==== Flight control settings ==== +==== Rate ====
- +
-This settings comprise of rate control, high and low, expo, if needed to be performed by quad itself ( for stock tx) and switch config, mainly for level mode switching. +
- +
-=== Rate ===+
  
 The rate is changed by the following lines in config.h file. The unit is degrees / second. The number is the rotation rate at max stick deflection, for example 360 would perform a full turn in 1 second. The rate is changed by the following lines in config.h file. The unit is degrees / second. The number is the rotation rate at max stick deflection, for example 360 would perform a full turn in 1 second.
Line 24: Line 20:
 </code> </code>
  
-=== Switches (auxiliary channels) ===+==== Expo ==== 
 + 
 +Normally, expo would be set in the transmitter, but if required it can also be set in software 
 + 
 +<code> 
 +//#define DISABLE_EXPO 
 + 
 +#define EXPO_XY 0.3 
 +#define EXPO_YAW 0.3 
 +</code> 
 + 
 +Range is 0.0 - 1.0, where zero is linear. Higher numbers are less sensitive near center, values 0.6 - 0.8 are commonly used ( 60% - 80% ) 
 + 
 +==== Switches (auxiliary channels) ====
  
 Switches/buttons are used to control functions such as level/acro mode change, dual rates and flips. Switches/buttons are used to control functions such as level/acro mode change, dual rates and flips.
Line 35: Line 44:
 // level / acro mode switch // level / acro mode switch
  
-// CH_FLIP - 0 - flip +// CH_FLIP - flip 
-// CH_EXPERT - 1 - expert +// CH_EXPERT - expert 
-// CH_HEADFREE - 2 - headfree +// CH_HEADFREE - headfree 
-// CH_RTH - 3 - headingreturn +// CH_RTH - headingreturn 
-// CH_AUX1 - 4 - AUX1 ( gestures <<v and>>v) +// CH_AUX1 - AUX1 ( gestures <<v and>>v) 
-// CH_PIT_TRIM - 6 - Pitch trims +// CH_PIT_TRIM - Pitch trims ***1** 
-// CH_RLL_TRIM - 7 - Roll trims +// CH_RLL_TRIM - Roll trims ***1** 
-// CH_THR_TRIM - 8 - Throttle trims +// CH_THR_TRIM - Throttle trims ***1** 
-// CH_YAW_TRIM - 9 - Yaw trims +// CH_YAW_TRIM - Yaw trims ***1** 
-// CH_INV 10 - Inverted mode +// CH_INV - Inverted mode 
-// CH_VID 7 - +// CH_VID 
-// CH_PIC 8 - +// CH_PIC 
-// CH_ON - 10 - on always +// CH_ON - on always 
-// CH_OFF - 11 - off always +// CH_OFF - off always 
-//+
 // devo can use DEVO_CHAN_5 - DEVO_CHAN_10 // devo can use DEVO_CHAN_5 - DEVO_CHAN_10
  
 #define RATES CH_EXPERT #define RATES CH_EXPERT
- 
 #define LEVELMODE CH_AUX1 #define LEVELMODE CH_AUX1
- 
 #define STARTFLIP CH_OFF #define STARTFLIP CH_OFF
 +#define LEDS_ON CH_FLIP
  
-#define LEDS_ON CH_FLIP+// ***1**  available only when #define USE_STOCK_TX is set
 </code> </code>
  
 Special channels: Not all channels are sent from the transmitter, some channels are based in the software, currently only gesture controlled channels CH_AUX1. Special channels: Not all channels are sent from the transmitter, some channels are based in the software, currently only gesture controlled channels CH_AUX1.
  
-**Stock tx**+Available channels depend on the //radio protocol// selected, the ones described are for Bayang protocol ( recomended ) 
 +=== Stock tx ===
  
 The trim buttons do not do anything in the stock tx. To use the trims for controlling a function, set the function channel to the trim (such as CH_PIT_TRIM - pitch trims) and enable "#define USE_STOCK_TX" The trim buttons do not do anything in the stock tx. To use the trims for controlling a function, set the function channel to the trim (such as CH_PIT_TRIM - pitch trims) and enable "#define USE_STOCK_TX"
  
 //Do not enable "**#define USE_STOCK_TX**" if you want to use a devo or tx module and the trims are set as a function!// //Do not enable "**#define USE_STOCK_TX**" if you want to use a devo or tx module and the trims are set as a function!//
 +=== Devo tx ===
  
-**Devo tx** +Silverware supports setting a channel number as found in DeviationTX:<font 14px/inherit;;inherit;;inherit>DEVO_CHAN_5 - DEVO_CHAN_10 for use with deviaton tx or with nrf_multipro module.</font>
- +
-In the above code the level function is set to "CH_AUX1" which is the "gestures channel". This is the default, since it works with any tx. For devo, you could set it to "CH_RTH" instead, for example (return home channel+
- +
-The devo channels are assigned as follows in the devo itself:+
  
 <code> <code>
-    CHANNEL1      // Aileron +#define LEDS_ON DEVO_CHAN_9 // sets leds to channel 9
-    CHANNEL2,     // Elevator +
-    CHANNEL3,     // Throttle +
-    CHANNEL4,     // Rudder +
-    DEVO_CHAN_5     // Leds / Inverted +
-    DEVO_CHAN_6     // Flip +
-    DEVO_CHAN_7     // Still camera +
-    DEVO_CHAN_8     // Video camera +
-    DEVO_CHAN_9     // Headless +
-    DEVO_CHAN_10    // Return To Home +
-    DEVO_CHAN_11    // Calibrate+
 </code> </code>
- 
-Silverware also supports to set simply a channel number as numbered in DeviationTX:<font 14px/inherit;;inherit;;inherit>DEVO_CHAN_5 - DEVO_CHAN_11 for use with deviaton tx or with nrf_multipro module.</font> 
  
 For the multimodule, use MULTI_CHAN_5 for channel 5, for example. For the multimodule, use MULTI_CHAN_5 for channel 5, for example.
  
-==== Other settings ==== +==== Auto throttle feature ====
- +
-**Auto throttle feature:**+
  
 The auto throttle will keep a constant upwards thrust as the quad leans in one direction. Used in level mode, usually. The auto throttle will keep a constant upwards thrust as the quad leans in one direction. Used in level mode, usually.
Line 105: Line 97:
 </code> </code>
  
-**Lower throttle feature**+==== Lower throttle feature ====
  
-With this option enabled, the quadcopter will lower the throttle in order to maintain better control near full throttle. Without it (default) the quadcopter will usually lean slightly in one direction at full throttle, as there may not be enough control ability. (the motors can't increase over maximum)+With this option enabled, the quadcopter will lower the throttle in order to maintain better control near full throttle. Without it (default) the quadcopter will usually lean slightly in one direction at full throttle, as there may not be enough control ability. ( at least one motor is producing maximum thrust ). The throttle is lowered by an amount as such that the motors are no longer maxed.
  
-<code> +Usually, other firmwares have this option enabled, but in silverware it is optional, because it results in a loss of thrust at full throttle, which small brushed quads most certainly can do without.
-#define MIX_LOWER_THROTTLE +
-</code>+
  
-**Motor filter feature**+An opposite option, increase thrust, is of use when throttle is near zero, and will improve control in such situations. The increase throttle option should be used with care while tuning quadcopters, as oscillation could result in continuous ascend.
  
-The motor filter is a tap hanning fir filter that is applied to the motor output. Enabled by defaultas it uses little resources.+The "type 3" mix is more useful with brushless builds, it's instant acting, but it also has the largest throttle loss (or increase ).
  
 <code> <code>
-#define MOTOR_FILTER +#define MIX_LOWER_THROTTLE 
-</code>+//#define MIX_INCREASE_THROTTLE
  
-**Clipff feature** +//#define MIX_LOWER_THROTTLE_3 
- +//#define MIX_INCREASE_THROTTLE_3
-The clip feedforward feature is an experimental feature that is supposed to help improve control near full throttle, and also help with vibration issues. It may also improve maximum throttle by a small amount in presence of vibration. +
- +
-<code> +
-#define CLIP_FF+
 </code> </code>
  
-**Throttle transient compensation feature**+==== Throttle transient compensation ====
  
-The TTCF feature improves throttle response of the quadcopter. The curve has been measured for 6mm motors, and it may not work the same with other motors. With this feature on, the quadcopter will react faster to throttle changes.+The TTCF feature improves throttle response of the quadcopter. The curve has been measured for 6mm motors, and it may not work the same with other motors. The factor can be adjusted also by adding the line to config.h. With this feature on, the quadcopter will react faster to throttle changes.
  
-This feature only works on the throttle stick, it does not affect controls in any other way.+This feature only works on the throttle stick, it does not affect controls in any other way. However, the increase motor use may reduce flight time.
  
 <code> <code>
 #define THROTTLE_TRANSIENT_COMPENSATION #define THROTTLE_TRANSIENT_COMPENSATION
 +
 +// this line may be added
 +#define THROTTLE_TRANSIENT_COMPENSATION_FACTOR 7.0
 </code> </code>
  
-**Gyro lpf filter (software)**+==== Gyro lpf filter (software) ==== 
 + 
 +The software lpf filter is a custom gyro filter, additional to the hardware filter which is present in the gyro device. The hardware filter is set around 43Hz by default, but for additional vibration removal, a software filter can be added.
  
-The software lpf filter is a custom gyro filter, additional to the hardware filter which is present in the gyro device. The hardware filter is set around 43Hz by default, but for additional vibration removal, a software filter can be added. Recommended: 2nd order 88, 4th order 88 .+Changing the filters affects the tuning of the pidsit'good idea to consider the filter before tuning.
  
-Enabling the filter may require slight lowering of D termif set near maximumA lowering of D term may need lowering of P termAs such , it's probably good idea to have the filter enabled before you tune a quad.+The last 2 filters have custom frequencyand they also account for variable sample rate, or different from defaultThey are recommended with gcc as the loop time is exceeded thereAll other filters are calculated for loop time of 1Khz ( 1000 uS).
  
 <code> <code>
Line 155: Line 146:
 //#define SOFT_LPF_4TH_160HZ //#define SOFT_LPF_4TH_160HZ
 //#define SOFT_LPF_4TH_250HZ //#define SOFT_LPF_4TH_250HZ
 +//#define SOFT_LPF_1ST_HZ 100
 +//#define SOFT_LPF_2ST_HZ 100
 //#define SOFT_LPF_NONE //#define SOFT_LPF_NONE
 </code> </code>
  
-**Gyro lpf filter (hardware)**+==== Gyro lpf filter (hardware) ====
  
-The hardware gyro lpf filter is part of the gyro integrated circuit. It's setting changes the frequency of the internal filter. The internal filter also has a latency which may affect pid D term. A lower latency may be better, however vibration will limit the usefulness of higher gyro frequencies.+The hardware gyro lpf filter is part of the gyro integrated circuit. It's setting changes the frequency of the internal filter. The internal filter also has a latency which may affect pid P and terms. A lower latency may be better, however vibration will limit the usefulness of higher gyro frequencies. The "0" setting should be avoided.
  
 <code> <code>
Line 167: Line 160:
 // gyro filter 2 = 92hz delay 3.9mS // gyro filter 2 = 92hz delay 3.9mS
 // gyro filter 3 = 41hz delay 5.9mS (Default) // gyro filter 3 = 41hz delay 5.9mS (Default)
-// gyro filter 4 = 20hz 
-// gyro filter 5 = 10hz 
-// gyro filter 6 = 5hz 
-// gyro filter 7 = 3600hz delay 0.17mS 
  
 #define GYRO_LOW_PASS_FILTER 3 #define GYRO_LOW_PASS_FILTER 3
 </code> </code>
 +
 +==== Motor filter feature ====
 +
 +There are 2 motor filtering options, a hanning 3 tap filter which reduces very high frequencies only, and a 1st order low pass filter that uses a coefficient as a setting. The motor filter has effects on pid tuning similar to those of the gyro low pass filters.
 +
 +<code>
 +// enable motor filter - select one
 +// motorfilter1: hanning 3 sample fir filter
 +// motorfilter2: 1st lpf, 0.2 - 0.6 , 0.6 = less filtering
 +//#define MOTOR_FILTER
 +#define MOTOR_FILTER2_ALPHA 0.3
 +</code>
 +
 +==== Motor curve ====
 +
 +In silverware, the motors are linearized so that the resulting thrust is linear. the curves are obtained by measuring the motors and propellor combination. Although it's not necessary to know the curve, using a curve allows the pids to be consistent across the throttle range.
 +
 +Motor linearity changes somewhat with pwm frequency, and for this reason each curve also has a frequency at which it was measured.
 +
 +<code>
 +// pwm frequency for motor control
 +#define PWMFREQ 24000
 +
 +// motor curve to use
 +// the pwm frequency has to be set independently
 +//#define MOTOR_CURVE_NONE
 +//#define MOTOR_CURVE_85MM_32KHZ
 +//#define BOLDCLASH_716MM_8K
 +#define BOLDCLASH_716MM_24K
 +</code>
 +
 +==== Other settings ====
 +
 +There are a number of other settings in config.h, as well as in some other files. They are less common, and not described in this document. Additionally, some settings may change in the future, keep in mind this document is not updated as often as the code.
  
  
docs/config.h.1508542662.txt.gz · Last modified: 2017/10/21 01:37 by silverxxx