Revert "add resistive frequency sensor, updated dependencies"

This reverts commit 17d16a6eef.
This commit is contained in:
Empire 2023-02-12 12:40:38 +01:00
parent 2b6d766492
commit 42ce4cdda2
8 changed files with 45 additions and 27 deletions

View File

@ -1,8 +1,7 @@
(sym_lib_table (sym_lib_table
(lib (name "LP38690DT-3.3")(type "Legacy")(uri "${KIPRJMOD}/kicad-stuff/LP38690DT-3.3.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 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 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 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 ds2438)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/ds2438.lib)(options "")(descr ""))
(lib (name "PlantCtrlESP32-rescue")(type "Legacy")(uri "${KIPRJMOD}/PlantCtrlESP32-rescue.lib")(options "")(descr ""))
) )

View File

@ -82,7 +82,11 @@
/** \addtogroup Configuration /** \addtogroup Configuration
* @{ * @{
*/ */
#define FIRMWARE_VERSION "2.5 HW0.10b" #define CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE
#define CONFIG_COMPILER_CXX_EXCEPTIONS
#define FIRMWARE_VERSION "2.4 HW0.10b"
#define TIMED_LIGHT_PIN CUSTOM1_PIN5 #define TIMED_LIGHT_PIN CUSTOM1_PIN5
#define FLOWMETER_PIN CUSTOM1_PIN1 #define FLOWMETER_PIN CUSTOM1_PIN1

View File

@ -21,7 +21,7 @@
#define FOREACH_SENSOR(SENSOR) \ #define FOREACH_SENSOR(SENSOR) \
SENSOR(NONE) \ SENSOR(NONE) \
SENSOR(FREQUENCY_MOD_RESISTANCE_PROBE) \ SENSOR(CAPACITIVE_FREQUENCY) \
SENSOR(ANALOG_RESISTANCE_PROBE) SENSOR(ANALOG_RESISTANCE_PROBE)
/** /**

View File

@ -19,6 +19,7 @@
#include "MathUtils.h" #include "MathUtils.h"
#include "MQTTUtils.h" #include "MQTTUtils.h"
#include "LogDefines.h" #include "LogDefines.h"
#include "SHT2x.h"
#define ANALOG_REREADS 5 #define ANALOG_REREADS 5
#define MOISTURE_MEASUREMENT_DURATION 400 /** ms */ #define MOISTURE_MEASUREMENT_DURATION 400 /** ms */
@ -38,6 +39,7 @@ private:
bool mConnected = false; bool mConnected = false;
int mPlantId = -1; int mPlantId = -1;
SENSOR_MODE mSensorMode; SENSOR_MODE mSensorMode;
SHT2x sht20;
public: public:
@ -132,8 +134,8 @@ public:
{ {
case NONE: case NONE:
return DEACTIVATED_PLANT; return DEACTIVATED_PLANT;
case FREQUENCY_MOD_RESISTANCE_PROBE: case CAPACITIVE_FREQUENCY:
return mapf(mMoisture_raw.getMedian(), MOIST_SENSOR_MIN_FRQ, MOIST_SENSOR_MAX_FRQ, 0, 100); return mapf(mMoisture_raw.getMedian(), MOIST_SENSOR_MAX_FRQ, MOIST_SENSOR_MIN_FRQ, 0, 100);
case ANALOG_RESISTANCE_PROBE: case ANALOG_RESISTANCE_PROBE:
return mapf(mMoisture_raw.getMedian(), ANALOG_SENSOR_MAX_MV, ANALOG_SENSOR_MIN_MV, 0, 100); return mapf(mMoisture_raw.getMedian(), ANALOG_SENSOR_MAX_MV, ANALOG_SENSOR_MIN_MV, 0, 100);
} }
@ -142,7 +144,7 @@ public:
float getCurrentMoistureRaw() float getCurrentMoistureRaw()
{ {
if (getSensorMode() == FREQUENCY_MOD_RESISTANCE_PROBE) if (getSensorMode() == CAPACITIVE_FREQUENCY)
{ {
if (mMoisture_raw.getMedian() < MOIST_SENSOR_MIN_FRQ) if (mMoisture_raw.getMedian() < MOIST_SENSOR_MIN_FRQ)
{ {

View File

@ -101,6 +101,17 @@ static inline uint16_t ulp_internal_data_read(size_t offset)
return RTC_SLOW_MEM[offset] & 0xffff; 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) void ulp_internal_start(void)
{ {
rtc_gpio_init(PIN); rtc_gpio_init(PIN);

View File

@ -13,22 +13,23 @@ platform = espressif32
board = esp32doit-devkit-v1 board = esp32doit-devkit-v1
framework = arduino framework = arduino
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
-DPLANT0_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT0_SENSORTYPE=ANALOG_RESISTANCE_PROBE
-DPLANT1_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT1_SENSORTYPE=ANALOG_RESISTANCE_PROBE
-DPLANT2_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT2_SENSORTYPE=CAPACITIVE_FREQUENCY
-DPLANT3_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT3_SENSORTYPE=CAPACITIVE_FREQUENCY
-DPLANT4_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT4_SENSORTYPE=CAPACITIVE_FREQUENCY
-DPLANT5_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT5_SENSORTYPE=CAPACITIVE_FREQUENCY
-DPLANT6_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE -DPLANT6_SENSORTYPE=CAPACITIVE_FREQUENCY
board_build.partitions = defaultWithSmallerSpiffs.csv board_build.partitions = defaultWithSmallerSpiffs.csv
; the latest development brankitchen-lightch (convention V3.0.x) ; the latest development brankitchen-lightch (convention V3.0.x)
lib_deps = bblanchon/ArduinoJson@^6.20.1 lib_deps = ArduinoJson@6.16.1
paulstoffregen/OneWire@^2.3.7 OneWire
milesburton/DallasTemperature@^3.11.0 DallasTemperature
pololu/VL53L0X@^1.3.1 pololu/VL53L0X
https://github.com/homieiot/homie-esp8266.git#develop https://github.com/homieiot/homie-esp8266.git#develop
robtillaart/SHT2x@^0.1.3
[platformio] [platformio]

View File

@ -23,6 +23,7 @@ Plant::Plant(int pinSensor, int pinPump, int plantId, HomieNode *plant, PlantSet
this->mSetting = setting; this->mSetting = setting;
this->mPlantId = plantId; this->mPlantId = plantId;
this->mSensorMode = mode; this->mSensorMode = mode;
this->sht20 = SHT2x();
} }
void Plant::init(void) void Plant::init(void)
@ -64,7 +65,7 @@ void Plant::initSensors(void)
{ {
switch (getSensorMode()) switch (getSensorMode())
{ {
case FREQUENCY_MOD_RESISTANCE_PROBE: case CAPACITIVE_FREQUENCY:
{ {
pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId);
@ -111,7 +112,7 @@ void Plant::blockingMoistureMeasurement(void)
} }
break; break;
} }
case FREQUENCY_MOD_RESISTANCE_PROBE: case CAPACITIVE_FREQUENCY:
case NONE: case NONE:
{ {
// nothing to do here // nothing to do here
@ -124,7 +125,7 @@ void Plant::startMoistureMeasurement(void)
{ {
switch (getSensorMode()) switch (getSensorMode())
{ {
case FREQUENCY_MOD_RESISTANCE_PROBE: case CAPACITIVE_FREQUENCY:
{ {
pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId);
pcnt_counter_resume(unit); pcnt_counter_resume(unit);
@ -142,7 +143,7 @@ void Plant::stopMoistureMeasurement(void)
{ {
switch (getSensorMode()) switch (getSensorMode())
{ {
case FREQUENCY_MOD_RESISTANCE_PROBE: case CAPACITIVE_FREQUENCY:
{ {
int16_t pulses; int16_t pulses;
pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId); pcnt_unit_t unit = (pcnt_unit_t)(PCNT_UNIT_0 + this->mPlantId);

View File

@ -318,7 +318,7 @@ void readPowerSwitchedSensors()
Plant plant = mPlants[i]; Plant plant = mPlants[i];
switch (plant.getSensorMode()) switch (plant.getSensorMode())
{ {
case FREQUENCY_MOD_RESISTANCE_PROBE: { case CAPACITIVE_FREQUENCY: {
Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " hz " << mPlants[i].getCurrentMoisturePCT() << "%" << endl; Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoistureRaw() << " hz " << mPlants[i].getCurrentMoisturePCT() << "%" << endl;
break; break;
} }