Merge lp:~pwlars/uci-phone-masher/init-servos-off into lp:uci-phone-masher

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 7
Merged at revision: 6
Proposed branch: lp:~pwlars/uci-phone-masher/init-servos-off
Merge into: lp:uci-phone-masher
Diff against target: 27 lines (+5/-1)
2 files modified
uci_phone_masher/controller.py (+4/-0)
uci_phone_masher/model.py (+1/-1)
To merge this branch: bzr merge lp:~pwlars/uci-phone-masher/init-servos-off
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+254922@code.launchpad.net

Commit message

Set all servos to the off position when starting up.

Description of the change

All the button states are set to "OFF" when we start up. This also sets the servos to the off position when starting the app for the first time, so that they are consistent with the starting state.

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

Approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'uci_phone_masher/controller.py'
2--- uci_phone_masher/controller.py 2015-03-31 14:11:51 +0000
3+++ uci_phone_masher/controller.py 2015-04-01 14:25:26 +0000
4@@ -68,6 +68,10 @@
5 # Set the PWM Frequency to 60Hz - works well for these servos
6 self.pwm.setPWMFreq(60)
7
8+ # Initialize all servos to the 'off' position
9+ for button in self.model.data.keys():
10+ self.unpress(button)
11+
12 def press(self, channel):
13 super(PhoneControllerI2C, self).press(channel)
14 self.pwm.setPWM(channel, 0, 193)
15
16=== modified file 'uci_phone_masher/model.py'
17--- uci_phone_masher/model.py 2015-03-31 14:17:43 +0000
18+++ uci_phone_masher/model.py 2015-04-01 14:25:26 +0000
19@@ -28,7 +28,7 @@
20 the class instance return a new class instead. The main benefit of this is
21 that it makes testing super-simple.
22
23- Is this reqlly required for such a trivial model? Probably not. But it's
24+ Is this really required for such a trivial model? Probably not. But it's
25 still a nice demonstration.
26
27 """

Subscribers

People subscribed via source and target branches