Override +- 10% buttons

More
28 Sep 2023 21:00 #281817 by DestructiveSoul
Replied by DestructiveSoul on topic Override +- 10% buttons
Hi Nick! I had a look at your stuff! Fantastic job!! you have done something really cool! I think i will start my own keypad! thanks for sharing!

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

More
16 Nov 2023 00:30 - 16 Nov 2023 00:32 #285558 by Dorro1971
Replied by Dorro1971 on topic Override +- 10% buttons
added by mistake!
Last edit: 16 Nov 2023 00:32 by Dorro1971.

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

More
16 Nov 2023 00:33 #285559 by Dorro1971
Replied by Dorro1971 on topic Override +- 10% buttons
Hi Vmax549,

did you get round to finishing the code?...

i was thinking about using something like
variable =self.sliders.adjustment.get_value()
but im not sure of the syntax or what the feed_rate slider is called....

If you have a solution that can be activated from a key press I'm all ears!

I tried generichid and it works but it hogs the usb at 50ms poll rate and I don't like the mpg jog...so i used an arduino as a hid keyboard and placed jog speeds, step sizes, cont or inc in tormach_mill_ui.py and used the mpg encoder frequency to change speeds..or step forwards/backwards..works really well and doesn't hog the usb...adding feedrate, spindle and maxvel via keys would be the finishing touch....

Can you or anyone else help me out?...I had help a while ago from yourself and snowgoer540 but sadly i lost all of my email contacts...

Thank you in advance...

dorro

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

More
19 Nov 2023 13:09 - 19 Nov 2023 13:25 #285891 by Dorro1971
Replied by Dorro1971 on topic Override +- 10% buttons
this works for me..i will send keystrokes from an arduino hid keyboard using three panel encoders to send increment or decement...


# search for "self.sliders.update({" in mill or lathe ui.py

            # ------------------------------------------------
            # Sliders
            # ------------------------------------------------
            self.sliders.update({
                "spindle": ui_support.OverrideSlider(
                    adjustment=self.builder.get_object("spindle_override_adjustment"),
                    scale=self.builder.get_object("spindle_override_scale"),
                    label=self.builder.get_object("spindle_override_label"),
                    button_100=self.button_list['spindle_override_100'],
                    prefix="S",
                    value_source_cb = lambda: self.hal['console-rpm-override'] * 100.0,
                    lcnc_apply_function=lambda value: self.command.spindleoverride(value / 100.0)
                )
            })
            self.sliders['spindle'].set_slider_value(100)
            self.init_sliders()

#add this line
            self.override = [100,100,100] #new list for override variables, set them to 100%






#search for "# Escape key for stop"
#add after the block below

            # Escape key for stop
            if kv == gtk.keysyms.Escape:
                self.error_handler.log("ESC key - queueing stop button event")
                self.enqueue_button_press_release(self.button_list['stop'])
                self.tool_descript_entry.shutdown_view()
                tooltipmgr.TTMgr().on_esc_key()
                return True


# add incement and decrement via keys

            if kv == gtk.keysyms.a:
                self.override[0] = self.override[0] + 5
                if self.override[0] > 200:
                 self.override[0] = 200
                self.sliders['spindle'].set_slider_value(self.override[0])  
                return True   

            if kv == gtk.keysyms.b:
                self.override[0] = self.override[0] - 5
                if self.override[0] < 0:
                 self.override[0] = 0
                self.sliders['spindle'].set_slider_value(self.override[0])  
                return True   

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

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


            if kv == gtk.keysyms.e:
                self.override[2] = self.override[2] + 5
                if self.override[2] > 100:
                 self.override[2] = 100
                self.sliders['maxvel'].set_slider_value(self.override[2])  
                return True   

            if kv == gtk.keysyms.f:
                self.override[2] = self.override[2] - 5
                if self.override[2] < 0:
                 self.override[2] = 0
                self.sliders['maxvel'].set_slider_value(self.override[2])  
                return True


#this works well as long as thenkeyboard is used, if the sliders are used then the variables are not updated,
#the still slider works but the next time the keybaord is used a large step may result as the variable is
#still set to the last value used by the keyboard








Hope this helps someone...


Ian
Last edit: 19 Nov 2023 13:25 by Dorro1971.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum