1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Merge pull request #4219 from mikeller/separate_rx_set_and_gps_beeping

Added distinct mode for 'beep GPS number of satellites found', and separated this functionality from 'RX_SET' beeping.
This commit is contained in:
Michael Keller 2017-10-10 00:39:41 +13:00 committed by GitHub
commit 802cd5690e
3 changed files with 20 additions and 21 deletions

View file

@ -78,6 +78,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT] = {
{ BOXCAMERA3, "CAMERA CONTROL 3", 34 },
{ BOXFLIPOVERAFTERCRASH, "FLIP OVER AFTER CRASH", 35 },
{ BOXPREARM, "PREARM", 36 },
{ BOXBEEPGPSCOUNT, "BEEP GPS SATELLITE COUNT", 37 },
};
// mask of enabled IDs, calculated on startup based on enabled features. boxId_e is used as bit index
@ -180,6 +181,7 @@ void initActiveBoxIds(void)
if (feature(FEATURE_GPS)) {
BME(BOXGPSHOME);
BME(BOXGPSHOLD);
BME(BOXBEEPGPSCOUNT);
}
#endif
@ -290,7 +292,7 @@ int packFlightModeFlags(boxBitmask_t *mspFlightModeFlags)
const uint64_t rcModeCopyMask = BM(BOXHEADADJ) | BM(BOXCAMSTAB) | BM(BOXCAMTRIG) | BM(BOXBEEPERON)
| BM(BOXLEDMAX) | BM(BOXLEDLOW) | BM(BOXLLIGHTS) | BM(BOXCALIB) | BM(BOXGOV) | BM(BOXOSD)
| BM(BOXTELEMETRY) | BM(BOXGTUNE) | BM(BOXBLACKBOX) | BM(BOXBLACKBOXERASE) | BM(BOXAIRMODE)
| BM(BOXANTIGRAVITY) | BM(BOXFPVANGLEMIX) | BM(BOXFLIPOVERAFTERCRASH) | BM(BOX3DDISABLE);
| BM(BOXANTIGRAVITY) | BM(BOXFPVANGLEMIX) | BM(BOXFLIPOVERAFTERCRASH) | BM(BOX3DDISABLE) | BM(BOXBEEPGPSCOUNT);
STATIC_ASSERT(sizeof(rcModeCopyMask) * 8 >= CHECKBOX_ITEM_COUNT, copy_mask_too_small_for_boxes);
for (unsigned i = 0; i < CHECKBOX_ITEM_COUNT; i++) {
if ((rcModeCopyMask & BM(i)) // mode copy is enabled

View file

@ -59,6 +59,7 @@ typedef enum {
BOXCAMERA3,
BOXFLIPOVERAFTERCRASH,
BOXPREARM,
BOXBEEPGPSCOUNT,
CHECKBOX_ITEM_COUNT
} boxId_e;

View file

@ -319,22 +319,22 @@ void beeperWarningBeeps(uint8_t beepCount)
}
#ifdef GPS
void beeperGpsStatus(void)
static void beeperGpsStatus(void)
{
// if GPS fix then beep out number of satellites
if (STATE(GPS_FIX) && gpsSol.numSat >= 5) {
uint8_t i = 0;
do {
beep_multiBeeps[i++] = 5;
beep_multiBeeps[i++] = 10;
} while (i < MAX_MULTI_BEEPS && gpsSol.numSat > i / 2);
if (!(getBeeperOffMask() & (1 << (BEEPER_GPS_STATUS - 1)))) {
// if GPS fix then beep out number of satellites
if (STATE(GPS_FIX) && gpsSol.numSat >= 5) {
uint8_t i = 0;
do {
beep_multiBeeps[i++] = 5;
beep_multiBeeps[i++] = 10;
} while (i < MAX_MULTI_BEEPS && gpsSol.numSat > i / 2);
beep_multiBeeps[i - 1] = 50; // extend last pause
beep_multiBeeps[i] = BEEPER_COMMAND_STOP;
beep_multiBeeps[i - 1] = 50; // extend last pause
beep_multiBeeps[i] = BEEPER_COMMAND_STOP;
beeper(BEEPER_MULTI_BEEPS); //initiate sequence
} else {
beeper(BEEPER_RX_SET);
beeper(BEEPER_MULTI_BEEPS); //initiate sequence
}
}
}
#endif
@ -347,14 +347,10 @@ void beeperUpdate(timeUs_t currentTimeUs)
{
// If beeper option from AUX switch has been selected
if (IS_RC_MODE_ACTIVE(BOXBEEPERON)) {
#ifdef GPS
if (feature(FEATURE_GPS)) {
beeperGpsStatus();
} else {
beeper(BEEPER_RX_SET);
}
#else
beeper(BEEPER_RX_SET);
#ifdef GPS
} else if (feature(FEATURE_GPS) && IS_RC_MODE_ACTIVE(BOXBEEPGPSCOUNT)) {
beeperGpsStatus();
#endif
}