Exceptions added
This commit is contained in:
parent
f727971138
commit
66d69eab6b
@ -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)
|
||||
|
@ -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
|
||||
|
@ -69,7 +69,7 @@ RTC_DATA_ATTR long consecutiveWateringPlant[MAX_PLANTS] = {0};
|
||||
bool volatile mDownloadMode = false; /**< Controller must not sleep */
|
||||
bool volatile mSensorsRead = false; /**< Sensors are read without Wifi or MQTT */
|
||||
int volatile pumpToRun = -1; /** pump to run at the end of the cycle */
|
||||
int volatile selfTestPumpRun = -1; /** pump to run at the end of the cycle */
|
||||
int volatile selfTestPumpRun = -1; /** pump to run at the end of the cycle */
|
||||
|
||||
bool mConfigured = false;
|
||||
long nextBlink = 0; /**< Time needed in main loop to support expected blink code */
|
||||
@ -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,9 +826,29 @@ 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()
|
||||
{
|
||||
|
||||
|
||||
if (selfTestPumpRun >= 0 && selfTestPumpRun < MAX_PLANTS)
|
||||
{
|
||||
Serial << "self test mode pump deactivate " << pumpToRun << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user