Skip to content

Commit

Permalink
remove release job, fix ci errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliDi committed Jun 28, 2024
1 parent b809b6b commit e5c84df
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv7em-none-eabi
components: rustfmt, clippy, rust-src
- run: cargo test

Expand All @@ -45,6 +46,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: thumbv7em-none-eabi
- run: cargo test --all-features

build:
Expand All @@ -58,21 +61,4 @@ jobs:
cargo build
--target thumbv7m-none-eabi
--all-features
release:
runs-on: ubuntu-latest
steps:
- name: version
run: echo "version=$(cargo pkgid | cut -d '#' -f2)" >> $GITHUB_OUTPUT
id: version
- name: Release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ github.ref }}
#body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<I2C: I2c<SevenBitAddress>> PasCo2<I2C> {
defmt::info!("Setting measurement mode: {:b}", mode);

self.i2c
.write(ADDRESS, &[MeasurementMode::address(), mode.into()])?;
.write(ADDRESS, &[MeasurementMode::address(), mode])?;
Ok(())
}

Expand Down Expand Up @@ -110,7 +110,7 @@ impl<I2C: I2c<SevenBitAddress>> PasCo2<I2C> {

/// Clear the int active bit and the alarm bit of the sensor's [MeasurementStatus] register
pub fn clear_measurement_status(&mut self) -> Result<(), I2C::Error> {
let bitmask = &MeasurementStatus::clear_int_active() & MeasurementStatus::clear_alarm();
let bitmask = MeasurementStatus::clear_int_active() & MeasurementStatus::clear_alarm();
self.i2c
.write(ADDRESS, &[MeasurementStatus::address(), bitmask])?;
Ok(())
Expand All @@ -124,7 +124,7 @@ impl<I2C: I2c<SevenBitAddress>> PasCo2<I2C> {
defmt::info!("Setting interrupt config: {:b}", config);

self.i2c
.write(ADDRESS, &[InterruptConfig::address(), config.into()])?;
.write(ADDRESS, &[InterruptConfig::address(), config])?;
Ok(())
}

Expand Down
6 changes: 2 additions & 4 deletions src/regs/measurement_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ impl Default for MeasurementMode {

impl From<MeasurementMode> for u8 {
fn from(value: MeasurementMode) -> Self {
let bitmask = (value.pwm_out_enable as u8) << 5
(value.pwm_out_enable as u8) << 5
| (value.pwm_mode as u8) << 4
| (value.baseline_offset_comp as u8) << 2
| value.operating_mode as u8;

bitmask
| value.operating_mode as u8
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/regs/measurement_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
pub struct MeasurementStatus {
/// New data available in CO2PPM Register
pub data_ready: bool,
/// Pin INT has been latched to active state
/// Pin INT has been latched to active state
pub int_active: bool,
/// Alarm notification (threshold violation occured)
pub alarm: bool
pub alarm: bool,
}


impl MeasurementStatus {
/// Bitmask to clear the int pin active bit
pub(crate) fn clear_int_active() -> u8 {
Expand Down
4 changes: 3 additions & 1 deletion src/regs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ impl Reg for AlarmThreshold {
0x09
}
}
// Explicitly state it here that the threshold is zero
#[allow(clippy::derivable_impls)]
impl Default for AlarmThreshold {
fn default() -> Self {
Self(0)
Self(0x0)
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/regs/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl From<u8> for Status {
Self {
ready: (value & 0b1000_0000) != 0,
pwm_dis: (value & 0b0100_0000) != 0,
temperature_error:(value & 0b0010_0000) != 0,
temperature_error: (value & 0b0010_0000) != 0,
voltage_error: (value & 0b0001_0000) != 0,
communication_error: (value & 0b0000_1000) != 0,
}
Expand All @@ -48,7 +48,6 @@ impl super::Reg for Status {
}
}


#[cfg(test)]
#[test]
fn test_bitmask() {
Expand Down

0 comments on commit e5c84df

Please sign in to comment.