This commit is contained in:
Justin E. Mann 2025-04-17 17:00:20 -06:00
parent 37c1715064
commit e2b6375fac
4 changed files with 5 additions and 23 deletions

View File

@ -8,13 +8,13 @@ RAK12035Sensor::RAK12035Sensor() : TelemetrySensor(meshtastic_TelemetrySensorTyp
int32_t RAK12035Sensor::runOnce()
{
LOG_INFO("Init sensor: %s", sensorName);
if (!hasSensor()) {
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
}
sensor.set_sensor_addr(RAK120351_ADDR);
delay(500);
sensor.begin(nodeTelemetrySensorsMap[sensorType].first);
// Get sensor firmware version
uint8_t data = 0;
@ -92,27 +92,9 @@ bool RAK12035Sensor::getMetrics(meshtastic_Telemetry *measurement)
LOG_ERROR("Failed to read sensor data");
return false;
}
LOG_INFO("Successful read from sensor Temperature: %.2f, Moisture: %ld%", (double)(temp / 10), moisture);
measurement->variant.environment_metrics.soil_temperature = (float)(temp / 10);
measurement->variant.environment_metrics.soil_moisture = moisture;
LOG_INFO("Check if the original temperature and moisture (relative_humidity) are being used.. if not just use them for the "
"soil monitoring.");
if (!measurement->variant.environment_metrics.has_temperature) {
LOG_INFO("Overwrite the temp metrics (not being set right now and this will allow the soil temp value to be used in the "
"client interface).");
measurement->variant.environment_metrics.has_temperature = true;
measurement->variant.environment_metrics.temperature = (float)(temp / 10);
}
if (!measurement->variant.environment_metrics.has_relative_humidity) {
LOG_INFO("Overwrite the moisture metrics (not being used for air humidity and this will allow the soil humidity to "
"appear in the client interfaces without adjustments).");
measurement->variant.environment_metrics.has_relative_humidity = true;
measurement->variant.environment_metrics.relative_humidity = (float)moisture;
}
return true;
}
#endif

View File

@ -17,7 +17,7 @@ lib_deps =
melopero/Melopero RV3028@^1.1.0
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@ -19,7 +19,7 @@ lib_deps =
melopero/Melopero RV3028@^1.1.0
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink

View File

@ -23,7 +23,7 @@ lib_deps =
bodmer/TFT_eSPI
beegee-tokyo/RAKwireless RAK12034@^1.0.0
beegee-tokyo/RAK14014-FT6336U @ 1.0.1
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
debug_tool = jlink
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
;upload_protocol = jlink