CasaVinteUm / Cafe21

This project transforms a Philips Walita Coffee Machine (EP1220) into a smart coffee dispenser that accepts Bitcoin Lightning Network payments.
6 stars 2 forks source link

Upgrade dependency on rzeldent/esp32_smartdisplay #8

Open nGoline opened 4 days ago

nGoline commented 4 days ago

We need help upgrading rzeldent/esp32_smartdisplay version to its latest tag, currently @2.1.0.

We must upgrade all direct lgvl calls from our code, including the lv_conf.h file.

We also have to update all designs in UIDesign to use boards v2.0.0 from nGoline/squarelinestudio-boards.

Make sure that we're calling lv_tick_inc on void UIController::run() as in:

// UIController.h
class UIController
{
...
private:
    uint32_t lv_last_tick;
    ...
};
// UIController.cpp
void UIController::run()
{
    ...
    static const uint32_t PROGRESS_DURATION = 5000;

    lv_last_tick = millis();

    while (true)
    {
        ...
        // Update ticks
        auto const now = millis();
        lv_tick_inc(now - lv_last_tick);
        lv_last_tick = now;

        // Update the UI
        delayLvgl = lv_timer_handler();
        vTaskDelay(delayLvgl + 1 / portTICK_PERIOD_MS);
    }
}
andersondeoliveiramachado commented 4 days ago

I managed to compile a version for https://github.com/rzeldent/esp32-smartdisplay that uses the LVGL 9.2.2 library, basically what I did was put the lv_conf.h from the project https://github.com/rzeldent/esp32-smartdisplay-demo/blob/main/include/lv_conf.h in place of Cafe21\include\lv_conf.h and modified the image files, which I believe SquareLine Studio Boards create accordingly for LVGL 9.

When generating the qrcode ( UIController.cpp ) , a change in the format is also necessary:

From

` auto ui_qrcode = lv_qrcode_create(ui_qrCodeContainer, size ? size : QRCODE_INITIAL_SIZE, lv_color_black(), lv_color_white());

`

To

auto ui_qrcode = lv_qrcode_create(ui_qrCodeContainer); lv_qrcode_set_size(ui_qrcode, QRCODE_INITIAL_SIZE); lv_qrcode_set_dark_color(ui_qrcode, lv_color_black()); lv_qrcode_set_light_color(ui_qrcode, lv_color_white());

=============================================================

In the image files I modified it this way:

From:

const lv_img_dsc_t ui_img_check_png = { .header.always_zero = 0, .header.w = 132, .header.h = 132, .data_size = sizeof(ui_img_check_png_data), .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA, .data = ui_img_check_png_data};

For :

const lv_img_dsc_t ui_img_check_png = { .header.w = 132, .header.h = 132, .data_size = sizeof(ui_img_check_png_data), .data = ui_img_check_png_data};