ソースを参照

update fsm

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 年 前
コミット
9431490e92

+ 1 - 1
Applications/app/app.c

@@ -26,7 +26,7 @@ static void _can_report_info(void) {
 	current_samp_t *s = foc_get_current_sample();
 	can_report_phase_current(0x45, F2I(s->Ia * 1000), F2I(s->Ib * 1000), F2I(s->Ic * 1000));
 	//sys_debug("phase current %f %f %f %f\n", s->Ia, s->Ib, s->Ic, s->max_Ia);
-	sys_debug("phase offset %d %d %d\n", s->adc_offset_a, s->adc_offset_b, s->adc_offset_c);
+	//sys_debug("phase offset %d %d %d\n", s->adc_offset_a, s->adc_offset_b, s->adc_offset_c);
 	s->max_Ia = 0.0f;
 }
 

+ 0 - 1
Applications/foc/foc_api.c

@@ -76,7 +76,6 @@ void foc_stop(void) {
 
 void foc_clear(void) {
 	foc_defulat_value();
-	hall_sensor_clear();
 }
 
 u32 foc_get_speed(void) {

+ 1 - 1
Applications/foc/foc_fsm.c

@@ -51,10 +51,10 @@ foc_fault_t foc_fsm_next_state(foc_state_t state) {
 void foc_fsm(motor_foc_t *foc) {
 	switch (foc->state) {
 		case IDLE:
-			foc_clear();
 			foc->mode = FOC_MODE_OPEN_LOOP;
 			break;
 		case START:
+			foc_clear();
 			pwm_turn_on_low_side();
 			foc_fsm_next_state(CURRENT_CALIBRATE);
 			break;

+ 2 - 2
Applications/foc/hall_sensor.c

@@ -208,7 +208,7 @@ int hall_sensor_calibrate(float voltage){
 	for (int i = 0;i < 5;i++) {
 		for (int j = 0;j < 360;j++) {
 			hall_sensor_set_theta(true, j);
-			co_task_delay(50);
+			co_task_delay(5);
 			wdog_reload();
 			int hall = get_hall_stat(7);
 			float s, c;
@@ -225,7 +225,7 @@ int hall_sensor_calibrate(float voltage){
 	for (int i = 0;i < 5;i++) {
 		for (int j = 360;j >= 0;j--) {
 			hall_sensor_set_theta(true, j);
-			co_task_delay(50);
+			co_task_delay(5);
 			wdog_reload();
 			int hall = get_hall_stat(7);
 			float s, c;

+ 0 - 3
Applications/foc/hall_sensor.h

@@ -51,9 +51,6 @@ typedef struct {
 	u32  sensor_error;
 }hall_sensor_t;
 
-
-
-
 void hall_sensor_init(void);
 void hall_sensor_clear(void);
 float hall_sensor_get_theta(void); //return degree