@psoro thanks for this Jose. I have scanned your QR code and all fine (0.4.4, / 2.7.0 / 0.21.7) .
I haven’t flashed any sketches yet as I am short of USB ports at the moment but I will as soon as I can.
We actually used 2 way bridge and device selector in the end and it works fine but I’m still interested in tracking down the correct syntax for future requirements.
Regarding the syntax for bridge, there are 3 distinct elements.
- Define the bridge
- Provide the tokens for the bridge
- Send the data to the bridged device
You and I have the exact same syntax for part 2 (simply provide the tokens for the 2 devices that the third device wants to send data to).
So the difference between your working system and my failed 3 way bridge lies with the definition of the bridge or the sending of the data, or both.
’1. Bridge definitions e.g.
WidgetBridge bridge2(V31);
WidgetBridge bridge3(V31);
I used a random unused pin thinking that is simply a placeholder for the bridge.
I notice you have used V5, V6 (device 1), V4, V5 (device 2) and V4, V5 (device 3) whereas I used the random V31 for all 6 entries across the 3 devices.
’2. Send the data to the bridged device
I used the following syntax, where the pin used is a Value Display that appears in each of the 2nd and 3rd devices:
bridge2.virtualWrite(V30, value);
bridge3.virtualWrite(V30, value);
whereas you used:
bridge2.virtualWrite(V1, value);
bridge3.virtualWrite(V1, value);
I notice from scanning your QR code that V1 appears 3 times in the project layout and you are using the multiple devices facility. So the 3 V1’s that appear are for device 1, device 2 and device 3.
As I said we ended up with the device selector rather than using multiple devices but the features are closely linked.
So I suspect with the V30 and V1 we are doing the same thing i.e. sending the data to a pin (value display widget) that exists on devices 2 and 3.
Summary
Having written this out I suspect the syntax differences between you and I is the actual bridge definitions. As I used V31 for device 2 and 3 it looks like the library ignores the first definition as it is repeated straight after in the sketch, albeit to a different device, and that is why only 1 device was receiving the bridged data. When I have time I will play around with the definitions to be sure of the correct syntax.
Meanwhile @Dmitriy if you have a minute could you please confirm that for 3 way bridging the syntax for the bridge definitions should be:
WidgetBridge bridge2(V_random_unused_pinX);
WidgetBridge bridge3(V_random_unused_pinY);
and not simply:
WidgetBridge bridge2(V_random_unused_pinX);
WidgetBridge bridge3(V_random_unused_pinX);
And that V_random_unused_pin? is a pin in the device doing the bridging rather than any of the devices receiving the bridged data.