diff --git a/Source/Meadow.Clima.sln b/Source/Meadow.Clima.sln index 4063466..d95c882 100644 --- a/Source/Meadow.Clima.sln +++ b/Source/Meadow.Clima.sln @@ -42,8 +42,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MQTTnet", "..\..\MQTTnet\So EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serialization.MicroJson", "..\..\Meadow.Foundation\Source\Meadow.Foundation.Libraries_and_Frameworks\Serialization.MicroJson\Driver\Serialization.MicroJson.csproj", "{6300EAB4-806F-4C18-8FE0-57C45A2C0C58}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Light.Veml7700", "..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Sensors.Light.Veml7700\Driver\Sensors.Light.Veml7700.csproj", "{C5925D96-F9F4-4F42-AC8D-97E464252A4D}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -366,18 +364,6 @@ Global {6300EAB4-806F-4C18-8FE0-57C45A2C0C58}.Release|iPhone.Build.0 = Release|Any CPU {6300EAB4-806F-4C18-8FE0-57C45A2C0C58}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {6300EAB4-806F-4C18-8FE0-57C45A2C0C58}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|iPhone.Build.0 = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|Any CPU.Build.0 = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|iPhone.ActiveCfg = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|iPhone.Build.0 = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C5925D96-F9F4-4F42-AC8D-97E464252A4D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -400,7 +386,6 @@ Global {85DC9E85-3472-418A-8065-5EF99323E6FE} = {2889A476-F914-49E8-9F97-4CC6CA34A901} {F6EB1347-3926-4308-BE20-70AC53BEBF1D} = {2889A476-F914-49E8-9F97-4CC6CA34A901} {6300EAB4-806F-4C18-8FE0-57C45A2C0C58} = {2889A476-F914-49E8-9F97-4CC6CA34A901} - {C5925D96-F9F4-4F42-AC8D-97E464252A4D} = {2889A476-F914-49E8-9F97-4CC6CA34A901} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CA61E123-F783-4CB3-8EB2-099EE930ADD4} diff --git a/Source/Meadow.Clima/Controllers/SensorController.cs b/Source/Meadow.Clima/Controllers/SensorController.cs index 757ebcd..1aeb6bb 100644 --- a/Source/Meadow.Clima/Controllers/SensorController.cs +++ b/Source/Meadow.Clima/Controllers/SensorController.cs @@ -22,7 +22,7 @@ public class SensorController /// /// Gets the interval at which sensor data is updated. /// - public TimeSpan UpdateInterval { get; } = TimeSpan.FromSeconds(5); + public TimeSpan UpdateInterval { get; } = TimeSpan.FromSeconds(15); /// /// Initializes a new instance of the class. @@ -35,39 +35,38 @@ public SensorController(IClimaHardware clima) if (clima.TemperatureSensor is { } temperatureSensor) { temperatureSensor.Updated += TemperatureUpdated; - temperatureSensor.StartUpdating(TimeSpan.FromSeconds(15)); temperatureSensor.StartUpdating(UpdateInterval); } if (clima.BarometricPressureSensor is { } pressureSensor) { pressureSensor.Updated += PressureUpdated; - pressureSensor.StartUpdating(TimeSpan.FromMinutes(1)); + pressureSensor.StartUpdating(UpdateInterval); } if (clima.HumiditySensor is { } humiditySensor) { humiditySensor.Updated += HumidityUpdated; - humiditySensor.StartUpdating(TimeSpan.FromMinutes(1)); + humiditySensor.StartUpdating(UpdateInterval); } if (clima.CO2ConcentrationSensor is { } co2Sensor) { co2Sensor.Updated += Co2Updated; - co2Sensor.StartUpdating(TimeSpan.FromMinutes(5)); + co2Sensor.StartUpdating(UpdateInterval); } if (clima.WindVane is { } windVane) { windVane.Updated += WindvaneUpdated; - windVane.StartUpdating(TimeSpan.FromSeconds(1)); + windVane.StartUpdating(UpdateInterval); } if (clima.RainGauge is { } rainGuage) { rainGuage.Updated += RainGaugeUpdated; - rainGuage.StartUpdating(TimeSpan.FromMinutes(5)); + rainGuage.StartUpdating(UpdateInterval); } if (clima.Anemometer is { } anemometer) diff --git a/Source/Meadow.Clima/Hardware/ClimaHardwareV4.cs b/Source/Meadow.Clima/Hardware/ClimaHardwareV4.cs index 7018bbc..60b57c3 100644 --- a/Source/Meadow.Clima/Hardware/ClimaHardwareV4.cs +++ b/Source/Meadow.Clima/Hardware/ClimaHardwareV4.cs @@ -1,9 +1,5 @@ -using Meadow.Foundation; -using Meadow.Foundation.ICs.IOExpanders; -using Meadow.Foundation.Sensors.Light; +using Meadow.Foundation.ICs.IOExpanders; using Meadow.Hardware; -using Meadow.Peripherals.Sensors.Light; -using Meadow.Units; namespace Meadow.Devices.Clima.Hardware; @@ -12,9 +8,6 @@ namespace Meadow.Devices.Clima.Hardware; /// public class ClimaHardwareV4 : ClimaHardwareV3 { - private ILightSensor? _lightSensor; - private bool _firstLightQuery = true; - /// public override string RevisionString => "v4.x"; @@ -26,8 +19,7 @@ public class ClimaHardwareV4 : ClimaHardwareV3 /// The Mcp23008 used to read version information public ClimaHardwareV4(IF7CoreComputeMeadowDevice device, II2cBus i2cBus, Mcp23008 mcpVersion) : base(device, i2cBus, mcpVersion) - { - } + { } internal override I2cConnector? CreateQwiicConnector() { @@ -42,29 +34,4 @@ public ClimaHardwareV4(IF7CoreComputeMeadowDevice device, II2cBus i2cBus, Mcp230 }, new I2cBusMapping(_device, 1)); } - - protected override ILightSensor? GetLightSensor() - { - if (_lightSensor == null && _firstLightQuery) - { - try - { - Logger?.Trace("Creating Light sensor"); - _lightSensor = new Veml7700(_device.CreateI2cBus()); - if (_lightSensor is PollingSensorBase pollingSensor) - { - pollingSensor.CommunicationError += (s, e) => { _lightSensor.StopUpdating(); }; - } - } - catch - { - Logger?.Warn("Light sensor not found on I2C bus"); - _lightSensor = null; - } - - _firstLightQuery = false; - } - - return _lightSensor; - } } \ No newline at end of file diff --git a/Source/Meadow.Clima/Meadow.Clima.csproj b/Source/Meadow.Clima/Meadow.Clima.csproj index a3f28e2..b76a2a4 100644 --- a/Source/Meadow.Clima/Meadow.Clima.csproj +++ b/Source/Meadow.Clima/Meadow.Clima.csproj @@ -27,7 +27,6 @@ -