Skip to content
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

Compilation fails with IDF 5.0.1 #50

Open
andrzejroszkowski opened this issue May 3, 2023 · 2 comments
Open

Compilation fails with IDF 5.0.1 #50

andrzejroszkowski opened this issue May 3, 2023 · 2 comments

Comments

@andrzejroszkowski
Copy link

andrzejroszkowski commented May 3, 2023

IDF: 5.0.1
OS: Windows 11
VS Code: 1.77.3
Espressif IDF VS Code Extension: v.1.6.1

Create sample project based on IDF C++ template (like "blink"), add "components" directory, anc checkout M5GFX and M5Unified modules, then try to use M5:

#include <cstdlib>
#include <thread>
#include "esp_log.h"
#include "gpio_cxx.hpp"
#include "M5Unified.hpp"

using namespace idf;
using namespace std;

extern "C" void app_main(void)
{
    try
    {
        GPIOInput gpio(GPIONum(26));
        gpio.set_pull_mode(GPIOPullMode::PULLUP());

        auto cfg = M5.config();
        M5.begin(cfg);
        M5.Lcd.setRotation(3);
        M5.Lcd.fillScreen(BLACK);
        M5.Lcd.setCursor(0, 0, 4);
        M5.Lcd.println("PIR TEST");

        while (true)
        {
            auto level = gpio.get_level();
            M5.Lcd.setCursor(110, 55, 6);
            M5.Lcd.println(level == GPIOLevel::HIGH ? "1":"0");
        }
    }
    catch (GPIOException &e)
    {
        printf("GPIO exception occurred: %s\n", esp_err_to_name(e.error));
        printf("stopping.\n");
    }
}

Compiler warns about deprecated API, but along those error is reported:

error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'int' [-Werror=format=]

Adding to CMakeLists.txt as a last line in M5GFX solves problem (although it may require better solution)
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-format)

Application @ https://github.com/andrzejroszkowski/m5gfx-sample

build-log.txt

@bhuvanchandra
Copy link

+1

@lovyan03
Copy link
Collaborator

Hello, @andrzejroszkowski
Thank you for pointing this out.
I will check and make adjustments...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants