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