QtQuickVcp

62 views
Skip to first unread message

Frederic RIBLE

unread,
May 22, 2019, 5:46:57 PM5/22/19
to Machinekit

Hello,

I am using a hal remote component to implement jog buttons in a QML UI.
When I click and release quickly the button, frequently the motion does not stop.

Looks like there is an issue in HalPin if you set the value to "true", then "false" before the remote component is synced.

Here is a log:

* jog on/off ok:

qml: setPin true
qml: synced false true
qml: synced true true
qml: setPin false
qml: synced false false
qml: synced true false

* jog on/off with problem:

qml: setPin true
qml: synced false true
qml: setPin false
qml: synced true false

And my QML code:

        HalPin {
            id: pin_jog_0_plus
            name: "jog.0.plus"
            type: HalPin.Bit
            direction: HalPin.Out
            onSyncedChanged: {
                console.log("synced " + synced + " " + value)
            }
        }

....

    function setPin(pin, v) {
        console.log("setPin " + v)
        pin.value = v
    }
...

                    MyButton {
                        property var _label: [ "X-", "X+", "Y-", "Y+", "Z-", "Z+"]
                        property var _pos: [ [0, 1], [2, 1], [1, 2], [1, 0], [3, 2], [3, 0]]
                        property var _pin: [pin_jog_0_minus, pin_jog_0_plus, pin_jog_1_minus, pin_jog_1_plus, pin_jog_2_minus, pin_jog_2_plus]
                        property var _pin_inc: [pin_jog_0_inc_minus, pin_jog_0_inc_plus, pin_jog_1_inc_minus, pin_jog_1_inc_plus, pin_jog_2_inc_minus, pin_jog_2_inc_plus]

                        Layout.fillWidth: true
                        Layout.fillHeight: true
                        Layout.maximumHeight: MyStyle.buttonSize
                        Layout.maximumWidth: MyStyle.buttonSize

                        Layout.row: _pos[index][1]
                        Layout.column: _pos[index][0]
                        text: _label[index]
                        onPressedChanged: {                           
                            if (pin_jog_increment.value === 0) setPin(_pin[index], pressed) // Continuous
                            else setPin(_pin_inc[index], pressed) // Press
                        }
                    }

Any clue?
Thanks.
Frederic (http://cnc.f1oat.org)


Frederic RIBLE

unread,
May 22, 2019, 6:09:55 PM5/22/19
to machi...@googlegroups.com

I have a workaround with the following new HalPinReliable class

import Machinekit.HalRemote 1.0
HalPin {
property bool setValue
onSetValueChanged: {
if (synced) value = setValue
}
onSyncedChanged: {
//console.log("synced " + synced + " " + value)
if (value != setValue) {
//console.log("fix")
value = setValue
}
}
}

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/8086b22f-c90f-49f9-176c-906627277a82%40rible.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages