|
@@ -41,6 +41,7 @@ static motor_t motor = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
static void MC_Check_MosVbusThrottle(void) {
|
|
static void MC_Check_MosVbusThrottle(void) {
|
|
|
|
|
+ static bool _ibus_offset = false;
|
|
|
int count = 1000;
|
|
int count = 1000;
|
|
|
float ibus_adc = 0;
|
|
float ibus_adc = 0;
|
|
|
gpio_phase_u_detect(true);
|
|
gpio_phase_u_detect(true);
|
|
@@ -51,7 +52,10 @@ static void MC_Check_MosVbusThrottle(void) {
|
|
|
sample_vbus();
|
|
sample_vbus();
|
|
|
ibus_adc += adc_get_ibus();
|
|
ibus_adc += adc_get_ibus();
|
|
|
}
|
|
}
|
|
|
- sample_ibus_offset(ibus_adc/1000.0f);
|
|
|
|
|
|
|
+ if (!_ibus_offset) {
|
|
|
|
|
+ sample_ibus_offset(ibus_adc/1000.0f);
|
|
|
|
|
+ _ibus_offset = true;
|
|
|
|
|
+ }
|
|
|
gpio_phase_u_detect(false);
|
|
gpio_phase_u_detect(false);
|
|
|
float abc[3];
|
|
float abc[3];
|
|
|
get_phase_vols(abc);
|
|
get_phase_vols(abc);
|