From 1e2ee3710443c11ac2210a200e3e6e33506fdd52 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 9 Nov 2023 18:08:39 -0300 Subject: [PATCH] Fixes Rainmaker to be a Managed Component (#8842) * Uses IDF Managed Components This changes is targeted to be used within Arduino Lib Builder and with projects that use Arduino as IDF Component. * Fixes RainMaker QR code Fixes RainMaker in order to use it as Managed Component and with the latest RainMaker release. * Removes Camera Component * SR Component only needed for the S3 --- CMakeLists.txt | 12 ------------ idf_component.yml | 11 +++++++++++ libraries/RainMaker/src/RMakerQR.cpp | 6 ++++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36adeb619e9..2517f490010 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,21 +254,9 @@ function(maybe_add_component component_name) endif() endfunction() -maybe_add_component(esp-dsp) - -if(CONFIG_ESP_INSIGHTS_ENABLED) - maybe_add_component(esp_insights) -endif() -if(CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK) - maybe_add_component(esp_rainmaker) - maybe_add_component(qrcode) -endif() if(IDF_TARGET MATCHES "esp32s2|esp32s3" AND CONFIG_TINYUSB_ENABLED) maybe_add_component(arduino_tinyusb) endif() if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ArduinoOTA) maybe_add_component(esp_https_ota) endif() -if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_LITTLEFS) - maybe_add_component(esp_littlefs) -endif() diff --git a/idf_component.yml b/idf_component.yml index c19e8ec8a93..9f6f9123f25 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -27,3 +27,14 @@ dependencies: idf: ">=5.1" mdns: "^1.1.0" chmorgan/esp-libhelix-mp3: "1.0.3" + esp-dsp: "^1.3.4" + espressif/esp_rainmaker: "^1.0.0" + espressif/rmaker_common: "^1.4.3" + espressif/esp_insights: "^1.0.1" + espressif/qrcode: "^0.1.0~1" + joltwallet/littlefs: "^1.10.2" + espressif/esp-sr: + version: "^1.4.2" + rules: + - if: "target in [esp32s3]" + diff --git a/libraries/RainMaker/src/RMakerQR.cpp b/libraries/RainMaker/src/RMakerQR.cpp index 7f94f70383f..903332f4b0f 100644 --- a/libraries/RainMaker/src/RMakerQR.cpp +++ b/libraries/RainMaker/src/RMakerQR.cpp @@ -6,14 +6,16 @@ void printQR(const char *name, const char *pop, const char *transport) log_w("Cannot generate QR code payload. Data missing."); return; } - char payload[150]; + char payload[150] = {0}; snprintf(payload, sizeof(payload), "{\"ver\":\"%s\",\"name\":\"%s\"" \ ",\"pop\":\"%s\",\"transport\":\"%s\"}", PROV_QR_VERSION, name, pop, transport); if(Serial){ Serial.printf("Scan this QR code from the ESP RainMaker phone app.\n"); } - qrcode_display(payload); + //qrcode_display(payload); // deprecated! + esp_qrcode_config_t cfg = ESP_QRCODE_CONFIG_DEFAULT(); + esp_qrcode_generate(&cfg, payload); if(Serial){ Serial.printf("If QR code is not visible, copy paste the below URL in a browser.\n%s?data=%s\n", QRCODE_BASE_URL, payload); }