@@ -75,8 +75,9 @@ uint8_t TXFlag = 0;
75
75
PID_TypeDef PowerPID ;
76
76
double PowerPIDSetpoint = 0.0 ;
77
77
//PID_TypeDef AccelerationPID;
78
+
79
+
78
80
//OTHERS
79
- uint16_t testi = 0 ;
80
81
extern uint8_t initPhase ;
81
82
uint16_t test_array [4095 ];
82
83
@@ -85,6 +86,8 @@ extern uint16_t expectedDegree;
85
86
extern uint16_t expectedPower ;
86
87
87
88
extern uint8_t mode ; //driver program 0-1pos / 1-switch
89
+
90
+ uint16_t temperature = 0 ;
88
91
/* USER CODE END PV */
89
92
90
93
/* Private function prototypes -----------------------------------------------*/
@@ -282,9 +285,10 @@ int main(void)
282
285
/* USER CODE BEGIN WHILE */
283
286
while (1 ) {
284
287
MessageLength = sprintf ((char * ) DataToSend ,
285
- "#%i,%i,%lu,%lu,%lu,%i,%.0f,%.0f/\n\r" , mode , bldcEncoder .calculatedAngle ,
288
+ "#%i,%i,%lu,%lu,%lu,%i,%.0f,%.0f,%i /\n\r" , mode , bldcEncoder .calculatedAngle ,
286
289
bldcMotor .pwmU , bldcMotor .pwmV , bldcMotor .pwmW ,
287
- bldcMotor .expectedPosition , bldcMotor .expectedPower , bldcMotor .actualPower );
290
+ bldcMotor .expectedPosition , bldcMotor .expectedPower , bldcMotor .actualPower ,
291
+ temperature );
288
292
CDC_Transmit_FS (DataToSend , MessageLength );
289
293
290
294
if (bldcMotor .expectedPower != (float )expectedPower ){
@@ -295,14 +299,18 @@ int main(void)
295
299
}
296
300
PID_SetOutputLimits (& PowerPID , 12 , bldcMotor .expectedPower );
297
301
}
298
- HAL_Delay ( 50 );
302
+
299
303
if (mode == 0 ){
300
304
float newPos = expectedDegree * 1.1406 ;
301
305
bldcMotor .expectedPosition = (uint16_t )newPos ;
302
306
} else if (mode == 1 ){
303
307
uint16_t switchPos = expectedDegree * 1.1406 ;
304
308
bldcHapticSwitch (0 , switchPos );
305
309
}
310
+
311
+ temperature = (0.04 * (uint16_t )adc_raw_table [4 ]) - 56 ;;
312
+
313
+ HAL_Delay (50 );
306
314
/* USER CODE END WHILE */
307
315
308
316
/* USER CODE BEGIN 3 */
0 commit comments