    shouldsave=true;
 }
 void setup() {
-  check_rtc_mem();
+ 
   Serial.begin(115200);Serial.println();Serial.println();
+   check_rtc_mem();
   pinMode(D3,INPUT);
   pinMode(CS,OUTPUT);
   pinMode(DC,OUTPUT);

    if(rtc_mem[1]>0) 
    {
       rtc_mem[1]--;
       ESP.rtcUserMemoryWrite(0, (uint32_t*)&rtc_mem, sizeof(rtc_mem));
       EPD.deepsleep();
       ESP.deepSleep(60 * sleeptime * 1000000);

  ESP.rtcUserMemoryRead(0, (uint32_t*)&rtc_mem, sizeof(rtc_mem));
  if (rtc_mem[0]!=126)
  {
    Serial.println("first time to run");
    rtc_mem[0]=126;
    rtc_mem[1]=0;
    ESP.rtcUserMemoryWrite(0, (uint32_t*)&rtc_mem, sizeof(rtc_mem));
