mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-07-05 13:48:53 +00:00
Merge pull request #43 from HendrikRauh/HendrikRauh/issue39
Reset protection
This commit is contained in:
commit
330d4ffa42
2 changed files with 16 additions and 8 deletions
|
@ -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 |
|
||||
| -------------- | ------------------ |
|
||||
|
|
22
src/main.cpp
22
src/main.cpp
|
@ -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...");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue