How to map numeric value to a string for pyvcp UI display?

More
11 Jun 2020 09:50 #171104 by sdwyer
Hi,
I've just got my VFD working via modbus with the vfdmod module.

I'm able to query for status and error codes but it returns a numeric value.

Is there a way to map a list of numeric values to text strings for the purpose of displaying on a pyvcp panel?
I've spent the last hour reading the docs and googling and I can't seem to find a solution.

i've attached screenshots as it stands now - you can see 'vfd status' is a numeric 1 which translates to "FWD running start" in the screenshot of the documentation.

I'd also like to add the fault code - there is another table elsewhere in the documentation for this, but its the same idea.

Cheers!
Shaun
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Jun 2020 12:52 #171128 by bbsr_5a
You shoudt set some LED to your panel and act on incomming error

you can also make your own COMP to deal with this issue
as it is real programming to get things devided and analysed
linuxcnc.org/docs/html/hal/halmodule.html

Please Log in or Create an account to join the conversation.

More
12 Jun 2020 01:48 #171203 by sdwyer
Hi bsr_5a,

Thanks for the suggestion.. I thought about doing this as a last resort, but the problem I see is clutter on the UI would be significant. I'd end up with 20-30 LED indicators on the panel that are there 'just incase'.

I'm wondering if i can do something with pyvcp and hide/show elements based on a value. I might go ask in the pyvcp group.

Please Log in or Create an account to join the conversation.

More
12 Jun 2020 08:15 #171223 by bbsr_5a
personly i wonder why you woudt know on the GUI what the error is
as you just need to Pause the machine and get a look on the VFD display that tels you what happend

you cand interfear the VFD on a error stop the machine and get a Humen decide

Please Log in or Create an account to join the conversation.

More
12 Jun 2020 12:47 - 12 Jun 2020 12:50 #171249 by MaHa
There is a way to use 'Image u32' , which allows an unlimited number of gif's. The first image is 0 and counting up. Just need to make a few Gifs (i used irfan view for the example, 200/50px). the set 'theError' to the corresponding number, and maybe need to convert.
I had no time to make the example fancy



<labelframe text="Error TXT">
			<font>("Helvetica",10)</font>
			<hbox>
				<label text="Error: "/>
				<image name="err1" file="err1.gif"/>
				<image name="err2" file="err2.gif"/>
				<image name="info1" file="info1.gif"/>
				<image name="message1" file="message1.gif"/>
				<vbox>
					<image_u32 halpin="selectimage" images="err1 err2 info1 message1"/>
				</vbox>
			</hbox>
		</labelframe>



net Err-type-in  theError =>  conv-s32-u32.0.in
net Err-type-out conv-s32-u32.0.out => pyvcp.selectimage
Attachments:
Last edit: 12 Jun 2020 12:50 by MaHa.

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum