Skip to content

error: 'esp_sleep_enable_ext1_wakeup_io' was not declared in this scope #10761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
Levanterman opened this issue Dec 19, 2024 · 4 comments
Closed
1 task done
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE

Comments

@Levanterman
Copy link

Levanterman commented Dec 19, 2024

Board

TTGO LoRa32-OLED

Device Description

TTGO LoRa32-OLED , 10K pull up connected to GPIO 13 and 25, works fine in Arduino IDE but not Platform IO .

Hardware Configuration

#define WAKEUP_GPIO_13 GPIO_NUM_13
#define WAKEUP_GPIO_25 GPIO_NUM_25

Version

latest master (checkout manually)

IDE Name

VSCode Version: 1.95.3 (Universal) Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 Date: 2024-11-13T14:50:04.152Z (1 mo ago) Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Darwin arm64 24.1.0

Operating System

Mac

Flash frequency

80

PSRAM enabled

yes

Upload speed

115200

Description

I have the same problem as 9904 and 9809

I have this this example working in the Arduino IDE with TTGO LoRa32-OLED, waking up on either Pin

#define WAKEUP_GPIO_13 GPIO_NUM_13
#define WAKEUP_GPIO_25 GPIO_NUM_25

I tried to convert the project to PlatformIO but I get the error

"src/main.cpp:196:5: error: 'esp_sleep_enable_ext1_wakeup_io' was not declared in this scope"

[env:ttgo-lora32-v2]
platform = espressif32
board = ttgo-lora32-v2
framework = arduino
lib_deps = sandeepmistry/LoRa@^0.8.0
platform_packages = platformio/framework-arduinoespressif32

(PACKAGES: - framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b )

Sketch

I have 
[this](https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/ExternalWakeUp.ino)
this example working in the Arduino IDE with TTGO LoRa32-OLED, waking up on either Pin

/*
Deep Sleep with External Wake Up

This code displays how to use deep sleep with
an external trigger as a wake up source and how
to store data in RTC memory to use it over reboots

This code is under Public Domain License.

Hardware Connections

Push Button to GPIO 33 pulled down with a 10K Ohm
resistor

NOTE:

Only RTC IO can be used as a source for external wake
source. They are pins: 0,2,4,12-15,25-27,32-39.

Author:
Pranav Cherukupalli [email protected]
*/
#include "driver/rtc_io.h"

#define BUTTON_PIN_BITMASK(GPIO) (1ULL << GPIO) // 2 ^ GPIO_NUMBER in hex
#define USE_EXT0_WAKEUP 1 // 1 = EXT0 wakeup, 0 = EXT1 wakeup
#define WAKEUP_GPIO GPIO_NUM_33 // Only RTC IO are allowed - ESP32 Pin example
RTC_DATA_ATTR int bootCount = 0;

/*
Method to print the reason by which ESP32
has been awaken from sleep
*/
void print_wakeup_reason() {
esp_sleep_wakeup_cause_t wakeup_reason;

wakeup_reason = esp_sleep_get_wakeup_cause();

switch (wakeup_reason) {
case ESP_SLEEP_WAKEUP_EXT0: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1: Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER: Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD: Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP: Serial.println("Wakeup caused by ULP program"); break;
default: Serial.printf("Wakeup was not caused by deep sleep: %d\n", wakeup_reason); break;
}
}

void setup() {
Serial.begin(115200);
delay(1000); //Take some time to open up the Serial Monitor

//Increment boot number and print it every reboot
++bootCount;
Serial.println("Boot number: " + String(bootCount));

//Print the wakeup reason for ESP32
print_wakeup_reason();

/*
First we configure the wake up source
We set our ESP32 to wake up for an external trigger.
There are two types for ESP32, ext0 and ext1 .
ext0 uses RTC_IO to wakeup thus requires RTC peripherals
to be on while ext1 uses RTC Controller so does not need
peripherals to be powered on.
Note that using internal pullups/pulldowns also requires
RTC peripherals to be turned on.
*/
#if USE_EXT0_WAKEUP
esp_sleep_enable_ext0_wakeup(WAKEUP_GPIO, 1); //1 = High, 0 = Low
// Configure pullup/downs via RTCIO to tie wakeup pins to inactive level during deepsleep.
// EXT0 resides in the same power domain (RTC_PERIPH) as the RTC IO pullup/downs.
// No need to keep that power domain explicitly, unlike EXT1.
rtc_gpio_pullup_dis(WAKEUP_GPIO);
rtc_gpio_pulldown_en(WAKEUP_GPIO);

#else // EXT1 WAKEUP
//If you were to use ext1, you would use it like
esp_sleep_enable_ext1_wakeup_io(BUTTON_PIN_BITMASK(WAKEUP_GPIO), ESP_EXT1_WAKEUP_ANY_HIGH);
/*
If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
during deepsleep. However, RTC IO relies on the RTC_PERIPH power domain. Keeping this power domain on will
increase some power consumption. However, if we turn off the RTC_PERIPH domain or if certain chips lack the RTC_PERIPH
domain, we will use the HOLD feature to maintain the pull-up and pull-down on the pins during sleep.
*/
rtc_gpio_pulldown_en(WAKEUP_GPIO); // GPIO33 is tie to GND in order to wake up in HIGH
rtc_gpio_pullup_dis(WAKEUP_GPIO); // Disable PULL_UP in order to allow it to wakeup on HIGH
#endif
//Go to sleep now
Serial.println("Going to sleep now");
esp_deep_sleep_start();
Serial.println("This will never be printed");
}

void loop() {
//This is not going to be called
}

Debug Message

src/main.cpp: In function 'void setup()':
src/main.cpp:196:5: error: 'esp_sleep_enable_ext1_wakeup_io' was not declared in this scope
     esp_sleep_enable_ext1_wakeup_io(bitmask, ESP_EXT1_WAKEUP_ANY_HIGH);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.cpp:196:5: note: suggested alternative: 'esp_sleep_enable_ext1_wakeup'
     esp_sleep_enable_ext1_wakeup_io(bitmask, ESP_EXT1_WAKEUP_ANY_HIGH);

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Levanterman Levanterman added the Status: Awaiting triage Issue is waiting for triage label Dec 19, 2024
@lbernstone
Copy link
Contributor

platformio is using version 2.0.17 (framework-arduinoespressif32 @ 3.20017.241212 <- the second set of numbers in there)
You can use the community version to run arduino-esp32 v3.X

@Levanterman
Copy link
Author

platformio is using version 2.0.17 (framework-arduinoespressif32 @ 3.20017.241212 <- the second set of numbers in there) You can use the community version to run arduino-esp32 v3.X

AH thank you , I will try this later and see if that fixes it.

@Jason2866
Copy link
Collaborator

With pioarduino (Platformio community fork) Arduino espressif32 core 3.1.0 can be used with

platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.10/platform-espressif32.zip

@Jason2866 Jason2866 added IDE: PlaformIO Issue relates to PlatformIO IDE and removed Status: Awaiting triage Issue is waiting for triage labels Dec 20, 2024
@Levanterman
Copy link
Author

@lbernstone lbernstone / @Jason2866 Thank you both, this worked ! Very happy, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE
Projects
None yet
Development

No branches or pull requests

3 participants