mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 22:52:07 +00:00
cleanup
This commit is contained in:
parent
37c1715064
commit
e2b6375fac
@ -8,13 +8,13 @@ RAK12035Sensor::RAK12035Sensor() : TelemetrySensor(meshtastic_TelemetrySensorTyp
|
|||||||
|
|
||||||
int32_t RAK12035Sensor::runOnce()
|
int32_t RAK12035Sensor::runOnce()
|
||||||
{
|
{
|
||||||
|
|
||||||
LOG_INFO("Init sensor: %s", sensorName);
|
LOG_INFO("Init sensor: %s", sensorName);
|
||||||
if (!hasSensor()) {
|
if (!hasSensor()) {
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
}
|
}
|
||||||
|
|
||||||
sensor.set_sensor_addr(RAK120351_ADDR);
|
sensor.set_sensor_addr(RAK120351_ADDR);
|
||||||
|
delay(500);
|
||||||
sensor.begin(nodeTelemetrySensorsMap[sensorType].first);
|
sensor.begin(nodeTelemetrySensorsMap[sensorType].first);
|
||||||
// Get sensor firmware version
|
// Get sensor firmware version
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
@ -92,27 +92,9 @@ bool RAK12035Sensor::getMetrics(meshtastic_Telemetry *measurement)
|
|||||||
LOG_ERROR("Failed to read sensor data");
|
LOG_ERROR("Failed to read sensor data");
|
||||||
return false;
|
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_temperature = (float)(temp / 10);
|
||||||
measurement->variant.environment_metrics.soil_moisture = moisture;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,7 +17,7 @@ lib_deps =
|
|||||||
melopero/Melopero RV3028@^1.1.0
|
melopero/Melopero RV3028@^1.1.0
|
||||||
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
|
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
|
||||||
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
||||||
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
|
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
||||||
;upload_protocol = jlink
|
;upload_protocol = jlink
|
||||||
|
@ -19,7 +19,7 @@ lib_deps =
|
|||||||
melopero/Melopero RV3028@^1.1.0
|
melopero/Melopero RV3028@^1.1.0
|
||||||
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
|
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
|
||||||
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
||||||
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
|
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
||||||
;upload_protocol = jlink
|
;upload_protocol = jlink
|
||||||
|
@ -23,7 +23,7 @@ lib_deps =
|
|||||||
bodmer/TFT_eSPI
|
bodmer/TFT_eSPI
|
||||||
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
beegee-tokyo/RAKwireless RAK12034@^1.0.0
|
||||||
beegee-tokyo/RAK14014-FT6336U @ 1.0.1
|
beegee-tokyo/RAK14014-FT6336U @ 1.0.1
|
||||||
beegee-tokyo/RAK12035_SoilMoisture@^1.0.3
|
beegee-tokyo/RAK12035_SoilMoisture@^1.0.4
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
||||||
;upload_protocol = jlink
|
;upload_protocol = jlink
|
||||||
|
Loading…
Reference in New Issue
Block a user