1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00
still requires pin jiggling
This commit is contained in:
Asbelos 2022-02-23 16:21:45 +00:00
parent 1afb4753ec
commit 74bbe595fc
4 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include "IODevice.h"
#include "EXRAIL2.h"
#include "CommandDistributor.h"
#include "TrackManager.h"
// This module is responsible for converting API calls into
// 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) {
byte speedCode = (tSpeed & 0x7F) + tDirection * 128;
setThrottle2(cab, speedCode);
TrackManager::setDCSignal(cab,speedCode); // in case this is a dcc track on this addr
// retain speed for loco reminders
updateLocoReminder(cab, speedCode );
}

View File

@ -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() {
// IMPORTANT: This function must be called in Interrupt() time within the 56uS timer

View File

@ -54,6 +54,7 @@ class MotorDriver {
virtual POWERMODE getPower() { return powerMode;}
virtual void setSignal( bool high);
virtual void setBrake( bool on);
virtual void setDCSignal(byte speedByte);
virtual int getCurrentRaw();
virtual int getCurrentRawInInterrupt();
virtual unsigned int raw2mA( int raw);

View File

@ -82,7 +82,7 @@ void TrackManager::setPROGSignal( bool on) {
}
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) {