Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confirm that PRFlippers and PRBumpers exist before iterating through them #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions procgame/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ def load():
curr_path = os.path.expanduser('./config.yaml')
system_path = os.path.expanduser('~/.pyprocgame/config.yaml')
if os.path.exists(curr_path):
path = curr_path
path = curr_path
elif os.path.exists(system_path):
path = system_path
else:
logger.warning('pyprocgame configuration not found at %s. Checking %s.' % (curr_path, system_path))
if os.path.exists(system_path):
path = system_path
else:
logger.warning('pyprocgame configuration not found at %s' % system_path)
return
logger.error('pyprocgame configuration not found at %s or %s' % (curr_path, system_path))
return
logger.info('pyprocgame configuration found at %s' % path)
try:
values = yaml.load(open(path, 'r'))
Expand Down
6 changes: 4 additions & 2 deletions procgame/game/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ def enable_flippers(self, enable):
#return True

"""Enables or disables the flippers AND bumpers."""
for flipper in self.config['PRFlippers']:
if self.config.has_key('PRFlippers'):
for flipper in self.config['PRFlippers']:
self.logger.info("Programming flipper %s", flipper)
main_coil = self.coils[flipper+'Main']
if self.coils.has_key(flipper+'Hold'):
Expand Down Expand Up @@ -468,7 +469,8 @@ def enable_alphanumeric_flippers(self, enable):

def enable_bumpers(self, enable):

for bumper in self.config['PRBumpers']:
if self.config.has_key('PRBumpers'):
for bumper in self.config['PRBumpers']:
switch_num = self.switches[bumper].number
coil = self.coils[bumper]

Expand Down