Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Respir-OS
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
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
Respir-OS
Commits
2d314665
Commit
2d314665
authored
Apr 08, 2021
by
Víctor Vázquez Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Format code with Black
parent
5d93aa1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
ipc.py
respir_os/common/ipc.py
+1
-3
analog.py
respir_os/controls/pcb/analog.py
+1
-3
servo.py
respir_os/controls/pcb/servo.py
+2
-6
No files found.
respir_os/common/ipc.py
View file @
2d314665
...
...
@@ -30,9 +30,7 @@ class IPCManager:
self
.
poller
=
None
def
send
(
self
,
topic
:
Topic
,
body
:
Dict
):
self
.
pub
.
send_multipart
(
[
topic
.
name
.
encode
(),
json
.
dumps
(
body
)
.
encode
()]
)
self
.
pub
.
send_multipart
([
topic
.
name
.
encode
(),
json
.
dumps
(
body
)
.
encode
()])
def
recv
(
self
,
block
=
True
)
->
Tuple
[
Topic
,
Dict
]:
if
not
self
.
subs
:
...
...
respir_os/controls/pcb/analog.py
View file @
2d314665
...
...
@@ -14,9 +14,7 @@ class AnalogConverter:
An MCP3008 analog to digital converter.
"""
def
__init__
(
self
,
pi
:
pigpio
.
pi
,
channel
:
int
,
baud_rate
:
int
,
voltage
:
float
):
def
__init__
(
self
,
pi
:
pigpio
.
pi
,
channel
:
int
,
baud_rate
:
int
,
voltage
:
float
):
"""
Instantiate a new ADC connected to the Pi.
...
...
respir_os/controls/pcb/servo.py
View file @
2d314665
...
...
@@ -9,9 +9,7 @@ class Servo:
A continuous servo that moves between 0 and 180 degrees.
"""
def
__init__
(
self
,
pi
:
pigpio
.
pi
,
gpio_pin
:
int
,
min_width
:
int
,
max_width
:
int
):
def
__init__
(
self
,
pi
:
pigpio
.
pi
,
gpio_pin
:
int
,
min_width
:
int
,
max_width
:
int
):
"""
Instantiate a new servo connected to the Pi on the given GPIO pin.
...
...
@@ -42,7 +40,5 @@ class Servo:
if
angle
<
0
or
angle
>
180
:
raise
ValueError
(
"The angle must be between 0 and 180 degrees."
)
width
=
(
angle
/
180
)
*
(
self
.
max_width
-
self
.
min_width
)
+
self
.
min_width
width
=
(
angle
/
180
)
*
(
self
.
max_width
-
self
.
min_width
)
+
self
.
min_width
self
.
pi
.
set_servo_pulsewidth
(
self
.
gpio_pin
,
width
)
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