From a6560e4490ebd35f9fd35737d92c9a132e21b92c Mon Sep 17 00:00:00 2001 From: Fisch Date: Tue, 30 Jul 2024 13:41:41 +0200 Subject: [PATCH] calibrations --- include/waterlevel.h | 6 +++--- platformio.ini | 9 ++++++++- src/main.cpp | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/waterlevel.h b/include/waterlevel.h index 8760cb9..4805a3a 100644 --- a/include/waterlevel.h +++ b/include/waterlevel.h @@ -50,11 +50,11 @@ uint16_t distance=DISTANCE_UNAVAILABLE; //Calibration -float waterlevel_calib_offset=500.0; //c -float waterlevel_calib_factor=-1.0; //m +float waterlevel_calib_offset=WATERLEVEL_OFFSET; //c +float waterlevel_calib_factor=WATERLEVEL_FACTOR; //m -float waterlevel_calib_reservoirArea=20*20*3.1416; //area in cm^2. barrel diameter inside is 400mm +float waterlevel_calib_reservoirArea=RES_AREA; //area in cm^2 uint16_t distance_unsuccessful_count=0; diff --git a/platformio.ini b/platformio.ini index 84743ed..60cd020 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,6 +32,9 @@ build_flags= -D THERMOMETER_ADDR_CASE={0x10,0x7E,0x22,0x99,0x01,0x08,0x00,0xA4} -D PIN_SDA=21 -D PIN_SCL=22 + -D WATERLEVEL_OFFSET=500.0 + -D WATERLEVEL_FACTOR=-1.0 + -D RES_AREA=20*20*3.1416 lib_deps = https://github.com/milesburton/Arduino-Temperature-Control-Library/ @@ -53,7 +56,7 @@ monitor_speed = 115200 build_flags= - '-D CLIENT_ID="hydroponic-Test"' + '-D CLIENT_ID="hydroponic-DB"' -D PIN_BUTTON=12 -D EC_PIN_RELAY_PROBE=35 @@ -72,6 +75,10 @@ build_flags= -D PIN_SDA=1 -D PIN_SCL=2 + -D WATERLEVEL_OFFSET=315.0 + -D WATERLEVEL_FACTOR=-1.0 + -D RES_AREA=37*56 + lib_deps = https://github.com/milesburton/Arduino-Temperature-Control-Library/ https://github.com/emilv/ArduinoSort/ diff --git a/src/main.cpp b/src/main.cpp index 491136a..3edc634 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,8 +8,8 @@ unsigned long last_check=0; #include "wifi_functions.h" -bool debug=true; //print Serial information -bool mqtt=false; +bool debug=false; //print Serial information +bool mqtt=true; bool eccalibrationoutput=false; //serial output for ec calibration /* Write to file with: sudo stty -F /dev/ttyUSB0 115200 @@ -243,7 +243,7 @@ void loop() { digitalWrite(PIN_LED,(loopmillis/250)%2==0); //blink led #endif #ifdef PIN_NEOPIXEL - pixels.setPixelColor(0, pixels.Color((loopmillis/250)%2==0,(loopmillis/250)%2==0,0)); + pixels.setPixelColor(0, pixels.Color(((loopmillis/250)%2==0)*255,((loopmillis/250)%2==0)*255,0)); pixels.show(); #endif }else{ //LED shows valueError flag status when values were okay once