mirror of
https://github.com/H3ALY/Wireless-PC-Switch.git
synced 2026-12-04 14:01:58 +00:00
Create config_validator.h
This commit is contained in:
1 parent
264c890f6a
commit
eec8f25056
1 file changed
+30
@@ -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
|
||||||
Reference in new issue
Block a user