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

Reduce RAM usage #11

Open
pierluigizagaria opened this issue Apr 24, 2024 · 4 comments
Open

Reduce RAM usage #11

pierluigizagaria opened this issue Apr 24, 2024 · 4 comments

Comments

@pierluigizagaria
Copy link

pierluigizagaria commented Apr 24, 2024

Thank you for providing this lib to the community.
I'm trying to use this library into a RC remote controller that uses lua script.
It complains for the RAM usage.

Is there any way to reduce RAM usage?

@pgundlach
Copy link
Member

I have no idea how to reduce RAM usage. I use this library on a laptop with plenty RAM so I have never had the need to look at that.

@pierluigizagaria
Copy link
Author

The big arrays are the one that occupies ram.
Could you simplify the qr code generation by removing advanced options? Or maybe by removing the big declared tables?

@pgundlach
Copy link
Member

How much size do the arrays take? I assume that the cclxvi table takes up most space and can be calculated on the fly. The other tables? I am not really sure how to calculate those.

@alufers
Copy link

alufers commented May 28, 2024

FYI: I've done the optimization and created an EdgeTX script based on this lib: https://github.com/alufers/edgetx-gps-qrcode

Here are is the outline of the modifications I had to make to make it run on the STM32 embedded in my radio: https://github.com/alufers/edgetx-gps-qrcode/blob/master/gps_qr.src.lua#L9

TL;DR: I had to remove almost everything not used for generating a binary QR code with the L error correction, and code-golf it to minimize the RAM usage. Additionally I run the script through a minifier.

The modifications remove useful features, so I would not want to contribute them here.

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