Gitshaoxiang / M5Dial-Gui-Demo

18 stars 2 forks source link

Missing M5Unified #1

Closed GermanSheepDog closed 5 months ago

GermanSheepDog commented 1 year ago

Hello,

if I installed a new ESP-IDF 5.x and compiled the program with idf.py, then a library is missing:

app_main.cpp:3:10: fatal error: M5Unified.h: No such file or directory
     3 | #include <M5Unified.h>

How can I easily integrate the library into ESP-IDF?

Fredde87 commented 11 months ago

Hi @GermanSheepDog,

Not sure about you, but I am new to using ESP-IDF and only used Arduino IDE before...

But I ran into the same issue. I got passed it by first git cloning the dependencies into the components folder.

cd components git clone https://github.com/m5stack/M5Unified git clone https://github.com/m5stack/M5GFX

then I edited the CMakeLists.txt file and added this,

set(EXTRA_COMPONENT_DIRS "components")

However, you'll most likely run into the same error I did after that, which was that this code does not support ESP-IDF 5.x (to be fair it does say 4.4 in the Readme but its not clear that it doesnt support newer versions).

So I gave up at this point and installed VSCode with the ESP-ISF extension. It was much easier. If you go down this route then follow these rough descriptions,

Stwissel commented 10 months ago

Tried that, but failed:

~/M5Dial-Gui-Demo/components/M5Unified/src/utility/Power_Class.cpp: In member function 'void m5::Power_Class::_powerOff(bool)':
/Users/stw/Code/M5Dial-Gui-Demo/components/M5Unified/src/utility/Power_Class.cpp:588:21: error: 'esp_sleep_enable_ext0_wakeup' was not declared in this scope
       if (ESP_OK != esp_sleep_enable_ext0_wakeup( pin, false))
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/M5Dial-Gui-Demo/components/M5Unified/src/utility/Power_Class.cpp:588:21: note: suggested alternative: 'esp_sleep_enable_wifi_wakeup'
       if (ESP_OK != esp_sleep_enable_ext0_wakeup( pin, false))
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     esp_sleep_enable_wifi_wakeup
[1216/1597] Building CXX object esp-idf/M5Unified/CMakeFiles/__idf_M5Unified.dir/src/utility/Speaker_Class.cpp.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

Might need an older build?

Gitshaoxiang commented 10 months ago

hello, make sure you are using the ESP-IDF v4.4. other version maybe with some API compatible issues. also before compile the project need to pull the submodule:

git submodule init
git submodule update