Coder Social home page Coder Social logo

lv_lib_qrcode's Issues

maybe older code style in function `lv_qrcode_create`

In lv_qrcode.c, function lv_qrcode_create calls LV_IMG_BUF_SIZE_INDEXED_1BIT and LV_ASSERT_MEM,however, I could not find the declarations or definitions in master lvgl respo.

lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color)
{
    uint32_t buf_size = LV_IMG_BUF_SIZE_INDEXED_1BIT(size, size);
    uint8_t * buf = lv_mem_alloc(buf_size);
    LV_ASSERT_MEM(buf);

So, I replace them with LV_CANVAS_BUF_SIZE_INDEXED_1BIT and lv_mem_assert, is that right?

lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color)
{
   uint32_t buf_size = LV_CANVAS_BUF_SIZE_INDEXED_1BIT(size, size);
   uint8_t * buf = lv_mem_alloc(buf_size);
   lv_mem_assert(buf);

Error building

I'm unable to build my firmware when adding the QR Code Lib, using the example code provided.
I get the following error:

src/lv_lib_qrcode/lv_qrcode.c:52:4: error: implicit declaration of function 'lv_mem_assert' [-Werror=implicit-function-declaration]
lv_mem_assert(buf);
^

I'm using lvl 6.1.2, and embedding the code within mongoose-os.

Lack of a user defined margin

Lack of a user defined colour pad

This bug report refers to the lack of a user defined colour pad, the empty area around a QR code.

Colour padding

Machine reading improves when codes have a large padded area around them, in the same colour as the very thin margin as defined in existing sources.

int margin = (obj_w - scaled) / 2;

Suggestion

To introduce a user defined padded area, a parameter could be added wherever graphic size is referenced (in buffers, allocation, and construction.)

Pull request pending

I've solved this problem and will submit a pull request called Colourpad Addition 1A.

No image displayed when testing

Hello,
I am trying to test the library as suggested by the example, but it only shows "NO DATA" in my display. My hardware is a 128x64 dot monochrome, and its working fine with others objects (images and labels). Are the instructions "lv_qrcode_create" and "lv_qrcode_update" all that is needed to display the QR Code?

Stack Overflow

I experimented with this library on an ESP32. I think it has 8K bytes of stack.
lv_qrcode_update starts by allocating two arrays (qr0 and data_tmp), each about 4K bytes, and this causes a stack overflow on the ESP32. (It did work on my Windows simultator, so I had a clue..)
data_tmp holds a copy of the data to convert into a QRcode. This is typically a URL, and they are never 4K long.
So I changed it to 128 bytes, then it worked fine on the ESP32
In fact, I think, it is not needed to make a local copy of the to-be-encoded data.

If you decide to fix this, maybe it is worthwhile adding this to the widgets. It took me quite a while to add it there and get everything properly compiling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.