1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

Servo Turnouts

This commit is contained in:
Asbelos
2020-06-23 20:01:43 +01:00
parent 030cb654b4
commit 1a1429bf72
7 changed files with 116 additions and 15 deletions

View File

@@ -2,6 +2,8 @@
#include "EEStore.h"
#include "StringFormatter.h"
#include "Hardware.h"
#include "PWMServoDriver.h"
bool Turnout::activate(int n,bool state){
Turnout * tt=get(n);
if (tt==NULL) return false;
@@ -14,7 +16,7 @@
void Turnout::activate(bool state) {
if (state) data.tStatus|=STATUS_ACTIVE;
else data.tStatus &= ~STATUS_ACTIVE;
if (data.tStatus & STATUS_PWM) Hardware::setServo(data.tStatus & STATUS_PWMPIN, (data.inactiveAngle+state?data.moveAngle:0));
if (data.tStatus & STATUS_PWM) PWMServoDriver::setServo(data.tStatus & STATUS_PWMPIN, (data.inactiveAngle+state?data.moveAngle:0));
else DCC::setAccessory(data.address,data.subAddress, state);
}
///////////////////////////////////////////////////////////////////////////////