Hey,
thanks you for the awesome platform and software. It really is fun playing around with it.
For a small project I have, I want two belas running in parallel (for performance reasons. maybe a not so small project after all).
I thought it would be super nice to control the two belas from one GUI. I'm almost there, but ran into a problem which maybe someone of you can solve.
I connected the two Belas with an Ethernet Cable directly and set the IP for eth0 in /etc/network/interfaces to static IP and gave the "main" bela 192.168.8.2 the "client" bela the 192.168.8.3
The main bela is connected via USB (he gets the 192.168.6.2 IP on the USB interface).
I can ssh into this one, and from there ssh into 192.168.8.3. So the two belas can communicate.
To actually control them over the GUI, i modified two files on the main bela:
In BelaWebSocket.js I added a second websocket connection:
this.url2 = "ws://" + "192.168.8.3" + ":"+this.port+"/"+this.address;
and duplicated the connection function accordingly.
In the onMessage function I added
// ignore messages from other bela
if (msg.origin != "ws://192.168.6.2:5555") {
return;
}
To only react to local messages. (Good enough for now)
In BelaData.js at the bottom (line 140 or so) under the send to the original websocket i added
if (this.ws2.readyState == 1) {
this.ws2.send(pkt);
}
else {
console.log("Not connected to second bela");
}
Boths Belas run the same program.
Now comes the part that I don't understand:
This setup works only if i have both belas connected to the PC. So if only the main bela is connected, and the other is powered externally, the websocket never connects.
(To connect both to the PC i changed the USB IP on the client to 192.168.6.3)
Am I missing something? My original assumption was, that maybe the IDE does not start up, if the usb network is down, but looking at the startup, everything seems to be fine.
Hopefully, one of you has a great idea what I have overlooked
Thanks,
Jan
P.S. if this works, i would of course be happy to contribute the code changes if found useful