Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
time-machine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hugo Hörnquist
time-machine
Commits
df29b164
Commit
df29b164
authored
6 years ago
by
Hugo Hörnquist
Browse files
Options
Downloads
Patches
Plain Diff
Add flask_raise mode.
parent
5dfa3efb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
time_machine/machine.py
+22
-7
22 additions, 7 deletions
time_machine/machine.py
with
22 additions
and
7 deletions
time_machine/machine.py
+
22
−
7
View file @
df29b164
...
...
@@ -107,9 +107,14 @@ def wait_btn():
return
g
.
wait_for_edge
(
btn_pin
,
g
.
RISING
,
bouncetime
=
500
)
#g.wait_for_edge(btn_pin, g.RISING)
class
Modes
:
button
=
0
flask_raise
=
1
def
main
():
global
state
,
pins
last_time
=
0
mode
=
Modes
.
button
while
True
:
if
state
==
States
.
no_hafv
:
print
...
...
@@ -120,26 +125,36 @@ def main():
elif
state
==
States
.
hafv_ready
:
print
"
Hafv redo
"
if
mode
==
Modes
.
button
:
lcd_info
(
"
Starta med knapp
"
,
last_time
)
wait_btn
()
elif
mode
==
Modes
.
flask_raise
:
lcd_info
(
"
Starta med lyft
"
,
last_time
)
wait_for_bottle_remove
()
state
=
States
.
hafv_active
start_time
=
time_ms
()
elif
state
==
States
.
hafv_active
:
print
"
currently Hafving
"
lcd_info
(
"
Klockar
"
,
last_time
)
if
not
bottle_check
(
pins
):
if
mode
==
Mode
.
button
and
not
bottle_check
(
pins
):
print
"
Early start
"
lcd_info
(
"
Tjuvstart!
"
,
last_time
)
wait_btn
()
state
=
States
.
no_hafv
continue
print
"
Raise the bottle
"
# TODO we actually don't need this, but it was
# here before so it stays until I refactor this.
if
mode
==
Modes
.
button
:
wait_for_bottle_remove
()
print
"
BOTTLE RAISED
"
print
"
Place back bottle after hafv
"
wait_for_bottle_place
()
print
"
BOTTLE PLACED
"
# Wait for bottle placed is in a loop because if the time
# is under 1 secound then we want to wait again. This is
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment