最高湿度不会超过99.9%
This commit is contained in:
@@ -180,9 +180,9 @@ public class DebugActivity extends BaseActivity<ActivityDebugBinding, DebugActiv
|
||||
MyQueue.start(MyQueue.TYPE_SENSOR, new QueueIOUITask<Boolean>() {
|
||||
@Override
|
||||
public Boolean doInQueueThread() throws Exception {
|
||||
try{
|
||||
try {
|
||||
return setAddress.test(sensorModel, sensorAddress);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -85,6 +85,12 @@ public class HumidityController extends Control {
|
||||
needDehumidifyToTarget = false;
|
||||
needDehumidify = false;
|
||||
}
|
||||
// 真实湿度已经接近 100%,禁止自动除湿
|
||||
if (RoomSensor.getBeforeCalibratedIndoorHumidity() > 99) {
|
||||
needDehumidify = false;
|
||||
needDehumidifyToTarget = false;
|
||||
}
|
||||
|
||||
// === 互斥处理 ===
|
||||
if (needHumidify && needDehumidify) {
|
||||
// 理论不会发生,保险处理
|
||||
|
||||
@@ -201,9 +201,10 @@ public class RoomSensor {
|
||||
/**
|
||||
* 获取室内平均湿度
|
||||
*/
|
||||
public static double getAverageIndoorHumidity() {
|
||||
public static double getBeforeCalibratedIndoorHumidity() {
|
||||
double sumOfHumidities = 0.0;
|
||||
int numberOfEnabledSensors = 0;
|
||||
|
||||
for (THSensor sensor : dynamicTHSensorList) {
|
||||
if (sensor.humidity == 0 || sensor.humidity == 100) {
|
||||
continue;
|
||||
@@ -211,6 +212,7 @@ public class RoomSensor {
|
||||
sumOfHumidities += sensor.humidity;
|
||||
numberOfEnabledSensors++;
|
||||
}
|
||||
|
||||
for (GasSensor sensor : dynamicCO2SensorList) {
|
||||
if (sensor.getHumidity() == 0 || sensor.getHumidity() == 100) {
|
||||
continue;
|
||||
@@ -218,6 +220,7 @@ public class RoomSensor {
|
||||
sumOfHumidities += sensor.getHumidity();
|
||||
numberOfEnabledSensors++;
|
||||
}
|
||||
|
||||
for (GasSensor sensor : dynamicAmmoniaSensorList) {
|
||||
if (sensor.getHumidity() == 0 || sensor.getHumidity() == 100) {
|
||||
continue;
|
||||
@@ -225,10 +228,23 @@ public class RoomSensor {
|
||||
sumOfHumidities += sensor.getHumidity();
|
||||
numberOfEnabledSensors++;
|
||||
}
|
||||
if (numberOfEnabledSensors == 0 || sumOfHumidities == 0) {
|
||||
|
||||
if (numberOfEnabledSensors == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return Math.round((sumOfHumidities / numberOfEnabledSensors + RoomSetting.getBiasHumidity()) * 10.0) / 10.0;
|
||||
|
||||
return sumOfHumidities / numberOfEnabledSensors;
|
||||
}
|
||||
public static double getAverageIndoorHumidity() {
|
||||
double averageHumidity = getAverageIndoorHumidity();
|
||||
|
||||
if (averageHumidity == 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
return Math.min(
|
||||
Math.round((averageHumidity + RoomSetting.getBiasHumidity()) * 10.0) / 10.0,
|
||||
99.9
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user