Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hddtempserial
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleg Nikulin
hddtempserial
Commits
e66e6214
Commit
e66e6214
authored
Jun 23, 2023
by
Oleg Nikulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Изменения в потоке ввода
parent
dabc790f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
hddtempserial.py
hddtempserial.py
+5
-10
No files found.
hddtempserial.py
View file @
e66e6214
...
...
@@ -13,16 +13,12 @@ temperatures = [30, 45, 50]
def
temp_input
(
stop_event
):
def
temp_input
():
global
temperatures
while
True
:
temps
=
[
0
,
0
,
0
]
temp_input
=
input
(
'
\033
[75G'
+
'Enter up to 3 temperature values (CSV): '
)
if
stop_event
.
is_set
():
input_thread_running
=
False
return
error
=
False
comma_pos
=
0
find_start_index
=
0
...
...
@@ -44,6 +40,7 @@ def temp_input(stop_event):
try
:
#проверка, введено ли число
temps
[
i
]
=
int
(
temp_substring
)
except
ValueError
:
print
(
'Temperature value must be a number'
)
error
=
True
break
...
...
@@ -154,8 +151,8 @@ if __name__ == "__main__":
if
args
.
speed
is
not
None
:
baudrate
=
args
.
speed
if
args
.
manual
:
input_
stop_event
=
Event
(
)
input_thread
=
threading
.
Thread
(
target
=
temp_input
,
args
=
(
input_stop_event
,))
input_
thread
=
threading
.
Thread
(
target
=
temp_input
)
input_thread
.
daemon
=
True
temp
=
'50,51,52'
if
port
is
None
:
...
...
@@ -193,14 +190,11 @@ if __name__ == "__main__":
if
(
poll
(
serial_port
)):
if
args
.
manual
and
not
input_thread_running
:
input_stop_event
.
clear
()
input_thread
.
start
()
input_thread_running
=
True
regularPollInterval
=
True
except
(
OSError
,
termios
.
error
):
input_stop_event
.
set
()
print
()
print
(
'Serial port error. Trying to open serial port again...'
)
serial_port
=
open_serial
(
port
,
baudrate
)
if
serial_port
is
not
None
:
...
...
@@ -213,4 +207,5 @@ if __name__ == "__main__":
time
.
sleep
(
0.5
)
except
KeyboardInterrupt
:
print
()
exit
()
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