Skip to content

Commit

Permalink
Remove logging to flash/ram
Browse files Browse the repository at this point in the history
  • Loading branch information
qqqlab committed Nov 8, 2024
1 parent 50ac7f0 commit fcd5f85
Show file tree
Hide file tree
Showing 26 changed files with 145 additions and 3,835 deletions.
4 changes: 2 additions & 2 deletions examples/02.QuadcopterAdvanced/02.QuadcopterAdvanced.ino
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Copyright (c) 2023-2024 https://madflight.com
#define IMU_I2C_ADR 0x69 //IMU I2C address. If unknown, use CLI 'i2c'

//-- AHRS sensor fusion
#define AHRS_USE AHRS_USE_MAHONY // AHRS_USE_MAHONY, AHRS_USE_MAHONY_BF, AHRS_USE_MADGWICK, AHRS_USE_VQF
#define AHRS_USE AHRS_USE_MAHONY // AHRS_USE_MAHONY, AHRS_USE_MAHONY_BF, AHRS_USE_MADGWICK, AHRS_USE_VQF

//--- GPS
#define GPS_BAUD 115200
Expand All @@ -147,7 +147,7 @@ Copyright (c) 2023-2024 https://madflight.com
#define BAT_USE BAT_USE_NONE // BAT_USE_INA226, BAT_USE_ADC, BAT_USE_NONE

//--- BLACKBOX LOGGER
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_INTFLASH internal flash, BB_USE_FLASH external flash, BB_USE_RAM ram or psram, BB_USE_NONE
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_NONE

//========================================================================================================================//
// RC RECEIVER //
Expand Down
2 changes: 1 addition & 1 deletion examples/03.PID-Tune/03.PID-Tune.ino
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Copyright (c) 2023-2024 https://madflight.com
#define BAT_USE BAT_USE_NONE // BAT_USE_INA226, BAT_USE_ADC, BAT_USE_NONE

//--- BLACKBOX LOGGER
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_INTFLASH internal flash, BB_USE_FLASH external flash, BB_USE_RAM ram or psram, BB_USE_NONE
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_NONE

//========================================================================================================================//
// RC RECEIVER CONFIG //
Expand Down
2 changes: 1 addition & 1 deletion examples/04.Plane/04.Plane.ino
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Copyright (c) 2024 https://madflight.com
#define BAT_USE BAT_USE_NONE // BAT_USE_INA226, BAT_USE_ADC, BAT_USE_NONE

//--- BLACKBOX LOGGER
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_INTFLASH internal flash, BB_USE_FLASH external flash, BB_USE_RAM ram or psram, BB_USE_NONE
#define BB_USE BB_USE_NONE //BB_USE_SD spi sdcard, BB_USE_SDMMC mmc sdcard, BB_USE_NONE

//========================================================================================================================//
// RC RECEIVER //
Expand Down
50 changes: 8 additions & 42 deletions src/madflight/bb/bb.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BB: madflight black box data logger
MIT License
Copyright (c) 2024 qqqlab - https://github.com/qqqlab
Copyright (c) 2024 https://madflight.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,56 +24,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===========================================================================================*/


#define BB_USE_NONE 1
//bb_flash.h
#define BB_USE_INTFLASH 101 //internal QSPI/OSPI flash
#define BB_USE_FLASH 102 //external SPI flash
#define BB_USE_RAM 103 //internal RAM (or PSRAM on ESP32)
//bb_sdcard.h
#define BB_USE_SD 201 //SDCARD with 1-bit SPI interface
#define BB_USE_SDMMC 202 //SDCARD with 1-bit MMC interface (ESP32/ESP32-S3)
#define BB_USE_SDDEBUG 203 //print log to Serial
#define BB_USE_SD 2 //SDCARD with 1-bit SPI interface
#define BB_USE_SDMMC 3 //SDCARD with 1-bit MMC interface (ESP32/ESP32-S3)
#define BB_USE_SDDEBUG 4 //print log to Serial


#include "../interface.h" //defines class BlackBox

//=====================================================================================================================
// No Logging
//=====================================================================================================================
#if !defined BB_USE || BB_USE == BB_USE_NONE

//black box public interface
class BlackBox {
public:
//loggers
void log_baro() {}
void log_bat() {}
void log_gps() {}
void log_imu() {}
void log_mode(uint8_t fm, const char* name) {(void)fm;(void)name;}
void log_msg(const char* msg) {(void)msg;}
void log_parm(const char* name, float value, float default_value) {(void)name;(void)value;(void)default_value;}
void log_pid() {}
void log_att() {}

//Blackbox Interface
void setup() {}
void start() {}
void stop() {}
void erase() {}
void dir() {}
void bench() {}
void info() {}
void csvDump(int fileno) {(void)fileno;}
};

BlackBox bb;

//=====================================================================================================================
// Logging to flash (internal or external)
//=====================================================================================================================
#elif BB_USE < BB_USE_SD

#include "bb_flash/bb_flash.h"
BlackBox bb_instance;
BlackBox &bb = bb_instance;

//=====================================================================================================================
// Logging to SDCARD (SPI or MMC interface)
Expand Down
Loading

0 comments on commit fcd5f85

Please sign in to comment.