Skip to content

add extra_configs support for local platformio env#104

Open
tstibor wants to merge 1 commit intoqqqlab:mainfrom
tstibor:platformio_custom
Open

add extra_configs support for local platformio env#104
tstibor wants to merge 1 commit intoqqqlab:mainfrom
tstibor:platformio_custom

Conversation

@tstibor
Copy link
Copy Markdown
Contributor

@tstibor tstibor commented Mar 14, 2026

Add platformio_custom.ini as an extra_configs entry so developers can define personal board environments (e.g. [env:m5stampfly]) without modifying the tracked platformio.ini. The file is gitignored to keep local configs out of the repository.

Example:

$ cat platformio_custom.ini
[env:M5STAMPFLY]
board = esp32-s3-devkitc-1
platform = espressif32
framework = arduino
monitor_filters = esp32_exception_decoder
build_flags =
    -D ARDUINO_USB_MODE=1
    -D ARDUINO_USB_CDC_ON_BOOT=1

Add platformio_custom.ini as an extra_configs entry so developers can
define personal board environments (e.g. [env:m5stampfly]) without
modifying the tracked platformio.ini. The file is gitignored to keep
local configs out of the repository.

Example:
$ cat platformio_custom.ini
[env:M5STAMPFLY]
board = esp32-s3-devkitc-1
platform = espressif32
framework = arduino
monitor_filters = esp32_exception_decoder
build_flags =
    -D ARDUINO_USB_MODE=1
    -D ARDUINO_USB_CDC_ON_BOOT=1
@qqqlab
Copy link
Copy Markdown
Owner

qqqlab commented Mar 15, 2026

I don't mind if you add the m5stampfly config directly in platform.ini (and keep the platform_custom.ini as well)

The idea is to support stampfly at some point.

Todo:

  • VL53L3 - driver available, but needs enable pin
  • PMW3901 - driver available, but need sync/mutex
  • INA3221
  • ESP-NOW remote

We could add a stampfly specific example or hack mf lib for stampfly specific stuff... Probably use first option: Do the PMW3901 update in imu_loop(), and set VL53L3 enable pin in setup()

What are you doing for rc radio?

This is my work-in-progress setup:

IMG_2664

Black port -> openlog sdcard
Red port -> elrs receiver

@tstibor
Copy link
Copy Markdown
Contributor Author

tstibor commented Mar 19, 2026

Today finally the HY2.0 cable arrived. I had not such a cable. My plan is connect a spare TBS CRSF nano to it.
Once everything is soldered I will look at the PMW3901 sync/mutex first.
IMG_1328

@tstibor
Copy link
Copy Markdown
Contributor Author

tstibor commented Mar 21, 2026

Success it flies. These are my settings:

#define MF_BOARD "brd/default_ESP32-S3.h"

const char madflight_config[] = R""(

//--- IMU --- Inertial Measurement Unit  (use spi -OR- i2c bus)
imu_gizmo      BMI270  // options: NONE, BMI270, ICM42688, ICM45686, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
imu_bus_type   SPI     // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
imu_align      CW90 // CW90FLIP     // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
imu_spi_bus    0       // spi
pin_imu_cs     46      // spi
pin_imu_int    11      // spi and i2c
imu_i2c_bus    -1      // i2c
imu_i2c_adr    0       // i2c: enter decimal i2c address, not hex (use 0 for default i2c address)

//--- RCL --- Remote Controller Link  (use serial bus -OR- ppm pin)
rcl_gizmo      CRSF  // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
rcl_ser_bus    1     // serial
pin_rcl_ppm   -1     // ppm
rcl_num_ch     8     // serial and ppm: number of channels
rcl_deadband   0     // serial and ppm: center stick deadband

//--- BAR --- Barometer
bar_gizmo      BMP280  // options: NONE, BMP280, BMP388, BMP390, BMP580, HP203B, MS5611
bar_i2c_adr    0x76
bar_i2c_bus    0

//--- MAG --- Magnetometer
mag_gizmo      BMM150 // options: NONE, QMC6309, QMC5883L, QMC5883P, RM3100, BMM150
mag_align      CW0    // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
mag_i2c_adr    0x10
mag_i2c_bus    0

//--- BAT --- Battery Monitor  (use i2c bus -OR- adc pins)
bat_gizmo      NONE  // options: NONE, ADC, INA226, INA228
bat_i2c_adr    0     // i2c
bat_i2c_bus   -1     // i2c
pin_bat_i     -1     // adc
pin_bat_v     -1     // adc
bat_cal_v      1     // for ADC: voltage scale, value is: actual_voltage_in_v / adc_reading; for INA226/228: not used
bat_cal_i      1     // for ADC: current scale, value is: actual_current_in_a / adc_reading; for INA226/228: rshunt value in ohm

//--- GPS ---
gps_gizmo      NONE  // options: NONE, UBLOX
gps_baud       0     // use 0 for auto baud
gps_ser_bus   -1

//--- BBX --- Black Box Data Logger  (use spi -OR- mmc)
bbx_gizmo      NONE  // options: NONE, SDSPI, SDMMC
pin_bbx_cs    -1     // spi
bbx_spi_bus   -1     // spi
pin_mmc_dat   -1     // mmc
pin_mmc_clk   -1     // mmc
pin_mmc_cmd   -1     // mmc

//--- RDR --- Radar (use serial bus -OR- trig+echo pins)
rdr_gizmo      NONE  // options: NONE, DTS6012M, LD2411S, LD2413, SR04, USD1
rdr_ser_bus   -1     // serial
rdr_baud       0     // serial, use 0 for default baud
pin_rdr_trig  -1     // trig+echo
pin_rdr_echo  -1     // trig+echo

//--- OFL --- Optical FLow (use serial bus -OR- spi bus)
ofl_gizmo      PMW3901  // options: NONE, PMW3901, PMW3901U
ofl_ser_bus    -1       // serial
ofl_baud       0        // serial, use 0 for default baud
ofl_spi_bus    0        // spi
pin_ofl_cs     12       // spi

//--- LED ---
led_gizmo     RGB   // options: NONE, HIGH_IS_ON, LOW_IS_ON, RGB
pin_led       39

//--- AHR --- AHRS (keep MAHONY, unless you want to experiment)
ahr_gizmo     MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF

//--- Serial bus 0 ---
pin_ser0_rx   -1
pin_ser0_tx   -1

//--- Serial bus 1 ---
pin_ser1_rx   2 // Serial1/uart1 (Radio Control Link) (Black Grove JST - I)
pin_ser1_tx   1 // Serial1/uart1 (Radio Control Link) (Black Grove JST - O)

//--- SPI bus 0 ---
pin_spi0_miso 43
pin_spi0_mosi 14
pin_spi0_sclk 44

//--- SPI bus 1 ---
pin_spi1_miso -1
pin_spi1_mosi -1
pin_spi1_sclk -1

//--- I2C Bus 0 ---
pin_i2c0_sda  3
pin_i2c0_scl  4

//--- I2C Bus 1 ---
pin_i2c1_sda  -1
pin_i2c1_scl  -1

//--- OUT Pins ---
pin_out0      41
pin_out1      42
pin_out2      10
pin_out3      5
pin_out4      -1
pin_out5      -1
pin_out6      -1
pin_out7      -1
pin_out8      -1
pin_out9      -1
pin_out10     -1
pin_out11     -1
pin_out12     -1
pin_out13     -1
pin_out14     -1
pin_out15     -1

rcl_rol_ch        1 // roll (aileron) channel number
rcl_rol_left   1100
rcl_rol_mid    1500
rcl_rol_right  1900

rcl_pit_ch        2 // pitch (elevator) channel
rcl_pit_pull   1100 // pwm for stick pulled toward you, i.e. pitch-up
rcl_pit_mid    1500
rcl_pit_push   1900 // pwm for stick pushed away, i.e. pitch-down

rcl_yaw_ch        4 // yaw (rudder) channel
rcl_yaw_left   1100
rcl_yaw_mid    1500
rcl_yaw_right  1900

rcl_thr_ch        3 // throttle channel
rcl_thr_pull   1100 // pwm for stick pulled toward you, i.e. idle throttle
rcl_thr_mid    1500
rcl_thr_push   1900 // pwm for stick pushed away, i.e. full throttle

rcl_arm_ch        5 // arm switch channel, set to 0 to use stick commands for arming
rcl_arm_min    1500 // armed pwm range min
rcl_arm_max    2500 // armed pwm range max

)""; // End of madflight_config


//========================================================================================================================//
//                                               COMPILER OPTIONS                                                         //
//========================================================================================================================//

// Reset config eeprom to defaults (uncomment this, upload, execute, then comment out, and upload again)
// #define MF_CONFIG_CLEAR

// Uncomment to reduce startup delay
#define MF_DEBUG

I am on master and else didn't change anything. Here is also the main.cpp
main.cpp
IMG_1335

The PID values though needs to be properly set. It wobbles and is difficult to fly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants