Naze32 Buzzer Codes
Curious what the buzzer beeps mean when you hook up a buzzer to your naze32?
Well, It is easy to figure out what the beeps mean, but you have to be willing to look at a little bit of code to do so.
Here is the latest buzzer code from Baseflight. This code explains what the sounds mean. It may have been updated since the publish date of this article, so I encourage you to read your own code to understand exactly what the buzzer is indicating.
It is always a good idea to look at the code comments to learn more about why things do what they do when dealing with these open source flight controllers and components.
How to find the comments:
You can tell what a comment is in the code because it will either begin with a / forward slash, or a *.
There are 2 ways to add comments in the code. The first is to add a forward slash in front of a line.
/this is a line that is commented out
The next line below it will not be part of the comment.
/this is a line that is commented out
This line has not been commented out and is not a comment
Another way to create a comment on multiple lines is to star and end the comment with a /* and a */ with each consecutive line within the comment stating with a *
/* This is a paragraph that
*has also been
By looking for these comments, you can really learn a lot about what the programmers of the code intended it to do. Think of it like an investigative backwards user manual. LOL.
The Buzzer code:
/* This file is part of baseflight
* Licensed under GPL V3 or modified DCL – see https://github.com/multiwii/baseflight/blob/master/README.md
void buzzer(uint8_t mode);
/* Buzzer different modes: (lower number is higher priority)
* BUZZER_STOP – Stops beeping
* BUZZER_BAT_CRIT_LOW – Faster warning beeps when battery is critically low (repeats)
* BUZZER_BAT_LOW – Warning beeps when battery is getting low (repeats)
* BUZZER_TX_LOST_ARMED – Beeps SOS when armed and TX is turned off or signal lost (autolanding/autodisarm)
* BUZZER_TX_LOST – Beeps when TX is turned off or signal lost (repeat until TX is okay)
* BUZZER_DISARMING – One beep when disarming the board
* BUZZER_ARMING – One beep when arming the board
* BUZZER_ARMING_GPS_FIX – Beep a tone when arming the board and GPS has fix
* BUZZER_TX_SET – Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled.
* BUZZER_ARMED – Warning beeps when board is armed. (repeats until board is disarmed or throttle is increased)
* BUZZER_ACC_CALIBRATION – ACC inflight calibration completed confirmation
* BUZZER_ACC_CALIBRATION_FAIL – ACC inflight calibration failed
* BUZZER_READY_BEEP – Ring a tone when board is ready to flight (GPS ready).
BUZZER_STOP = 0, // Highest priority command which is used only for stopping the buzzer
BUZZER_STOPPED // State which is used when buzzer is in idle mode
So the thing to be learned here is that if you don’t know why your quad is doing something such as beeping constantly when a buzzer is installed, before you go digging through forums, or spouting out questions on the net, take a look at the code. The developers have put all sorts of comments here to tell you what the code is doing and it can really take some of the mystery out of why things act the way that they do.
For example: Now we know that the quad will beep sos when the to signal is lost.
How? It’s explained in the code comments.
*BUZZER_TX_LOST_ARMED– Beeps SOS when armed and TX is turned off or signal lost (autolanding/autodisarm)
Let’s say I wanted to know why the quad beeps constantly when I arm the flight controller.
Again the comment in the code provides this answer.
*BUZZER_ARMED – Warning beeps when board is armed. (repeats until board is disarmed or throttle is increased)
So we can see here that the buzzer will beep constantly until the quad is flying or disarmed. It’s all coming together now. I’m sure that this was done to prevent injury.
I encourage you to check the code and read through it to figure out the inner workings of your flight controller. The beauty of open source is that the information is available to you and you can take advantage of reading the comments. Even if you have no experience with c++ or programming languages in general, learning to read the comments can really help you to understand what the heck is going on.
You can find all of baseflight’s code here:https://github.com/multiwii/baseflight/tree/master/src
Cleanflight’s code can be found here:https://github.com/cleanflight/cleanflight?files=1
To find this buzzer code I just opened the buzzer.h file. Feel free to browse through the othe files such as telemetry or Gps. There are great comments to be read in there!