Chetan Sharma / Mbed OS HKCC_Controller_MBed_OS

Dependencies:   FastPWM3

Revision:
55:5afc2865ef7f
Parent:
51:6cd89bd6fcaa
Child:
57:57a108e15b52
--- a/FOC/foc.cpp	Fri Feb 19 22:40:19 2021 -0800
+++ b/FOC/foc.cpp	Thu Feb 25 21:53:26 2021 -0800
@@ -51,7 +51,7 @@
 
 void linearize_dtc(float *dtc){
     /// linearizes the output of the inverter, which is not linear for small duty cycles ///
-    float sgn = 1.0f-(2.0f*(dtc<0));
+    float sgn = 1.0f-(2.0f * (*dtc < 0));
     if(abs(*dtc) >= .01f){
         *dtc = *dtc*.986f+.014f*sgn;
         }
@@ -71,7 +71,7 @@
         TIM1->CCR2 = (PWM_ARR>>1)*(1.0f);
         TIM1->CCR1 = (PWM_ARR>>1)*(1.0f);
         ADC1->CR2  |= 0x40000000;                                               // Begin sample and conversion
-        wait(.001);
+        ThisThread::sleep_for(1ms);
         adc2_offset += ADC2->DR;
         adc1_offset += ADC1->DR;
         }