ESP12E goes offline and comes online randomly

#include <Bounce2.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
BlynkTimer timer;
int ReCnctFlag;


#define server "192.1xx.1.1xx"

char auth[] = "xxxxxxxxx";
char ssid[] = "xxxxxx";
char pass[] = "xxxxxxxxxx";

int val;
int encoder0PinA = 5;
int encoder0PinB = 4;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;

int curBrightness = 0;
bool isFirstConnect = true;

const int PinDT=5;    // DATA signal
const int PinCLK=4;    // CLOCK signal


BLYNK_CONNECTED() {
  if (isFirstConnect) {
     Blynk.syncAll();
     Blynk.syncVirtual(V6, V5, V3); 
     isFirstConnect = false;
  }
  int value = millis() / 1000;
  Blynk.virtualWrite(V33, value);
}

BLYNK_WRITE(V6) {

  curBrightness = param.asInt();
  Blynk.virtualWrite(V6, curBrightness);
  analogWrite(D5, curBrightness);
}

Bounce debouncer1 = Bounce(); 
Bounce debouncer2 = Bounce();

void setup() {
  pinMode (encoder0PinA, INPUT);
  debouncer1.attach(encoder0PinA);
  debouncer1.interval(5); 
  
  pinMode (encoder0PinB, INPUT);
  debouncer1.attach(encoder0PinB);
  debouncer1.interval(5); 
  
  
  pinMode(D5, OUTPUT);
  pinMode(encoder0PinA, INPUT);
  pinMode(encoder0PinB, INPUT);
  delay(10);
  
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,1xx), 8080);
  Serial.begin (115200);
  
}

void loop() {
  debouncer1.update();
  debouncer2.update();

  int value1 = debouncer1.read();
  int value2 = debouncer2.read();
  
    n = digitalRead(encoder0PinA);
  if ((encoder0PinALast == LOW) && (n == HIGH)) {
    if (digitalRead(encoder0PinB) == LOW) {
      encoder0Pos--;
      if(curBrightness - 700 >= 0)curBrightness -= 100;
      Blynk.virtualWrite(V6, curBrightness);
      analogWrite(D5, curBrightness);
    } else {
      encoder0Pos++;
      if(curBrightness + 100 <= 1023) curBrightness += 100;
      Blynk.virtualWrite(V6, curBrightness);
      analogWrite(D5, curBrightness);
    }
  }
  encoder0PinALast = n;
  

  if(Blynk.connected()){
    Blynk.run();
  }
  timer.run();
}

The same code was running fine on nodemcu from past 2 weeks. No disconnects. But now as soon as i am using ESP12E the problem has started.