1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

Fixed beeper delay to use microseconds instead of milliseconds.

This commit is contained in:
Michael Keller 2016-09-22 16:01:12 +12:00
parent d143fda9c1
commit 963657ce2e

View file

@ -138,7 +138,7 @@ static uint32_t beeperNextToggleTime = 0;
// Time of last arming beep in microseconds (for blackbox) // Time of last arming beep in microseconds (for blackbox)
static uint32_t armingBeepTimeMicros = 0; static uint32_t armingBeepTimeMicros = 0;
static void beeperProcessCommand(void); static void beeperProcessCommand(uint32_t currentTime);
typedef struct beeperTableEntry_s { typedef struct beeperTableEntry_s {
uint8_t mode; uint8_t mode;
@ -331,13 +331,13 @@ void beeperUpdate(uint32_t currentTime)
} }
} }
beeperProcessCommand(); beeperProcessCommand(currentTime);
} }
/* /*
* Calculates array position when next to change beeper state is due. * Calculates array position when next to change beeper state is due.
*/ */
static void beeperProcessCommand(void) static void beeperProcessCommand(uint32_t currentTime)
{ {
if (currentBeeperEntry->sequence[beeperPos] == BEEPER_COMMAND_REPEAT) { if (currentBeeperEntry->sequence[beeperPos] == BEEPER_COMMAND_REPEAT) {
beeperPos = 0; beeperPos = 0;
@ -345,7 +345,7 @@ static void beeperProcessCommand(void)
beeperSilence(); beeperSilence();
} else { } else {
// Otherwise advance the sequence and calculate next toggle time // Otherwise advance the sequence and calculate next toggle time
beeperNextToggleTime = millis() + 10 * currentBeeperEntry->sequence[beeperPos]; beeperNextToggleTime = currentTime + 1000 * 10 * currentBeeperEntry->sequence[beeperPos];
beeperPos++; beeperPos++;
} }
} }