diff --git a/Inc/config.h b/Inc/config.h index 12bd5646..9b8f6eef 100644 --- a/Inc/config.h +++ b/Inc/config.h @@ -261,6 +261,11 @@ // ########################### END OF DEBUG LCD ############################ +// ############################### BUZZER ENABLE / DISABLE ############################### +#define BUZZER_ENABLED // If enabled the buzzer will buzz, otherwise not. +// ########################### END OF BUZZER ENABLE / DISABLE ############################ + + // ################################# VARIANT_ADC SETTINGS ############################ #ifdef VARIANT_ADC diff --git a/Src/bldc.c b/Src/bldc.c index d5fb4c93..03677f9b 100644 --- a/Src/bldc.c +++ b/Src/bldc.c @@ -130,8 +130,9 @@ void DMA1_Channel1_IRQHandler(void) { RIGHT_TIM->BDTR |= TIM_BDTR_MOE; } - // Create square wave for buzzer + // Create square wave for buzzer and more buzzerTimer++; +#ifdef BUZZER_ENABLED if (buzzerFreq != 0 && (buzzerTimer / 5000) % (buzzerPattern + 1) == 0) { if (buzzerPrev == 0) { buzzerPrev = 1; @@ -146,6 +147,7 @@ void DMA1_Channel1_IRQHandler(void) { HAL_GPIO_WritePin(BUZZER_PORT, BUZZER_PIN, GPIO_PIN_RESET); buzzerPrev = 0; } +#endif // Adjust pwm_margin depending on the selected Control Type if (rtP_Left.z_ctrlTypSel == FOC_CTRL) {