Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Wake from deep sleep vs hard reset

    Technical Discussion
    1
    1
    247
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SimonnomiS last edited by

      I am having a problem with my ESP32 TTGO T-Display device. If I wake from sleep using an ext wakeup the code below works as it should, if the voltage is below 3.35 the screen will not turn on and if above 3.35v it turns on but if I do a hard reset the screen turns on even if the voltage is below the 3.35v any idea as to why the reset seems to ignore the if (battery_voltage <= 3.35) statement?

        float v = analogRead(34);
        float cutoff_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
      
        if (battery_voltage <= 3.35) {
          Serial.println(String("display off"));
          ledcSetup(pwmLedChannelTFT, pwmFreq, pwmResolution);
          ledcAttachPin(TFT_BL, pwmLedChannelTFT);
          ledcWrite(pwmLedChannelTFT, 0);
          DisplayOff = true;
        } else {
          tft.init();
      
          Serial.print("Configuring PWM for TFT backlight... ");
          ledcSetup(pwmLedChannelTFT, pwmFreq, pwmResolution);
          ledcAttachPin(TFT_BL, pwmLedChannelTFT);
          Serial.println("DONE");
      
          Serial.print("Setting PWM for TFT backlight to default intensity... ");
          ledcWrite(pwmLedChannelTFT, BrightnessLevel);
          Serial.println("DONE");
      
          tft.fillScreen(TFT_BLACK);
          tft.setRotation(3);
          tft.drawXBitmap(30, 30, logo, 175, 72, tft.color565(0, 59, 161));
          delay(2000);
      
          tft.fillScreen(TFT_RED);
          tft.setRotation(0);
          tft.setTextSize(1);
          tft.setFreeFont(GenFnt);              // Select the font
          tft.setTextColor(0xFFE0, TFT_BLACK);  // White characters on black background
          tft.drawString(Punit, 15, 45);        // Print the name of the font
          tft.drawString(Tunit, 15, 140);       // Print the name of the font
          tft.drawXBitmap(50, 6, BTlogo, BTlogoWidth, BTlogoHeight, TFT_DARKGREY);
          DisplayOff = false;
      }
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Powered by NodeBB | Contributors