Skip to content

Commit 86a311f

Browse files
committed
fix(prov): revert custom QR print implementation
1 parent 89ef364 commit 86a311f

File tree

2 files changed

+0
-64
lines changed

2 files changed

+0
-64
lines changed

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,6 @@ if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThre
304304
endif()
305305
endif()
306306

307-
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_WiFiProv OR CONFIG_ARDUINO_SELECTIVE_RainMaker)
308-
if(NOT IDF_TARGET STREQUAL "esp32c2")
309-
list(APPEND requires espressif__qrcode)
310-
endif()
311-
endif()
312-
313307
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
314308

315309
if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}")

libraries/WiFiProv/src/WiFiProv.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <esp32-hal.h>
3131
#if __has_include("qrcode.h")
3232
#include "qrcode.h"
33-
#include "qrcodegen.h"
3433
#endif
3534

3635
#include <nvs_flash.h>
@@ -183,60 +182,6 @@ bool WiFiProvClass::disableAutoStop(uint32_t cleanup_delay) {
183182

184183
// Copied from IDF example
185184

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-
240185
void WiFiProvClass::printQR(const char *name, const char *pop, const char *transport, Print &out) {
241186
if (!name || !transport) {
242187
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
261206
#if __has_include("qrcode.h")
262207
if (out) {
263208
esp_qrcode_config_t cfg = ESP_QRCODE_CONFIG_DEFAULT();
264-
cfg.display_func = _qrcode_print_console;
265209
out.printf("Scan this QR code from the provisioning application for Provisioning.\n");
266-
qr_out = &out;
267210
esp_qrcode_generate(&cfg, payload);
268-
qr_out = NULL;
269211
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);
270212
}
271213
#else

0 commit comments

Comments
 (0)