Discussion:
Haldial update bug and solved?
(too old to reply)
Nicklas Karlsson
2017-07-21 01:37:31 UTC
Permalink
Raw Message
For some reason the hal dial had stopped working. It is the first time I look into the source code and at first I made wrong conclusion and found something that made it partially react to some action.

It look a little bit odd since self.delta_scaled is incremented/decremented both in the scroll function and emit_count_changed function. The increment/decrement in the emit_count_changed_signal seems to handle the case then dial is moved fast enough to not detect the crossover. Maybe you know better, I only know now it works for me.


diff --git a/lib/python/gladevcp/hal_dial.py b/lib/python/gladevcp/hal_dial.py
index 731fe64ee..e25945195 100644
--- a/lib/python/gladevcp/hal_dial.py
+++ b/lib/python/gladevcp/hal_dial.py
@@ -142,9 +142,11 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
if event.direction == gtk.gdk.SCROLL_UP:
self._count += 1
self._minute_offset +=1
+ self._delta_scaled += self.scale
if event.direction == gtk.gdk.SCROLL_DOWN:
self._count -= 1
self._minute_offset -=1
+ self._delta_scaled -= self.scale
self._last_offset = self._minute_offset
self.redraw_canvas()
self.emit("count_changed", self._count,self.scale,self._delta_scaled)
@@ -295,6 +297,7 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
alloc = self.get_allocation()
self.queue_draw_area(alloc.x, alloc.y, alloc.width, alloc.height)
self.window.process_updates(True)
+ self.queue_draw()

# Get propertys
def do_get_property(self, property):


Nicklas Karlsson
Chris Morley
2017-07-21 03:23:58 UTC
Permalink
Raw Message
I'll look at it when I get a chance..thanks.
Chris M

----- Reply message -----
From: "Nicklas Karlsson" <***@gmail.com>
To: "emc-***@lists.sourceforge.net" <emc-***@lists.sourceforge.net>
Subject: [Emc-developers] Haldial update bug and solved?
Date: Thu, Jul 20, 2017 7:40 PM



For some reason the hal dial had stopped working. It is the first time I look into the source code and at first I made wrong conclusion and found something that made it partially react to some action.

It look a little bit odd since self.delta_scaled is incremented/decremented both in the scroll function and emit_count_changed function. The increment/decrement in the emit_count_changed_signal seems to handle the case then dial is moved fast enough to not detect the crossover. Maybe you know better, I only know now it works for me.


diff --git a/lib/python/gladevcp/hal_dial.py b/lib/python/gladevcp/hal_dial.py
index 731fe64ee..e25945195 100644
--- a/lib/python/gladevcp/hal_dial.py
+++ b/lib/python/gladevcp/hal_dial.py
@@ -142,9 +142,11 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
if event.direction == gtk.gdk.SCROLL_UP:
self._count += 1
self._minute_offset +=1
+ self._delta_scaled += self.scale
if event.direction == gtk.gdk.SCROLL_DOWN:
self._count -= 1
self._minute_offset -=1
+ self._delta_scaled -= self.scale
self._last_offset = self._minute_offset
self.redraw_canvas()
self.emit("count_changed", self._count,self.scale,self._delta_scaled)
@@ -295,6 +297,7 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
alloc = self.get_allocation()
self.queue_draw_area(alloc.x, alloc.y, alloc.width, alloc.height)
self.window.process_updates(True)
+ self.queue_draw()

# Get propertys
def do_get_property(self, property):


Nicklas Karlsson

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
Emc-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers
Chris Morley
2017-07-21 13:05:25 UTC
Permalink
Raw Message
Ok I looked at the code and this looks right to me.

scrolling with a wheel is handled differently from dragging - which is why delta_scaled is handled twice.


I am not sure what you changed? The code you show is already there.

If this is in the branch that you are having problems with hal_lib then that is probably the actual problem (my guess).

If hal_lib is broken then the widgets will not update the HAL pins.

In other branches of work I have had some problems with the GObject timer but that was mostly with my QT branch and usually made a seg fault.

Without more info it's hard for me to be more specific and I am still working so can't test anything....


Chris M


________________________________
From: Nicklas Karlsson <***@gmail.com>
Sent: July 21, 2017 1:37 AM
To: emc-***@lists.sourceforge.net
Subject: [Emc-developers] Haldial update bug and solved?

For some reason the hal dial had stopped working. It is the first time I look into the source code and at first I made wrong conclusion and found something that made it partially react to some action.

It look a little bit odd since self.delta_scaled is incremented/decremented both in the scroll function and emit_count_changed function. The increment/decrement in the emit_count_changed_signal seems to handle the case then dial is moved fast enough to not detect the crossover. Maybe you know better, I only know now it works for me.


diff --git a/lib/python/gladevcp/hal_dial.py b/lib/python/gladevcp/hal_dial.py
index 731fe64ee..e25945195 100644
--- a/lib/python/gladevcp/hal_dial.py
+++ b/lib/python/gladevcp/hal_dial.py
@@ -142,9 +142,11 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
if event.direction == gtk.gdk.SCROLL_UP:
self._count += 1
self._minute_offset +=1
+ self._delta_scaled += self.scale
if event.direction == gtk.gdk.SCROLL_DOWN:
self._count -= 1
self._minute_offset -=1
+ self._delta_scaled -= self.scale
self._last_offset = self._minute_offset
self.redraw_canvas()
self.emit("count_changed", self._count,self.scale,self._delta_scaled)
@@ -295,6 +297,7 @@ class Hal_Dial(gtk.DrawingArea, _HalJogWheelBase):
alloc = self.get_allocation()
self.queue_draw_area(alloc.x, alloc.y, alloc.width, alloc.height)
self.window.process_updates(True)
+ self.queue_draw()

# Get propertys
def do_get_property(self, property):


Nicklas Karlsson

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
Emc-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Loading...