Skip to content

Add serial binary communication #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
895cc03
update bufferflow_timedraw as bufferflow_timed
umbynos Jul 15, 2021
05ee6f5
remove old commands
umbynos Jul 15, 2021
6a50f87
remove utf8 decoding with timedraw buffer type
umbynos Jul 19, 2021
e80400b
binary support (WIP)
umbynos Jul 19, 2021
eb2b3f3
use switch case
umbynos Jul 20, 2021
1cd174a
fixed test deps
umbynos Mar 1, 2021
48cc695
socketio test connection is working 🎉 (with the correct python-socket…
umbynos Mar 4, 2021
fc1222e
add callback to capture returned message, add new test for serial
umbynos Jul 21, 2021
9c7d3f8
fix tests: "socketio.exceptions.ConnectionError: Connection refused b…
umbynos Jul 21, 2021
dfcc14e
minor optimizations: data and buf are already an array of bytes
umbynos Jul 23, 2021
b7f70f1
enhanced a bit how the logic of the serial works
umbynos Jul 23, 2021
c86bb4f
enhance a lot test on serial communication (with different buffer types)
umbynos Jul 23, 2021
099a575
update and enhance commands output (the space in front of `<` and `>`…
umbynos Jul 23, 2021
b41d0cc
increased sleeptime, remove harcoded message[i]: should work on diffe…
umbynos Jul 29, 2021
fcaa53c
generalize the tests
umbynos Jul 29, 2021
43451a3
Apply suggestions from code review
umbynos Aug 2, 2021
15af2e4
add sketch used for testing
umbynos Aug 2, 2021
575efa1
Fix panic closing closed channel
silvanocerza Aug 3, 2021
2d78733
apply suggestions
umbynos Aug 3, 2021
8f9ff20
Partially revert #e80400b7ddbbc2e8f34f1e6701b55102c3a99289
umbynos Aug 3, 2021
0bbb45b
🧹(cleanup) and 🛠️(refactoring) of bufferflow stuff
umbynos Aug 4, 2021
5e2ad37
extract code in helper function and uniform the code
umbynos Aug 4, 2021
5d0bd27
optimize the handling of data coming from the serial port
umbynos Aug 4, 2021
f3d5dca
uniform default bufferflow and 🧹
umbynos Aug 4, 2021
5db1975
forgot to fix this in #621
umbynos Aug 4, 2021
37cf997
apply suggestions from code review ✨
umbynos Aug 5, 2021
724de59
remove timedbinary: it's the same as timedraw except for the casting
umbynos Aug 5, 2021
402a848
Escape html commands string
silvanocerza Aug 6, 2021
d5228ec
forgot to remove timed_binary
umbynos Aug 6, 2021
bcf0023
remove useless id field (was unused)
umbynos Aug 9, 2021
d077ded
remove useless channel done & other stuff
umbynos Aug 9, 2021
d704dd2
make sendNoBuf more general: will be used later 😏
umbynos Aug 10, 2021
791b03e
add `sendraw` command to send base64 encoded bytes, add tests (for se…
umbynos Aug 11, 2021
8dadd0c
forgot to skip test_sendraw_serial on CI
umbynos Aug 11, 2021
500a1ee
update comments
umbynos Aug 12, 2021
a86a61a
refactor tests
umbynos Aug 12, 2021
a21ae9e
remove BlockUntilReady because it was unused
umbynos Aug 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove timedbinary: it's the same as timedraw except for the casting
  • Loading branch information
umbynos committed Aug 5, 2021
commit 724de590dc512a9835457c35f52c543d5eb22510
75 changes: 0 additions & 75 deletions bufferflow_timedbinary.go

This file was deleted.

4 changes: 1 addition & 3 deletions serialport.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (p *serport) reader(buftype string) {

data := ""
switch buftype {
case "timedraw", "timed", "timedbinary":
case "timedraw", "timed":
data = string(bufferPart[:n])
// give the data to our bufferflow so it can do it's work
// to read/translate the data to see if it wants to block
Expand Down Expand Up @@ -301,8 +301,6 @@ func spHandlerOpen(portname string, baud int, buftype string) {
bw = NewBufferflowTimed(portname, h.broadcastSys)
case "timedraw":
bw = NewBufferflowTimedRaw(portname, h.broadcastSys)
case "timedbinary":
bw = NewBufferflowTimedBinary(portname, h.broadcastSys)
case "default":
bw = NewBufferflowDefault(portname, h.broadcastSys)
default:
Expand Down
12 changes: 2 additions & 10 deletions test/test_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def test_open_serial_timedraw(socketio):
general_test_serial(socketio, "timedraw")


@pytest.mark.skipif(
running_on_ci(),
reason="VMs have no serial ports",
)
def test_open_serial_timedbinary(socketio):
general_test_serial(socketio, "timedbinary")


def general_test_serial(socketio, buffertype):
port = "/dev/ttyACM0"
global message
Expand All @@ -75,7 +67,7 @@ def general_test_serial(socketio, buffertype):
# check if the send command has been registered
assert any("send " + port + " /\"ciao/\"" in i for i in message)
#check if message has been sent back by the connected board
if buffertype in ("timedbinary", "timedraw"):
if buffertype == "timedraw":
output = decode_output(extract_serial_data(message))
elif buffertype in ("default", "timed"):
output = extract_serial_data(message)
Expand All @@ -89,7 +81,7 @@ def general_test_serial(socketio, buffertype):
print(message)
# check if the send command has been registered
assert any("send " + port + " /\"🧀🧀🧀🧀🧀🧀🧀🧀🧀🧀/\"" in i for i in message)
if buffertype in ("timedbinary", "timedraw"):
if buffertype == "timedraw":
output = decode_output(extract_serial_data(message))
elif buffertype in ("default", "timed"):
output = extract_serial_data(message)
Expand Down