🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Core 2 wakeup from touch?

    Core 2
    3
    8
    5.4k
    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.
    • D
      digs71
      last edited by

      Hello,
      is there a way to make the M5Core2 wake up from sleeping modes by touching the screen?
      I'm aware of the "esp_sleep_enable_touchpad_wakeup();" function, but I just can't get it to do what it is supposed to. Using "touchAttachInterrupt(G27, callback, Threshold);" does not help. Furthermore, except for G27, all other pins I tried to tie to this function (0,2,4,12-15,27,32,33) lead to permanent reboot cycles. With G27, at least this issue did not occur.
      Your response is highly appreciated,
      digs

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @digs71

        esp_sleep_enable_touchpad_wakeup(); is meant for when some of the ESP32 GPIOs are used as capacitive touch pads. They are completely different form the M5Core2 touch screen.

        Have a look at this example which puts ESP32 into light sleep which then can be woken by touching the screen.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • D
          digs71
          last edited by

          hi @felmue,

          thanks a lot for the fast reply. i'll try your proposed solution asap. seems i've missed out on this basic solution, although i did quite some search before and never stumbled across such a piece of code. however, i'll get back to you.

          have a good day, digs

          1 Reply Last reply Reply Quote 0
          • D
            digs71
            last edited by

            hi @felmue,

            meanwhile I tested your proposed solution. Unfortunately, it just lead to a continuous reboot cycle without any sleep state ever reached :-((
            Substituting "deep_sleep" for "light_sleep" did not change anything.

            Grepping in my Arduino libraries i found "gpio_wakeup_enable" and "esp_sleep_enable_gpio_wakeup" to be declared in various header files under
            ~/.arduino15/packages/esp32/hardware/esp32/2.0.5/...
            ~/.arduino15/staging/packages/2.0.4/...
            ~/.arduino15/packages/m5stack/hardware/esp32/2.0.4
            but not under ~/Arduino/libraries/M5Core2....

            The CST_INT definition was found under ~/Arduino/libraries/M5Core2...
            whereas GPIO_INTR_LOW_LEVEL again only in the ~/.arduino15 branch

            Is the multitude of declarations under .arduino15 or the absence from the M5Core2 libraries a potential explanation for failure? Could it be, that your solution works fine with one of the ESP32 development boards but not with the M5Core2?

            Appreciating your response.
            Best, digs

            1 Reply Last reply Reply Quote 0
            • felmueF
              felmue
              last edited by felmue

              Hello @digs71

              esp_sleep_enable_gpio_wakeup can only be used for light sleep but not for deep sleep. See ESP32 sleep modes.

              If you want to use deep sleep check out this example.

              Please also check out this article about different sleep modes.

              The sleep functions are not M5Core2 specific. They are functions of the ESP32 so it should work on all devices using ESP32. It is normal for them to be found in esp32 related libraries, but not in the M5Core2 library.

              Both my sleep examples have been tested on an M5Core2 (under ESP32 Arduino framework 2.0.4 and 2.0.5), so I am stumped as to why it fails for you.

              Could you please post the debug log - hopefully this will shed some light on the reason for the reboot.

              Thanks
              Felix

              GPIO translation table M5Stack / M5Core2
              Information about various M5Stack products.
              Code examples

              1 Reply Last reply Reply Quote 1
              • D
                digs71
                last edited by

                Hi @felmue,

                after your reply (thanxxxs!) I tested again. And this time it worked :-))) I must have messed up your original example code 'til the failure point with my supplements. This time I sticked rigoroulsy to your formulation. Success!

                Regarding your literature hints: Thanks again. I had gone through relevant randomnerd tutorials before. That's how "esp_sleep_enable_touchpad_wakeup()" came to my mind... a dead end road as I learned from your remarks. The Espressif sleep docu I have yet to read.

                Best,
                digs

                ajb2k3A 1 Reply Last reply Reply Quote 0
                • felmueF
                  felmue
                  last edited by

                  Hello @digs71

                  I am glad to hear you got it sorted out. Thank you for reporting back.

                  Thanks
                  Felix

                  GPIO translation table M5Stack / M5Core2
                  Information about various M5Stack products.
                  Code examples

                  1 Reply Last reply Reply Quote 0
                  • ajb2k3A
                    ajb2k3 @digs71
                    last edited by

                    @digs71 Cool

                    UIFlow, so easy an adult can learn it!
                    If I don't know it, be patient!
                    I've ether not learned it or am too drunk to remember it!
                    Author of the WIP UIFlow Handbook!
                    M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post