Просмотр исходного кода

加减速切换torque_real 还原回使用PMSM_FOC_Get()->in.s_targetCurrent

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 2 лет назад
Родитель
Сommit
708f8ddf3e
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      Applications/foc/core/thro_torque.c

+ 5 - 2
Applications/foc/core/thro_torque.c

@@ -199,7 +199,7 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
 	if (thro_r > _torque.thro_ration) {
 		if (!_torque.accl) {
 			_torque.thro_ration_last = _torque.thro_ration;
-			_torque.torque_real = _torque.torque_req;
+			_torque.torque_real = PMSM_FOC_Get()->in.s_targetCurrent;
 			if (_torque.torque_real < 0) { //电子刹车的时候,扭矩可能为负
 				_torque.torque_real = 0;
 			}
@@ -211,7 +211,10 @@ void thro_torque_process(u8 run_mode, float f_throttle) {
 	}else if (thro_r < _torque.thro_ration) {
 		if (_torque.accl) {
 			_torque.thro_ration_last = _torque.thro_ration;
-			_torque.torque_real = _torque.torque_req;
+			_torque.torque_real = PMSM_FOC_Get()->in.s_targetCurrent;
+			if (_torque.torque_real < 0) { //电子刹车的时候,扭矩可能为负
+				_torque.torque_real = 0;
+			}
 			dec_r = thro_r;
 			dec_r_last = _torque.thro_ration_last;
 			dec_trq = _torque.torque_real;