Posts: 2
Threads: 2
Joined: Dec 2020
I was playing with the BLE feature to integrate a laser distometer. The device can receive commands (laser on/off, continuous mode, single measurement, etc) that i managed to control with the BLE output node which is connected to a button output buffer of length 1. The issue is, that once the button has been pressed, its output buffer is filled and never cleared again. The output node will therefore repeat sending the command at each analysis cycle. Manually adding clear="true" (and for the sake of testing, also clear="false") to the input line of the BLE output node doesn't have any effect. Also for other types of outputs that might be sent to an external device via BLE, i think "clear at input" might be a useful behavior?
Posts: 323
Threads: 6
Joined: Aug 2018
Institution: RWTH Aachen University
Makes sense, indeed.
The current solution is to handle erasing in the analysis block. Sending BLE data is always (and only) done when the analysis cycle has finished, so you can control the data before each send. Usually, you would react to the button push by preparing the data to be sent. So, for example, your button would write the value 1 to a buffer "buttonTriggered" and in the analysis block you would copy some data to "dataToBeSent" if "buttonTriggered" equals 1 and just clear "dataToBeSent" otherwise (clear="true" at the output a type="empty" input for the else case). You can then simply unconditionally append a zero afterwards to clear the "buttonTriggered" buffer.
In your case this seems a bit awkward as you want to send the same value as set by the button. So you would do something like this, which appears unnecessarily overcomplicated as you do not need to fetch special data:
Code:
<if equal="true">
<input clear="true">buttonTriggered</input>
<input type="value">1</input>
<input type="value">1</input>
<input type="empty" />
<output clear="true">dataToBeSend</output>
</if>
<append>
<input type="value">0</input>
<output>buttonTriggered</output>
</append>