Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a setting to disable the buzzer #434

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Src/bldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down