Skip to content

Commit

Permalink
fix actions
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Dec 20, 2023
1 parent 54ca01a commit d5ec61b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 39 deletions.
71 changes: 43 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,64 +153,79 @@ jobs:

linux-py:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./grpl-py
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install maturin
run: pip install maturin
- name: Install Clang
run: sudo apt-get update && sudo apt-get install -y libclang1-15 clang llvm gcc-multilib
- name: Prepare Rust Libs
run: ./gradlew updateRustLibs --max-workers 1
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m grpl-py/Cargo.toml
args: --release -m grpl-py/Cargo.toml -i /usr/local/bin/python
sccache: 'true'
manylinux: auto

windows-py:
runs-on: windows-latest
defaults:
run:
working-directory: ./grpl-py
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
- uses: actions/setup-python@v4
with:
python-version: '3.12'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m grpl-py/Cargo.toml
sccache: 'true'

macos-py:
runs-on: macos-latest
defaults:
run:
working-directory: ./grpl-py
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Setup Rust
uses: ATiltedTree/setup-rust@v1
with:
python-version: '3.12'
rust-version: stable
- name: Setup Rust Toolchain (Windows Arm64)
run: rustup target add aarch64-pc-windows-msvc
- name: Prepare Rust Libs
run: ./gradlew updateRustLibs --max-workers 1
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release -m grpl-py/Cargo.toml
sccache: 'true'

# macos-py:
# runs-on: macos-latest
# strategy:
# matrix:
# target: [x86_64, aarch64]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: 17
# - uses: actions/setup-python@v4
# with:
# python-version: '3.12'
# - name: Prepare Rust Libs
# run: ./gradlew updateRustLibs --max-workers 1
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# args: --release -m grpl-py/Cargo.toml
# sccache: 'true'
21 changes: 10 additions & 11 deletions grpl-py/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use grapple_frc_msgs::grapple::lasercan::{LaserCanRoi, LaserCanStatusFrame};
use grapplefrcdriver::lasercan::{
lasercan_get_status, lasercan_set_range, lasercan_set_roi, lasercan_set_timing_budget,
LaserCanDevice,
};
use pyo3::prelude::*;
use grapplefrcdriver::lasercan::{LaserCanDevice, lasercan_get_status, lasercan_set_range, lasercan_set_timing_budget, lasercan_set_roi};
use grapple_frc_msgs::grapple::lasercan::{LaserCanStatusFrame, LaserCanRoi};
use std::ptr::addr_of_mut;

#[pyclass]
Expand All @@ -13,7 +16,7 @@ enum LaserCanRangingMode {
impl LaserCanRangingMode {
fn is_long(&self) -> bool {
if *self == LaserCanRangingMode::Long {
return true
return true;
}
false
}
Expand Down Expand Up @@ -45,24 +48,20 @@ struct LaserCAN {
}

impl LaserCAN {

fn new(can_id: u8) -> Self {
let handle = LaserCanDevice::new(can_id);
LaserCAN {
handle,
can_id,
}
LaserCAN { handle, can_id }
}

fn get_measurement(&mut self) -> Option<LaserCanStatusFrame> {
let status = lasercan_get_status(addr_of_mut!(self.handle));
if status.status != 0xFF {
return Some(status)
if status.status != 0xFF {
return Some(status);
}
None
}

fn set_ranging_mode(&mut self, mode : LaserCanRangingMode) -> i32 {
fn set_ranging_mode(&mut self, mode: LaserCanRangingMode) -> i32 {
lasercan_set_range(addr_of_mut!(self.handle), mode.is_long())
}

Expand Down

0 comments on commit d5ec61b

Please sign in to comment.