Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: FOC/foc.cpp
- 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; }