   Serial.println("publish: " + json);
   g_mqtt_client.publish(g_report_topic, json);
 
+  g_led_interval = 50;
+  g_led_fast = 0;
   g_need_report = false;
 }
 

#include <MQTTClient.h>

#define JSON_BUF_SIZE 1024

typedef enum {
  STATUS_INVALID,

  EEPROM.write(3, *((uint8_t *)&cnt + 3));
}

static void handle_led() {
  unsigned long now = millis();

  if (now - g_last_led_ms >= g_led_interval) {
    // save the last time you blinked the LED
    g_last_led_ms = now;

    // if the LED is off turn it on and vice-versa:
    if (g_led_state == LOW) {
      g_led_state = HIGH;
    } else {
      g_led_state = LOW;
    }

    if (g_led_interval = 50) {
      g_led_fast += 1;
      if (g_led_fast >= 10) {
        g_led_interval = 1000;
      }
    }
    digitalWrite(LED_PIN, g_led_state);
  }
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("setup...");

  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, g_led_state);
  g_last_led_ms = millis();

  init_reset_cnt();
  g_status = STATUS_INIT_GPRS;
