Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wled00/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void handleOnOff(bool forceOff)
if (rlyPin>=0) {
// note: pinMode is set in first call to handleOnOff(true) in beginStrip()
digitalWrite(rlyPin, rlyMde); // set to on state
delay(RELAY_DELAY); // let power stabilize before sending LED data (#346 #812 #3581 #3955)
delay(relayDelay); // let power stabilize before sending LED data (#346 #812 #3581 #3955)
}
offMode = false;
}
Expand Down
2 changes: 2 additions & 0 deletions wled00/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
JsonObject relay = hw[F("relay")];

rlyOpenDrain = relay[F("odrain")] | rlyOpenDrain;
CJSON(relayDelay, relay[F("del")]);
int hw_relay_pin = relay["pin"] | -2;
if (hw_relay_pin > -2) {
PinManager::deallocatePin(rlyPin, PinOwner::Relay);
Expand Down Expand Up @@ -1049,6 +1050,7 @@ void serializeConfig(JsonObject root) {
hw_relay["pin"] = rlyPin;
hw_relay["rev"] = !rlyMde;
hw_relay[F("odrain")] = rlyOpenDrain;
hw_relay[F("del")] = relayDelay;

hw[F("baud")] = serialBaud;

Expand Down
4 changes: 3 additions & 1 deletion wled00/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ static_assert(WLED_MAX_BUSSES <= 32, "WLED_MAX_BUSSES exceeds hard limit");
#endif
#endif

#define RELAY_DELAY 50 // delay in ms between switching on relay and sending data to LEDs
#ifndef RELAY_DELAY
#define RELAY_DELAY 50 // default delay in ms between switching on relay and sending data to LEDs
#endif

#if defined(ESP8266) || defined(CONFIG_IDF_TARGET_ESP32S2)
#define WLED_MAX_COLOR_ORDER_MAPPINGS 5
Expand Down
4 changes: 3 additions & 1 deletion wled00/data/settings_leds.htm
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@
d.getElementsByName("RL")[0].value = rl.pin;
d.getElementsByName("RM")[0].checked = rl.rev;
d.getElementsByName("RO")[0].checked = rl.odrain;
d.getElementsByName("RLD")[0].value = rl.delay;
Comment thread
DedeHai marked this conversation as resolved.
Outdated
}
let li = c.light;
if (li) {
Expand Down Expand Up @@ -1115,7 +1116,8 @@ <h3>IR Remote</h3>
<div class="sec">
<h3>Relay</h3>
Relay GPIO: <input type="number" min="-1" max="48" name="RL" onchange="UI()" class="xs"><span style="cursor: pointer;" onclick="off('RL')">&nbsp;&#x2715;</span><br>
Invert <input type="checkbox" name="RM"> Open drain <input type="checkbox" name="RO"><br><br>
Invert <input type="checkbox" name="RM"> Open drain <input type="checkbox" name="RO"><br>
Delay: <input type="number" min="0" max="65535" name="RLD" class="xl"> ms<br><br>
</div>
<h2>General settings</h2>
<div class="sec">
Expand Down
1 change: 1 addition & 0 deletions wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
}
rlyMde = (bool)request->hasArg(F("RM"));
rlyOpenDrain = (bool)request->hasArg(F("RO"));
relayDelay = request->arg(F("RLD")).toInt();
Comment thread
coderabbitai[bot] marked this conversation as resolved.

disablePullUp = (bool)request->hasArg(F("IP"));
touchThreshold = request->arg(F("TT")).toInt();
Expand Down
1 change: 1 addition & 0 deletions wled00/wled.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ WLED_GLOBAL bool rlyOpenDrain _INIT(false);
#else
WLED_GLOBAL bool rlyOpenDrain _INIT(RLYODRAIN);
#endif
WLED_GLOBAL uint16_t relayDelay _INIT(RELAY_DELAY); // delay in ms between switching on relay and sending data to LEDs
#ifndef IRPIN
#define IRPIN -1
#endif
Expand Down
1 change: 1 addition & 0 deletions wled00/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
printSetFormValue(settingsScript,PSTR("RL"),rlyPin);
printSetFormCheckbox(settingsScript,PSTR("RM"),rlyMde);
printSetFormCheckbox(settingsScript,PSTR("RO"),rlyOpenDrain);
printSetFormValue(settingsScript,PSTR("RLD"),relayDelay);
int i = 0;
for (const auto &button : buttons) {
settingsScript.printf_P(PSTR("addBtn(%d,%d,%d);"), i++, button.pin, button.type);
Expand Down
Loading