mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Merge pull request #2355 from brycedjohnson/blackboxerase2
Blackbox erase additions
This commit is contained in:
commit
c3213cf6bf
2 changed files with 16 additions and 8 deletions
|
@ -254,6 +254,7 @@ typedef enum BlackboxState {
|
||||||
BLACKBOX_STATE_SHUTTING_DOWN, //11
|
BLACKBOX_STATE_SHUTTING_DOWN, //11
|
||||||
BLACKBOX_STATE_START_ERASE, //12
|
BLACKBOX_STATE_START_ERASE, //12
|
||||||
BLACKBOX_STATE_ERASING, //13
|
BLACKBOX_STATE_ERASING, //13
|
||||||
|
BLACKBOX_STATE_ERASED //14
|
||||||
} BlackboxState;
|
} BlackboxState;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1466,17 +1467,15 @@ static void blackboxLogIteration(timeUs_t currentTimeUs)
|
||||||
void handleBlackbox(timeUs_t currentTimeUs)
|
void handleBlackbox(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static bool erasedOnce = false; //Only allow one erase per FC reboot.
|
|
||||||
|
|
||||||
switch (blackboxState) {
|
switch (blackboxState) {
|
||||||
case BLACKBOX_STATE_STOPPED:
|
case BLACKBOX_STATE_STOPPED:
|
||||||
if (ARMING_FLAG(ARMED)) {
|
if (ARMING_FLAG(ARMED)) {
|
||||||
blackboxOpen();
|
blackboxOpen();
|
||||||
startBlackbox();
|
startBlackbox();
|
||||||
}
|
}
|
||||||
if (IS_RC_MODE_ACTIVE(BOXBLACKBOXERASE) && !erasedOnce) {
|
if (IS_RC_MODE_ACTIVE(BOXBLACKBOXERASE)) {
|
||||||
blackboxSetState(BLACKBOX_STATE_START_ERASE);
|
blackboxSetState(BLACKBOX_STATE_START_ERASE);
|
||||||
erasedOnce = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BLACKBOX_STATE_PREPARE_LOG_FILE:
|
case BLACKBOX_STATE_PREPARE_LOG_FILE:
|
||||||
|
@ -1610,17 +1609,24 @@ void handleBlackbox(timeUs_t currentTimeUs)
|
||||||
case BLACKBOX_STATE_ERASING:
|
case BLACKBOX_STATE_ERASING:
|
||||||
if (isBlackboxErased()) {
|
if (isBlackboxErased()) {
|
||||||
//Done eraseing
|
//Done eraseing
|
||||||
blackboxSetState(BLACKBOX_STATE_STOPPED);
|
blackboxSetState(BLACKBOX_STATE_ERASED);
|
||||||
beeper(BEEPER_BLACKBOX_ERASE);
|
beeper(BEEPER_BLACKBOX_ERASE);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case BLACKBOX_STATE_ERASED:
|
||||||
|
if (!IS_RC_MODE_ACTIVE(BOXBLACKBOXERASE)) {
|
||||||
|
blackboxSetState(BLACKBOX_STATE_STOPPED);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did we run out of room on the device? Stop!
|
// Did we run out of room on the device? Stop!
|
||||||
if (isBlackboxDeviceFull()) {
|
if (isBlackboxDeviceFull()) {
|
||||||
if (blackboxState != BLACKBOX_STATE_ERASING && blackboxState != BLACKBOX_STATE_START_ERASE) {
|
if (blackboxState != BLACKBOX_STATE_ERASING
|
||||||
|
&& blackboxState != BLACKBOX_STATE_START_ERASE
|
||||||
|
&& blackboxState != BLACKBOX_STATE_ERASED) {
|
||||||
blackboxSetState(BLACKBOX_STATE_STOPPED);
|
blackboxSetState(BLACKBOX_STATE_STOPPED);
|
||||||
// ensure we reset the test mode flag if we stop due to full memory card
|
// ensure we reset the test mode flag if we stop due to full memory card
|
||||||
if (startedLoggingInTestMode) startedLoggingInTestMode = false;
|
if (startedLoggingInTestMode) startedLoggingInTestMode = false;
|
||||||
|
|
|
@ -151,7 +151,7 @@ static const box_t boxes[CHECKBOX_ITEM_COUNT + 1] = {
|
||||||
{ BOXAIRMODE, "AIR MODE;", 28 },
|
{ BOXAIRMODE, "AIR MODE;", 28 },
|
||||||
{ BOX3DDISABLESWITCH, "DISABLE 3D SWITCH;", 29},
|
{ BOX3DDISABLESWITCH, "DISABLE 3D SWITCH;", 29},
|
||||||
{ BOXFPVANGLEMIX, "FPV ANGLE MIX;", 30},
|
{ BOXFPVANGLEMIX, "FPV ANGLE MIX;", 30},
|
||||||
{ BOXBLACKBOXERASE, "BLACKBOX ERASE;", 31 },
|
{ BOXBLACKBOXERASE, "BLACKBOX ERASE (>30s);", 31 },
|
||||||
{ CHECKBOX_ITEM_COUNT, NULL, 0xFF }
|
{ CHECKBOX_ITEM_COUNT, NULL, 0xFF }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -380,7 +380,9 @@ void initActiveBoxIds(void)
|
||||||
#ifdef BLACKBOX
|
#ifdef BLACKBOX
|
||||||
if (feature(FEATURE_BLACKBOX)) {
|
if (feature(FEATURE_BLACKBOX)) {
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXBLACKBOX;
|
activeBoxIds[activeBoxIdCount++] = BOXBLACKBOX;
|
||||||
|
#ifdef USE_FLASHFS
|
||||||
activeBoxIds[activeBoxIdCount++] = BOXBLACKBOXERASE;
|
activeBoxIds[activeBoxIdCount++] = BOXBLACKBOXERASE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue