Skip to content

Commit

Permalink
Black Box
Browse files Browse the repository at this point in the history
  • Loading branch information
qqqlab committed Jan 31, 2024
1 parent 21ee8d6 commit eb767f0
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 601 deletions.
8 changes: 3 additions & 5 deletions madflight/madflight.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#define APPNAME "madflight v1.0.1-dev"

//this is a development version - random stuff does not work - use latest release if you want something more stable
#define APPNAME "madflight v1.0.1"

//Arduino ESP32 / RP2040 / STM32 Flight Controller
//GPL-3.0 license
Expand Down Expand Up @@ -47,7 +45,7 @@ fast blinking - something is wrong, connect USB serial for info
#define RCIN_NUM_CHANNELS 6 //number of receiver channels (minimal 6)

//--- IMU SENSOR
#define IMU_USE IMU_USE_SPI_MPU9250 // IMU_USE_SPI_BMI270, IMU_USE_SPI_MPU9250, IMU_USE_SPI_MPU6500, IMU_USE_SPI_MPU6000, IMU_USE_I2C_MPU9250, IMU_USE_I2C_MPU9150, IMU_USE_I2C_MPU6500, IMU_USE_I2C_MPU6050, IMU_USE_I2C_MPU6000
#define IMU_USE IMU_USE_SPI_MPU6500 // IMU_USE_SPI_BMI270, IMU_USE_SPI_MPU9250, IMU_USE_SPI_MPU6500, IMU_USE_SPI_MPU6000, IMU_USE_I2C_MPU9250, IMU_USE_I2C_MPU9150, IMU_USE_I2C_MPU6500, IMU_USE_I2C_MPU6050, IMU_USE_I2C_MPU6000
//Set sensor orientation. The label is yaw / roll (in that order) needed to rotate the sensor from it's normal position to it's mounted position.
//if not sure what is needed: try each setting until roll-right gives positive ahrs_roll, pitch-up gives positive ahrs_pitch, and yaw-right gives positive ahrs_yaw
#define IMU_ALIGN IMU_ALIGN_CW0 //IMU_ALIGN_CW0, IMU_ALIGN_CW90, IMU_ALIGN_CW180, IMU_ALIGN_CW270, IMU_ALIGN_CW0FLIP, IMU_ALIGN_CW90FLIP, IMU_ALIGN_CW180FLIP, IMU_ALIGN_CW270FLIP
Expand All @@ -67,7 +65,7 @@ fast blinking - something is wrong, connect USB serial for info
#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_FLASH log to internal or external flash, BB_USE_RAM log to ram or psram, BB_USE_NONE
#define BB_USE BB_USE_NONE //BB_USE_INTFLASH internal flash, BB_USE_FLASH external flash, BB_USE_RAM ram or psram, BB_USE_NONE

//========================================================================================================================//
// BOARD //
Expand Down
14 changes: 7 additions & 7 deletions madflight/src/bb/BlackBoxWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ void writeI16(String name, int16_t value) {
}
}

void writeUnsignedVB(String name, uint32_t value) {
void writeU(String name, uint32_t value) {
if(logStarted) {
logUnsignedVB(value);
logU(value);
}else{
writeHeaderField(name, BB_DATATYPE_UVB);
}
}

void writeSignedVB(String name, int32_t value) {
void writeI(String name, int32_t value) {
if(logStarted) {
logSignedVB((uint32_t)value);
logI((uint32_t)value);
}else{
writeHeaderField(name, BB_DATATYPE_SVB);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ void logFloat(float value) {
}

//Write an unsigned integer to the blackbox using variable byte encoding.
void logUnsignedVB(uint32_t value)
void logU(uint32_t value)
{
//While this isn't the final byte (we can only write 7 bits at a time)
while (value > 127) {
Expand All @@ -210,10 +210,10 @@ void logUnsignedVB(uint32_t value)


//Write a signed integer to the blackbox using ZigZig and variable byte encoding.
void logSignedVB(int32_t value)
void logI(int32_t value)
{
//ZigZag encode to make the value always positive
logUnsignedVB(zigzagEncode(value));
logU(zigzagEncode(value));
}

/**
Expand Down
288 changes: 0 additions & 288 deletions madflight/src/bb/W25Qxx/W25Qxx.h

This file was deleted.

Loading

0 comments on commit eb767f0

Please sign in to comment.