From 311e31468aa251faf572ab696d15e7d2cabdbf6f Mon Sep 17 00:00:00 2001 From: GreenWizard Date: Sat, 30 Dec 2023 13:45:24 +0100 Subject: [PATCH] extracted secrets from main.cpp --- controller/tea_poor/.gitignore | 3 +++ controller/tea_poor/src/main.cpp | 10 +++++----- controller/tea_poor/src/secrets.h.example | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 controller/tea_poor/src/secrets.h.example diff --git a/controller/tea_poor/.gitignore b/controller/tea_poor/.gitignore index 89cc49c..1f7aa88 100644 --- a/controller/tea_poor/.gitignore +++ b/controller/tea_poor/.gitignore @@ -3,3 +3,6 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch + +# hide secrets +src/secrets.h \ No newline at end of file diff --git a/controller/tea_poor/src/main.cpp b/controller/tea_poor/src/main.cpp index adfa85b..b439390 100644 --- a/controller/tea_poor/src/main.cpp +++ b/controller/tea_poor/src/main.cpp @@ -3,21 +3,21 @@ #include #include #include +#include "secrets.h" #include // Setting up water pump WaterPumpScheduler waterPump( - std::make_shared(12, 9, 3) + std::make_shared( + WATER_PUMP_DIRECTION_PIN, WATER_PUMP_BRAKE_PIN, WATER_PUMP_POWER_PIN + ) ); // Just for safety reasons, we don't want to pour tea for too long // Their is no reason to make it configurable and add unnecessary complexity const int WATER_PUMP_SAFE_THRESHOLD = 10 * 1000; // setting up remote control -RemoteControl remoteControl( - "MyWiFiNetwork", // network name/SSID - "VerySecurePassword" // network password -); +RemoteControl remoteControl(WIFI_SSID, WIFI_PASSWORD); void _sendSystemStatus(std::ostream& response) { response << "{"; diff --git a/controller/tea_poor/src/secrets.h.example b/controller/tea_poor/src/secrets.h.example new file mode 100644 index 0000000..84d12c9 --- /dev/null +++ b/controller/tea_poor/src/secrets.h.example @@ -0,0 +1,14 @@ +// contains user specific information that should not be shared +#ifndef SECRETS_H +#define SECRETS_H + +// WiFi network name/SSID +const char* WIFI_SSID = "MyWiFiNetwork"; +const char* WIFI_PASSWORD = "VerySecurePassword"; + +// PINs for water pump controller +const int WATER_PUMP_DIRECTION_PIN = 12; +const int WATER_PUMP_BRAKE_PIN = 9; +const int WATER_PUMP_POWER_PIN = 3; + +#endif // SECRETS_H \ No newline at end of file