Show blackbox log number in OSD only when available.
This commit is contained in:
parent
086c75b3bf
commit
53955a4a6b
|
@ -76,7 +76,7 @@ static struct {
|
|||
afatfsFilePtr_t logFile;
|
||||
afatfsFilePtr_t logDirectory;
|
||||
afatfsFinder_t logDirectoryFinder;
|
||||
uint32_t largestLogFileNumber;
|
||||
int32_t largestLogFileNumber;
|
||||
|
||||
enum {
|
||||
BLACKBOX_SDCARD_INITIAL,
|
||||
|
@ -440,7 +440,7 @@ static void blackboxLogFileCreated(afatfsFilePtr_t file)
|
|||
|
||||
static void blackboxCreateLogFile(void)
|
||||
{
|
||||
uint32_t remainder = blackboxSDCard.largestLogFileNumber + 1;
|
||||
int32_t remainder = blackboxSDCard.largestLogFileNumber + 1;
|
||||
|
||||
char filename[] = LOGFILE_PREFIX "00000." LOGFILE_SUFFIX;
|
||||
|
||||
|
@ -488,7 +488,7 @@ static bool blackboxSDCardBeginLog(void)
|
|||
memcpy(logSequenceNumberString, directoryEntry->filename + 3, 5);
|
||||
logSequenceNumberString[5] = '\0';
|
||||
|
||||
blackboxSDCard.largestLogFileNumber = MAX((uint32_t) atoi(logSequenceNumberString), blackboxSDCard.largestLogFileNumber);
|
||||
blackboxSDCard.largestLogFileNumber = MAX((int32_t)atoi(logSequenceNumberString), blackboxSDCard.largestLogFileNumber);
|
||||
}
|
||||
} else {
|
||||
// We're done checking all the files on the card, now we can create a new log file
|
||||
|
@ -619,12 +619,17 @@ bool isBlackboxDeviceWorking(void)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int blackboxGetLogNumber(void)
|
||||
int32_t blackboxGetLogNumber(void)
|
||||
{
|
||||
switch (blackboxConfig()->device) {
|
||||
#ifdef USE_SDCARD
|
||||
case BLACKBOX_DEVICE_SDCARD:
|
||||
return blackboxSDCard.largestLogFileNumber;
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ bool blackboxDeviceEndLog(bool retainLog);
|
|||
|
||||
bool isBlackboxDeviceFull(void);
|
||||
bool isBlackboxDeviceWorking(void);
|
||||
unsigned int blackboxGetLogNumber(void);
|
||||
int32_t blackboxGetLogNumber(void);
|
||||
|
||||
void blackboxReplenishHeaderBudget(void);
|
||||
blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes);
|
||||
|
|
|
@ -670,11 +670,14 @@ static bool osdDisplayStat(int statistic, uint8_t displayRow)
|
|||
break;
|
||||
|
||||
case OSD_STAT_BLACKBOX_NUMBER:
|
||||
if (blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) {
|
||||
itoa(blackboxGetLogNumber(), buff, 10);
|
||||
{
|
||||
int32_t logNumber = blackboxGetLogNumber();
|
||||
if (logNumber >= 0) {
|
||||
itoa(logNumber, buff, 10);
|
||||
osdDisplayStatisticLabel(displayRow, "BB LOG NUM", buff);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -923,7 +923,12 @@ static void osdElementLogStatus(osdElementParms_t *element)
|
|||
} else if (isBlackboxDeviceFull()) {
|
||||
tfp_sprintf(element->buff, "%c>", SYM_BBLOG);
|
||||
} else {
|
||||
tfp_sprintf(element->buff, "%c%d", SYM_BBLOG, blackboxGetLogNumber());
|
||||
int32_t logNumber = blackboxGetLogNumber();
|
||||
if (logNumber >= 0) {
|
||||
tfp_sprintf(element->buff, "%c%d", SYM_BBLOG, logNumber);
|
||||
} else {
|
||||
tfp_sprintf(element->buff, "%c", SYM_BBLOG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -423,7 +423,7 @@ extern "C" {
|
|||
int32_t getMAhDrawn() { return 0; }
|
||||
int32_t getEstimatedAltitudeCm() { return 0; }
|
||||
int32_t getEstimatedVario() { return 0; }
|
||||
unsigned int blackboxGetLogNumber() { return 0; }
|
||||
int32_t blackboxGetLogNumber() { return 0; }
|
||||
bool isBlackboxDeviceWorking() { return true; }
|
||||
bool isBlackboxDeviceFull() { return false; }
|
||||
serialPort_t *openSerialPort(serialPortIdentifier_e, serialPortFunction_e, serialReceiveCallbackPtr, void *, uint32_t, portMode_e, portOptions_e) {return NULL;}
|
||||
|
|
|
@ -1132,7 +1132,7 @@ extern "C" {
|
|||
return simulationVerticalSpeed;
|
||||
}
|
||||
|
||||
unsigned int blackboxGetLogNumber() {
|
||||
int32_t blackboxGetLogNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue