ESP32 sleep mode multiple wake-up sources with timer

Hi,
I'm currently working on a project, based on ESP32, where I read and send some sensor data over WiFi every 15 minutes. When the ESP is not sending data it goes into sleep mode. I also use a display that shows some of the last acquired data when a capacitive touch plate is touched. This also puts the ESP out of sleep mode.
Here's part of the code:

#define sleep_Time 900*1000000 //15min in microseconds

void setup() {

  esp_sleep_enable_timer_wakeup(sleep_Time);
  touchAttachInterrupt(T0, touchISR, threshold);
  esp_sleep_enable_touchpad_wakeup();

 if (esp_sleep_get_wakeup_cause() = ESP_SLEEP_WAKEUP_TOUCHPAD) {
   //show data on display
   }
else{
   //read and send sensor data via WiFi   
}

esp_deep_sleep_start();

}

The problem is that after I touch the plate to activate the display the sleep mode timer re-initializes putting the ESP back to sleep for another 15min. What I am trying to achive is to read and send the data every 15min even if I wake up the ESP from touch to activate the display in between the sleep mode.
I hope I explained myself :sweat_smile:
Thank you!

OK, let's see if I got this correct.

You want to put the ESP32 to deep sleep, and when you touch the sensor you want the display to show some thing by waking up the esp32 from deep sleep, displaying the thing and going back to sleep but you still want to transmit every 15, regardless of how many times the esp32 was woken from deep sleep, right?

Have you considered using the ULP for the wake and and send function? The ULP is the other processor on the ESP32 module that is programmed in assembler. The ULP can be programmed in the Arduino IDE. The ULP can keep track of the need to send the data once every 15 minutes, separately from the touch sensor. The ULP can set a RTC_FAST memory location that can pass the message to the ESP main processor its time to send the thing and then wake the main core up to do the thing.

See the ESP32API for more information.