diff --git a/board/sym-lib-table b/board/sym-lib-table index 9987325..b8f1854 100644 --- a/board/sym-lib-table +++ b/board/sym-lib-table @@ -1,7 +1,8 @@ (sym_lib_table - (lib (name LP38690DT-3.3)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/LP38690DT-3.3.lib)(options "")(descr "")) - (lib (name ESP32-DEVKITC-32D)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/ESP32/ESP32-DEVKITC-32D.lib)(options "")(descr "")) - (lib (name DW01)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/DW01.lib)(options "")(descr "")) - (lib (name SX1308)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/SX1308.lib)(options "")(descr "")) - (lib (name ds2438)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/ds2438.lib)(options "")(descr "")) + (lib (name "LP38690DT-3.3")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/LP38690DT-3.3.lib")(options "")(descr "")) + (lib (name "ESP32-DEVKITC-32D")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/ESP32/ESP32-DEVKITC-32D.lib")(options "")(descr "")) + (lib (name "DW01")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/DW01.lib")(options "")(descr "")) + (lib (name "SX1308")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/SX1308.lib")(options "")(descr "")) + (lib (name "ds2438")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/ds2438.lib")(options "")(descr "")) + (lib (name "PlantCtrlESP32-rescue")(type "Legacy")(uri "${KIPRJMOD}/PlantCtrlESP32-rescue.lib")(options "")(descr "")) ) diff --git a/esp32/include/ControllerConfiguration.h b/esp32/include/ControllerConfiguration.h index 3d0ac5e..7379f04 100644 --- a/esp32/include/ControllerConfiguration.h +++ b/esp32/include/ControllerConfiguration.h @@ -82,11 +82,7 @@ /** \addtogroup Configuration * @{ */ -#define CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE -#define CONFIG_COMPILER_CXX_EXCEPTIONS - - -#define FIRMWARE_VERSION "2.4 HW0.10b" +#define FIRMWARE_VERSION "2.5 HW0.10b" #define TIMED_LIGHT_PIN CUSTOM1_PIN5 #define FLOWMETER_PIN CUSTOM1_PIN1 diff --git a/esp32/include/HomieTypes.h b/esp32/include/HomieTypes.h index f3d5cc9..8f6280f 100644 --- a/esp32/include/HomieTypes.h +++ b/esp32/include/HomieTypes.h @@ -21,7 +21,7 @@ #define FOREACH_SENSOR(SENSOR) \ SENSOR(NONE) \ - SENSOR(CAPACITIVE_FREQUENCY) \ + SENSOR(FREQUENCY_MOD_RESISTANCE_PROBE) \ SENSOR(ANALOG_RESISTANCE_PROBE) /** diff --git a/esp32/include/PlantCtrl.h b/esp32/include/PlantCtrl.h index ed211e4..701803a 100644 --- a/esp32/include/PlantCtrl.h +++ b/esp32/include/PlantCtrl.h @@ -19,7 +19,6 @@ #include "MathUtils.h" #include "MQTTUtils.h" #include "LogDefines.h" -#include "SHT2x.h" #define ANALOG_REREADS 5 #define MOISTURE_MEASUREMENT_DURATION 400 /** ms */ @@ -39,7 +38,6 @@ private: bool mConnected = false; int mPlantId = -1; SENSOR_MODE mSensorMode; - SHT2x sht20; public: @@ -128,8 +126,8 @@ public: { case NONE: return DEACTIVATED_PLANT; - case CAPACITIVE_FREQUENCY: - return mapf(mMoisture_raw.getMedian(), MOIST_SENSOR_MAX_FRQ, MOIST_SENSOR_MIN_FRQ, 0, 100); + case FREQUENCY_MOD_RESISTANCE_PROBE: + return mapf(mMoisture_raw.getMedian(), MOIST_SENSOR_MIN_FRQ, MOIST_SENSOR_MAX_FRQ, 0, 100); case ANALOG_RESISTANCE_PROBE: return mapf(mMoisture_raw.getMedian(), ANALOG_SENSOR_MAX_MV, ANALOG_SENSOR_MIN_MV, 0, 100); } @@ -138,7 +136,7 @@ public: float getCurrentMoistureRaw() { - if (getSensorMode() == CAPACITIVE_FREQUENCY) + if (getSensorMode() == FREQUENCY_MOD_RESISTANCE_PROBE) { if (mMoisture_raw.getMedian() < MOIST_SENSOR_MIN_FRQ) { diff --git a/esp32/include/ulp-pwm.h b/esp32/include/ulp-pwm.h index 778d202..66c9cb9 100644 --- a/esp32/include/ulp-pwm.h +++ b/esp32/include/ulp-pwm.h @@ -101,17 +101,6 @@ static inline uint16_t ulp_internal_data_read(size_t offset) return RTC_SLOW_MEM[offset] & 0xffff; } -static inline uint32_t rtc_io_number_get(gpio_num_t gpio_num) -{ - assert(rtc_gpio_is_valid_gpio(gpio_num) && "Invalid GPIO for RTC"); - uint32_t bit = rtc_bit[gpio_num]; - Serial.print("Resolved GPIO "); - Serial.print(gpio_num); - Serial.print(" to rtc bit "); - Serial.println(bit); - return bit; -} - void ulp_internal_start(void) { rtc_gpio_init(PIN); diff --git a/esp32/platformio.ini b/esp32/platformio.ini index 060c0c3..392e8b2 100644 --- a/esp32/platformio.ini +++ b/esp32/platformio.ini @@ -13,23 +13,22 @@ platform = espressif32 board = esp32doit-devkit-v1 framework = arduino build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY - -DPLANT0_SENSORTYPE=ANALOG_RESISTANCE_PROBE - -DPLANT1_SENSORTYPE=ANALOG_RESISTANCE_PROBE - -DPLANT2_SENSORTYPE=CAPACITIVE_FREQUENCY - -DPLANT3_SENSORTYPE=CAPACITIVE_FREQUENCY - -DPLANT4_SENSORTYPE=CAPACITIVE_FREQUENCY - -DPLANT5_SENSORTYPE=CAPACITIVE_FREQUENCY - -DPLANT6_SENSORTYPE=CAPACITIVE_FREQUENCY + -DPLANT0_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT1_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT2_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT3_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT4_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT5_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE + -DPLANT6_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE board_build.partitions = defaultWithSmallerSpiffs.csv ; the latest development brankitchen-lightch (convention V3.0.x) -lib_deps = ArduinoJson@6.16.1 - OneWire - DallasTemperature - pololu/VL53L0X +lib_deps = bblanchon/ArduinoJson@^6.20.1 + paulstoffregen/OneWire@^2.3.7 + milesburton/DallasTemperature@^3.11.0 + pololu/VL53L0X@^1.3.1 https://github.com/homieiot/homie-esp8266.git#develop - robtillaart/SHT2x@^0.1.3 [platformio] diff --git a/esp32/src/PlantCtrl.cpp b/esp32/src/PlantCtrl.cpp index 72fc01b..2ee3d39 100644 --- a/esp32/src/PlantCtrl.cpp +++ b/esp32/src/PlantCtrl.cpp @@ -23,7 +23,6 @@ Plant::Plant(int pinSensor, int pinPump, int plantId, HomieNode *plant, PlantSet this->mSetting = setting; this->mPlantId = plantId; this->mSensorMode = mode; - this->sht20 = SHT2x(); } void Plant::init(void) @@ -65,7 +64,7 @@ void Plant::initSensors(void) { switch (getSensorMode()) { - case CAPACITIVE_FREQUENCY: + case FREQUENCY_MOD_RESISTANCE_PROBE: { pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); @@ -112,7 +111,7 @@ void Plant::blockingMoistureMeasurement(void) } break; } - case CAPACITIVE_FREQUENCY: + case FREQUENCY_MOD_RESISTANCE_PROBE: case NONE: { // nothing to do here @@ -125,7 +124,7 @@ void Plant::startMoistureMeasurement(void) { switch (getSensorMode()) { - case CAPACITIVE_FREQUENCY: + case FREQUENCY_MOD_RESISTANCE_PROBE: { pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); pcnt_counter_resume(unit); @@ -143,7 +142,7 @@ void Plant::stopMoistureMeasurement(void) { switch (getSensorMode()) { - case CAPACITIVE_FREQUENCY: + case FREQUENCY_MOD_RESISTANCE_PROBE: { int16_t pulses; pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 333146f..4156ede 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -315,7 +315,7 @@ void readPowerSwitchedSensors() Plant plant = mPlants[i]; switch (plant.getSensorMode()) { - case CAPACITIVE_FREQUENCY: { + case FREQUENCY_MOD_RESISTANCE_PROBE: { Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " hz " << mPlants[i].getCurrentMoisturePCT() << "%" << endl; break; }