 #include <stdint.h>
+#include <string.h>
 
 #include <ESP8266WiFi.h>
 #include <WiFiManager.h>

    Serial.print("ESP ID: ");
    Serial.println(esp_id);

    Serial.println("Starting WIFI manager ...");
    wifiManager.autoConnect("ESP-ZG01");
}

static void mqtt_send(const char *topic, const char *value)


void loop()
{
    // update the circular buffer every second
    unsigned long int second = millis() / 1000;
    unsigned long int secidx = second % 60;
    if (secidx != secidx_prev) {
        // new second, store the counts from the last second
        unsigned long int count = counts;
        secondcounts[secidx_prev] = count - count_prev;
        count_prev = count;
        secidx_prev = secidx;
    }

    // report every LOG_PERIOD
    if ((second - second_prev) > LOG_PERIOD) {
        second_prev = second;

        // calculate sum
        int cpm = 0;
        for (int i = 0; i < 60; i++) {
            cpm += secondcounts[i];
        }

        // send over MQTT
        char message[16];
