Feedrate/Rapid/Spindle Override reset to 100% using a physical button

More
26 Feb 2024 15:12 #294530 by B.Reilly01
I know this has been discussed at length on other GUIs, but I was wondering what pins were available to reset overrides to 100%?  I have those little encoders with push buttons for resetting overrides to 100%.  I know in Linuxcnc 2.9 there are pins that are like feedrate_override.reset, but these are do not seem present in 2.8, which pathpilot is built off.  I was wondering if there was a good work around for this? Or is Pathpilot had other pins built in for this?  I know there's software buttons for this, I'd like to encorporate my physical buttons.

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

More
01 Mar 2024 13:01 #294840 by B.Reilly01
So if found the button in Python, how do I have a physical button call code in python?

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

More
12 Apr 2024 15:13 #298069 by nick.smith
I do this with keyboard shortcuts and xdotool. Maybe not as clean as something in python, but works perfectly and I use it dozens of times per day.

 
Attachments:
The following user(s) said Thank You: tommylight

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

More
15 May 2024 17:00 #300689 by B.Reilly01
Could you expand on this a little bit? How did you assign the buttons?

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

More
10 Jul 2024 22:04 - 10 Jul 2024 22:06 #304850 by Dorro1971
this might work..in tmc/python/tormach_lathe_ui.py or tormach_mill_ui.py

look for this phrase..

# Escape used to stop certain UI tasks.
if kv == gtk.keysyms.Escape:
self.error_handler.log("ESC key - queueing stop event")
self.enqueue_button_press_release(self.button_list)
self.tool_descript_entry.shutdown_view() # if active terminates the tool description overlay
self.profile_renderer.update() # if active terminates a zoom view on the profile render
tooltipmgr.TTMgr().on_esc_key() # if active end the current tooltip.
return True

#w key on keyboard
if kv == gtk.keysyms.w:
self.sliders.set_slider_value(100)
return True

i use this addition for a jog encoder and spindle,feedrate,maxvel panel encoders...this version does need variables declaring earlier in the program but you might get the idea...

#--user keys

#add self.override = [100,100,100] #new list for override variables after init_sliders line 588 o this version

# MOD1_MASK indicates the left alt key pressed

if event.state & (gtk.gdk.MOD1_MASK): #MOD1_MASK = left ALT key

#panel encoders

if kv == gtk.keysyms.u:
self.override[0] = self.override[0] + 1
if self.override[0] > 200:
self.override[0] = 200
self.sliders.set_slider_value(self.override[0])
return True

if kv == gtk.keysyms.v:
self.override[0] = self.override[0] - 1
if self.override[0] < 0:
self.override[0] = 0
self.sliders.set_slider_value(self.override[0])
return True

if kv == gtk.keysyms.w:
self.override[1] = self.override[1] + 1
if self.override[1] > 200:
self.override[1] = 200
self.sliders.set_slider_value(self.override[1])
return True

if kv == gtk.keysyms.x:
self.override[1] = self.override[1] - 1
if self.override[1] < 0:
self.override[1] = 0
self.sliders.set_slider_value(self.override[1])
return True


if kv == gtk.keysyms.y:
self.override[2] = self.override[2] + 1
if self.override[2] > 100:
self.override[2] = 100
self.sliders.set_slider_value(self.override[2])
return True

if kv == gtk.keysyms.z:
self.override[2] = self.override[2] - 1
if self.override[2] < 0:
self.override[2] = 0
self.sliders.set_slider_value(self.override[2])
return True

#jog speed

#jog speed 1
if kv == gtk.keysyms.a:
self.sliders.adjustment.set_value(1)
if kv == gtk.keysyms.A:
self.sliders.adjustment.set_value(1)
return True

#jog speed 10
if kv == gtk.keysyms.b:
self.sliders.adjustment.set_value(10)
if kv == gtk.keysyms.B:
self.sliders.adjustment.set_value(10)
return True

#jog speed 30
if kv == gtk.keysyms.c:
self.sliders.adjustment.set_value(30)
if kv == gtk.keysyms.C:
self.sliders.adjustment.set_value(30)
return True

#jog speed 50
if kv == gtk.keysyms.d:
self.sliders.adjustment.set_value(40)
if kv == gtk.keysyms.D:
self.sliders.adjustment.set_value(40)
return True

#jog increment

#increment jog x0.01
if kv == gtk.keysyms.g:
self.enqueue_button_press_release(self.button_list)
if kv == gtk.keysyms.G:
self.enqueue_button_press_release(self.button_list)
return True

#increment jog x0.1
if kv == gtk.keysyms.h:
self.enqueue_button_press_release(self.button_list)
if kv == gtk.keysyms.H:
self.enqueue_button_press_release(self.button_list)
return True

#increment jog x1
if kv == gtk.keysyms.i:
self.enqueue_button_press_release(self.button_list)
if kv == gtk.keysyms.I:
self.enqueue_button_press_release(self.button_list)
return True
#incremental jog

#incremental jog
if kv == gtk.keysyms.j:
self.set_keyboard_jog_mode(linuxcnc.JOG_INCREMENT)
if kv == gtk.keysyms.J:
self.set_keyboard_jog_mode(linuxcnc.JOG_INCREMENT)
return True

#continuous jog

#continuous jog
if kv == gtk.keysyms.k:
self.set_keyboard_jog_mode(linuxcnc.JOG_CONTINUOUS)
if kv == gtk.keysyms.K:
self.set_keyboard_jog_mode(linuxcnc.JOG_CONTINUOUS)
return True

#reset

#reset
if kv == gtk.keysyms.s:
self.enqueue_button_press_release(self.button_list)
return True


#--end user keys


panel encoder send a keypress for each indent ...




sorry for pasting code but i can't remember how to wrap it!...

Dorro
Last edit: 10 Jul 2024 22:06 by Dorro1971.

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

Moderators: cncbasher
Time to create page: 0.251 seconds
Powered by Kunena Forum