 #include "EmonLib.h" // Include Emon Library
 #include <Average.h>
 
+extern "C" {
+#include "user_interface.h"
+}
+
 #define _IS_MY_HOME
 // WIFI
 #ifdef _IS_MY_HOME
-//#include "/usr/local/src/ap_settingii.h"
 #include "/usr/local/src/ap_setting.h"
 #else
 #include "ap_setting.h"
 #endif
+
+#define RTC_MAGIC 12345678
+
+typedef struct _tagPoint {
+  uint32 magic;
+  uint32 salt;
+} RTC_REVCOUNT;
+
+RTC_REVCOUNT rtc_mem_revcount;
 
 #define DEBUG_PRINT 0
 

      }

      if (((millis() - sentMills) > REPORT_INTERVAL ) && ( irStatus == oldirStatus )) {
      sendmqttMsg(topic, payload);
        sentMills = millis();
      }

      if ( irStatus != oldirStatus ) {
      sendmqttMsg(topic, payload);
        sentMills = millis();
        oldirStatus = irStatus ;
        oldrevValue = revValue ;

    Serial.begin(115200);
  }
  delay(20);

  rtc_check();

  if (DEBUG_PRINT) {
    Serial.println("power meter test!");

