#ifndef AMPEL_UTIL_H_INCLUDED #define AMPEL_UTIL_H_INCLUDED #include // For uint32_t #if defined(ESP8266) # define esp_get_max_free_block_size() ESP.getMaxFreeBlockSize() # define esp_get_heap_fragmentation() ESP.getHeapFragmentation() #elif defined(ESP32) # define esp_get_max_free_block_size() ESP.getMaxAllocHeap() //largest block of heap that can be allocated. # define esp_get_heap_fragmentation() -1 // apparently not available for ESP32 #endif 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; } } class Ampel { private: static void showFreeSpace(); public: const char *version = "v0.3.1-S8"; // Update manually after significant changes. const char *board; const char *sensorId; const char *macAddress; uint32_t max_loop_duration; Ampel(); }; extern Ampel ampel; #endif