stuff changed
This commit is contained in:
3
esp32/CMakeLists.txt
Normal file
3
esp32/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(esp32)
|
@@ -1,7 +1,8 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x5000,
|
||||
otadata, data, ota, 0xe000, 0x2000,
|
||||
app0, app, ota_0, 0x10000, 0x300000,
|
||||
app1, app, ota_1, 0x310000,0x300000,
|
||||
spiffs, data, spiffs, 0x610000,0x17000,
|
||||
#https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x4000
|
||||
otadata, data, ota, 0xD000, 0x2000
|
||||
phy_init, data, phy, 0xF000, 0x1000
|
||||
factory, app, factory, 0x10000, 0x140000
|
||||
ota_0, app, ota_0, 0x150000, 0x140000
|
||||
ota_1, app, ota_1, 0x290000, 0x140000
|
||||
spiffs, data, spiffs, 0x3D0000, 0x30000
|
|
@@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp32doit-devkit-v1]
|
||||
platform = espressif32
|
||||
platform = espressif32@4.2.0
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
@@ -22,10 +22,12 @@ build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
-DPLANT6_SENSORTYPE=FREQUENCY_MOD_RESISTANCE_PROBE
|
||||
board_build.partitions = defaultWithSmallerSpiffs.csv
|
||||
|
||||
;#https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html
|
||||
|
||||
|
||||
; the latest development brankitchen-lightch (convention V3.0.x)
|
||||
lib_deps = bblanchon/ArduinoJson@^6.20.1
|
||||
paulstoffregen/OneWire@^2.3.7
|
||||
paulstoffregen/OneWire@^2.3.6
|
||||
milesburton/DallasTemperature@^3.11.0
|
||||
pololu/VL53L0X@^1.3.1
|
||||
https://github.com/homieiot/homie-esp8266.git#develop
|
||||
|
1638
esp32/sdkconfig.esp32doit-devkit-v1
Normal file
1638
esp32/sdkconfig.esp32doit-devkit-v1
Normal file
File diff suppressed because it is too large
Load Diff
6
esp32/src/CMakeLists.txt
Normal file
6
esp32/src/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# This file was automatically generated for projects
|
||||
# without default 'CMakeLists.txt' file.
|
||||
|
||||
FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)
|
||||
|
||||
idf_component_register(SRCS ${app_sources})
|
@@ -265,7 +265,7 @@ void Plant::advertise(void)
|
||||
mPump = this->mPlant->advertise("switch").setName("Pump").setDatatype("Boolean");
|
||||
this->mPlant->advertise("lastPump").setName("lastPump").setDatatype("Integer").setUnit("unixtime").setRetained(true);
|
||||
this->mPlant->advertise("moist").setName("Percent").setDatatype("Float").setUnit("%").setRetained(true);
|
||||
this->mPlant->advertise("moistraw").setName("adc").setDatatype("Float").setUnit("3.3/4096V").setRetained(true);
|
||||
this->mPlant->advertise("moistraw").setName("frequency").setDatatype("Float").setUnit("hz").setRetained(true);
|
||||
this->mPlant->advertise("state").setName("state").setDatatype("String").setRetained(true);
|
||||
|
||||
}
|
||||
|
@@ -220,7 +220,6 @@ void readOneWireSensors()
|
||||
for (uint8_t i = 0; i < sensors.getDeviceCount(); i++)
|
||||
{
|
||||
uint8_t ds18b20Address[8];
|
||||
|
||||
bool valid = false;
|
||||
float temp = -127;
|
||||
for (int retry = 0; retry < AMOUNT_SENOR_QUERYS && !valid; retry++)
|
||||
@@ -244,9 +243,8 @@ void readOneWireSensors()
|
||||
{
|
||||
// wrong family or crc errors on each retry
|
||||
continue;
|
||||
}
|
||||
|
||||
char buf[(sizeof(ds18b20Address) * 2) + 1]; /* additional byte for trailing terminator */
|
||||
}
|
||||
char buf[(sizeof(ds18b20Address) * 2) + 1]; /* additional byte for trailing terminator */
|
||||
snprintf(buf, sizeof(buf), "%.2X%.2X%.2X%.2X%.2X%.2X%.2X%.2X",
|
||||
ds18b20Address[0],
|
||||
ds18b20Address[1],
|
||||
@@ -256,8 +254,7 @@ void readOneWireSensors()
|
||||
ds18b20Address[5],
|
||||
ds18b20Address[6],
|
||||
ds18b20Address[7]);
|
||||
|
||||
if (valid)
|
||||
if (valid)
|
||||
{
|
||||
Serial << "DS18S20 Temperatur " << String(buf) << " : " << temp << " °C " << endl;
|
||||
if (strcmp(lipoSensorAddr.get(), buf) == 0)
|
||||
@@ -355,8 +352,7 @@ void readPowerSwitchedSensors()
|
||||
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
|
||||
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
|
||||
tankSensor.setMeasurementTimingBudget(200000);
|
||||
|
||||
for (int readCnt = 0; readCnt < 5; readCnt++)
|
||||
for (int readCnt = 0; readCnt < 5; readCnt++)
|
||||
{
|
||||
if (!tankSensor.timeoutOccurred())
|
||||
{
|
||||
@@ -721,9 +717,6 @@ void pumpActiveLoop()
|
||||
|
||||
void safeSetup()
|
||||
{
|
||||
/* reduce power consumption */
|
||||
setCpuFrequencyMhz(80);
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial << "Wifi mode set to " << WIFI_OFF << " to allow analog2 useage " << endl;
|
||||
@@ -806,13 +799,11 @@ void safeSetup()
|
||||
{
|
||||
mPlants[i].initSensors();
|
||||
}
|
||||
Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL);
|
||||
readPowerSwitchedSensors();
|
||||
|
||||
Homie.setup();
|
||||
|
||||
Wire = TwoWire(0);
|
||||
Wire.setPins(SENSOR_TANK_SDA, SENSOR_TANK_SCL);
|
||||
Wire.begin();
|
||||
|
||||
/************************* Start One-Wire bus ***************/
|
||||
int tempInitStartTime = millis();
|
||||
@@ -832,7 +823,7 @@ void safeSetup()
|
||||
/* Measure temperature TODO idea: move this into setup */
|
||||
if (sensorCount > 0)
|
||||
{
|
||||
// sensors.setResolution(DS18B20_RESOLUTION);
|
||||
sensors.setResolution(DS18B20_RESOLUTION);
|
||||
sensors.requestTemperatures();
|
||||
}
|
||||
|
||||
@@ -920,6 +911,11 @@ void safeSetup()
|
||||
*/
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial << "First init" << endl;
|
||||
Serial.flush();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
safeSetup();
|
||||
@@ -1071,8 +1067,9 @@ void plantcontrol()
|
||||
Serial.flush();
|
||||
}
|
||||
|
||||
bool isLowLight = mSolarVoltage <= 9;
|
||||
#if defined(TIMED_LIGHT_PIN)
|
||||
bool isLowLight = mSolarVoltage <= 9;
|
||||
|
||||
bool shouldLight = determineTimedLightState(isLowLight);
|
||||
if(shouldLight){
|
||||
ulp_pwm_set_level(timedLightPowerLevel.get());
|
||||
|
Reference in New Issue
Block a user