-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
112 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# generated network protocol code | ||
protocols/* | ||
protocols/*pb2.py |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,37 @@ | ||
import serial # pip install pySerial | ||
import serial | ||
from protocols import network_protocol_pb2 | ||
import time | ||
import argparse | ||
|
||
p = serial.Serial("/dev/ttyACM0", 115200) | ||
|
||
while True: | ||
last_packet = time.time() | ||
s = b"" | ||
def main() -> None: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("serialport", metavar="SERIAL", type=str, help="Serial port") | ||
args = parser.parse_args() | ||
|
||
port = serial.Serial(args.serialport, 115200) | ||
|
||
while True: | ||
if p.in_waiting > 0: | ||
b = p.read() | ||
s += b | ||
last_packet = time.time() | ||
if ( | ||
time.time() - last_packet | ||
) > 0.001: # Arbitrary longish time picked up by experiment | ||
break | ||
last_packet = time.time() | ||
s = b"" | ||
while True: | ||
if port.in_waiting > 0: | ||
b = port.read() | ||
s += b | ||
last_packet = time.time() | ||
if ( | ||
time.time() - last_packet | ||
) > 0.001: # Arbitrary longish time picked up by experiment | ||
break | ||
|
||
stat = network_protocol_pb2.ControllerStatus() | ||
stat = network_protocol_pb2.ControllerStatus() | ||
|
||
try: | ||
stat.ParseFromString(s) | ||
print("------") | ||
print(stat) | ||
except: | ||
pass | ||
try: | ||
stat.ParseFromString(s) | ||
print("------") | ||
print(stat) | ||
except: | ||
pass | ||
|
||
while p.in_waiting == 0: | ||
pass | ||
while port.in_waiting == 0: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "debug" | ||
version = "0.1.0" | ||
description = "RespiraWorks ventilator debug interface" | ||
description = "RespiraWorks ventilator debug tools" | ||
authors = ["Martin Shetty <[email protected]>"] | ||
readme = "README.md" | ||
packages = [ | ||
|
@@ -17,6 +17,7 @@ matplotlib = "^3.9.2" | |
pandas = "^2.2.3" | ||
gitpython = "^3.1.43" | ||
platformio = "^6.1.16" | ||
protobuf = "^5.28.3" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^8.3.3" | ||
|
@@ -27,6 +28,8 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry.scripts] | ||
debug = "debug.debug_cli:main" | ||
decode = "miscellaneous.decoder:main" | ||
mock_controller = "miscellaneous.mock_cycle_controller:main" | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = [ | ||
|