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

new dashboard OLED page for Black Box

This commit is contained in:
Krzysztof Kuczek 2021-01-16 20:06:07 +01:00
parent 8e361c574b
commit 4cd1f4efb4
4 changed files with 42 additions and 1 deletions

View file

@ -745,4 +745,13 @@ blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes)
return BLACKBOX_RESERVE_PERMANENT_FAILURE; return BLACKBOX_RESERVE_PERMANENT_FAILURE;
} }
} }
int8_t blackboxGetLogFileNo(void)
{
// return current file number or -1
if (blackboxSDCard.state == BLACKBOX_SDCARD_READY_TO_LOG){
return blackboxSDCard.largestLogFileNumber;
}else {
return -1;
}
}
#endif // BLACKBOX #endif // BLACKBOX

View file

@ -63,3 +63,4 @@ int32_t blackboxGetLogNumber(void);
void blackboxReplenishHeaderBudget(void); void blackboxReplenishHeaderBudget(void);
blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes); blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes);
int8_t blackboxGetLogFileNo(void);

View file

@ -63,6 +63,9 @@
#include "io/dashboard.h" #include "io/dashboard.h"
#include "io/displayport_oled.h" #include "io/displayport_oled.h"
#include "blackbox/blackbox_io.h"
#include "blackbox/blackbox.h"
#include "rx/rx.h" #include "rx/rx.h"
#include "scheduler/scheduler.h" #include "scheduler/scheduler.h"
@ -580,6 +583,33 @@ static void showDebugPage(void)
} }
#endif #endif
static void showBBPage(void)
{
uint8_t rowIndex = PAGE_TITLE_LINE_COUNT;
int8_t fileNo;
if (isBlackboxDeviceWorking()){
switch (blackboxConfig()->device) {
case BLACKBOX_DEVICE_SDCARD:
fileNo = blackboxGetLogFileNo();
if( fileNo > 0){
tfp_sprintf(lineBuffer, "File no: %d", fileNo);
}else{
tfp_sprintf(lineBuffer, "Log not started!");
}
break;
default:
tfp_sprintf(lineBuffer, "Not supp. dev.");
break;
}
}else{
tfp_sprintf(lineBuffer, "BB not working");
}
padLineBuffer();
i2c_OLED_set_line(bus, rowIndex++);
i2c_OLED_send_string(bus, lineBuffer);
}
static const pageEntry_t pages[PAGE_COUNT] = { static const pageEntry_t pages[PAGE_COUNT] = {
{ PAGE_WELCOME, FC_FIRMWARE_NAME, showWelcomePage, PAGE_FLAGS_SKIP_CYCLING }, { PAGE_WELCOME, FC_FIRMWARE_NAME, showWelcomePage, PAGE_FLAGS_SKIP_CYCLING },
{ PAGE_ARMED, "ARMED", showArmedPage, PAGE_FLAGS_SKIP_CYCLING }, { PAGE_ARMED, "ARMED", showArmedPage, PAGE_FLAGS_SKIP_CYCLING },
@ -594,6 +624,7 @@ static const pageEntry_t pages[PAGE_COUNT] = {
#if defined(USE_TASK_STATISTICS) #if defined(USE_TASK_STATISTICS)
{ PAGE_TASKS, "TASKS", showTasksPage, PAGE_FLAGS_NONE }, { PAGE_TASKS, "TASKS", showTasksPage, PAGE_FLAGS_NONE },
#endif #endif
{ PAGE_BB, "BLACK BOX", showBBPage, PAGE_FLAGS_NONE },
#ifdef ENABLE_DEBUG_DASHBOARD_PAGE #ifdef ENABLE_DEBUG_DASHBOARD_PAGE
{ PAGE_DEBUG, "DEBUG", showDebugPage, PAGE_FLAGS_NONE }, { PAGE_DEBUG, "DEBUG", showDebugPage, PAGE_FLAGS_NONE },
#endif #endif

View file

@ -53,7 +53,7 @@ typedef enum {
#ifdef ENABLE_DEBUG_DASHBOARD_PAGE #ifdef ENABLE_DEBUG_DASHBOARD_PAGE
PAGE_DEBUG, PAGE_DEBUG,
#endif #endif
PAGE_BB,
PAGE_COUNT PAGE_COUNT
} pageId_e; } pageId_e;