Exceptions added

This commit is contained in:
c3ma 2021-11-13 17:26:39 +01:00
parent f727971138
commit 66d69eab6b
3 changed files with 28 additions and 10 deletions

View File

@ -85,9 +85,9 @@
#define FIRMWARE_VERSION "sw 2.0 hw 0.10b"
#define TIMED_LIGHT_PIN CUSTOM1_PIN5
//#define FLOWMETER_PIN CUSTOM1_PIN1
#define FLOWMETER_PIN CUSTOM1_PIN1
#ifdef FLOWMETER_PIN
#define FLOWMETER_FLOWFACTOR 22 /** F = 22 * Q;Q = L/min */
#define FLOWMETER_FLOWFACTOR 23 /** F = 22 * Q;Q = L/min */
#endif
#define MOIST_SENSOR_MAX_FRQ 60000 // 60kHz (500Hz margin)

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

@ -639,12 +639,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);
@ -829,6 +826,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()
{