#ifndef _FOC_CONFIG_H__
#define _FOC_CONFIG_H__
#include "math/fast_math.h"

#define CONFIG_DEFAULT_IDC_LIM 45
#define CONFIG_DEFAULT_PHASE_CURR_LIM 200
#define CONFIG_DEFAULT_RPM_LIM       3500
#define CONFIG_DEFAULT_LOCK_PHASE_CURR_LIM 100

#define CONFIG_DEFAULT_EPM_PHASE_CURR 50
#define CONFIG_DEFAULT_EPM_RPM        200
#define CONFIG_DEFAULT_EBRK_PHASE_CURR 10.0F //0:means disable ebrake
#define CONFIG_DEFAULT_EBRK_IDC_LIM 15
#define CONFIG_SVM_MODULATION       1.0f//(1.0F/SQRT3_BY_2)
#define CONFIG_BRK_SHUT_POWER_ENABLE 1
#define CONFIG_AUTOHOLD_ENABLE 1
#define CONFIG_DEFAULT_FW_ENABLE 1
/* 转把 */
#define CONFIG_THROTTLE_LOW_VALUE 1.2f /* 转把最小值 */
#define CONFIG_THROTTLE_MAX_VALUE 3.8f /* 转把最大值 */
#define CONFIG_THROTTLE_MIN_RPM   10   /* 转把对应最小的速度 */
#define CONFIG_THROTTLE_MIN_IDQ   20   /* 转把对应最小的扭矩电流 Q轴 */
#define CONFIG_MIN_CRUISE_RPM 	  1000   /* 能启动定速巡航的最小速度 */

#define CONFIG_MIN_RPM_FOR_EBRAKE 800 //进入电流回收的最小转速
#define CONFIG_MIN_CURRENT_FOR_EBRK 100.0F
#define CONFIG_MIN_RPM_EXIT_EBRAKE 100 //推出电流回收的最小转速

#define CONFIG_IDQ_CTRL_TS FOC_PWM_FS
#define CONFIG_SPD_CTRL_TS 1000
#define CONFIG_SPD_CTRL_MS (1000/CONFIG_SPD_CTRL_TS)
#define CONFIG_SPD_CTRL_US (CONFIG_SPD_CTRL_MS * 1000)
#define CONFIG_FOC_VDQ_RAMP_TS 100
#define CONFIG_FOC_VDQ_RAMP_FINAL_TIME 3000

/* 电子刹车，动能回收，加速 */
#define CONFIG_eCTRL_STEP_TS CONFIG_SPD_CTRL_MS     /* 斜率给定的step的时间值，单位 ms */
#define CONFIG_eCTRL_Brake_TIME 1500     /* 捏住刹车的时间，超过这个时间启动ebrake，单位 ms */
#define CONFIG_ACC_TIME 3000
#define CONFIG_DEC_TIME 2000
#define CONFIG_EBRK_RAMP_TIME 500
#define CONFIG_AUTOHOLD_DETECT_TIME 3000

#define CONFIG_LIMIT_RAMP_TIME (10 * 1000)

#define CONFIG_MTPA_CALI_RAMP_TIME (10 * 1000)

#define CONFIG_RAMP_SECOND_STEP (0.1F)
#define CONFIG_RAMP_SECOND_TARGET (5.0F)

#define CONFIG_RAMP_CROSS_ZERO_STEP (0.1F)

#define CURRENT_LOOP_RAMP_COUNT 300

#define CONFIG_TORQUE_MODE_MIN_RPM 600

#endif /* _FOC_CONFIG_H__ */

