Merge branch 'fix/remove_deprecated_sntp_api' into 'master'

fix: build errors on idf 5.1

See merge request app-frameworks/esp-rainmaker!358
This commit is contained in:
Piyush Shah
2023-03-23 18:18:01 +08:00
4 changed files with 18 additions and 3 deletions

View File

@@ -88,6 +88,13 @@ build_idf_v5.0:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio"
build_idf_v5.1:
extends: .build_template
image: espressif/idf:release-v5.1
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio"
build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env

View File

@@ -14,8 +14,6 @@
#include <string.h>
#include <esp_log.h>
#include <nvs.h>
#include <lwip/apps/sntp.h>
#include <esp_rmaker_standard_types.h>
#include <esp_rmaker_standard_services.h>
#include <esp_rmaker_utils.h>

View File

@@ -7,7 +7,8 @@
#include <sdkconfig.h>
#include <esp_log.h>
#include <esp_err.h>
#include <stdbool.h>
static const char *TAG = "esp_rmaker_mqtt_budget";
#ifdef CONFIG_ESP_RMAKER_MQTT_ENABLE_BUDGETING

View File

@@ -508,12 +508,21 @@ esp_schedule_handle_t esp_schedule_create(esp_schedule_config_t *schedule_config
esp_schedule_handle_t *esp_schedule_init(bool enable_nvs, char *nvs_partition, uint8_t *schedule_count)
{
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
if (!esp_sntp_enabled()) {
ESP_LOGI(TAG, "Initializing SNTP");
esp_sntp_setoperatingmode(SNTP_OPMODE_POLL);
esp_sntp_setservername(0, "pool.ntp.org");
esp_sntp_init();
}
#else
if (!sntp_enabled()) {
ESP_LOGI(TAG, "Initializing SNTP");
sntp_setoperatingmode(SNTP_OPMODE_POLL);
sntp_setservername(0, "pool.ntp.org");
sntp_init();
}
#endif
if (!enable_nvs) {
return NULL;