This commit is contained in:
Empire 2021-11-19 18:58:26 +00:00
commit 61fad8e14c
4 changed files with 40 additions and 11 deletions

View File

@ -1,6 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x150000,
app1, app, ota_1, 0x160000,0x150000,
spiffs, data, spiffs, 0x300000,0x17000,
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
1 # Name # Name, Type, SubType, Offset, Size, Flags Type SubType Offset Size Flags
2 nvs nvs, data, nvs, 0x9000, 0x5000, data nvs 0x9000 0x5000
3 otadata otadata, data, ota, 0xe000, 0x2000, data ota 0xe000 0x2000
4 app0 app0, app, ota_0, 0x10000, 0x300000, app ota_0 0x10000 0x150000
5 app1 app1, app, ota_1, 0x310000,0x300000, app ota_1 0x160000 0x150000
6 spiffs spiffs, data, spiffs, 0x610000,0x17000, data spiffs 0x300000 0x17000
7 #https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html

View File

@ -12,9 +12,10 @@
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY -fexceptions -lstdc++-exc
board_build.partitions = defaultWithSmallerSpiffs.csv
; the latest development brankitchen-lightch (convention V3.0.x)
lib_deps = ArduinoJson@6.16.1
OneWire

View File

@ -9,9 +9,19 @@ void log(int level, String message, int statusCode)
{
String buffer;
StaticJsonDocument<200> doc;
// Read the current time
time_t now; // this is the epoch
tm tm; // the structure tm holds time information in a more convient way
doc["level"] = level;
doc["message"] = message;
doc["statusCode"] = statusCode;
time(&now);
localtime_r(&now, &tm);
if (tm.tm_year > (2021 - 1970)) { /* Only add the time, if we have at least 2021 */
doc["time"] = String(String(1900 + tm.tm_year) + "-" + String(tm.tm_mon + 1) + "-" + String(tm.tm_mday) +
" " + String(tm.tm_hour) + ":" + String(tm.tm_min) + ":" + String(tm.tm_sec));
}
serializeJson(doc, buffer);
if (mAliveWasRead)
{

View File

@ -209,7 +209,7 @@ void readOneWireSensors()
continue;
}
char buf[sizeof(ds18b20Address) * 2];
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],
@ -658,12 +658,9 @@ void pumpActiveLoop()
}
}
/**
* @brief Startup function
* Is called once, the controller is started
*/
void setup()
void safeSetup()
{
throw std::runtime_error("Shit happened");
/* reduce power consumption */
setCpuFrequencyMhz(80);
@ -848,6 +845,26 @@ void setup()
setupFinishedTimestamp = millis();
}
/**
* @brief Startup function
* Is called once, the controller is started
*/
void setup()
{
try
{
safeSetup();
}
catch (const std::exception &e)
{
Serial.printf("Exception thrown: \"%s\"", e.what());
}
catch (...)
{
Serial.println("Other exception thrown.");
}
}
void selfTest()
{