Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions configs/HELLBENDER_0001/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,33 @@
#define SPI1_SDI_PIN PA24
#define SPI1_SDO_PIN PA27

#define SDCARD_CS_PIN PA25
//#define FLASH_CS_PIN PA0
//#define USE_MAX7456

#define MAX7456_SPI_CS_PIN PA17

#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SDCARD

Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Make DEFAULT_BLACKBOX_DEVICE conditional on OSD/SD availability

As written, if a user enables USE_MAX7456, SD card support is compiled out, yet the default blackbox device would still be SDCARD. That’s likely to produce a build-time config error or an unusable default. Define the default based on whether OSD disables SD (fallback to FLASH when SD is disabled).

Apply this diff to make the default adaptive:

-#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_SDCARD
+#ifndef USE_MAX7456
+#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_SDCARD
+#else
+#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_FLASH
+#endif

Run this repo-wide check to confirm which blackbox device constants are used across configs (and adjust the FLASH constant if your tree uses a different identifier):


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Defaults used across configs (context shown):"
rg -n -C2 '^\s*#\s*define\s+DEFAULT_BLACKBOX_DEVICE\b'
echo
echo "All BLACKBOX_DEVICE_* identifiers referenced in configs (deduped):"
rg -nP 'BLACKBOX_DEVICE_[A-Z_]+' | gawk -F: '{print $3}' | sed -E 's/.*\b(BLACKBOX_DEVICE_[A-Z_]+)\b.*/\1/' | sort -u

Length of output: 178056


🏁 Script executed:

#!/bin/bash
sed -n '1,80p' configs/HELLBENDER_0001/config.h

Length of output: 2268


Wrap DEFAULT_BLACKBOX_DEVICE to respect USE_MAX7456

The board currently always defaults to BLACKBOX_DEVICE_SDCARD, but if USE_MAX7456 is enabled SD support is disabled, leading to a broken or unusable build. Change the default to fall back to flash when Max7456 OSD is in use:

configs/HELLBENDER_0001/config.h (around line 57)

-#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_SDCARD
+#ifndef USE_MAX7456
+#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_SDCARD
+#else
+#define DEFAULT_BLACKBOX_DEVICE         BLACKBOX_DEVICE_FLASH
+#endif

– Only BLACKBOX_DEVICE_SDCARD and BLACKBOX_DEVICE_FLASH exist in the tree, so this will cover both cases.
– Place the new conditional block immediately after the MAX7456_SPI_CS_PIN definition.
– Ensures a valid default regardless of OSD/SD compile-time flags.

🤖 Prompt for AI Agents
In configs/HELLBENDER_0001/config.h around lines 57-58, the
DEFAULT_BLACKBOX_DEVICE is unconditionally set to BLACKBOX_DEVICE_SDCARD which
breaks builds when USE_MAX7456 is enabled; replace that single define with a
conditional block placed immediately after the MAX7456_SPI_CS_PIN definition
that sets DEFAULT_BLACKBOX_DEVICE to BLACKBOX_DEVICE_FLASH when USE_MAX7456 is
defined and to BLACKBOX_DEVICE_SDCARD otherwise (only these two devices exist
in-tree), ensuring a valid default regardless of OSD/SD compile-time flags.

#define USE_FLASH
//#define FLASH_CS_PIN PA0 // CS1 pin automatically used by the QSPI driver
#define USE_FLASH_CHIP
#define USE_FLASH_W25Q128FV

// Enable QUADSPI on RP2350 (pins are fixed via QMI; platform code handles them)
#define USE_QUADSPI
#define USE_QUADSPI_DEVICE_1
#define FLASH_QUADSPI_INSTANCE ((QUADSPI_TypeDef *)0x1)

Comment on lines +64 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

QUADSPI instance macro appears STM32-specific; likely invalid on RP2350

FLASH_QUADSPI_INSTANCE cast to QUADSPI_TypeDef is a HAL/STM32 idiom and does not apply to RP2350. RP2350 QMI is handled by the platform code with PICO_QSPI_* defines. Retain USE_QUADSPI, but drop the instance and device-id defines unless your Betaflight RP2350 branch explicitly uses them.

Apply this diff to remove the non-RP constructs:

 // Enable QUADSPI on RP2350 (pins are fixed via QMI; platform code handles them)
 #define USE_QUADSPI
-#define USE_QUADSPI_DEVICE_1
-#define FLASH_QUADSPI_INSTANCE ((QUADSPI_TypeDef *)0x1)

Sanity-check whether any other configs use these macros (they likely won’t on RP targets):


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Search for FLASH_QUADSPI_INSTANCE usage in configs:"
rg -n 'FLASH_QUADSPI_INSTANCE' -C2 || true
echo
echo "Search for USE_QUADSPI_DEVICE_* usage in configs:"
rg -nP 'USE_QUADSPI_DEVICE_\d+' -C2 || true

Length of output: 3000


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for USE_QUADSPI_DEVICE_1 usage outside configs:"
rg -n 'USE_QUADSPI_DEVICE_1' --glob '!configs/**' -C2 || true

echo
echo "Searching for FLASH_QUADSPI_INSTANCE usage outside configs:"
rg -n 'FLASH_QUADSPI_INSTANCE' --glob '!configs/**' -C2 || true

echo
echo "Verifying conditional compilation around USE_QUADSPI in source files:"
rg -n '#\s*if.*USE_QUADSPI' --glob '!configs/**' -C2 || true

Length of output: 624


Remove STM32-specific QUADSPI macros in RP2350 config

RP2350’s QSPI is driven by QMI (PICO_QSPI_*) and doesn’t reference USE_QUADSPI_DEVICE_1 or FLASH_QUADSPI_INSTANCE. These defines only appear in configs and aren’t used elsewhere—drop them to avoid invalid HAL/STM32 casts.

• File: configs/HELLBENDER_0001/config.h Lines 66–67
Remove:

 // Enable QUADSPI on RP2350 (pins are fixed via QMI; platform code handles them)
 #define USE_QUADSPI
-#define USE_QUADSPI_DEVICE_1
-#define FLASH_QUADSPI_INSTANCE ((QUADSPI_TypeDef *)0x1)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Enable QUADSPI on RP2350 (pins are fixed via QMI; platform code handles them)
#define USE_QUADSPI
#define USE_QUADSPI_DEVICE_1
#define FLASH_QUADSPI_INSTANCE ((QUADSPI_TypeDef *)0x1)
// Enable QUADSPI on RP2350 (pins are fixed via QMI; platform code handles them)
#define USE_QUADSPI
🤖 Prompt for AI Agents
In configs/HELLBENDER_0001/config.h around lines 64–68, remove the two
STM32-specific QUADSPI macro lines (the #define USE_QUADSPI_DEVICE_1 and the
#define FLASH_QUADSPI_INSTANCE ...) and keep only the generic USE_QUADSPI
define; delete those lines so the file relies on the RP2350/QMI PICO_QSPI_*
configuration instead, and then rebuild to ensure no remaining references to
those removed macros exist.

// RP2350 QMI CS1 wiring and external flash size (Winbond W25Q64JVXGIM 8MiB)
#define PICO_QSPI_CS1_GPIO 0
#define PICO_QSPI_CS1_SIZE_BYTES (8 * 1024 * 1024)

#ifndef USE_MAX7456
// MAX7456 and SD card cannot be used at the same time
#define SDCARD_SPI_CS_PIN PA25
#define USE_SDCARD
#define USE_SDCARD_SPI
#endif

#define GYRO_1_CS_PIN PA1
#define GYRO_1_EXTI_PIN PA22

Expand Down