-
Notifications
You must be signed in to change notification settings - Fork 639
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
Interlock by software on Sonoff T1 2 gang, or Sonoff Dual #491
Comments
Except for the wait, the firmware already does that if you set the synchronization mode to "Zero or one switches active". In this sync mode, the firmware will check it never has more than one relay ON. One thing thou: right now it will action the relays in order, so there is a change to have both on for a few millis. |
Forgive my English. How is this option activated? |
The bit that Xose refers to is in the relay.ino file, relaySync function, lines 256-258 of the current build. These are the sequential changes he says. for (unsigned short i=0; i<_relays.size(); i++) { And that is called in previous function called relayStatus. The loop seems ok to me, but I don't understand yet the previous lines to that to avoid the situation. Maybe it's as easy as adding some wait (of some miliseconds) after the loop completes to give all relays time to be effectively turned off. I can't see if the requested relay gets its target status and then relaysync is called, or the other way round. I haven't had enough time to look it in depth and change it (and any related bit of code) to what I (and you) want, tho. It's the first time I look into the code of espurna. Let the weekend come! :) |
Those lines actually only enqueue the actions. This is part of the flow window strategy the firmware uses to avoid wearing out the relays too much too quickly. The actual relay switching is done in the espurna/code/espurna/relay.ino Line 773 in f8907d6
And that's where it loops the relays in order. That loop should be done twice. The first time to turn off those relays that must be turned off and the second one to turn on the relays that must be turned on. |
I have pushed a commit that forces turning off relays before turning others on, basically calling the loop in relayLoop twice with different target modes. |
Thanks a lot Xose. Keep up the good work!!! |
Thanks for the modification. In this case, if I set the mode "0 or one switch active" it would serve so that when you activate, for example, lowering a shutter, before it stops rising in case it is activated, right? |
That is what I understand, yes |
I have two sonoff basic to control a blind, it's possible use "One and just one switch active" or i need use sonoff dual? The dual sonoff has 2 physical buttons to use as the gpio 14 of the sonof basic? |
A firmware on a device will only control the relays on its device, so you need a device with 2 or more relays for this option to be of any use for you. Dual, 4ch or T1 for instance. |
Thanks, I've asked for one to prove that I think it's version r2 |
This is staged for release. |
Hi, i'd like to suggest an enhancement.
If there was a interlock mechanism embedded on Espurna for devices with 2 relays like Sonoff T1 or Sonoff Dual, it would be a great way to control motors with 2 directions like blinds or curtains (persianas). I don't know if it is difficult to do, something like "when getting a signal to turn on a relay, first signal the other relay to turn off and wait some miliseconds (safety?), then turn on the asked relay".
Thanks a lot Xose and the rest for this great firmware. Keep the good work!
The text was updated successfully, but these errors were encountered: