Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_EFI/AP_EFI_ThrottleLinearisation.cpp
Views: 1798
#include "AP_EFI_config.h"12#if AP_EFI_THROTTLE_LINEARISATION_ENABLED34#include "AP_EFI.h"5#include <AP_Param/AP_Param.h>67// settings for throttle linearisation8const AP_Param::GroupInfo AP_EFI_ThrLin::var_info[] = {910// @Param: _EN11// @DisplayName: Enable throttle linearisation12// @Description: Enable EFI throttle linearisation13// @Values: 0:Disabled, 1:Enabled14// @User: Advanced15AP_GROUPINFO_FLAGS("_EN", 1, AP_EFI_ThrLin, enable, 0, AP_PARAM_FLAG_ENABLE),1617// @Param: _COEF118// @DisplayName: Throttle linearisation - First Order19// @Description: First Order Polynomial Coefficient. (=1, if throttle is first order polynomial trendline)20// @Range: -1 121// @User: Advanced22// @RebootRequired: True23AP_GROUPINFO("_COEF1", 2, AP_EFI_ThrLin, coefficient[0], 1),2425// @Param: _COEF226// @DisplayName: Throttle linearisation - Second Order27// @Description: Second Order Polynomial Coefficient (=0, if throttle is second order polynomial trendline)28// @Range: -1 129// @User: Advanced30// @RebootRequired: True31AP_GROUPINFO("_COEF2", 3, AP_EFI_ThrLin, coefficient[1], 0),3233// @Param: _COEF334// @DisplayName: Throttle linearisation - Third Order35// @Description: Third Order Polynomial Coefficient. (=0, if throttle is third order polynomial trendline)36// @Range: -1 137// @User: Advanced38// @RebootRequired: True39AP_GROUPINFO("_COEF3", 4, AP_EFI_ThrLin, coefficient[2], 0),4041// @Param: _OFS42// @DisplayName: throttle linearization offset43// @Description: Offset for throttle linearization44// @Range: 0 10045// @User: Advanced46// @RebootRequired: True47AP_GROUPINFO("_OFS", 5, AP_EFI_ThrLin, offset, 0),4849AP_GROUPEND50};5152AP_EFI_ThrLin::AP_EFI_ThrLin(void)53{54AP_Param::setup_object_defaults(this, var_info);55}5657/*58apply throttle linearisation59*/60float AP_EFI_ThrLin::linearise_throttle(float throttle_percent)61{62if (!enable) {63return throttle_percent;64}65float ret = coefficient[0] * throttle_percent;66ret += coefficient[1] * throttle_percent * throttle_percent;67ret += coefficient[2] * throttle_percent * throttle_percent * throttle_percent;68ret += offset;69return ret;70}7172#endif // AP_EFI_THROTTLE_LINEARISATION_ENABLED73747576