I'm trying to reset some NVS data with a press of a button. As soon as the ISR runs, the system reboots.
Here's the short code, what could be the cause, how to solve?
Code: Select all
#include <Preferences.h>
#include <Arduino.h>
#define RESET_BUTTON 23
void IRAM_ATTR reset_isr(){
Preferences pref;
pref.begin("wifidata");
pref.remove("st_ssid");
pref.remove("st_password");
pref.end();
Serial.println("Credientials removed!");
};
void setup() {
pinMode(RESET_BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(RESET_BUTTON), reset_isr, RISING);
Serial.begin(115200);
}
void loop() {
}