KMotionCNC Screen Editor Action Execute C Program

Moderators: TomKerekes, dynomotion

Post Reply
dropTarget
Posts: 5
Joined: Wed Jan 31, 2018 10:36 pm

KMotionCNC Screen Editor Action Execute C Program

Post by dropTarget » Thu Feb 01, 2018 2:23 am

I have been customizing my KMotionCNC screen with the KMotion434k screen editor with great results until I hit a bit of a snag. I am attempting to execute a C program when a button is pressed. I have set up the button's size, text, color, etc. and selected "Program// run a KMotion user C program" in the "script/action" dropdown. I selected a thread of 5 and a VAR of 0. After exiting the action script form, the script field contains "Action:4;5;0;0;0;0;KStep\myProgramName.c". I then "SET" the Button control contents and save the screen script. I have verified that the user C program compiles, downloads and runs successfully from the KMotion C Program screen.
When the button is pressed during KMotionCNC execution, the KMotion console output reports the following:

EXECUTE0
^
Error:Expecting value 1 to 7

which leads me to believe that thread 0 is the target of the program instead of thread 5.

Is there something I'm missing?

Thanks,
RJ

dynomotion
Site Admin
Posts: 12
Joined: Fri Nov 24, 2017 8:22 pm

Re: KMotionCNC Screen Editor Action Execute C Program

Post by dynomotion » Thu Feb 01, 2018 4:28 am

Hi dropTarget,

You are correct that was a bug introduced in V4.34k. Now that actions from buttons are executed from worker Threads care must be taken that any dynamically created Action data lives until the worker Thread completes.

Here is a patch that should fix this problem. Replace this file in your C:\KMotion434k\KMotion\Release directory.
http://dynomotion.com/Software/Patch/Fi ... preter.dll

Here is the changed source if needed:
http://dynomotion.com/Software/Patch/Fi ... preter.cpp

Please let us know if it solves the problem or if there are any issues.

Regards

dropTarget
Posts: 5
Joined: Wed Jan 31, 2018 10:36 pm

Re: KMotionCNC Screen Editor Action Execute C Program

Post by dropTarget » Thu Feb 01, 2018 5:01 pm

Yes! That did the trick.
Thank you for an excellent product and great support.

RJ

Post Reply