ESPSomfy-RTS/test/test_bootpins_s3/test_bootpins_s3.cpp
cjkas 92e69d599f fix: warn of radio pins that block flashing over USB
GPIO2 on the original ESP32, 46 on the S2/S3 and 8 on the C3/C6 don't stop
a normal boot, but held at the wrong level at reset they keep esptool from
starting the download mode.  The WT32-ETH01 wiring puts TX on GPIO2.

Each warning now says what the pin does and what to do: move it for a pin
that stops the boot, disconnect it to flash for one that only blocks USB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 22:54:11 +01:00

45 lines
1.3 KiB
C++

#include <unity.h>
#include <string.h>
// As on the ESP32-S3, where GPIO45 picks the flash voltage.
#define CONFIG_IDF_TARGET_ESP32S3 1
#include "BootPins.h"
void setUp() {}
void tearDown() {}
static void test_gpio45_picks_the_flash_voltage() {
const char *effect = bootPinEffect(45);
TEST_ASSERT_NOT_NULL(effect);
TEST_ASSERT_NOT_NULL(strstr(effect, "1.8 V"));
}
static void test_gpio0_picks_the_boot_mode() {
TEST_ASSERT_NOT_NULL(bootPinEffect(0));
}
static void test_gpio46_blocks_flashing_over_usb() {
const char *effect = bootPinEffect(46);
TEST_ASSERT_NOT_NULL(effect);
TEST_ASSERT_NOT_NULL(strstr(effect, "USB"));
}
static void test_gpio12_is_safe() {
// 12 is the S3's default SCK.
TEST_ASSERT_NULL(bootPinEffect(12));
}
static void test_default_radio_pins_are_safe() {
// transceiver_config_t::load()'s defaults for the S3.
const uint8_t pins[] = {15, 14, 11, 13, 12, 10};
for(uint8_t pin : pins) TEST_ASSERT_NULL_MESSAGE(bootPinEffect(pin), "default radio pin");
}
int main(int, char **) {
UNITY_BEGIN();
RUN_TEST(test_gpio45_picks_the_flash_voltage);
RUN_TEST(test_gpio0_picks_the_boot_mode);
RUN_TEST(test_gpio46_blocks_flashing_over_usb);
RUN_TEST(test_gpio12_is_safe);
RUN_TEST(test_default_radio_pins_are_safe);
return UNITY_END();
}