feat(board): use additional button for APOTA

This commit is contained in:
Paula Scharf 2025-07-17 16:15:10 +02:00
parent cdf606af5f
commit 439bbb8391

View file

@ -72,27 +72,11 @@ void initVariant(void) {
.loop_count = 0
};
uint8_t pixel[3] = { 0x10, 0x00, 0x00 }; // green
blinkLED(pixel, led_chan, ws2812_encoder, tx_config);
// define button pin
pinMode(0, INPUT_PULLUP);
// keep button pressed
unsigned long pressStartTime = 0;
bool buttonPressed = false;
// Wait 3.5 seconds for the button to be pressed
unsigned long startTime = millis();
pinMode(47, INPUT_PULLUP);
// Check if button is pressed
while (millis() - startTime < 3500) {
if (digitalRead(0) == LOW) {
if (!buttonPressed) {
// The button was pressed
buttonPressed = true;
}
} else if (buttonPressed) {
if (digitalRead(47) == LOW) {
// When the button is pressed and then released, boot into the OTA1 partition
const esp_partition_t *ota1_partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_1, NULL);
@ -108,9 +92,9 @@ void initVariant(void) {
ESP_LOGE("OTA", "Error setting OTA1 partition: %s", esp_err_to_name(err));
}
}
// Abort after releasing the button
break;
}
} else {
uint8_t pixel[3] = { 0x10, 0x00, 0x00 }; // green
blinkLED(pixel, led_chan, ws2812_encoder, tx_config);
}
}
}