1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-25 09:06:13 +01:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Harald Barth
8786285624 Assume that we have enough HW serials 2023-05-20 23:57:17 +02:00
Harald Barth
132b0773ef Fault pin handling made more straight forward 2023-05-20 23:15:15 +02:00
5 changed files with 26 additions and 13 deletions

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202305201256Z" #define GITHUB_SHA "devel-202305202114Z"

View File

@ -214,14 +214,12 @@ int MotorDriver::getCurrentRaw(bool fromISR) {
// if (fromISR == false) DIAG(F("%c: %d"), trackLetter, current); // if (fromISR == false) DIAG(F("%c: %d"), trackLetter, current);
current = current-senseOffset; // adjust with offset current = current-senseOffset; // adjust with offset
if (current<0) current=0-current; if (current<0) current=0-current;
if ((faultPin != UNUSED_PIN) && powerMode==POWERMODE::ON) { // current >= 0 here, we use negative current as fault pin flag
if (invertFault && isLOW(fastFaultPin)) if ((faultPin != UNUSED_PIN) && powerPin) {
return (current == 0 ? -1 : -current); if (invertFault ? isHIGH(fastFaultPin) : isLOW(fastFaultPin))
if (!invertFault && !isLOW(fastFaultPin))
return (current == 0 ? -1 : -current); return (current == 0 ? -1 : -current);
} }
return current; return current;
} }
#ifdef ANALOG_READ_INTERRUPT #ifdef ANALOG_READ_INTERRUPT

View File

@ -73,8 +73,8 @@
// EX 8874 based shield connected to a 3V3 system with 12-bit (4096) ADC // EX 8874 based shield connected to a 3V3 system with 12-bit (4096) ADC
#define EX8874_SHIELD F("EX8874"), \ #define EX8874_SHIELD F("EX8874"), \
new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 1.27, 5000, -A4), \ new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 1.27, 5000, A4), \
new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 1.27, 5000, -A5) new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 1.27, 5000, A5)
#elif defined(ARDUINO_ARCH_ESP32) #elif defined(ARDUINO_ARCH_ESP32)
@ -90,8 +90,8 @@
// EX 8874 based shield connected to a 3.3V system (like ESP32) and 12bit (4096) ADC // EX 8874 based shield connected to a 3.3V system (like ESP32) and 12bit (4096) ADC
// numbers are GPIO numbers. comments are UNO form factor shield pin numbers // numbers are GPIO numbers. comments are UNO form factor shield pin numbers
#define EX8874_SHIELD F("EX8874"),\ #define EX8874_SHIELD F("EX8874"),\
new MotorDriver(25/* 3*/, 19/*12*/, UNUSED_PIN, 13/*9*/, 35/*A2*/, 1.27, 5000, -36 /*-A4*/), \ new MotorDriver(25/* 3*/, 19/*12*/, UNUSED_PIN, 13/*9*/, 35/*A2*/, 1.27, 5000, 36 /*A4*/), \
new MotorDriver(23/*11*/, 18/*13*/, UNUSED_PIN, 12/*8*/, 34/*A3*/, 1.27, 5000, -39 /*-A5*/) new MotorDriver(23/*11*/, 18/*13*/, UNUSED_PIN, 12/*8*/, 34/*A3*/, 1.27, 5000, 39 /*A5*/)
#else #else
// STANDARD shield on any Arduino Uno or Mega compatible with the original specification. // STANDARD shield on any Arduino Uno or Mega compatible with the original specification.
@ -104,8 +104,8 @@
// EX 8874 based shield connected to a 5V system (like Arduino) and 10bit (1024) ADC // EX 8874 based shield connected to a 5V system (like Arduino) and 10bit (1024) ADC
#define EX8874_SHIELD F("EX8874"), \ #define EX8874_SHIELD F("EX8874"), \
new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 5.08, 5000, -A4), \ new MotorDriver( 3, 12, UNUSED_PIN, 9, A0, 5.08, 5000, A4), \
new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 5.08, 5000, -A5) new MotorDriver(11, 13, UNUSED_PIN, 8, A1, 5.08, 5000, A5)
#endif #endif

View File

@ -58,6 +58,20 @@ Stream * WifiInterface::wifiStream;
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif
// To be able to define these in platform specific
// DCCTimer<PLATFORM>.cpp files, we here make the
// assumption that these exist to link against.
// if enough serial interfaces exist.
#if NUM_SERIAL > 0
extern HardwareSerial Serial1;
#endif
#if NUM_SERIAL > 1
extern HardwareSerial Serial2;
#endif
#if NUM_SERIAL > 2
extern HardwareSerial Serial3;
#endif
bool WifiInterface::setup(long serial_link_speed, bool WifiInterface::setup(long serial_link_speed,
const FSH *wifiESSID, const FSH *wifiESSID,
const FSH *wifiPassword, const FSH *wifiPassword,

View File

@ -4,7 +4,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "4.2.52" #define VERSION "4.2.53"
// 4.2.53 - Fix: Fault pin handling made more straight forward
// 4.2.52 - Experimental support for sabertooth motor controller on ESP32 // 4.2.52 - Experimental support for sabertooth motor controller on ESP32
// 4.2.51 - Add DISABLE_PROG to disable programming to save RAM/Flash // 4.2.51 - Add DISABLE_PROG to disable programming to save RAM/Flash
// 4.2.50 - Fixes: estop all, turnout eeprom, cab ID check // 4.2.50 - Fixes: estop all, turnout eeprom, cab ID check