30
30
#include < esp32-hal.h>
31
31
#if __has_include("qrcode.h")
32
32
#include " qrcode.h"
33
- #include " qrcodegen.h"
34
33
#endif
35
34
36
35
#include < nvs_flash.h>
@@ -183,60 +182,6 @@ bool WiFiProvClass::disableAutoStop(uint32_t cleanup_delay) {
183
182
184
183
// Copied from IDF example
185
184
186
- #if __has_include("qrcode.h")
187
- static const char *lt[] = {
188
- /* 0 */ " " ,
189
- /* 1 */ " \u2580 " ,
190
- /* 2 */ " \u2580 " ,
191
- /* 3 */ " \u2580\u2580 " ,
192
- /* 4 */ " \u2584 " ,
193
- /* 5 */ " \u2588 " ,
194
- /* 6 */ " \u2584\u2580 " ,
195
- /* 7 */ " \u2588\u2580 " ,
196
- /* 8 */ " \u2584 " ,
197
- /* 9 */ " \u2580\u2584 " ,
198
- /* 10 */ " \u2588 " ,
199
- /* 11 */ " \u2580\u2588 " ,
200
- /* 12 */ " \u2584\u2584 " ,
201
- /* 13 */ " \u2588\u2584 " ,
202
- /* 14 */ " \u2584\u2588 " ,
203
- /* 15 */ " \u2588\u2588 " ,
204
- };
205
-
206
- static Print *qr_out = NULL ;
207
-
208
- static void _qrcode_print_console (esp_qrcode_handle_t qrcode) {
209
- int size = qrcodegen_getSize (qrcode);
210
- int border = 2 ;
211
- unsigned char num = 0 ;
212
-
213
- if (qr_out == NULL ) {
214
- return ;
215
- }
216
-
217
- for (int y = -border; y < size + border; y += 2 ) {
218
- for (int x = -border; x < size + border; x += 2 ) {
219
- num = 0 ;
220
- if (qrcodegen_getModule (qrcode, x, y)) {
221
- num |= 1 << 0 ;
222
- }
223
- if ((x < size + border) && qrcodegen_getModule (qrcode, x + 1 , y)) {
224
- num |= 1 << 1 ;
225
- }
226
- if ((y < size + border) && qrcodegen_getModule (qrcode, x, y + 1 )) {
227
- num |= 1 << 2 ;
228
- }
229
- if ((x < size + border) && (y < size + border) && qrcodegen_getModule (qrcode, x + 1 , y + 1 )) {
230
- num |= 1 << 3 ;
231
- }
232
- qr_out->print (lt[num]);
233
- }
234
- qr_out->print (" \n " );
235
- }
236
- qr_out->print (" \n " );
237
- }
238
- #endif
239
-
240
185
void WiFiProvClass::printQR (const char *name, const char *pop, const char *transport, Print &out) {
241
186
if (!name || !transport) {
242
187
log_w (" Cannot generate QR code payload. Data missing." );
@@ -261,11 +206,8 @@ void WiFiProvClass::printQR(const char *name, const char *pop, const char *trans
261
206
#if __has_include("qrcode.h")
262
207
if (out) {
263
208
esp_qrcode_config_t cfg = ESP_QRCODE_CONFIG_DEFAULT ();
264
- cfg.display_func = _qrcode_print_console;
265
209
out.printf (" Scan this QR code from the provisioning application for Provisioning.\n " );
266
- qr_out = &out;
267
210
esp_qrcode_generate (&cfg, payload);
268
- qr_out = NULL ;
269
211
out.printf (" If QR code is not visible, copy paste the below URL in a browser.\n %s?data=%s\n " , " https://rainmaker.espressif.com/qrcode.html" , payload);
270
212
}
271
213
#else
0 commit comments