RC_Channel: use float for stick mixing
This commit is contained in:
parent
b84633630a
commit
14b9e99020
@ -369,14 +369,14 @@ bool RC_Channel::has_override() const
|
||||
controller as it increases the influence of the users stick input,
|
||||
allowing the user full deflection if needed
|
||||
*/
|
||||
int16_t RC_Channel::stick_mixing(const int16_t servo_in)
|
||||
float RC_Channel::stick_mixing(const float servo_in)
|
||||
{
|
||||
float ch_inf = (float)(radio_in - radio_trim);
|
||||
ch_inf = fabsf(ch_inf);
|
||||
ch_inf = MIN(ch_inf, 400.0f);
|
||||
ch_inf = ((400.0f - ch_inf) / 400.0f);
|
||||
|
||||
int16_t servo_out = servo_in;
|
||||
float servo_out = servo_in;
|
||||
servo_out *= ch_inf;
|
||||
servo_out += control_in;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
void set_override(const uint16_t v, const uint32_t timestamp_ms);
|
||||
bool has_override() const;
|
||||
|
||||
int16_t stick_mixing(const int16_t servo_in);
|
||||
float stick_mixing(const float servo_in);
|
||||
|
||||
// get control input with zero deadzone
|
||||
int16_t get_control_in_zero_dz(void) const;
|
||||
|
Loading…
Reference in New Issue
Block a user