diff --git a/software/src/modules/modbus_tcp/modbus_tcp.cpp b/software/src/modules/modbus_tcp/modbus_tcp.cpp index cca114006..4bb113961 100644 --- a/software/src/modules/modbus_tcp/modbus_tcp.cpp +++ b/software/src/modules/modbus_tcp/modbus_tcp.cpp @@ -33,6 +33,8 @@ #include "modules/power_manager/power_manager.h" #endif +#include + extern uint32_t local_uid_num; // MODBUS TABLE CHANGELOG @@ -41,73 +43,6 @@ extern uint32_t local_uid_num; // 3 - Add phase switch #define MODBUS_TABLE_VERSION 3 - -template -struct Option { -public: - template, typename std::enable_if::type...> - Option(T t): val(t), have_val(true) {} - - // val has to be initialized if it is a primitive type. - Option() : val(), have_val(false) {} - - T &unwrap() { - return expect("unwrapped Option without value!"); - } - - const T &unwrap() const { - return expect("unwrapped Option without value!"); - } - - T &unwrap_or(T &default_value) { - if (!have_val) - return default_value; - return val; - } - - const T &unwrap_or(const T &default_value) const { - if (!have_val) - return default_value; - return val; - } - - T &expect(const char *message) { - if (!have_val) - esp_system_abort(message); - return val; - } - - const T &expect(const char *message) const { - if (!have_val) - esp_system_abort(message); - return val; - } - - T &insert(const T &default_value) { - val = default_value; - have_val = true; - return val; - } - - bool is_some() const { - return have_val; - } - - bool is_none() const { - return !have_val; - } - - void clear() { - have_val = false; - } - -private: - T val; - bool have_val; -}; - - - static uint8_t hextouint(const char c) { uint8_t i = 0;