basic factory reset routine
This commit is contained in:
parent
e88760c299
commit
b16b6902d7
2 changed files with 18 additions and 1 deletions
|
|
@ -12,6 +12,6 @@
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wt32-eth01
|
board = wt32-eth01
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = siwats/ESPMegaProR3@^2.0.7
|
lib_deps = siwats/ESPMegaPROR3@^2.0.7
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
;build_flags = -DCORE_DEBUG_LEVEL=5
|
;build_flags = -DCORE_DEBUG_LEVEL=5
|
||||||
17
src/main.cpp
17
src/main.cpp
|
|
@ -89,6 +89,13 @@ void sendExtStopBytes()
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
gpio_config_t gpio_2_conf;
|
||||||
|
gpio_2_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
gpio_2_conf.mode = GPIO_MODE_INPUT;
|
||||||
|
gpio_2_conf.pull_up_en = GPIO_PULLUP_ENABLE;
|
||||||
|
gpio_config(&gpio_2_conf);
|
||||||
|
// If GPIO 2 is pulled low, clear the FRAM then reboot (Reset the device to factory defaults)
|
||||||
|
bool clear_fram = !gpio_get_level(GPIO_NUM_2);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
cudDisplayAdapter.begin(CUD_DISPLAY_BAUD_RATE, SERIAL_8N1, CUD_DISPLAY_RX_PIN, CUD_DISPLAY_TX_PIN);
|
cudDisplayAdapter.begin(CUD_DISPLAY_BAUD_RATE, SERIAL_8N1, CUD_DISPLAY_RX_PIN, CUD_DISPLAY_TX_PIN);
|
||||||
sendExtStopBytes();
|
sendExtStopBytes();
|
||||||
|
|
@ -100,6 +107,16 @@ void setup()
|
||||||
Serial.print("boot_state.txt=\"Core Initializing . . .\"");
|
Serial.print("boot_state.txt=\"Core Initializing . . .\"");
|
||||||
sendStopBytes();
|
sendStopBytes();
|
||||||
espmega.begin();
|
espmega.begin();
|
||||||
|
if (clear_fram)
|
||||||
|
{
|
||||||
|
Serial.print("boot_state.txt=\"Factory Resetting . . .\"");
|
||||||
|
sendStopBytes();
|
||||||
|
for (uint16_t i = 0; i < 32768; i++)
|
||||||
|
{
|
||||||
|
espmega.fram.write8(i, 0);
|
||||||
|
}
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
Serial.print("boot_state.txt=\"IoT Initializing . . .\"");
|
Serial.print("boot_state.txt=\"IoT Initializing . . .\"");
|
||||||
sendStopBytes();
|
sendStopBytes();
|
||||||
espmega.enableIotModule();
|
espmega.enableIotModule();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue