Merge pull request #43 from HendrikRauh/HendrikRauh/issue39

Reset protection
This commit is contained in:
Hendrik Rauh 2024-12-15 20:36:46 +01:00 committed by GitHub
commit 330d4ffa42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 8 deletions

View file

@ -86,7 +86,7 @@ All print files (STL, STEP, X_T) can be found in [assets/case](/assets/case/). A
## ⚙️ Default config
To reset the settings, hold down the button and connect the ESP to the power supply. As soon as the LED flashes quickly, the settings are reset.
To reset the settings, hold down the button and connect the ESP to the power supply, the LED will flash quickly. After 3 seconds the LED should light up static and the settings are reset. If you release the button early you abort the reset and the LED flashes slowly.
| Setting | Value |
| -------------- | ------------------ |

View file

@ -100,21 +100,29 @@ void setup()
// LED
analogWrite(PIN_LED, brightness_led);
// delay(5000);
ledBlink(500);
// Button
pinMode(PIN_BUTTON, INPUT_PULLUP);
if (digitalRead(PIN_BUTTON) == LOW)
{
ledBlink(100);
delay(2000);
Serial.println("Reset config");
config.begin("dmx", false);
config.clear();
config.end();
unsigned long startTime = millis();
while (digitalRead(PIN_BUTTON) == LOW && (millis() - startTime <= 3000))
{
}
if (digitalRead(PIN_BUTTON) == LOW)
{
ledBlink(1);
Serial.println("Reset config");
config.begin("dmx", false);
config.clear();
config.end();
delay(2000);
}
}
ledBlink(500);
// wait for serial monitor
delay(5000);
Serial.println("Starting DMX-Interface...");