util.h 826 Bytes
Newer Older
1
2
3
4
5
#ifndef AMPEL_UTIL_H_INCLUDED
#define AMPEL_UTIL_H_INCLUDED
#include <Arduino.h>
#include "config.h"
#include "wifi_util.h" // To get MAC
Eric Duminil's avatar
Eric Duminil committed
6
#include "csv_writer.h" // To close filesystem before reset
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

#include <WiFiUdp.h> //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();
}

Eric Duminil's avatar
Eric Duminil committed
27
28
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
29
30
31
32
#define seconds() (millis() / 1000UL)
extern uint32_t max_loop_duration;
const extern String SENSOR_ID;

Eric Duminil's avatar
Eric Duminil committed
33
34
void resetAmpel();

35
#endif