Explorar o código

shark_get_seconds 使用32bit的ticks,不要用64位除法,耗CPU资源

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui %!s(int64=3) %!d(string=hai) anos
pai
achega
dc56c4e7fd
Modificáronse 3 ficheiros con 3 adicións e 2 borrados
  1. 1 1
      Applications/foc/mc_error.c
  2. 1 0
      Applications/foc/motor/motor.c
  3. 1 1
      Applications/os/os_task.c

+ 1 - 1
Applications/foc/mc_error.c

@@ -9,7 +9,7 @@ void err_add_record(u8 err_code, s16 err_value) {
 		return;
 	}
 	err[err_code].err_value = err_value;
-	err[err_code].err_time = shark_get_seconds();
+	err[err_code].err_time = get_tick_ms();
 }
 
 int err_get_record(u8 index, int size, err_record_t *err_out) {

+ 1 - 0
Applications/foc/motor/motor.c

@@ -37,6 +37,7 @@ static motor_t motor = {
 	.s_direction = POSITIVE,
 	.n_gear = 0,
 	.b_is96Mode = false,
+	.mode = CTRL_MODE_OPEN,
 };
 
 static void MC_Check_MosVbusThrottle(void) {

+ 1 - 1
Applications/os/os_task.c

@@ -34,7 +34,7 @@ u64 shark_get_mseconds(void)
 }
 
 u32 shark_get_seconds(void){
-	return shark_mseconds/1000;
+	return _g_ticks/1000;
 }
 
 u32 get_tick_ms(void) {