Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relay type inverse send short signal on boot - when set to always off #1078

Closed
kakaki opened this issue Jul 25, 2018 · 1 comment
Closed
Milestone

Comments

@kakaki
Copy link

kakaki commented Jul 25, 2018

Hi i have notices that in relay module in _relayConfigure pins are not set to high when relay is type inverse - there is short period of time when relays is set active - i have added to it control w gate and it's opening/closing gate on every reboot of device.

Simple fix is to set pin to high in same loop where it's set as output.

Changed code:

void _relayConfigure() {
    for (unsigned int i=0; i<_relays.size(); i++) {
        pinMode(_relays[i].pin, OUTPUT);
        if (_relays[i].type == RELAY_TYPE_LATCHED || _relays[i].type == RELAY_TYPE_LATCHED_INVERSE) {
            pinMode(_relays[i].reset_pin, OUTPUT);
        }
        if (_relays[i].type == RELAY_TYPE_INVERSE) {
          //set to high to block short opening of relay
          digitalWrite(_relays[i].pin, HIGH);
        }
        _relays[i].pulse = getSetting("relayPulse", i, RELAY_PULSE_MODE).toInt();
        _relays[i].pulse_ms = 1000 * getSetting("relayTime", i, RELAY_PULSE_MODE).toFloat();
    }
}
@xoseperez
Copy link
Owner

It makes sense. I would expect the same behavior whether it's a normal or an inverse logic relay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants