qtvcp issues
15 Jan 2019 06:38 #124225
by KCJ
Replied by KCJ on topic qtvcp issues
In QtPyVCP I use a work around that is very similar to what Norbert described to reset the mode after an MDI command. It seems to work well. Here is the code if it might be helpful:
github.com/kcjengr/qtpyvcp/blob/master/q...hine_actions.py#L131
github.com/kcjengr/qtpyvcp/blob/master/q...hine_actions.py#L131
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
15 Jan 2019 06:48 - 15 Jan 2019 06:49 #124226
by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
I will have to check.
It should work if the command was sent by one of the push buttons that sets a flag,
and if the task_ mode is 3 (mdi),
and if the inpos (in position) status is True.
I would think that all of those would be valid under the conditions you describe. But I will check to be sure.
I forgot to mention in my earlier posts that In the handler that I have this commented out.
# from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
It should work if the command was sent by one of the push buttons that sets a flag,
and if the task_ mode is 3 (mdi),
and if the inpos (in position) status is True.
I would think that all of those would be valid under the conditions you describe. But I will check to be sure.
I forgot to mention in my earlier posts that In the handler that I have this commented out.
# from qtvcp.widgets.gcode_editor import GcodeEditor as GCODE
Last edit: 15 Jan 2019 06:49 by auto-mation-assist.
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
15 Jan 2019 06:50 #124227
by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Ok great, every bit of information is helpfull.
Please Log in or Create an account to join the conversation.
15 Jan 2019 07:36 #124228
by cmorley
Replied by cmorley on topic qtvcp issues
There is code in the ACTION library that should cover mode changes back and forth.
ACTION.ensure_mode(modes)
only changes modes if required, returns: whether the mode changed, and the old mode, so you can return it to the same mode.
No sense in reinventing the wheel. If the code doesn't quite suit what you need I am certainly willing to add code to cover common requirements.
Chris M
ACTION.ensure_mode(modes)
only changes modes if required, returns: whether the mode changed, and the old mode, so you can return it to the same mode.
No sense in reinventing the wheel. If the code doesn't quite suit what you need I am certainly willing to add code to cover common requirements.
Chris M
The following user(s) said Thank You: KCJ
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
15 Jan 2019 21:43 #124269
by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Norbert
In regards to your, 'Does your way also work correct, if no movement is involved?
What if we just send a G4 P1 or M61 Q2 or just a (MSG, Hallo world)'
G4 P - interp goes from idle to reading and inserts the G4 in the G code list.
M61 Q2 - interp goes from idle to reading and inserts M61 in the Mcode list.
MSG, Hallo world - gives: unkown word starting with 'S' - interp stays in idle
Hallo world - gives: unkown word starting with 'a' - interp stays in idle
Looks like its ok to me.
If are commas allowed in a command for some reason I would have to change how I handle a command.
In regards to your, 'Does your way also work correct, if no movement is involved?
What if we just send a G4 P1 or M61 Q2 or just a (MSG, Hallo world)'
G4 P - interp goes from idle to reading and inserts the G4 in the G code list.
M61 Q2 - interp goes from idle to reading and inserts M61 in the Mcode list.
MSG, Hallo world - gives: unkown word starting with 'S' - interp stays in idle
Hallo world - gives: unkown word starting with 'a' - interp stays in idle
Looks like its ok to me.
If are commas allowed in a command for some reason I would have to change how I handle a command.
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
15 Jan 2019 21:52 #124270
by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
Chris,
This is the present code I use for finishing the present jogging position commands to exist MDI mode. It get called by periodic. jogging_control[14] gets set to 1 by the button push of a selected command. I do not see a need to change it for my application.
def mdi_to_manual(self):
if self.jogging_control[14] == -1:
return
if self.jogging_control[14] == 1:
if self.s.inpos == True:
# task_mode: manual = 1, auto = 2, midi = 3
if self.s.task_mode == 3:
self.c.mode(linuxcnc.MODE_MANUAL)
self.jogging_control[14] = -1
print "mdi position cmd completed"
This is the present code I use for finishing the present jogging position commands to exist MDI mode. It get called by periodic. jogging_control[14] gets set to 1 by the button push of a selected command. I do not see a need to change it for my application.
def mdi_to_manual(self):
if self.jogging_control[14] == -1:
return
if self.jogging_control[14] == 1:
if self.s.inpos == True:
# task_mode: manual = 1, auto = 2, midi = 3
if self.s.task_mode == 3:
self.c.mode(linuxcnc.MODE_MANUAL)
self.jogging_control[14] = -1
print "mdi position cmd completed"
Please Log in or Create an account to join the conversation.
15 Jan 2019 23:07 - 15 Jan 2019 23:29 #124274
by cmorley
Is much easier to read. Its future proof. it's consistent.
But even more then that I think you could not even need the whole function if you used other objects for the intended behaviour.
I believe this was for positioning the axes with the push of a single button, which there is an action button for that.
Of course there will be times that the widgets/libraries will not cover your needs, in that case I would be interesting in improving the widget/library if it is a common enough behaviour. If it's really odd then of course custom code makes sense, but even then it also makes sense to use as much of the 'building blocks' as you can.
In this way everyone who builds a screen helps and gets help from eveyone else who makes a screen - because the code is consistent, exercised and improved.
Just my 2cents worth.
Thanks
Chris M
Replied by cmorley on topic qtvcp issues
def mdi_to_manual(self):
if self.jogging_control[14] == -1:
return
if self.jogging_control[14] == 1:
if self.s.inpos == True:
ACTION.SET_MANUAL_MODE()
self.jogging_control[14] = -1
print "mdi position cmd completed"
Is much easier to read. Its future proof. it's consistent.
But even more then that I think you could not even need the whole function if you used other objects for the intended behaviour.
I believe this was for positioning the axes with the push of a single button, which there is an action button for that.
Of course there will be times that the widgets/libraries will not cover your needs, in that case I would be interesting in improving the widget/library if it is a common enough behaviour. If it's really odd then of course custom code makes sense, but even then it also makes sense to use as much of the 'building blocks' as you can.
In this way everyone who builds a screen helps and gets help from eveyone else who makes a screen - because the code is consistent, exercised and improved.
Just my 2cents worth.
Thanks
Chris M
Last edit: 15 Jan 2019 23:29 by cmorley.
Please Log in or Create an account to join the conversation.
- auto-mation-assist
- Offline
- Platinum Member
Less
More
- Posts: 425
- Thank you received: 81
16 Jan 2019 06:17 - 16 Jan 2019 06:18 #124281
by auto-mation-assist
Replied by auto-mation-assist on topic qtvcp issues
That is much easier to read. I don’t know why it removes tabs when I copy and paste some code. It looks fine until I submit it. The function this is for is to read the pre-set multi axis position commands from the .ini file and send a selected one from an array of labeled buttons. It is also used for other similar functions that handle handle different data.
I know you prefer action items but i prefer to use my code to the maximum degree possible and is something that will likely never change. One type of car for example does not suit everyones personal preferences and that is why there are some many different ones on the road. Each year improvements are made to each model, and each model is able to take a person to the desired destination. Kind of like software.
I know you prefer action items but i prefer to use my code to the maximum degree possible and is something that will likely never change. One type of car for example does not suit everyones personal preferences and that is why there are some many different ones on the road. Each year improvements are made to each model, and each model is able to take a person to the desired destination. Kind of like software.
Last edit: 16 Jan 2019 06:18 by auto-mation-assist.
Please Log in or Create an account to join the conversation.
16 Jan 2019 07:19 #124284
by cmorley
Replied by cmorley on topic qtvcp issues
Not sure if you noticed:
To post code don't use quick replay, use Action and then there is special button to paste code
<code>
Put code here
<\code>
it's a pain but It preserves spaces in the code.
I guess we will have to agree to disagree
Chris M
To post code don't use quick replay, use Action and then there is special button to paste code
<code>
Put code here
<\code>
it's a pain but It preserves spaces in the code.
I guess we will have to agree to disagree
Chris M
Please Log in or Create an account to join the conversation.
19 Jan 2019 04:57 #124433
by cmorley
Replied by cmorley on topic qtvcp issues
I pushed Qtvcp to master so you could base your work from master to keep current now if you like.
Chris M
Chris M
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.107 seconds