From dd6f32688bdc662f7516e5a04037b1bd057e4099 Mon Sep 17 00:00:00 2001 From: "Justin E. Mann" Date: Wed, 27 Nov 2024 17:05:55 -0700 Subject: [PATCH] messing with calibration check and default values --- .../Telemetry/Sensor/RAK12035VBSensor.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp b/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp index 60bf2bc0c..6eeb0dd75 100644 --- a/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp +++ b/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp @@ -9,7 +9,7 @@ RAK12035VBSensor::RAK12035VBSensor() : TelemetrySensor(meshtastic_TelemetrySenso int32_t RAK12035VBSensor::runOnce() { - LOG_INFO("Init sensor: %s\n", sensorName); + LOG_INFO("Init sensor: %s", sensorName); if (!hasSensor()) { return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS; } @@ -20,14 +20,14 @@ int32_t RAK12035VBSensor::runOnce() // Get sensor firmware version uint8_t data = 0; sensor.get_sensor_version(&data); - LOG_INFO("Sensor Firmware version: %i\n", data); + LOG_INFO("Sensor Firmware version: %i", data); if ( data != 0) { - LOG_DEBUG("RAK12035VBSensor Init Succeed\n"); + LOG_DEBUG("RAK12035VBSensor Init Succeed"); status = true; } else { - LOG_ERROR("RAK12035VBSensor Init Failed\n"); + LOG_ERROR("RAK12035VBSensor Init Failed"); status = false; } return initI2CSensor(); @@ -44,16 +44,26 @@ void RAK12035VBSensor::setup() { sensor.get_wet_cal(&hundred_val); delay(100); if(zero_val == 0 || zero_val >= hundred_val){ + LOG_COLOR_W("Dry calibration value is %d", zero_val); + LOG_COLOR_W("Wet calibration value is %d", hundred_val); + LOG_COLOR_W("This does not make sense. Youc can recalibrate this sensor using the calibration sketch included here: https://github.com/RAKWireless/RAK12035_SoilMoisture."); + LOG_COLOR_W("For now, setting default calibration value for Dry Calibration: %d", default_zero_val); sensor.set_dry_cal(default_zero_val); sensor.get_dry_cal(&zero_val); + LOG_COLOR_W("Dry calibration reset complete. New value is %d", zero_val); } if(hundred_val == 0 || hundred_val <= zero_val){ + LOG_COLOR_W("Dry calibration value is %d", zero_val); + LOG_COLOR_W("Wet calibration value is %d", hundred_val); + LOG_COLOR_W("This does not make sense. Youc can recalibrate this sensor using the calibration sketch included here: https://github.com/RAKWireless/RAK12035_SoilMoisture."); + LOG_COLOR_W("For now, setting default calibration value for Wet Calibration: %d", default_hundred_val); sensor.set_wet_cal(default_hundred_val); sensor.get_wet_cal(&hundred_val); + LOG_COLOR_W("Wet calibration reset complete. New value is %d", hundred_val); } delay(100); - LOG_INFO("Dry calibration value is %d\n", zero_val); - LOG_INFO("Wet calibration value is %d\n", hundred_val); + LOG_INFO("Dry calibration value is %d", zero_val); + LOG_INFO("Wet calibration value is %d", hundred_val); } bool RAK12035VBSensor::getMetrics(meshtastic_Telemetry *measurement)