Merge lp:~pwlars/uci-phone-masher/debug-memory-controller into lp:uci-phone-masher

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 10
Merged at revision: 10
Proposed branch: lp:~pwlars/uci-phone-masher/debug-memory-controller
Merge into: lp:uci-phone-masher
Diff against target: 36 lines (+14/-1)
1 file modified
uci_phone_masher/controller.py (+14/-1)
To merge this branch: bzr merge lp:~pwlars/uci-phone-masher/debug-memory-controller
Reviewer Review Type Date Requested Status
Paul Larson Approve
Review via email: mp+292764@code.launchpad.net

Description of the change

These are just some useful debugging messages to use when messing with the memory controller, which is only used for testing, as it doesn't even try to use servos if they are connected

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'uci_phone_masher/controller.py'
--- uci_phone_masher/controller.py 2016-04-21 19:16:40 +0000
+++ uci_phone_masher/controller.py 2016-04-25 08:10:53 +0000
@@ -24,6 +24,9 @@
24 'PhoneControllerMemory',24 'PhoneControllerMemory',
25]25]
2626
27# Default pwm for a "pressed" button state - use offset to adjust this
28DEFAULT_PWM_PRESS = 193
29
2730
28class PhoneControllerBase(object):31class PhoneControllerBase(object):
2932
@@ -77,7 +80,8 @@
7780
78 def press(self, channel):81 def press(self, channel):
79 super(PhoneControllerI2C, self).press(channel)82 super(PhoneControllerI2C, self).press(channel)
80 self.pwm.setPWM(channel, 0, 193)83 offset = self._model.get_button_offset(channel)
84 self.pwm.setPWM(channel, 0, DEFAULT_PWM_PRESS + offset)
8185
82 def unpress(self, channel):86 def unpress(self, channel):
83 super(PhoneControllerI2C, self).unpress(channel)87 super(PhoneControllerI2C, self).unpress(channel)
@@ -95,3 +99,12 @@
95 Used when we don't have i2c available, or we're testing.99 Used when we don't have i2c available, or we're testing.
96100
97 """101 """
102 def set_offset(self, button_num, offset):
103 super(PhoneControllerMemory, self).set_offset(button_num, offset)
104 print("DEBUG: offset set to {}".format(
105 self._model.get_button_offset(button_num)))
106
107 def press(self, channel):
108 super(PhoneControllerMemory, self).press(channel)
109 print("DEBUG: Pressing button - PWM set to {}".format(
110 DEFAULT_PWM_PRESS+self._model.get_button_offset(channel)))

Subscribers

People subscribed via source and target branches