Skip to content

Commit 9552a6f

Browse files
[SoilMeasurement] Remove value validation and added initial value for all-clusters (project-chip#39993)
* Move value validation and added initial value for all-clusters * Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Setting measured value to min for all cluster --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 60f6b62 commit 9552a6f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

examples/all-clusters-app/all-clusters-common/src/soil-measurement-stub.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ void emberAfSoilMeasurementClusterInitCallback(EndpointId endpoint)
6666
if (err != CHIP_NO_ERROR)
6767
{
6868
ChipLogError(AppServer, "SoilMeasurement cluster error registration");
69+
return;
6970
}
71+
72+
// Set initial measured value to min since all clusters does not perform any actual measurements
73+
gServer.Cluster().SetSoilMoistureMeasuredValue(kDefaultSoilMoistureMeasurementLimits.minMeasuredValue);
7074
}
7175

7276
void emberAfSoilMeasurementClusterShutdownCallback(EndpointId endpoint)

examples/all-clusters-app/linux/AllClustersCommandDelegate.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,6 @@ void AllClustersAppCommandHandler::OnSoilMoistureChange(EndpointId endpointId, D
958958
{
959959
ChipLogDetail(NotSpecified, "Set SoilMoisture value to null");
960960
}
961-
else if (soilMoisture.Value() > 100)
962-
{
963-
ChipLogDetail(NotSpecified, "Invalid SoilMoisture value");
964-
return;
965-
}
966961
else
967962
{
968963
ChipLogDetail(NotSpecified, "Set SoilMoisture value to %u", soilMoisture.Value());

0 commit comments

Comments
 (0)