1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-02-17 06:29:15 +01:00

exchange pin number to track letter

This commit is contained in:
Harald Barth 2023-03-20 10:03:02 +01:00
parent 43c7baf8f5
commit 2fb485847f
3 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202303151539Z" #define GITHUB_SHA "devel-202303200902Z"

View File

@ -137,8 +137,7 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
if (currentPin==UNUSED_PIN) if (currentPin==UNUSED_PIN)
DIAG(F("** WARNING ** No current or short detection")); DIAG(F("** WARNING ** No current or short detection"));
else { else {
DIAG(F("CurrentPin=A%d, TripValue=%d"), DIAG(F("Track %c, TripValue=%d"), trackLetter, rawCurrentTripValue);
currentPin-A0, rawCurrentTripValue);
// self testing diagnostic for the non-float converters... may be removed when happy // self testing diagnostic for the non-float converters... may be removed when happy
// DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"), // DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"),
@ -163,7 +162,7 @@ void MotorDriver::setPower(POWERMODE mode) {
// when switching a track On, we need to check the crrentOffset with the pin OFF // when switching a track On, we need to check the crrentOffset with the pin OFF
if (powerMode==POWERMODE::OFF && currentPin!=UNUSED_PIN) { if (powerMode==POWERMODE::OFF && currentPin!=UNUSED_PIN) {
senseOffset = ADCee::read(currentPin); senseOffset = ADCee::read(currentPin);
DIAG(F("CurrentPin A%d sensOffset=%d"),currentPin-A0,senseOffset); DIAG(F("Track %c sensOffset=%d"),trackLetter,senseOffset);
} }
IODevice::write(powerPin,invertPower ? LOW : HIGH); IODevice::write(powerPin,invertPower ? LOW : HIGH);

View File

@ -182,11 +182,13 @@ class MotorDriver {
isProgTrack = on; isProgTrack = on;
} }
void checkPowerOverload(bool useProgLimit, byte trackno); void checkPowerOverload(bool useProgLimit, byte trackno);
void setTrackLetter(char c);
#ifdef ANALOG_READ_INTERRUPT #ifdef ANALOG_READ_INTERRUPT
bool sampleCurrentFromHW(); bool sampleCurrentFromHW();
void startCurrentFromHW(); void startCurrentFromHW();
#endif #endif
private: private:
char trackLetter = '?';
bool isProgTrack = false; // tells us if this is a prog track bool isProgTrack = false; // tells us if this is a prog track
void getFastPin(const FSH* type,int pin, bool input, FASTPIN & result); void getFastPin(const FSH* type,int pin, bool input, FASTPIN & result);
void getFastPin(const FSH* type,int pin, FASTPIN & result) { void getFastPin(const FSH* type,int pin, FASTPIN & result) {