|
1 |
| -/* |
2 |
| - * The MIT License (MIT) |
3 |
| - * |
4 |
| - * Copyright (c) 2021 Ha Thach (tinyusb.org) for Adafruit Industries |
5 |
| - * |
6 |
| - * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 |
| - * of this software and associated documentation files (the "Software"), to deal |
8 |
| - * in the Software without restriction, including without limitation the rights |
9 |
| - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 |
| - * copies of the Software, and to permit persons to whom the Software is |
11 |
| - * furnished to do so, subject to the following conditions: |
12 |
| - * |
13 |
| - * The above copyright notice and this permission notice shall be included in |
14 |
| - * all copies or substantial portions of the Software. |
15 |
| - * |
16 |
| - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 |
| - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 |
| - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 |
| - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 |
| - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 |
| - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 |
| - * THE SOFTWARE. |
23 |
| - */ |
24 |
| - |
25 | 1 | #include "esp32-hal-gpio.h"
|
26 | 2 | #include "pins_arduino.h"
|
27 | 3 | #include "driver/rmt_tx.h"
|
28 |
| -#include "esp_log.h" |
29 |
| -#include "esp_partition.h" |
30 |
| -#include "esp_system.h" |
31 |
| -#include "esp_ota_ops.h" |
32 | 4 |
|
33 | 5 | extern "C" {
|
34 | 6 |
|
@@ -72,29 +44,7 @@ void initVariant(void) {
|
72 | 44 | .loop_count = 0
|
73 | 45 | };
|
74 | 46 |
|
75 |
| - // define button pin |
76 |
| - pinMode(47, INPUT_PULLUP); |
77 |
| - |
78 |
| - // Check if button is pressed |
79 |
| - if (digitalRead(47) == LOW) { |
80 |
| - // When the button is pressed and then released, boot into the OTA1 partition |
81 |
| - const esp_partition_t *ota1_partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_1, NULL); |
82 |
| - |
83 |
| - if (ota1_partition) { |
84 |
| - esp_err_t err = esp_ota_set_boot_partition(ota1_partition); |
85 |
| - if (err == ESP_OK) { |
86 |
| - uint8_t pixel[3] = { 0x00, 0x00, 0x10 }; // blue |
87 |
| - blinkLED(pixel, led_chan, ws2812_encoder, tx_config); |
88 |
| - esp_restart(); // restart, to boot OTA1 partition |
89 |
| - } else { |
90 |
| - uint8_t pixel[3] = { 0x00, 0x10, 0x00 }; // red |
91 |
| - blinkLED(pixel, led_chan, ws2812_encoder, tx_config); |
92 |
| - ESP_LOGE("OTA", "Error setting OTA1 partition: %s", esp_err_to_name(err)); |
93 |
| - } |
94 |
| - } |
95 |
| - } else { |
96 |
| - uint8_t pixel[3] = { 0x10, 0x00, 0x00 }; // green |
97 |
| - blinkLED(pixel, led_chan, ws2812_encoder, tx_config); |
98 |
| - } |
| 47 | + uint8_t pixel[3] = { 0x10, 0x00, 0x00 }; // green |
| 48 | + blinkLED(pixel, led_chan, ws2812_encoder, tx_config); |
99 | 49 | }
|
100 | 50 | }
|
0 commit comments