1 Commits

Author SHA1 Message Date
eeeck b0059f6e9f Move user configuration to config.h 2025-12-09 00:24:36 +01:00
2 changed files with 13 additions and 5 deletions
@@ -1,8 +1,10 @@
#ifndef WIFI_CREDENTIALS_H
#define WIFI_CREDENTIALS_H
#ifndef CONFIG_H
#define CONFIG_H
#define SSID "your_wifi_ssid"
#define PASSWORD "your_wifi_password"
#define AUTH_MODE WIFI_AUTH_WPA2_PSK
#define MQTT_ADDR "mqtt://yourmqttserver"
#define MQTT_PORT 1883
#endif
+9 -3
View File
@@ -6,7 +6,7 @@
#include "esp_log.h"
#include "nvs_flash.h"
#include "main.hpp"
#include "wifi-credentials.h"
#include "config.h"
#define WIFI_TIMEOUT_TICKS pdMS_TO_TICKS(8000)
@@ -83,10 +83,16 @@ void wifiTask(void *pvParameters) {
ESP_ERROR_CHECK(esp_task_wdt_add(NULL));
for(;;) {
EventBits_t bits = xEventGroupWaitBits(wifi_event_group, WIFI_CONNECTED_BIT, pdFALSE, pdTRUE, WIFI_TIMEOUT_TICKS);
wifi_ap_record_t ap;
if (esp_wifi_sta_get_ap_info(&ap) == ESP_OK) {
ESP_LOGV(TAG, "RSSI: %d", ap.rssi);
}
//TODO: manage data send rate if with slow network
// or just let mqtt know (useful for making a notice on home manager)
ESP_ERROR_CHECK(esp_task_wdt_reset());
ESP_LOGI(TAG, "Wi-Fi task reset");
vTaskDelay(pdMS_TO_TICKS(4000));
vTaskDelay(pdMS_TO_TICKS(WIFI_TIMEOUT_TICKS));
}
}