ElegantOTA update progress on GLCD

I am trying to get to display the progress bar shown on webpage while using ElegantOTA on my ST7920 128x64 Monochrome GLCD. The output of the Serial monitor is

OTA update started!
Update Received: firmware.bin
OTA Progress Current: 1436 bytes, Final: 0 bytes
OTA Progress Current: 172320 bytes, Final: 170884 bytes
OTA Progress Current: 348948 bytes, Final: 347512 bytes
OTA Progress Current: 528448 bytes, Final: 527012 bytes
OTA Progress Current: 709384 bytes, Final: 707948 bytes
OTA Progress Current: 868780 bytes, Final: 867344 bytes
OTA update finished successfully!

tried using this in code

otaProgress = (current * 100) / final;
drawUpdateScreen("Updating...", otaProgress);

But then the update process stops and the esp32 reboots, reason maybe because
otaProgress = (current100) / final = 1436100 / 0= 0. Dividing by zero is bound to throw error. Others are giving >= 100%.
I am stuck. please guide
I had tried ArduinoOTA. It worked but

  1. Have to use Arduino ide so PC is a must
  2. Compiling and uploading takes around 10 minutes.
  3. Cannot compile using PlatformIO, gives tons of errors.
    this is my code
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ElegantOTA.h>
#include <U8g2lib.h> // Oliver Kraus @ https://github.com/olikraus/u8g2

U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, /* CS=*/ U8X8_PIN_NONE, /* reset=*/U8X8_PIN_NONE); // ESP32 Hardware SPI (Save Pins)
// Pins of GLCD Reset(RST) and Register Select(RS) tied to 3.3V

/*
  Fontname: 7_Seg_31x14
  Copyright: Created with Fony 1.4.0.2
  Glyphs: 224/256
  BBX Build Mode: 0
*/
const uint8_t u8g2_font_7_Seg_31x14[1607] U8G2_FONT_SECTION("u8g2_font_7_Seg_31x14") = 
  "\340\0\4\4\4\5\5\6\6\14\35\0\343\376\0\0\0\1\256\2n\6* \6\0 X\3!\6\0"
  " \230\2\42\6\0 \230\2#\6\0 \230\2$\6\0 \230\2%\6\0 \230\2&\6\0 \230"
  "\2'\6\0 \230\2(\6\0 \230\2)\6\0 \230\2*\6\0 \230\2+\16\231\344\321\316\260"
  "i\36\260\31\66\15\0,\6\0 x\2-\10\71\244\322\302\3\6.\6\0 x\2/\6\0 \330"
  "\2\60\37\272\345\340\6\212\20&F\220(d\77*\66\60h\300a\205\354G%H\214\60\21\2\5\0"
  "\61\21\263\363\340J\210\7.\204\204\12\361\300\205\220\0\62\36\272\345\340B\222\23AJ\210\233\77\24b"
  "\42\4\212\20F\4\216\233\357\4\206\60\203B\1\63\34\272\345\340B\222\23AJ\210\233\77\24qB\311"
  "\211\200\342\346OJ\210\70\241\2\0\64\30\272\345\340B\300a\205\354G\305Z\230\10\201\306D@q\363"
  "\17E\6\65\35\272\345\340\206\212\23\42\212\214\233\337\11\14a\6\215\211\200\342\346\207BL\204@\241\0"
  "\66 \272\345\340\206\212\23\42\212\214\233\337\11\14a\6E\10\23\303\12\331\217J\220\30a\42\4\12\0"
  "\67\27\252%\341B\222\23AJ\210\233\77\24\31\36P@q\363\207\42\3\70\42\272\345\340\6\212\20&"
  "F\220(d\77*\66\302D\10\24!L\14+d\77*Ab\204\211\20(\0\71\37\272\345\340\6\212"
  "\20&F\220(d\77*\66\302D\10\64&\2\212\233\77)!\342\204\12\0:\11\363$qBz\300"
  "\11;\6\0 \330\2<\6\0 \30\2=\6\0 \30\2>\6\0 \30\2\77\6\0 \30\2@"
  "\6\0 \30\2A\6\0 \30\2B\6\0 \30\2C\6\0 \30\2D\6\0 \30\2E\6\0"
  " \30\2F\6\0 \30\2G\6\0 \30\2H\6\0 \30\2I\6\0 \30\2J\6\0 \30"
  "\2K\6\0 \30\2L\6\0 \30\2M\6\0 \30\2N\6\0 \30\2O\6\0 \30\2P"
  "\6\0 \30\2Q\6\0 \30\2R\6\0 \30\2S\6\0 \30\2T\6\0 \30\2U\6\0"
  " \30\2V\6\0 \30\2W\6\0 \30\2X\6\0 \30\2Y\6\0 \30\2Z\6\0 \30"
  "\2[\6\0 \30\2\134\6\0 \30\2]\6\0 \30\2^\6\0 \30\2_\6\0 \30\2`"
  "\6\0 \30\2a\6\0 \30\2b\6\0 \30\2c\6\0 \30\2d\6\0 \30\2e\6\0"
  " \30\2f\6\0 \30\2g\6\0 \30\2h\6\0 \30\2i\6\0 \30\2j\6\0 \30"
  "\2k\6\0 \30\2l\6\0 \30\2m\6\0 \30\2n\6\0 \30\2o\6\0 \30\2p"
  "\6\0 \30\2q\6\0 \30\2r\6\0 \30\2s\6\0 \30\2t\6\0 \30\2u\6\0"
  " \30\2v\6\0 \30\2w\6\0 \30\2x\6\0 \30\2y\6\0 \30\2z\6\0 \30"
  "\2{\6\0 \30\2|\6\0 \30\2}\6\0 \30\2~\6\0 \30\2\177\6\0 \30\2\200"
  "\6\0 \30\2\201\6\0 \30\2\202\6\0 \30\2\203\6\0 \30\2\204\6\0 \30\2\205\6\0"
  " \30\2\206\6\0 \30\2\207\6\0 \30\2\210\6\0 \30\2\211\6\0 \30\2\212\6\0 \30"
  "\2\213\6\0 \30\2\214\6\0 \30\2\215\6\0 \30\2\216\6\0 \30\2\217\6\0 \30\2\220"
  "\6\0 \30\2\221\6\0 \30\2\222\6\0 \30\2\223\6\0 \30\2\224\6\0 \30\2\225\6\0"
  " \30\2\226\6\0 \30\2\227\6\0 \30\2\230\6\0 \30\2\231\6\0 \30\2\232\6\0 \30"
  "\2\233\6\0 \30\2\234\6\0 \30\2\235\6\0 \30\2\236\6\0 \30\2\237\6\0 \30\2\240"
  "\6\0 \30\2\241\6\0 \30\2\242\6\0 \30\2\243\6\0 \30\2\244\6\0 \30\2\245\6\0"
  " \30\2\246\6\0 \30\2\247\6\0 \30\2\250\6\0 \30\2\251\6\0 \30\2\252\6\0 \30"
  "\2\253\6\0 \30\2\254\6\0 \30\2\255\6\0 \30\2\256\6\0 \30\2\257\6\0 \30\2\260"
  "\6\0 \30\2\261\6\0 \30\2\262\6\0 \30\2\263\6\0 \30\2\264\6\0 \30\2\265\6\0"
  " \30\2\266\6\0 \30\2\267\6\0 \30\2\270\6\0 \30\2\271\6\0 \30\2\272\6\0 \30"
  "\2\273\6\0 \30\2\274\6\0 \30\2\275\6\0 \30\2\276\6\0 \30\2\277\6\0 \30\2\300"
  "\6\0 \30\2\301\6\0 \30\2\302\6\0 \30\2\303\6\0 \30\2\304\6\0 \30\2\305\6\0"
  " \30\2\306\6\0 \30\2\307\6\0 \30\2\310\6\0 \30\2\311\6\0 \30\2\312\6\0 \30"
  "\2\313\6\0 \30\2\314\6\0 \30\2\315\6\0 \30\2\316\6\0 \30\2\317\6\0 \30\2\320"
  "\6\0 \30\2\321\6\0 \30\2\322\6\0 \30\2\323\6\0 \30\2\324\6\0 \30\2\325\6\0"
  " \30\2\326\6\0 \30\2\327\6\0 \30\2\330\6\0 \30\2\331\6\0 \30\2\332\6\0 \30"
  "\2\333\6\0 \30\2\334\6\0 \30\2\335\6\0 \30\2\336\6\0 \30\2\337\6\0 \30\2\340"
  "\6\0 \30\2\341\6\0 \30\2\342\6\0 \30\2\343\6\0 \30\2\344\6\0 \30\2\345\6\0"
  " \30\2\346\6\0 \30\2\347\6\0 \30\2\350\6\0 \30\2\351\6\0 \30\2\352\6\0 \30"
  "\2\353\6\0 \30\2\354\6\0 \30\2\355\6\0 \30\2\356\6\0 \30\2\357\6\0 \30\2\360"
  "\6\0 \30\2\361\6\0 \30\2\362\6\0 \30\2\363\6\0 \30\2\364\6\0 \30\2\365\6\0"
  " \30\2\366\6\0 \30\2\367\6\0 \30\2\370\6\0 \30\2\371\6\0 \30\2\372\6\0 \30"
  "\2\373\6\0 \30\2\374\6\0 \30\2\375\6\0 \30\2\376\6\0 \30\2\377\6\0 \30\2\0"
  "\0\0\4\377\377\0";

/*
  Fontname: 7_Seg_18x12m
  Copyright: Created with Fony 1.4.0.2
  Glyphs: 224/256
  BBX Build Mode: 0
*/
const uint8_t u8g2_font_7_Seg_18x12[1599] U8G2_FONT_SECTION("u8g2_font_7_Seg_18x12") = 
  "\340\0\4\4\4\5\5\6\5\13\22\0\356\377\0\0\0\1\246\2f\6\42 \6\0 \310\1!\6\0"
  " \230\1\42\6\0 \230\1#\6\0 \230\1$\6\0 \230\1%\22\11\245\303aPE\342\204\215"
  "\232\317\304IT\321\0&\6\0 \230\1'\6\0 \230\1(\6\0 \230\1)\6\0 \230\1*"
  "\6\0 \230\1+\16\231\244\324g\330\64\17\330\14\233\6\0,\6\0 x\1-\10\71d\325\341\1"
  "\3.\7\63\244s!\1/\6\0 \330\1\60\35\32\243\303\3E\10\23#H\24\262\250\330\300\240\1"
  "\207\25\262\250\4\211\21&B\240\0\61\17\23\261\303%\204\13!\241B\270\20\22\0\62\34\32\243\303!"
  "\311\211 %\304\315P\210\211\20(B\30\21\70n:\21EB\34I\63\32\32\243\303!\311\211 %"
  "\304\315P\304\11%'\2\212\233I\11\21'T\0\64\27\32\243\303!\340\260B\66*\66\302D\10\64"
  "&\2\212\233C\221\1\65\33\32\243\303C\305\11\21E\306M'\60\204\31\64&\2\212\233I\11\21'"
  "T\0\66\34\32\243\303C\305\11\21E\306M'\60\204\31\24!L\14+U\25\211\22\42\216$\67\26"
  "\12\343\303!\311\211 %\304\315Pdx@\1\305\315Pd\0\70!\32\243\303\3E\10\23#H\24"
  "\262\250\330\10\23!P\204\60\61\254\220E%H\214\60\21\2\5\0\71\33\32\243\303\3E\10\23#H"
  "\24\262\250\330\10\23!\320\230\10('&B\240P:\11\323$t!=\260\4;\6\0 \30\1<"
  "\6\0 \30\1=\6\0 \30\1>\6\0 \30\1\77\6\0 \30\1@\6\0 \30\1A\6\0"
  " \30\1B\6\0 \30\1C\6\0 \30\1D\6\0 \30\1E\6\0 \30\1F\6\0 \30"
  "\1G\6\0 \30\1H\6\0 \30\1I\6\0 \30\1J\6\0 \30\1K\6\0 \30\1L"
  "\6\0 \30\1M\6\0 \30\1N\6\0 \30\1O\6\0 \30\1P\6\0 \30\1Q\6\0"
  " \30\1R\6\0 \30\1S\6\0 \30\1T\6\0 \30\1U\6\0 \30\1V\6\0 \30"
  "\1W\6\0 \30\1X\6\0 \30\1Y\6\0 \30\1Z\6\0 \30\1[\6\0 \30\1\134"
  "\6\0 \30\1]\6\0 \30\1^\6\0 \30\1_\6\0 \30\1`\6\0 \30\1a\6\0"
  " \30\1b\6\0 \30\1c\6\0 \30\1d\6\0 \30\1e\6\0 \30\1f\6\0 \30"
  "\1g\6\0 \30\1h\6\0 \30\1i\6\0 \30\1j\6\0 \30\1k\6\0 \30\1l"
  "\6\0 \30\1m\6\0 \30\1n\6\0 \30\1o\6\0 \30\1p\6\0 \30\1q\6\0"
  " \30\1r\6\0 \30\1s\6\0 \30\1t\6\0 \30\1u\6\0 \30\1v\6\0 \30"
  "\1w\6\0 \30\1x\6\0 \30\1y\6\0 \30\1z\6\0 \30\1{\6\0 \30\1|"
  "\6\0 \30\1}\6\0 \30\1~\6\0 \30\1\177\6\0 \30\1\200\6\0 \30\1\201\6\0"
  " \30\1\202\6\0 \30\1\203\6\0 \30\1\204\6\0 \30\1\205\6\0 \30\1\206\6\0 \30"
  "\1\207\6\0 \30\1\210\6\0 \30\1\211\6\0 \30\1\212\6\0 \30\1\213\6\0 \30\1\214"
  "\6\0 \30\1\215\6\0 \30\1\216\6\0 \30\1\217\6\0 \30\1\220\6\0 \30\1\221\6\0"
  " \30\1\222\6\0 \30\1\223\6\0 \30\1\224\6\0 \30\1\225\6\0 \30\1\226\6\0 \30"
  "\1\227\6\0 \30\1\230\6\0 \30\1\231\6\0 \30\1\232\6\0 \30\1\233\6\0 \30\1\234"
  "\6\0 \30\1\235\6\0 \30\1\236\6\0 \30\1\237\6\0 \30\1\240\6\0 \30\1\241\6\0"
  " \30\1\242\6\0 \30\1\243\6\0 \30\1\244\6\0 \30\1\245\6\0 \30\1\246\6\0 \30"
  "\1\247\6\0 \30\1\250\6\0 \30\1\251\6\0 \30\1\252\6\0 \30\1\253\6\0 \30\1\254"
  "\6\0 \30\1\255\6\0 \30\1\256\6\0 \30\1\257\6\0 \30\1\260\6\0 \30\1\261\6\0"
  " \30\1\262\6\0 \30\1\263\6\0 \30\1\264\6\0 \30\1\265\6\0 \30\1\266\6\0 \30"
  "\1\267\6\0 \30\1\270\6\0 \30\1\271\6\0 \30\1\272\6\0 \30\1\273\6\0 \30\1\274"
  "\6\0 \30\1\275\6\0 \30\1\276\6\0 \30\1\277\6\0 \30\1\300\6\0 \30\1\301\6\0"
  " \30\1\302\6\0 \30\1\303\6\0 \30\1\304\6\0 \30\1\305\6\0 \30\1\306\6\0 \30"
  "\1\307\6\0 \30\1\310\6\0 \30\1\311\6\0 \30\1\312\6\0 \30\1\313\6\0 \30\1\314"
  "\6\0 \30\1\315\6\0 \30\1\316\6\0 \30\1\317\6\0 \30\1\320\6\0 \30\1\321\6\0"
  " \30\1\322\6\0 \30\1\323\6\0 \30\1\324\6\0 \30\1\325\6\0 \30\1\326\6\0 \30"
  "\1\327\6\0 \30\1\330\6\0 \30\1\331\6\0 \30\1\332\6\0 \30\1\333\6\0 \30\1\334"
  "\6\0 \30\1\335\6\0 \30\1\336\6\0 \30\1\337\6\0 \30\1\340\6\0 \30\1\341\6\0"
  " \30\1\342\6\0 \30\1\343\6\0 \30\1\344\6\0 \30\1\345\6\0 \30\1\346\6\0 \30"
  "\1\347\6\0 \30\1\350\6\0 \30\1\351\6\0 \30\1\352\6\0 \30\1\353\6\0 \30\1\354"
  "\6\0 \30\1\355\6\0 \30\1\356\6\0 \30\1\357\6\0 \30\1\360\6\0 \30\1\361\6\0"
  " \30\1\362\6\0 \30\1\363\6\0 \30\1\364\6\0 \30\1\365\6\0 \30\1\366\6\0 \30"
  "\1\367\6\0 \30\1\370\6\0 \30\1\371\6\0 \30\1\372\6\0 \30\1\373\6\0 \30\1\374"
  "\6\0 \30\1\375\6\0 \30\1\376\6\0 \30\1\377\6\0 \30\1\0\0\0\4\377\377\0";


// Set Wifi Credentials
const char *ssid = "your-ssid";    // Actual Changed
const char *password = "your-password"; // Actual change

// Initialize ElegantOTA
#if defined(ESP8266)
  #include <ESP8266WiFi.h>
  #include <WiFiClient.h>
  #include <ESP8266WebServer.h>
#elif defined(ESP32)
  #include <WiFi.h>
  #include <WiFiClient.h>
  #include <WebServer.h>
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
  #include <WiFi.h>
  #include <WiFiClient.h>
  #include <WiFiServer.h>
  #include <WebServer.h>
#endif

#if defined(ESP8266)
  ESP8266WebServer server(80);
#elif defined(ESP32)
  WebServer server(80);
#elif defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
  WebServer server(80);
#endif

#define PlusPin 39
#define MenuPin 34
#define MinusPin 36
#define BackLitPin 14 

bool OTA_Ready = false;
uint8_t dotsLength = 0;
bool otaInProgress = false;
uint8_t otaProgress = 0;
unsigned long ota_progress_millis = 0;

// Function Prototypes //
/*************************/
void u8g2_prepare();
void drawReadyScreen();
void drawUpdateScreen(const char* message, int progress);
void drawInfoScreen(const char* message, uint8_t value);
void onOTAStart();
void onOTAProgress(size_t current, size_t final);
void onOTAEnd(bool success);
void OTA_Prepare();

void u8g2_prepare(void) {
  u8g2.setFont(u8g2_font_6x12_tf);
  u8g2.setFontRefHeightExtendedText();
  u8g2.setDrawColor(1);
  u8g2.setFontPosTop();
  u8g2.setFontDirection(0);
}

void drawReadyScreen() {
  dotsLength++;
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_6x12_tf);
    u8g2.drawStr(30, 0, "OTA Ready");

    // Display SSID
    u8g2.setCursor(0, 15);
    u8g2.print("SSID: ");
    u8g2.print(ssid);

    // Display Ip address
    u8g2.drawStr(0, 30, "Ip:");
    u8g2.drawStr(18, 30, WiFi.localIP().toString().c_str());
    u8g2.drawStr(0, 45, "Waiting ");
    if(dotsLength > 80) dotsLength = 1;
    u8g2.drawHLine(43, 55, dotsLength);
  } while (u8g2.nextPage());
  delay(100);
}

void drawUpdateScreen(const char* message, int progress) {
  if(digitalRead(BackLitPin) == 0){
    digitalWrite(BackLitPin, HIGH);  // Turn On LCD Backlight
  }
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_6x12_tf);
    
    // Display SSID
    u8g2.setCursor(0, 0);
    u8g2.print("SSID: ");
    u8g2.print(ssid);
    
    // Display IP address
    u8g2.drawStr(0, 12, "Ip:");
    u8g2.drawStr(18, 12, WiFi.localIP().toString().c_str());

    // Display message
    u8g2.drawStr(0, 24, message);

    // Display progress percentage
    char progressStr[20];
    snprintf(progressStr, sizeof(progressStr), "Progress: %d%%", progress);
    u8g2.drawStr(0, 36, progressStr);

    // Draw progress bar
    int barWidth = map(progress, 0, 100, 0, 120);
    u8g2.drawFrame(0, 48, 120, 15); // Outer frame
    u8g2.drawBox(0, 48, barWidth, 15); // Filled progress
  } while (u8g2.nextPage());
  delay(100);
}

void drawInfoScreen(const char* message, uint8_t value){
  for(int i = value; i != 0; i--){
    u8g2.firstPage();
    do {
      u8g2.setFont(u8g2_font_6x12_tf);
      u8g2.drawStr(0, 0, message);
      u8g2.setFont(u8g2_font_7_Seg_31x14);
      u8g2.setCursor(14, 20);
      u8g2.print(i);
    } while (u8g2.nextPage());
    delay(1000);
  }
  u8g2.setFont(u8g2_font_6x12_tf);
}

// ElegantOTA Callbacks
void onOTAStart() {
  // Log when OTA has started
  Serial.println("OTA update started!");
  // <Add your own code here>
  otaInProgress = true;
  otaProgress = 0;
  drawUpdateScreen("Update Started", otaProgress);
}

void onOTAProgress(size_t current, size_t final) {
  // Log every 1 second
  if (millis() - ota_progress_millis > 1000) {
    ota_progress_millis = millis();
    Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
    //otaProgress = (current * 100) / final;
    //drawUpdateScreen("Updating...", otaProgress);
  }
}

void onOTAEnd(bool success) {
  // Log when OTA has finished
  if (success) {
    Serial.println("OTA update finished successfully!");
    otaInProgress = false;
    drawUpdateScreen("Update Completed", 100);
    delay(2000); // Show completion message for 2 seconds
    drawInfoScreen("Restarting in...", 3);
    //ESP.restart(); // Restart the device after successful update
  } else {
    Serial.println("There was an error during OTA update!");
  }
  // <Add your own code here>
}

void OTA_Prepare(){
  uint8_t attempts = 0;

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    attempts++;
    if(attempts >= 5) return; // try 5 times
    char buffer[50]; // Buffer to hold the formatted string
    sprintf(buffer, "Attempt number %d /5", attempts); // Format the string
    drawInfoScreen(buffer, (attempts + 3)); // Pass the formatted string to the function
    if(digitalRead(MinusPin) == 0 && digitalRead(MenuPin) == 0 && !OTA_Ready){
      return;
    }
  }

  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  
  server.on("/", []() {
    server.send(200, "text/plain", "Hi! This is ElegantOTA Demo.");
  });

  ElegantOTA.begin(&server);    // Start ElegantOTA
  // ElegantOTA callbacks
  ElegantOTA.onStart(onOTAStart);
  ElegantOTA.onProgress(onOTAProgress);
  ElegantOTA.onEnd(onOTAEnd);

  server.begin();

  if(WiFi.status() == WL_CONNECTED){
    OTA_Ready = true;
  }
  else{
    drawInfoScreen("Failed to Connect", 3);
  }
}

void setup() {

  Serial.begin(115200);
  Serial.println("Starting...");
 
  // Set the pinsMode to Input/Output
  pinMode(MenuPin, INPUT);
  pinMode(PlusPin, INPUT);
  pinMode(MinusPin, INPUT);
  
  pinMode(BackLitPin, OUTPUT);
  digitalWrite(BackLitPin, LOW);  // Turn LCD Backlight OFF
  
  
  u8g2.begin();   // Initialise Display
  u8g2_prepare();
}

void loop() {
  if(digitalRead(PlusPin) == 0 && digitalRead(MenuPin) == 0 && !OTA_Ready){
    // Start OTA Mode
    digitalWrite(BackLitPin, HIGH);  // Turn LCD Backlight ON
    drawInfoScreen("Entering OTA Mode in", 3);
    OTA_Prepare();
  }
  else if(digitalRead(MinusPin) == 0 && digitalRead(MenuPin) == 0 && OTA_Ready){
    // Exit OTA Mode
    drawInfoScreen("Exiting OTA Mode in", 3);
    server.stop(); // Stop the web server
    WiFi.disconnect(); // Disconnect from Wi-Fi
    delay(1000);
    WiFi.mode(WIFI_OFF); // Turn off Wi-Fi
    OTA_Ready = false;
  }
  // Turn the backlight On / Off
  else if (digitalRead(PlusPin) == 0) {
    digitalWrite(BackLitPin, HIGH);  // Turn On LCD Backlight
  }   
  else if (digitalRead(MinusPin) == 0) {
    if(!otaInProgress) digitalWrite(BackLitPin, LOW);  // Turn OFF LCD Backlight
  }
  
  if(OTA_Ready){
    server.handleClient();
    ElegantOTA.loop();
    if (!otaInProgress) {
      // Display IP address and "OTA Ready" when no update is in progress
      drawReadyScreen();
    }
  }
  else{
    // Run Basic Test Code
    u8g2.firstPage();
    do {
      u8g2.setFont(u8g2_font_6x12_tf);
      u8g2.drawStr(0, 0, "Press Menu + Plus");
      u8g2.drawStr(0, 12, "to Enter OTA Mode");
    } while(u8g2.nextPage());
    delay(100);
  }
}

Demo.ino (3.0 KB)
ElegantOTA.cpp (14.3 KB)
ElegantOTA.h (3.7 KB)

Solved- I used ESPAsyncWebserver library instead of Webserver library