Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
time-machine
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hugo Hörnquist
time-machine
Commits
756098c2
Commit
756098c2
authored
Sep 23, 2018
by
Hugo Hörnquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made last_time local.
parent
b159e3cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
time_machine/machine.py
time_machine/machine.py
+7
-8
No files found.
time_machine/machine.py
View file @
756098c2
...
...
@@ -36,8 +36,6 @@ lcd_rows = 2
lcd
=
LCD
.
Adafruit_CharLCD
(
lcd_rs
,
lcd_en
,
lcd_d4
,
lcd_d5
,
lcd_d6
,
lcd_d7
,
lcd_columns
,
lcd_rows
,
lcd_backlight
)
last_time
=
0
risewait
=
threading
.
Event
()
fallwait
=
threading
.
Event
()
...
...
@@ -97,7 +95,7 @@ def wait_for_bottle_place():
def
wait_for_bottle_remove
():
return
wait_fall
()
if
test
else
wait_rise
()
def
lcd_info
(
msg
):
def
lcd_info
(
msg
,
last_time
):
lcd
.
clear
()
lcd
.
home
()
lcd
.
set_cursor
(
0
,
0
)
...
...
@@ -111,27 +109,28 @@ def wait_btn():
def
main
():
global
state
,
pins
last_time
=
0
while
True
:
if
state
==
States
.
no_hafv
:
print
print
"Inget Hafv"
lcd_info
(
"Vilar"
)
lcd_info
(
"Vilar"
,
last_time
)
wait_for_bottle_place
()
state
=
States
.
hafv_ready
elif
state
==
States
.
hafv_ready
:
print
"Hafv redo"
lcd_info
(
"Starta med knapp"
)
lcd_info
(
"Starta med knapp"
,
last_time
)
wait_btn
()
state
=
States
.
hafv_active
start_time
=
time_ms
()
elif
state
==
States
.
hafv_active
:
print
"currently Hafving"
lcd_info
(
"Klockar"
)
lcd_info
(
"Klockar"
,
last_time
)
if
not
bottle_check
(
pins
):
print
"Early start"
lcd_info
(
"Tjuvstart!"
)
lcd_info
(
"Tjuvstart!"
,
last_time
)
wait_btn
()
state
=
States
.
no_hafv
continue
...
...
@@ -147,7 +146,7 @@ def main():
t
=
(
end_time
-
start_time
)
/
1000.0
print
"Hafvtid: {0} s"
.
format
(
t
)
last_time
=
t
lcd_info
(
"Avvakta"
)
lcd_info
(
"Avvakta"
,
last_time
)
state
=
States
.
no_hafv
time
.
sleep
(
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment