firmware wip - wrong datatypes
This commit is contained in:
parent
65e6989a5d
commit
3795569b07
3 changed files with 12 additions and 12 deletions
|
@ -110,8 +110,8 @@ char Esp32CamIP[16];
|
||||||
// PumpLastOn (long) timestamp
|
// PumpLastOn (long) timestamp
|
||||||
unsigned long PumpLastOn;
|
unsigned long PumpLastOn;
|
||||||
bool OutputInvert;
|
bool OutputInvert;
|
||||||
byte SoilmoistureWet;
|
unsigned short SoilmoistureWet;
|
||||||
byte SoilmoistureDry;
|
unsigned short SoilmoistureDry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,19 +138,19 @@ int getSoilmoisture(byte moistureSensor, bool returnRAW = false) {
|
||||||
// value to return
|
// value to return
|
||||||
int soilmoisture = 0;
|
int soilmoisture = 0;
|
||||||
// value for wet
|
// value for wet
|
||||||
int wet;
|
//~ int wet;
|
||||||
// value for dry
|
// value for dry
|
||||||
int dry;
|
//~ int dry;
|
||||||
|
|
||||||
switch(moistureSensor) {
|
switch(moistureSensor) {
|
||||||
case 1:
|
case 1:
|
||||||
// read analog value from analog moisture sensor
|
// read analog value from analog moisture sensor
|
||||||
wet = 180;
|
//~ wet = 180;
|
||||||
// this value was measured in air, without contact to anything
|
// this value was measured in air, without contact to anything
|
||||||
//dry= 590;
|
//dry= 590;
|
||||||
|
|
||||||
// was measured in dry soil, not bone dry but really dry (6 days no watering)
|
// was measured in dry soil, not bone dry but really dry (6 days no watering)
|
||||||
dry = 360;
|
//~ dry = 360;
|
||||||
|
|
||||||
digitalWrite(PINsoilmoisture, HIGH);
|
digitalWrite(PINsoilmoisture, HIGH);
|
||||||
// wait a bit to let the circuit stabilize
|
// wait a bit to let the circuit stabilize
|
||||||
|
@ -172,22 +172,22 @@ int getSoilmoisture(byte moistureSensor, bool returnRAW = false) {
|
||||||
// wet = 560;
|
// wet = 560;
|
||||||
|
|
||||||
// measured in fresh watered soil
|
// measured in fresh watered soil
|
||||||
wet = 485;
|
//~ wet = 485;
|
||||||
dry= 250;
|
//~ dry= 250;
|
||||||
|
|
||||||
// get raw value from I2C chirp sensor
|
// get raw value from I2C chirp sensor
|
||||||
soilmoisture = readI2CRegister16bit(0x20, 0);
|
soilmoisture = readI2CRegister16bit(0x20, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wet = 0;
|
//~ wet = 0;
|
||||||
dry = 1;
|
//~ dry = 1;
|
||||||
soilmoisture = -1;
|
soilmoisture = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(returnRAW == true) {
|
if(returnRAW == true) {
|
||||||
return soilmoisture;
|
return soilmoisture;
|
||||||
} else {
|
} else {
|
||||||
short soilmoistureP = map(soilmoisture, wet, dry, 100, 0);
|
short soilmoistureP = map(soilmoisture, SoilmoistureWet, SoilmoistureDry, 100, 0);
|
||||||
// dont return negative percentage values
|
// dont return negative percentage values
|
||||||
if(soilmoistureP < 0) {
|
if(soilmoistureP < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* CanGrow_Version.h gets generated from cangrow.sh */
|
/* CanGrow_Version.h gets generated from cangrow.sh */
|
||||||
|
|
||||||
const char* CanGrowVer = "0.1-dev";
|
const char* CanGrowVer = "0.1-dev";
|
||||||
const char* CanGrowBuild = "c178191-20241205031352";
|
const char* CanGrowBuild = "65e6989-20241205031950";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue