examples/watering_demo: make demo compatible with ESP-IDF v5.x
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
set(PRIVREQ esp_timer)
|
||||
|
||||
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
|
||||
set(PRIVREQ esp_adc)
|
||||
list(APPEND PRIVREQ esp_adc)
|
||||
else()
|
||||
set(PRIVREQ esp_adc_cal)
|
||||
list(APPEND PRIVREQ esp_adc_cal)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS "button_adc.c" "button_gpio.c" "iot_button.c"
|
||||
|
||||
@@ -83,10 +83,11 @@ esp_err_t app_audio_beep_play_start(void)
|
||||
{
|
||||
if (NULL == audio_sem) {
|
||||
ESP_LOGE(TAG, "audio not initialized");
|
||||
return;
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
xSemaphoreGive(audio_sem);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool app_audio_beep_is_playing(void)
|
||||
|
||||
@@ -97,7 +97,7 @@ void app_pump_auto_watering(void *args)
|
||||
}
|
||||
}
|
||||
|
||||
static void pump_timer_cb(xTimerHandle tmr)
|
||||
static void pump_timer_cb(TimerHandle_t tmr)
|
||||
{
|
||||
app_pump_t *ref = (app_pump_t *) pvTimerGetTimerID(tmr);
|
||||
if (++ref->curr_watering_time < ref->max_watering_time) {
|
||||
@@ -304,4 +304,4 @@ int app_pump_set_lower_humidity(int min)
|
||||
pump_ref()->lower_humidity = min;
|
||||
app_nvs_set_lower_humidity(min);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <esp_log.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
@@ -250,7 +251,7 @@ static void rainmaker_event_handler(void *arg, esp_event_base_t event_base,
|
||||
ESP_LOGI(TAG, "MQTT Published. Msg id: %d.", *((int *)event_data));
|
||||
break;
|
||||
default:
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %d", event_id);
|
||||
ESP_LOGW(TAG, "Unhandled RainMaker Common Event: %"PRIi32"", event_id);
|
||||
}
|
||||
} else {
|
||||
ESP_LOGW(TAG, "Invalid event received!");
|
||||
|
||||
Reference in New Issue
Block a user