243行:
#define SPEED_LOOP_FREQUENCY_HZ 1000
#define PID_SPEED_KP_DEFAULT 19736 //PID中P值初始值
#define PID_SPEED_KI_DEFAULT 800 //PID中I值初始值
#define PID_SPEED_KD_DEFAULT 0
#define SP_KPDIV 512 //PID中P值除以的系數 越大則P的控制越弱
#define SP_KIDIV 16384 //PID中I值除以的系數
#define SP_KDDIV 16
#define SPD_DIFFERENTIAL_TERM_ENABLING DISABLE //PID中微分未使用
電機啟動參數調節(分幾步開環啟動及所需的時間、速度等):
#define ALIGNMENT_DURATION 700
#define ALIGNMENT_ANGLE_DEG 90
#define FINAL_I_ALIGNMENT 2997
// With ALIGNMENT_ANGLE_DEG equal to 90 degrees final alignment
// phase current = (FINAL_I_ALIGNMENT * 1.65/ Av)/(32767 * Rshunt)
// being Av the voltage gain between Rshunt and A/D input
#define STARTING_ANGLE_DEG 90
#define PHASE1_DURATION100
#define PHASE1_FINAL_SPEED_RPM 50
#define PHASE1_FINAL_CURRENT 2075
#define PHASE2_DURATION500
#define PHASE2_FINAL_SPEED_RPM 500
#define PHASE2_FINAL_CURRENT 2151
#define PHASE3_DURATION200
#define PHASE3_FINAL_SPEED_RPM 1000
#define PHASE3_FINAL_CURRENT 2227
#define PHASE4_DURATION200
#define PHASE4_FINAL_SPEED_RPM 2000
#define PHASE4_FINAL_CURRENT 4150 //4150
#define PHASE5_DURATION2000
#define PHASE5_FINAL_SPEED_RPM 2000
#define PHASE5_FINAL_CURRENT 4150 //4150
#define ENABLE_SL_ALGO_FROM_PHASE 3 //啟動需幾個階段