PYVCP Spinbox to HAL pwmgen.0.scale;

More
22 Aug 2021 00:13 #218365 by C_M_H
Hello,

I'm trying to learn how to pass values from an Axis / PYVCP spinbox to a HAL parameter.

I have a spinbox setup that I want to use to adjust the scale function of pwmgen.0. I tried just setting the parameter in the post-gui hal file with;

setp   pwmgen.0.scale     pyvcp.PWM_Scale

This gives this error;

value 'pyvcp.PWM_Scale' invalid for float

This is the spinbox setup;

<spinbox>
            <halpin>"PWM_Scale"</halpin>
            <min_>0</min_>
            <max_>5</max_>
            <initval>0.1</initval>
            <resolution>.1</resolution>
            <format>"2.1f"</format>
            <font>('Fixed',14)</font>
            <width>4</width>
        </spinbox>

Any thoughts on how I can accomplish this?

Thanks in advance,

Craig


 

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

More
22 Aug 2021 00:52 #218369 by cmorley
try:
net     PWM_signal    pwmgen.0.scale     pyvcp.PWM_Scale

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

More
22 Aug 2021 01:35 #218372 by C_M_H
Thanks for the fast reply!

Unfortunately that's where I started, trying to use net.

net PWM_signal pwmgen.0.scale pyvcp.PWM_Scale

Gives this error;

Signal 'PWM_signal' can not add OUT pin 'pyvcp.PWM_Scale', it already has I/O pin 'pwmgen.0.scale'

I'm going to re-read the manual some more...

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

More
31 Aug 2021 00:25 #219204 by C_M_H
Okay, got it working, here's the fix.

I used the passthru component as described in this post;

forum.linuxcnc.org/24-hal-components/6487-pid-pin-problems

Works great. I'm stoked to be able to adjust parameters from within Axis / PYVCP.

Here's what it looks like in my postgui HAL file;

loadrt Passthru count=2
addf Passthru.0 servo-thread
addf Passthru.1 servo-thread

net out-sig <= pyvcp.PWM_Scale => Passthru.0.in
net io-sig <= Passthru.0.out => pwmgen.0.scale

net out1-sig <= pyvcp.PWM_Offset => Passthru.1.in
net io1-sig <= Passthru.1.out => pwmgen.0.offset

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

Time to create page: 0.088 seconds
Powered by Kunena Forum