rszimm / sprinklers_pi

Sprinkling System Control Program for the Raspberry Pi
GNU General Public License v2.0
310 stars 100 forks source link

I would like access to GPIO 15 #122

Closed BrianAus closed 6 years ago

BrianAus commented 6 years ago

I want to include open HAB on my raspberry Pi with the open sprinkler board. Specifically I want openHAB to control things using 433 Mhz. The Open sprinkler board has a space for a 433Mhz transmitter that connects data to GPIO 15. When I try to open GPIO15 it complains that it is already in use (by sprinklerspi). I stopped sprinklerspi and all works. Is there a way I can prevent sprinklerspi from opening GPIO15. I did have a look at the code and it seems that when the output mode is opensprinkler then it should not open GPIO 15

Thanks

nhorvath commented 6 years ago

If you're in open sprinkler mode we don't. Please ensure you're actually in opensprinkler mode.

        if (eot == OT_OPEN_SPRINKLER)
        {
            pinMode(SR_CLK_PIN, OUTPUT);
            digitalWrite(SR_CLK_PIN, 0);
            pinMode(SR_NOE_PIN, OUTPUT);
            digitalWrite(SR_NOE_PIN, 0);
            pinMode(SR_DAT_PIN, OUTPUT);
            digitalWrite(SR_DAT_PIN, 0);
            pinMode(SR_LAT_PIN, OUTPUT);
            digitalWrite(SR_LAT_PIN, 0);
        }
        else
        {
            for (uint8_t i=0; i<sizeof(ZoneToIOMap); i++)
            {
                pinMode(ZoneToIOMap[i], OUTPUT);
                digitalWrite(ZoneToIOMap[i], (eot==OT_DIRECT_NEG)?1:0);
            }
        }
BrianAus commented 6 years ago

Thanks Nick

I am definitely in open sprinkler mode and I also saw that code. This was my log pi@devpi ~ $ sudo python TransmitRF.py FANsouthHI TransmitRF.py:38: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(TRANSMIT_PIN, GPIO.OUT) /etc/init.d/sprinklerspi stop allowed it to work. I have restarted sprinklerspi and it is now working as expected Strange but true

Thanks for the quick response Brian

nhorvath commented 6 years ago

After changing modes you should restart sprinklerpi (and maybe even the pi itself) if you need to use the pins that were formerly assigned to zones directly. This should probably be documented somewhere. My guess is that you hadn't restarted since switching to open sprinkler mode.