Initialisation depot
This commit is contained in:
28
ESP32/DCC-Bench/src/RelayController.cpp
Normal file
28
ESP32/DCC-Bench/src/RelayController.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @file RelayController.cpp
|
||||
* @brief Implementation of relay controller for track configuration switching
|
||||
*
|
||||
* @author Locomotive Test Bench Project
|
||||
* @date 2025
|
||||
*/
|
||||
|
||||
#include "RelayController.h"
|
||||
|
||||
RelayController::RelayController() : is3Rail(false) {
|
||||
}
|
||||
|
||||
void RelayController::begin() {
|
||||
pinMode(RELAY_PIN, OUTPUT);
|
||||
digitalWrite(RELAY_PIN, LOW); // Start in 2-rail mode
|
||||
is3Rail = false;
|
||||
|
||||
Serial.println("Relay Controller initialized - 2-rail mode");
|
||||
}
|
||||
|
||||
void RelayController::setRailMode(bool mode3Rail) {
|
||||
is3Rail = mode3Rail;
|
||||
digitalWrite(RELAY_PIN, is3Rail ? HIGH : LOW);
|
||||
|
||||
Serial.print("Rail mode changed to: ");
|
||||
Serial.println(is3Rail ? "3-rail" : "2-rail");
|
||||
}
|
||||
Reference in New Issue
Block a user