frequency resistive sensor adjustment

This commit is contained in:
Empire 2023-03-22 21:43:52 +01:00
parent 63ed9afabc
commit e8759435e7
3 changed files with 7 additions and 1 deletions

View File

@ -90,7 +90,7 @@
#define FLOWMETER_PULSES_PER_ML 2.2
#endif
#define MOIST_SENSOR_MAX_FRQ 60000 // 60kHz (500Hz margin)
#define MOIST_SENSOR_MAX_FRQ 5200 // 60kHz (500Hz margin)
#define MOIST_SENSOR_MIN_FRQ 500 // 0.5kHz (500Hz margin)
#define ANALOG_SENSOR_MAX_MV 1300 //successive approximation of good range

View File

@ -47,6 +47,8 @@ static const char *SENSOR_STRING[] = {
#define HYDROPONIC_MODE -3
//plant uses cooldown and duration and workhours, moisture is measured but ignored
#define TIMER_ONLY -4
//special value to indicate a shorted sensor when the plant is not deactivated but the sensor reads short circuit value
#define SHORT_CIRCUIT_MODE -5
typedef struct PlantSettings_t
{

View File

@ -148,6 +148,10 @@ public:
{
return MISSING_SENSOR;
}
if (mMoisture_raw.getMedian() > MOIST_SENSOR_MAX_FRQ)
{
return SHORT_CIRCUIT_MODE;
}
}
return mMoisture_raw.getMedian();