Add actions file

This commit is contained in:
hodasemi 2023-08-16 08:59:21 +02:00
parent 4f9b54499a
commit 9b97b199c0
3 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,41 @@
name: Gavania Merge Build
run_name: Test successful gavania build on merge request
on:
pull_request:
types: [opened, reopened, edited, review_requested, synchronize]
jobs:
Arduino:
steps:
- uses: https://github.com/actions/checkout@v3
- uses: https://github.com/dtolnay/rust-toolchain@stable
- name: Build
run: |
cd rust/arduino
cargo build
Pico:
steps:
- uses: https://github.com/actions/checkout@v3
- uses: https://github.com/dtolnay/rust-toolchain@stable
- name: Build
run: |
cd rust/pico
cargo build
Serial Reader:
steps:
- uses: https://github.com/actions/checkout@v3
- uses: https://github.com/dtolnay/rust-toolchain@stable
- name: Build
run: |
cd rust/serial_reader
cargo build

12
.vscode/tasks.json vendored
View file

@ -25,5 +25,17 @@
"cwd": "rust/pico"
}
},
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "SerialReader: cargo build",
"options": {
"cwd": "rust/serial_reader"
}
},
]
}

View file

@ -80,6 +80,8 @@ fn main() {
}
});
let buffer = serial_info.buffer().unwrap();
connect_button.connect_clicked(move |_| {
if !CONNECTED.load(SeqCst) {
let usb_id = UsbId {
@ -107,6 +109,9 @@ fn main() {
if let Ok(port) = Port::open(usb_id, serialport_settings, 50, 1) {
CONNECTED.store(true, SeqCst);
let (mut buffer_start, mut buffer_end) = buffer.bounds();
buffer.delete(&mut buffer_start, &mut buffer_end);
*PORT.lock().unwrap() = Some(port);
}
}