mirror of https://github.com/rusefi/bldc.git
Add high voltage tiltback
This commit is contained in:
parent
9f263b8c1a
commit
3c31d264fd
|
@ -303,8 +303,11 @@
|
||||||
#ifndef APPCONF_BALANCE_TILTBACK_SPEED
|
#ifndef APPCONF_BALANCE_TILTBACK_SPEED
|
||||||
#define APPCONF_BALANCE_TILTBACK_SPEED 5.0
|
#define APPCONF_BALANCE_TILTBACK_SPEED 5.0
|
||||||
#endif
|
#endif
|
||||||
#ifndef APPCONF_BALANCE_TILTBACK_VOLTAGE
|
#ifndef APPCONF_BALANCE_TILTBACK_HIGH_V
|
||||||
#define APPCONF_BALANCE_TILTBACK_VOLTAGE 0.0
|
#define APPCONF_BALANCE_TILTBACK_HIGH_V 100.0
|
||||||
|
#endif
|
||||||
|
#ifndef APPCONF_BALANCE_TILTBACK_LOW_V
|
||||||
|
#define APPCONF_BALANCE_TILTBACK_LOW_V 0.0
|
||||||
#endif
|
#endif
|
||||||
#ifndef APPCONF_BALANCE_STARTUP_M_TOLERANCE
|
#ifndef APPCONF_BALANCE_STARTUP_M_TOLERANCE
|
||||||
#define APPCONF_BALANCE_STARTUP_M_TOLERANCE 20.0
|
#define APPCONF_BALANCE_STARTUP_M_TOLERANCE 20.0
|
||||||
|
|
|
@ -254,7 +254,8 @@ static THD_FUNCTION(balance_thread, arg) {
|
||||||
|
|
||||||
// Over speed tilt back safety
|
// Over speed tilt back safety
|
||||||
if(fabsf(mc_interface_get_duty_cycle_now()) > balance_conf.tiltback_duty ||
|
if(fabsf(mc_interface_get_duty_cycle_now()) > balance_conf.tiltback_duty ||
|
||||||
(fabsf(mc_interface_get_duty_cycle_now()) > 0.05 && GET_INPUT_VOLTAGE() < balance_conf.tiltback_voltage)){
|
(fabsf(mc_interface_get_duty_cycle_now()) > 0.05 && GET_INPUT_VOLTAGE() > balance_conf.tiltback_high_voltage) ||
|
||||||
|
(fabsf(mc_interface_get_duty_cycle_now()) > 0.05 && GET_INPUT_VOLTAGE() < balance_conf.tiltback_low_voltage)){
|
||||||
if(mc_interface_get_duty_cycle_now() > 0){
|
if(mc_interface_get_duty_cycle_now() > 0){
|
||||||
setpoint_target = balance_conf.tiltback_angle;
|
setpoint_target = balance_conf.tiltback_angle;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -234,7 +234,8 @@ int32_t confgenerator_serialize_appconf(uint8_t *buffer, const app_configuration
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_duty, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_duty, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_angle, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_angle, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_speed, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_speed, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_voltage, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_high_voltage, &ind);
|
||||||
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.tiltback_low_voltage, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_m_tolerance, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_m_tolerance, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_c_tolerance, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_c_tolerance, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_speed, &ind);
|
buffer_append_float32_auto(buffer, conf->app_balance_conf.startup_speed, &ind);
|
||||||
|
@ -500,7 +501,8 @@ bool confgenerator_deserialize_appconf(const uint8_t *buffer, app_configuration
|
||||||
conf->app_balance_conf.tiltback_duty = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.tiltback_duty = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.tiltback_angle = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.tiltback_angle = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.tiltback_speed = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.tiltback_speed = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.tiltback_voltage = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.tiltback_high_voltage = buffer_get_float32_auto(buffer, &ind);
|
||||||
|
conf->app_balance_conf.tiltback_low_voltage = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.startup_m_tolerance = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.startup_m_tolerance = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.startup_c_tolerance = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.startup_c_tolerance = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->app_balance_conf.startup_speed = buffer_get_float32_auto(buffer, &ind);
|
conf->app_balance_conf.startup_speed = buffer_get_float32_auto(buffer, &ind);
|
||||||
|
@ -750,7 +752,8 @@ void confgenerator_set_defaults_appconf(app_configuration *conf) {
|
||||||
conf->app_balance_conf.tiltback_duty = APPCONF_BALANCE_TILTBACK_DUTY;
|
conf->app_balance_conf.tiltback_duty = APPCONF_BALANCE_TILTBACK_DUTY;
|
||||||
conf->app_balance_conf.tiltback_angle = APPCONF_BALANCE_TILTBACK_ANGLE;
|
conf->app_balance_conf.tiltback_angle = APPCONF_BALANCE_TILTBACK_ANGLE;
|
||||||
conf->app_balance_conf.tiltback_speed = APPCONF_BALANCE_TILTBACK_SPEED;
|
conf->app_balance_conf.tiltback_speed = APPCONF_BALANCE_TILTBACK_SPEED;
|
||||||
conf->app_balance_conf.tiltback_voltage = APPCONF_BALANCE_TILTBACK_VOLTAGE;
|
conf->app_balance_conf.tiltback_high_voltage = APPCONF_BALANCE_TILTBACK_HIGH_V;
|
||||||
|
conf->app_balance_conf.tiltback_low_voltage = APPCONF_BALANCE_TILTBACK_LOW_V;
|
||||||
conf->app_balance_conf.startup_m_tolerance = APPCONF_BALANCE_STARTUP_M_TOLERANCE;
|
conf->app_balance_conf.startup_m_tolerance = APPCONF_BALANCE_STARTUP_M_TOLERANCE;
|
||||||
conf->app_balance_conf.startup_c_tolerance = APPCONF_BALANCE_STARTUP_C_TOLERANCE;
|
conf->app_balance_conf.startup_c_tolerance = APPCONF_BALANCE_STARTUP_C_TOLERANCE;
|
||||||
conf->app_balance_conf.startup_speed = APPCONF_BALANCE_STARTUP_SPEED;
|
conf->app_balance_conf.startup_speed = APPCONF_BALANCE_STARTUP_SPEED;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
#define MCCONF_SIGNATURE 503309878
|
#define MCCONF_SIGNATURE 503309878
|
||||||
#define APPCONF_SIGNATURE 3223366057
|
#define APPCONF_SIGNATURE 183781183
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *conf);
|
int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *conf);
|
||||||
|
|
|
@ -507,7 +507,8 @@ typedef struct {
|
||||||
float tiltback_duty;
|
float tiltback_duty;
|
||||||
float tiltback_angle;
|
float tiltback_angle;
|
||||||
float tiltback_speed;
|
float tiltback_speed;
|
||||||
float tiltback_voltage;
|
float tiltback_high_voltage;
|
||||||
|
float tiltback_low_voltage;
|
||||||
float startup_m_tolerance;
|
float startup_m_tolerance;
|
||||||
float startup_c_tolerance;
|
float startup_c_tolerance;
|
||||||
float startup_speed;
|
float startup_speed;
|
||||||
|
|
Loading…
Reference in New Issue