#ifndef AMPEL_UTIL_H_INCLUDED #define AMPEL_UTIL_H_INCLUDED #include #include "config.h" #include "wifi_util.h" // To get MAC #ifdef AMPEL_CSV # include "csv_writer.h" // To close filesystem before reset #endif #include //required for NTP #include "src/lib/NTPClient-master/NTPClient.h" // NTP #if defined(ESP8266) # define BOARD "ESP8266" # define get_free_heap_size() system_get_free_heap_size() #elif defined(ESP32) # define BOARD "ESP32" # define get_free_heap_size() esp_get_free_heap_size() #else # define BOARD "Unknown" #endif namespace ntp { void initialize(); void update(); String getLocalTime(); } namespace util { template inline auto min(const Tpa &a, const Tpb &b) -> decltype(a < b ? a : b) { return b < a ? b : a; } template inline auto max(const Tpa &a, const Tpb &b) -> decltype(b > a ? b : a) { return b > a ? b : a; } } #define seconds() (millis() / 1000UL) extern uint32_t max_loop_duration; const extern String SENSOR_ID; void resetAmpel(); #endif