Get value from device and show as text

284 views
Skip to first unread message

Lars NS

unread,
Sep 28, 2012, 5:34:17 AM9/28/12
to comman...@googlegroups.com
Hi

I'm new to CommandFusion, and I can't figure out how to show a value from my system.

I send a command (GG 2 \x0D), and get a response(GG 2,VALUE \x0D) from my system indicating the volume of a groupfader in my audioDSP. How should I set this up - a step by step, or and examplefile would be helpful.
In my GUI I have up/down buttons for volume and I just need that text-value indicating the volume.

Best Regards,
Lars

Jordan

unread,
Sep 28, 2012, 6:23:00 AM9/28/12
to comman...@googlegroups.com
Assuming you have already a System defined for sending the volume up/down commands, you can create a Feedback item with a regular expression that captures the date you want from the string you receive from the DSP.
The Feedback item should have the following regex:

GG 2,(.*)

which captures anything between the comma and the EOM delimiter (make sure you put \x0D in the system EOM field).
In the Feedback definition, click Add Group, give it a name (eg. "volume"), set Data Type to Serial, Target Type to Serial and Join is the serial join of the text box you use to display the volume.

This should be it.

Jarrod Bell

unread,
Sep 28, 2012, 9:45:32 AM9/28/12
to comman...@googlegroups.com
One slight difference is you should put the EOM on the end of the regex as well:
GG 2,(.*)\x0D

The EOM is never actually stripped from the data, its just used to split data as it arrives. The data is only separated, nothing is stripped from it.

Other than that, Jordan was spot on. Just remember to match the join number of the volume text object in your GUI with the join number in your feedback "capture group" item.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/2NZWYnpOBx8J.
To post to this group, send email to comman...@googlegroups.com.
To unsubscribe from this group, send email to commandfusio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/commandfusion?hl=en.

Jordan

unread,
Sep 28, 2012, 10:08:31 AM9/28/12
to comman...@googlegroups.com, jar...@commandfusion.com
Eheh yeah, I usually have my fair share of trial&error before getting these right ;)

Lars NS

unread,
Oct 5, 2012, 5:26:19 AM10/5/12
to comman...@googlegroups.com, jar...@commandfusion.com
I can't get this to work - I have made a new file with macros on the up/down buttons for volume, first the set volume command, and then a get volume.

The text field stays empty when using the GUI online.

I have set the serial join to the same value for both the feedback command and the text item.

I have attached the file here, that might clear things up.

Best regards, Lars
ESP88_test.gui

Jordan

unread,
Oct 5, 2012, 8:28:40 AM10/5/12
to comman...@googlegroups.com, jar...@commandfusion.com
Can't test the GUI as my dev iPad is out for a demo, but at a first glance you are trying to update the serial join 1 at Index 1 of List 1, which is not correct, as iViewer would look for something which is identifies as l1:i1:s1.
Remove all references to lists and indexes and try again, I will try and simulate your GUI when I get the iPad back.

Jarrod Bell

unread,
Oct 5, 2012, 9:35:42 AM10/5/12
to comman...@googlegroups.com
As Jordan mentioned - remove the list join details from the feedback item, you are not using lists.

Also, check the EOM of your system. You have it set to \x3B, but is that data actually sent as part of the incoming messages? Your regex doesnt look for it.
If the EOM is never found, then the incoming data will never be sent through the feedback system as it will be constantly buffered until the EOM arrives. I think you should have this set to \x0D like mentioned earlier.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/3JyGnlk_I-QJ.

Lars NS

unread,
Oct 8, 2012, 3:07:54 AM10/8/12
to comman...@googlegroups.com, jar...@commandfusion.com
Removed the listjoin, and went through the Regex again - I had a space missing... it works!

Thanks for the help you guys!

The next "problem".. how do I convert the HEX value my system returns as volume-level to match a decibel-scale where 0h(-60dB) to 90h(+12dB) in 0.5dB steps (0-144 dec) ?

Jarrod Bell

unread,
Oct 9, 2012, 12:31:07 AM10/9/12
to comman...@googlegroups.com
You can use the capture group to convert the captured data, just set the "Hex Data" property to the data type that you are capturing (hex byte in your case I believe), and it will convert it back to decimal values for the final join assignment.
Make sure to set the data type to analog so you get the conversion options. Make sure to leave the min and max settings blank if you dont want to convert it for use in a gauge/slider.

The little help window under the property fields in the feedback properties dialog gives you more info based on the property you have highlighted.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/X0XN0CU5Z0wJ.

Lars NS

unread,
Dec 17, 2012, 8:42:53 AM12/17/12
to comman...@googlegroups.com
I recieve a 90h for example - and set the capture group to datatype to analog and the target to serial(maybe this is wrong?) and the token for value. The min and max are set to -60 and the max is set to 12(being 90h from device) Hex data is set to HexByte.

The value i get is a constant "65535" no matter what the hex value returned is. 

Could you please guide me through the process of getting a value in hex and displaying it as text in decimal (0h(-60dB) to 90h(+12dB) in 0.5dB steps (0-144 dec) 

Best regards, Lars

Jarrod Bell

unread,
Dec 17, 2012, 8:54:27 AM12/17/12
to comman...@googlegroups.com
Min and Max will scale the incoming value to the range 0-65535, for use with sliders/gauges.
You will need to use transform field and some math instead.

Make sure min and max are both empty, set the hex data mode to Hex Byte (you had this part correct), then use this math as the transform value:
value-132


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/zpoXLJ9-KLsJ.

Lars Justesen

unread,
Dec 17, 2012, 9:08:44 AM12/17/12
to comman...@googlegroups.com
Set the datatype to analog and target to serial and token for value - no min and max, and the transform is set to "value-132"

This gives me values ranging from -84 to 14508... I must admit that I'm a bit confused right now ;)

Please give guide me through this, I really want to understand how this works :)
Venlig hilsen
Lars Justesen

North Star aps
Farum Hovedgade 53-55
DK-3520 Farum

Telefon : +45 4495-0662
Mobil 	: +45 5051-2606
Email 	: la...@northstar-aps.dk
Web 	: http://northstar-aps.dk

Jarrod Bell

unread,
Dec 18, 2012, 10:37:42 AM12/18/12
to comman...@googlegroups.com
OK, so there is scaling going on as well. Try this math:

(value/2)-60:1

See the wiki for details on output formatting for math expressions:
http://www.commandfusion.com/wiki2/software/gui-designer/math-expressions#numbers-and-text-output-formatting

Remember: Min and Max settings in the feedback capture group MUST be left blank.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Lars Justesen

unread,
Dec 19, 2012, 6:58:18 AM12/19/12
to comman...@googlegroups.com
Thank you so much Jarrod! That solved my problem!
Will take a look at that link.

Venlig hilsen
Lars Justesen

North Star aps
Farum Hovedgade 53-55
DK-3520 Farum

Telefon : +45 4495-0662
Mobil 	: +45 5051-2606
Email 	: la...@northstar-aps.dk
Web 	: http://northstar-aps.dk
Reply all
Reply to author
Forward
0 new messages