RC_Channel: use float for stick mixing

This commit is contained in:
Iampete1 2021-09-18 18:55:21 +01:00 committed by Andrew Tridgell
parent b84633630a
commit 14b9e99020
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;