mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 08:06:13 +01:00
DC hooks
still requires pin jiggling
This commit is contained in:
parent
1afb4753ec
commit
74bbe595fc
2
DCC.cpp
2
DCC.cpp
|
@ -35,6 +35,7 @@
|
||||||
#include "IODevice.h"
|
#include "IODevice.h"
|
||||||
#include "EXRAIL2.h"
|
#include "EXRAIL2.h"
|
||||||
#include "CommandDistributor.h"
|
#include "CommandDistributor.h"
|
||||||
|
#include "TrackManager.h"
|
||||||
|
|
||||||
// This module is responsible for converting API calls into
|
// This module is responsible for converting API calls into
|
||||||
// messages to be sent to the waveform generator.
|
// messages to be sent to the waveform generator.
|
||||||
|
@ -78,6 +79,7 @@ void DCC::begin(const FSH * motorShieldName) {
|
||||||
void DCC::setThrottle( uint16_t cab, uint8_t tSpeed, bool tDirection) {
|
void DCC::setThrottle( uint16_t cab, uint8_t tSpeed, bool tDirection) {
|
||||||
byte speedCode = (tSpeed & 0x7F) + tDirection * 128;
|
byte speedCode = (tSpeed & 0x7F) + tDirection * 128;
|
||||||
setThrottle2(cab, speedCode);
|
setThrottle2(cab, speedCode);
|
||||||
|
TrackManager::setDCSignal(cab,speedCode); // in case this is a dcc track on this addr
|
||||||
// retain speed for loco reminders
|
// retain speed for loco reminders
|
||||||
updateLocoReminder(cab, speedCode );
|
updateLocoReminder(cab, speedCode );
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,11 @@ int MotorDriver::getCurrentRaw() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MotorDriver::setDCSignal(byte speedcode) {
|
||||||
|
// spedcxode is a dcc speed /direction
|
||||||
|
// TODO jiggle the DC speed pin PWMs
|
||||||
|
|
||||||
|
}
|
||||||
int MotorDriver::getCurrentRawInInterrupt() {
|
int MotorDriver::getCurrentRawInInterrupt() {
|
||||||
|
|
||||||
// IMPORTANT: This function must be called in Interrupt() time within the 56uS timer
|
// IMPORTANT: This function must be called in Interrupt() time within the 56uS timer
|
||||||
|
|
|
@ -54,6 +54,7 @@ class MotorDriver {
|
||||||
virtual POWERMODE getPower() { return powerMode;}
|
virtual POWERMODE getPower() { return powerMode;}
|
||||||
virtual void setSignal( bool high);
|
virtual void setSignal( bool high);
|
||||||
virtual void setBrake( bool on);
|
virtual void setBrake( bool on);
|
||||||
|
virtual void setDCSignal(byte speedByte);
|
||||||
virtual int getCurrentRaw();
|
virtual int getCurrentRaw();
|
||||||
virtual int getCurrentRawInInterrupt();
|
virtual int getCurrentRawInInterrupt();
|
||||||
virtual unsigned int raw2mA( int raw);
|
virtual unsigned int raw2mA( int raw);
|
||||||
|
|
|
@ -82,7 +82,7 @@ void TrackManager::setPROGSignal( bool on) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackManager::setDCSignal(int16_t cab, byte speedbyte) {
|
void TrackManager::setDCSignal(int16_t cab, byte speedbyte) {
|
||||||
// TODO LOOPMODE(cab,setDC(speedbyte));
|
LOOPMODE(cab,setDCSignal(speedbyte));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TrackManager::setTrackMode(byte trackToSet, int16_t modeOrAddr) {
|
bool TrackManager::setTrackMode(byte trackToSet, int16_t modeOrAddr) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user