Create config_validator.h

This commit is contained in:
Ross 'H3ALY' Healy authored and GitHub committed 2024-10-19 21:08:28 +01:00
1 parent 264c890f6a
commit eec8f25056
1 file changed
+30
+30
View File
@@ -0,0 +1,30 @@
#ifndef CONFIG_VALIDATOR_H
#define CONFIG_VALIDATOR_H
#include <Arduino.h>
#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