Skip to content

Commit

Permalink
Revert "boards: apollo3: lora_things_plus: Add rainfall sensor tests"
Browse files Browse the repository at this point in the history
This reverts commit a9dd112.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
  • Loading branch information
alistair23 committed Nov 28, 2024
1 parent e7bfb35 commit 43ee755
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
8 changes: 0 additions & 8 deletions boards/apollo3/lora_things_plus/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ static mut CHIRP_I2C_MOISTURE: Option<
capsules_core::virtualizers::virtual_i2c::I2CDevice<'static, apollo3::iom::Iom<'static>>,
>,
> = None;
#[cfg(feature = "dfrobot_i2c_rainfall")]
static mut DFROBOT_I2C_RAINFALL: Option<
&'static capsules_extra::dfrobot_rainfall_sensor::DFRobotRainFall<
'static,
capsules_core::virtualizers::virtual_i2c::I2CDevice<'static, apollo3::iom::Iom<'static>>,
>,
> = None;

/// Dummy buffer that causes the linker to reserve enough space for the stack.
#[no_mangle]
Expand Down Expand Up @@ -330,7 +323,6 @@ unsafe fn setup_dfrobot_i2c_rainfall(
apollo3::stimer::STimer<'static>,
apollo3::iom::Iom<'static>
));
DFROBOT_I2C_RAINFALL = Some(dfrobot_rainfall);

let rainfall = components::rainfall::RainFallComponent::new(
board_kernel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@
use crate::tests::run_kernel_op;
#[cfg(feature = "chirp_i2c_moisture")]
use crate::CHIRP_I2C_MOISTURE;
#[cfg(feature = "dfrobot_i2c_rainfall")]
use crate::DFROBOT_I2C_RAINFALL;
use crate::{BME280, CCS811};
use core::cell::Cell;
use kernel::debug;
#[cfg(feature = "chirp_i2c_moisture")]
use kernel::hil::sensors::MoistureDriver;
#[cfg(feature = "dfrobot_i2c_rainfall")]
use kernel::hil::sensors::RainFallDriver;
use kernel::hil::sensors::{
AirQualityClient, AirQualityDriver, HumidityClient, HumidityDriver, MoistureClient,
RainFallClient, TemperatureClient, TemperatureDriver,
TemperatureClient, TemperatureDriver,
};
use kernel::ErrorCode;

Expand All @@ -32,7 +28,6 @@ struct SensorTestCallback {
co2_done: Cell<bool>,
tvoc_done: Cell<bool>,
moisture_done: Cell<bool>,
rainfall_done: Cell<bool>,
calibration_temp: Cell<Option<i32>>,
calibration_humidity: Cell<Option<u32>>,
}
Expand All @@ -47,7 +42,6 @@ impl<'a> SensorTestCallback {
co2_done: Cell::new(false),
tvoc_done: Cell::new(false),
moisture_done: Cell::new(false),
rainfall_done: Cell::new(false),
calibration_temp: Cell::new(None),
calibration_humidity: Cell::new(None),
}
Expand Down Expand Up @@ -91,14 +85,6 @@ impl<'a> MoistureClient for SensorTestCallback {
}
}

impl<'a> RainFallClient for SensorTestCallback {
fn callback(&self, value: Result<usize, ErrorCode>) {
self.rainfall_done.set(true);

debug!("Rainfall in the last hour: {}mm", value.unwrap());
}
}

impl<'a> AirQualityClient for SensorTestCallback {
fn environment_specified(&self, result: Result<(), ErrorCode>) {
result.unwrap();
Expand All @@ -119,29 +105,6 @@ impl<'a> AirQualityClient for SensorTestCallback {

static CALLBACK: SensorTestCallback = SensorTestCallback::new();

#[cfg(feature = "dfrobot_i2c_rainfall")]
#[test_case]
fn run_chirp_i2c_moisture() {
debug!("check run DFRobot Rainfall I2C Sensor... ");
run_kernel_op(100);

let dfrobot = unsafe { DFROBOT_I2C_RAINFALL.unwrap() };

// Make sure the device is ready for us.
run_kernel_op(1000);

RainFallDriver::set_client(dfrobot, &CALLBACK);
CALLBACK.reset();

dfrobot.read_rainfall(1).unwrap();

run_kernel_op(10_000);
assert_eq!(CALLBACK.rainfall_done.get(), true);

debug!(" [ok]");
run_kernel_op(100);
}

#[cfg(feature = "chirp_i2c_moisture")]
#[test_case]
fn run_chirp_i2c_moisture() {
Expand Down

0 comments on commit 43ee755

Please sign in to comment.