Skip to content
Closed
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
cname: docs.meshcore.nz
cname: docs.meshcore.io
publish_dir: ./site
publish_branch: 'gh-pages'
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ build_flags =
-D ENV_INCLUDE_VL53L0X=1
-D ENV_INCLUDE_BME680=1
-D ENV_INCLUDE_BMP085=1
-D ENV_INCLUDE_RAK12035=1
Copy link
Copy Markdown
Member

@liamcottle liamcottle Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ENV_INCLUDE_RAK12035 will probably need to be moved to the RAK4631 variant platformio.ini instead of global sensors, as it causes compilation errors for other devices, due to RAK WisBlock specific pin defines not existing.

src/helpers/sensors/RAK12035_SoilMoisture.cpp:246:18: error: 'WB_IO2' was not declared in this scope

You can see these errors in the automated tests run against this PR.
https://github.com/meshcore-dev/MeshCore/actions/runs/23731296245/job/69516637482?pr=2191

lib_deps =
adafruit/Adafruit INA3221 Library @ ^1.0.1
adafruit/Adafruit INA219 @ ^1.2.3
Expand Down
47 changes: 46 additions & 1 deletion src/helpers/sensors/EnvironmentSensorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ static Adafruit_MLX90614 MLX90614;
static Adafruit_VL53L0X VL53L0X;
#endif

#if ENV_INCLUDE_RAK12035
#define TELEM_RAK12035_ADDRESS 0x20 // RAK12035 Soil Moisture sensor I2C address
#include "RAK12035_SoilMoisture.h"
static RAK12035_SoilMoisture RAK12035;
#endif

#if ENV_INCLUDE_GPS && defined(RAK_BOARD) && !defined(RAK_WISMESH_TAG)
#define RAK_WISBLOCK_GPS
#endif
Expand Down Expand Up @@ -331,6 +337,17 @@ bool EnvironmentSensorManager::begin() {
}
#endif

#if ENV_INCLUDE_RAK12035
RAK12035.setup(*TELEM_WIRE);
if (RAK12035.begin(TELEM_RAK12035_ADDRESS)) {
MESH_DEBUG_PRINTLN("Found sensor RAK12035 at address: %02X", TELEM_RAK12035_ADDRESS);
RAK12035_initialized = true;
} else {
RAK12035_initialized = false;
MESH_DEBUG_PRINTLN("RAK12035 was not found at I2C address %02X", TELEM_RAK12035_ADDRESS);
}
#endif

return true;
}

Expand Down Expand Up @@ -483,8 +500,36 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
}
#endif

}
#if ENV_INCLUDE_RAK12035
if (RAK12035_initialized) {

// RAK12035 Telemetry is Channel 2
telemetry.addTemperature(2, RAK12035.get_sensor_temperature());
telemetry.addPercentage(2, RAK12035.get_sensor_moisture());

// RAK12035 CALIBRATION Telemetry is Channel 3, if enabled

#ifdef ENABLE_RAK12035_CALIBRATION
// Calibration Data Screen is Channel 3
float cap = RAK12035.get_sensor_capacitance();
float _wet = RAK12035.get_humidity_full();
float _dry = RAK12035.get_humidity_zero();

telemetry.addFrequency(3, cap);
telemetry.addTemperature(3, _wet);
telemetry.addPower(3, _dry);

if(cap > _dry){
RAK12035.set_humidity_zero(cap);
}

if(cap < _wet){
RAK12035.set_humidity_full(cap);
}
#endif
}
#endif
}
return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/helpers/sensors/EnvironmentSensorManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class EnvironmentSensorManager : public SensorManager {
bool SHT4X_initialized = false;
bool BME680_initialized = false;
bool BMP085_initialized = false;
bool RAK12035_initialized = false;

bool gps_detected = false;
bool gps_active = false;
Expand Down
Loading
Loading