added nvs config library

This commit is contained in:
CommanderRedYT
2021-12-29 05:41:53 +01:00
parent 16b81ee300
commit 3f0baddcb1

View File

@@ -36,9 +36,6 @@ namespace {
extern "C" void onReceive(const uint8_t *mac_addr, const uint8_t *data, int len) extern "C" void onReceive(const uint8_t *mac_addr, const uint8_t *data, int len)
{ {
ESP_LOGI(TAG, "Received data"); ESP_LOGI(TAG, "Received data");
const std::string token = "Bobbycar_123";
const std::string id = "Buero";
const std::string message(data, data + len); const std::string message(data, data + len);
//Serial.printf("Received: %s\n", message.c_str()); //Serial.printf("Received: %s\n", message.c_str());
@@ -65,12 +62,12 @@ extern "C" void onReceive(const uint8_t *mac_addr, const uint8_t *data, int len)
return; return;
} }
if (msg_token != std::string(token.c_str())) { if (msg_token != stringSettings.esp_now_door_token) {
//Serial.println("Invalid token"); //Serial.println("Invalid token");
return; return;
} }
if (msg_type == "BOBBYOPEN" && msg_value == std::string(id.c_str())) { if (msg_type == "BOBBYOPEN" && msg_value == stringSettings.esp_now_door_id) {
//Serial.println("Bob is opening the door"); //Serial.println("Bob is opening the door");
digitalWrite(PIN_RELAY, HIGH); digitalWrite(PIN_RELAY, HIGH);
ledtimer = espchrono::millis_clock::now(); ledtimer = espchrono::millis_clock::now();