From eec8f2505629a57a4f8232842348932a0eb748e0 Mon Sep 17 00:00:00 2001 From: Ross 'H3ALY' Healy Date: Sat, 19 Oct 2024 21:08:28 +0100 Subject: [PATCH] Create config_validator.h --- src/core/config_validator.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/core/config_validator.h diff --git a/src/core/config_validator.h b/src/core/config_validator.h new file mode 100644 index 0000000..7dda549 --- /dev/null +++ b/src/core/config_validator.h @@ -0,0 +1,30 @@ +#ifndef CONFIG_VALIDATOR_H +#define CONFIG_VALIDATOR_H + +#include +#include "config.h" + +bool validate_config() { + bool valid = true; + + if (strcmp(ssid, "YOUR_WIRELESS_SSID") == 0 || strcmp(password, "YOUR_WIRELESS_PASSWORD") == 0) { + Serial.println("Error: Wi-Fi settings are not properly configured."); + valid = false; + } + + if (strcmp(mqtt_server, "YOUR_MQTT_SERVER_ADDRESS") == 0 || + strcmp(mqtt_user, "YOUR_MQTT_USERNAME") == 0 || + strcmp(mqtt_pass, "YOUR_MQTT_PASSWORD") == 0 || + strcmp(mqtt_client_name, "YOUR_MQTT_CLIENT_NAME") == 0) { + Serial.println("Error: MQTT settings are not properly configured."); + valid = false; + } + + if (enable_ota && strcmp(ota_hostname, "YOUR_OTA_HOSTNAME") == 0) { + Serial.println("Warning: OTA is enabled but the hostname is not properly configured."); + } + + return valid; +} + +#endif