Skip to content

Commit

Permalink
extracted secrets from main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenWizard2015 committed Dec 30, 2023
1 parent 63bee21 commit 311e314
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions controller/tea_poor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

# hide secrets
src/secrets.h
10 changes: 5 additions & 5 deletions controller/tea_poor/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
#include <WaterPumpController.h>
#include <WaterPumpScheduler.h>
#include <RemoteControl.h>
#include "secrets.h"

#include <sstream>
// Setting up water pump
WaterPumpScheduler waterPump(
std::make_shared<WaterPumpController>(12, 9, 3)
std::make_shared<WaterPumpController>(
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 << "{";
Expand Down
14 changes: 14 additions & 0 deletions controller/tea_poor/src/secrets.h.example
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 311e314

Please sign in to comment.