mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
SPRacingF3Mini - Quick hack to allow configuration to be reset when
holding buttons A and B down for 5 seconds when powering on.
This commit is contained in:
parent
b030d494c8
commit
180e1cb7b6
2 changed files with 42 additions and 3 deletions
|
@ -193,6 +193,41 @@ void init(void)
|
||||||
ledInit(false);
|
ledInit(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SPRACINGF3MINI
|
||||||
|
gpio_config_t buttonAGpioConfig = {
|
||||||
|
BUTTON_A_PIN,
|
||||||
|
Mode_IPU,
|
||||||
|
Speed_2MHz
|
||||||
|
};
|
||||||
|
gpioInit(BUTTON_A_PORT, &buttonAGpioConfig);
|
||||||
|
|
||||||
|
gpio_config_t buttonBGpioConfig = {
|
||||||
|
BUTTON_B_PIN,
|
||||||
|
Mode_IPU,
|
||||||
|
Speed_2MHz
|
||||||
|
};
|
||||||
|
gpioInit(BUTTON_B_PORT, &buttonBGpioConfig);
|
||||||
|
|
||||||
|
// Check status of bind plug and exit if not active
|
||||||
|
delayMicroseconds(10); // allow GPIO configuration to settle
|
||||||
|
|
||||||
|
if (!isMPUSoftReset()) {
|
||||||
|
uint8_t secondsRemaining = 5;
|
||||||
|
bool bothButtonsHeld;
|
||||||
|
do {
|
||||||
|
bothButtonsHeld = !digitalIn(BUTTON_A_PORT, BUTTON_A_PIN) && !digitalIn(BUTTON_B_PORT, BUTTON_B_PIN);
|
||||||
|
if (bothButtonsHeld) {
|
||||||
|
if (--secondsRemaining == 0) {
|
||||||
|
resetEEPROM();
|
||||||
|
systemReset();
|
||||||
|
}
|
||||||
|
delay(1000);
|
||||||
|
LED0_TOGGLE;
|
||||||
|
}
|
||||||
|
} while (bothButtonsHeld);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SPEKTRUM_BIND
|
#ifdef SPEKTRUM_BIND
|
||||||
if (feature(FEATURE_RX_SERIAL)) {
|
if (feature(FEATURE_RX_SERIAL)) {
|
||||||
switch (masterConfig.rxConfig.serialrx_provider) {
|
switch (masterConfig.rxConfig.serialrx_provider) {
|
||||||
|
|
|
@ -180,12 +180,16 @@
|
||||||
#define USE_SERVOS
|
#define USE_SERVOS
|
||||||
#define USE_CLI
|
#define USE_CLI
|
||||||
|
|
||||||
|
#define BUTTON_A_PORT GPIOB
|
||||||
|
#define BUTTON_A_PIN Pin_1
|
||||||
|
#define BUTTON_B_PORT GPIOB
|
||||||
|
#define BUTTON_B_PIN Pin_0
|
||||||
|
|
||||||
#define SPEKTRUM_BIND
|
#define SPEKTRUM_BIND
|
||||||
// USART3,
|
// USART3,
|
||||||
#define BIND_PORT GPIOB
|
#define BIND_PORT GPIOB
|
||||||
#define BIND_PIN Pin_11
|
#define BIND_PIN Pin_11
|
||||||
|
|
||||||
#define HARDWARE_BIND_PLUG
|
#define HARDWARE_BIND_PLUG
|
||||||
// Hardware bind plug at PB1
|
#define BINDPLUG_PORT BUTTON_B_PORT
|
||||||
#define BINDPLUG_PORT GPIOB
|
#define BINDPLUG_PIN BUTTON_B_PIN
|
||||||
#define BINDPLUG_PIN Pin_1
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue