From 9020dc3af4ebfea2f56f65907726ec55f1ffeb59 Mon Sep 17 00:00:00 2001 From: Alexander Bobkov Date: Fri, 4 Jul 2025 23:58:14 -0400 Subject: [PATCH] receiver --- .../main/espnow_receiver.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ESP32-IDF_ESPNOW-Receiver/main/espnow_receiver.c b/ESP32-IDF_ESPNOW-Receiver/main/espnow_receiver.c index bad53a533..042755de3 100644 --- a/ESP32-IDF_ESPNOW-Receiver/main/espnow_receiver.c +++ b/ESP32-IDF_ESPNOW-Receiver/main/espnow_receiver.c @@ -5,7 +5,7 @@ SDK: ESP-IDF v.5.4.1 - + This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this @@ -15,4 +15,19 @@ /* This program uses ESPNOW for receiving joystick x- and y- axis values from the receiving device. -*/ \ No newline at end of file +*/ + +#include "freertos/FreeRTOS.h" +#include "nvs_flash.h" +#include "esp_err.h" + +void app_main(void) { + + // Initialize NVS + esp_err_t ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_ERROR_CHECK( nvs_flash_erase() ); + ret = nvs_flash_init(); + } + ESP_ERROR_CHECK( ret ); +} \ No newline at end of file