Skip to main content
Ubus99
Associate III
February 21, 2022
Solved

How to build a Flow that can be toggled between Probe and TCP mode?

  • February 21, 2022
  • 1 reply
  • 1146 views

I would like to use the toggle UI element to switch between two paths: probe send and receive, and TCP send and receive.

The rest of the pipeline should remain the same.

This topic has been closed for replies.
Best answer by stephane.legargeant

Hello

Do you mean one sub flow with STLink probe, and another using a TCP node ?

It is possible to use some "switch" nodes to connect one path or the other one :

  • Add the toggle button, and store the value "probe" or"TCP" in a the flow context (with a "change" node : set flow.myswitch to msg.payload)
  • Add a "switch" node on probe path, with the condition flow.myswitch== probe
  • Add another switch on TCP path, with the condition flow.myswitch==TCP

When the toggle is moved, the flow variable is set, and will activate one path or the other.

Here is an example :

0693W00000KZyThQAL.pngLet us know if this is answering your question.

Best regards

1 reply

stephane.legargeant
ST Employee
February 21, 2022

Hello

Do you mean one sub flow with STLink probe, and another using a TCP node ?

It is possible to use some "switch" nodes to connect one path or the other one :

  • Add the toggle button, and store the value "probe" or"TCP" in a the flow context (with a "change" node : set flow.myswitch to msg.payload)
  • Add a "switch" node on probe path, with the condition flow.myswitch== probe
  • Add another switch on TCP path, with the condition flow.myswitch==TCP

When the toggle is moved, the flow variable is set, and will activate one path or the other.

Here is an example :

0693W00000KZyThQAL.pngLet us know if this is answering your question.

Best regards

Ubus99
Ubus99Author
Associate III
February 21, 2022

Thank you for your answer, this should work.

That being said, judging from the Icon, the "switch" node looks like it switches between two paths, which would be a great function to have.