yoprogramo / QRcodeDisplay

ESP Generate QRCode for several displays - Base Repo
18 stars 9 forks source link

How to select QR version and/or data correction level #7

Closed migrassi closed 1 year ago

migrassi commented 2 years ago

Hola Jose Antonio (@yoprogramo). ¿Hay alguna forma de seleccionar la versión o el nivel de corrección de erores del QR generado? Probé cambiando los valores hardcodeados en frame.c (VERSION=7 y ECCLEVEL=1) pero no ha funcionado. Gracias.

yoprogramo commented 2 years ago

Hola,

Si, pero tendrías que seguir el método que indico en https://github.com/yoprogramo/QRcodeDisplay/issues/2#issuecomment-1075726406

Por cuestiones de ahorro de memoria no se incluyen más niveles en el código, estoy pensando en usar un sistema de defines para que no se compile más que el nivel que se va a utilizar cada vez, pero no he tenido tiempo de hacerlo todavía.

migrassi commented 2 years ago

Hola @yoprogramo,

Perdón por la demora en responder, pero trabajo con esto solo por las noches y, dada la diferencia horaria entre nuestros países, se produce este delay de casi 24 horas en el ida y vuelta. La solución aportada en #2 funcionó perfectamente. Mi idea era generar códigos más simples (probé con Version 3, ECL 1) para ver si mejoraba la legibilidad del QR en cámaras de móviles más antiguos o de gama baja. La mejora no es espectacular, pero si solo se necesita codificar un texto corto (una URL, por ejemplo) se gana algo en velocidad de reconocimiento.

En cuanto a agregar a la librería la capacidad de configurar ambas cosas mediante #define anidados o algo así, parece factible pero engorroso, si se quiere considerar todas las alternativas combinadas (40 versiones con 4 diferentes niveles de corrección). Teniendo en cuenta que una vez definida la versión y ECL que un proyecto necesita rara vez se cambiará y que, si en algún caso es necesario hacerlo, el proceso mediante dofbit es bastante simple, tal vez no vale mucho la pena. Ya verás tu si conviene.

Muchas gracias por la ayuda!!

tkjoko09 commented 1 year ago

Hi yoprogramo. can you help me to change the frame.c to accept Version 10? i think we need it now, I use ESP32 so it can hold more memory. BTW, i am a newbe so i cant generate it by my self. Thanks for your Attention.

yoprogramo commented 1 year ago

Hi yoprogramo. can you help me to change the frame.c to accept Version 10? i think we need it now, I use ESP32 so it can hold more memory. BTW, i am a newbe so i cant generate it by my self. Thanks for your Attention.

Hello @tkjoko09 the process is faily simple:

  1. git clone git@github.com:tz1/qrduino.git
  2. cd qrduino
  3. make dofbit
  4. execute dofbit 10 1 > frame.c

I made it for you, this is the result:

` const unsigned char neccblk1 = 2; const unsigned char neccblk2 = 2; const unsigned char datablkw = 68; const unsigned char eccblkwid = 18; const unsigned char VERSION = 10; const unsigned char ECCLEVEL = 1; const unsigned char WD = 57; const unsigned char WDB = 8; unsigned char strinbuf[456]; unsigned char qrframe[600]; unsigned char rlens[58];

ifndef AVR

define PROGMEM

define memcpy_P memcpy

define __LPM(x) *x

else

include <avr/pgmspace.h>

endif

const unsigned char framebase[] PROGMEM = { 0xfe,0x00,0x00,0x00,0x00,0x03,0x3f,0x80, 0x82,0x00,0x00,0x00,0x00,0x01,0x20,0x80, 0xba,0x00,0x00,0x00,0x00,0x03,0x2e,0x80, 0xba,0x00,0x00,0x00,0x00,0x01,0x2e,0x80, 0xba,0x00,0x00,0x3e,0x00,0x01,0x2e,0x80, 0x82,0x00,0x00,0x22,0x00,0x02,0x20,0x80, 0xfe,0xaa,0xaa,0xaa,0xaa,0xaa,0xbf,0x80, 0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x3e,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x0f,0x80,0x00,0x3e,0x00,0x00,0xf8,0x00, 0x08,0x80,0x00,0x22,0x00,0x00,0x88,0x00, 0x0a,0x80,0x00,0x2a,0x00,0x00,0xa8,0x00, 0x08,0x80,0x00,0x22,0x00,0x00,0x88,0x00, 0x0f,0x80,0x00,0x3e,0x00,0x00,0xf8,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xa6,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x02,0x00,0x00,0x3e,0x00,0x00,0xf8,0x00, 0x00,0x80,0x00,0x22,0x00,0x00,0x88,0x00, 0xfe,0x00,0x00,0x2a,0x00,0x00,0xa8,0x00, 0x82,0x00,0x00,0x22,0x00,0x00,0x88,0x00, 0xba,0x00,0x00,0x3e,0x00,0x00,0xf8,0x00, 0xba,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xba,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x82,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00, };

const unsigned char framask[] PROGMEM = { 0xff,0xff,0xff,0xff,0xff,0xf8,0x10,0x04, 0x00,0x80,0x08,0x00,0x40,0x01,0x00,0x02, 0x00,0x02,0x00,0x01,0x00,0x00,0x40,0x00, 0x08,0x00,0x00,0x80,0x00,0x04,0x00,0x00, 0x10,0x00,0x00,0x20,0x00,0x00,0x20,0x00, 0x00,0x10,0x00,0x00,0x1f,0x00,0x00,0x43, 0xe0,0x00,0x0c,0x3e,0x00,0x00,0xe1,0xf0, 0x00,0x07,0x87,0xc0,0x00,0x1f,0x02,0x00, 0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00, 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x08, 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, 0x04,0x00,0x00,0x00,0x00,0x10,0x00,0x00, 0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20, 0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, 0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x80, 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00, 0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x7f, 0x00,0x00,0x00,0x00,0x00,0xfe,0x00,0x00, 0x00,0x00,0x00,0xfe,0x00,0x00,0x3e,0x00, 0x00,0xff,0xc0,0x00,0x1f,0x00,0x00,0x7f, 0xf0,0x00,0x07,0xc0,0x00,0x1f,0xfe,0x00, 0x00,0xf8,0x00,0x03,0xff,0xe0,0x00,0x0f, 0x80,0x00,0x3f,0xff,0x00,0x00,0x00,0x00, 0x00,0x07,0xfc,0x00,0x00,0x00,0x00,0x00, 0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x0f, 0xf8,0x00,0x00,0x00,0x00,0x00,0x00, }; `

Let me know it it works for you.

tkjoko09 commented 1 year ago

Thats Great, Its Work for me with Version 10. Thanks You Very Much. Greeting from Indonesia.

tkjoko09 commented 1 year ago

Anyway, How to do This?? // Hello @tkjoko09 the process is faily simple:

git clone [git@github.com](mailto:git@github.com):tz1/qrduino.git
cd qrduino
make dofbit
execute dofbit 10 1 > frame.c

//

is it using Linux system? is linux has always including GCC compiler??

yoprogramo commented 1 year ago

Hello again,

Yes, I'm using a ubuntu 22.04 system to do it. The gcc compiler can be installed with this commands:

sudo apt update && sudo apt install build-essential

tkjoko09 commented 1 year ago

Hello again,

Yes, I'm using a ubuntu 22.04 system to do it. The gcc compiler can be installed with this commands:

sudo apt update && sudo apt install build-essential

Nice, Thanks Again. i will try on my Orange Pi Linux system also with Ubuntu.