Skip to content

Commit

Permalink
Fixed moving to the next recipe step issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
betterengineering committed Nov 13, 2015
1 parent 03c5592 commit 5487ad3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion openroast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
from openroast.controllers import recipe


roaster = freshroastsr700.freshroastsr700(thermostat=True)
recipes = recipe.Recipe()
roaster = freshroastsr700.freshroastsr700(
thermostat=True, state_transition_func=recipes.move_to_next_section)


class Openroast(object):
Expand Down
13 changes: 8 additions & 5 deletions openroast/controllers/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,15 @@ def load_current_section(self):
self.get_current_section_time(),
self.get_current_cooling_status())

def move_to_next_section(self):
if (self.currentRecipeStep + 1) >= self.get_num_recipe_sections():
openroast.roaster.idle()
def move_to_next_section(self, roaster, state):
if self.check_recipe_loaded():
if (self.currentRecipeStep + 1) >= self.get_num_recipe_sections():
openroast.roaster.idle()
else:
self.currentRecipeStep += 1
self.load_current_section()
else:
self.currentRecipeStep += 1
self.load_current_section()
openroast.roaster.idle()

def get_current_recipe(self):
return self.recipe
2 changes: 1 addition & 1 deletion openroast/views/roasttab.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def load_recipe_into_roast_tab(self):
self.update_fan_info()

def next_section(self):
openroast.recipes.move_to_next_section()
openroast.recipes.move_to_next_section(None, None)
self.update_section_time()
self.targetTempLabel.setText(str(openroast.roaster.target_temp))
self.update_target_temp()
Expand Down

0 comments on commit 5487ad3

Please sign in to comment.