OpenSprinkler Forums Hardware Questions OpenSprinkler Beagle (OSBo) Unified Firmware and BBB IO Reply To: Unified Firmware and BBB IO



I got a hint from another user @sakos on how this could be achieved in this post –

– Control of relay on legacy Opensprinkler Pi boards.
To assign the relay to a station just configure the station as “RF” and set “0” as RF code.

I downloaded their SD card image to try to figure out what changes they made.
They made changes to the function switch_rfstation in OpenSprinkler.cpp

The function has slightly changed in the latest Firmware 2.1.9(9) from what sakos had. So I took what sakos did and tried to make it work.
What I came up with is this:

void OpenSprinkler::switch_rfstation(RFStationData *data, bool turnon) {
ulong on, off;
uint16_t length = parse_rfstation_code(data, &on, &off);
#if defined(ARDUINO)
#if defined(ESP8266)
rfswitch.send(turnon ? on : off, 24);
send_rfsignal(turnon ? on : off, length);
if (((char*)data)[0]==’0′ && ((char*)data)[1]< ‘0’) {
//Single zero character of RF code
digitalWrite(PIN_RFTX, turnon ? HIGH : LOW);
} else {
// pre-open gpio file to minimize overhead
rf_gpio_fd = gpio_fd_open(PIN_RFTX);
send_rfsignal(turnon ? on : off, length);
rf_gpio_fd = -1;


… and it works in controlling the mini-relay!

I understand the PIN used by the mini-relay has been repurposed in the code for the RF functionality.
It would be great if @Ray could implement a way to choose if you are using the RF functionality or the mini-relay.
Perhaps it could be handled with the argument to the script? something like:
sudo ./ osbo_relay (for the relay)
sudo ./ osbo_rf (for RF)

But for now I guess I’ll have to live with my hack.