diff options
-rw-r--r-- | apps/SoilMoisture.cpp | 5 | ||||
-rw-r--r-- | apps/SoilMoisture.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/apps/SoilMoisture.cpp b/apps/SoilMoisture.cpp index 5edba0e..fea1ef9 100644 --- a/apps/SoilMoisture.cpp +++ b/apps/SoilMoisture.cpp @@ -113,10 +113,11 @@ uint8_t SoilMoisture::getSensorCount() { uint16_t SoilMoisture::getValue(uint8_t sensor) { auto req = createGetValue(sensor); - return writeAndRead(req).read16le(); + auto buffer = writeAndRead(req); + buffer.read8(); // sensor index + return buffer.read16le(); } - string SoilMoisture::getName(uint8_t sensor) { auto req = createGetSensorName(sensor); diff --git a/apps/SoilMoisture.h b/apps/SoilMoisture.h index 45ba5d4..79e393f 100644 --- a/apps/SoilMoisture.h +++ b/apps/SoilMoisture.h @@ -10,7 +10,7 @@ using namespace trygvis::bluetooth; enum class sm_cmd_code : uint8_t { SM_CMD_GET_SENSOR_COUNT = 1, - SM_CMD_GET_VALUE = 2, + SM_CMD_GET_VALUE = 8, SM_CMD_SET_WARNING_VALUE = 3, SM_CMD_GET_WARNING_VALUE = 4, SM_CMD_SET_SENSOR_NAME = 5, |