mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Merge branch 'devel-sabertooth' into devel
This commit is contained in:
commit
3b6789ef01
|
@ -205,6 +205,39 @@ int16_t CommandDistributor::retClockTime() {
|
|||
void CommandDistributor::broadcastLoco(byte slot) {
|
||||
DCC::LOCO * sp=&DCC::speedTable[slot];
|
||||
broadcastReply(COMMAND_TYPE, F("<l %d %d %d %l>\n"), sp->loco,slot,sp->speedCode,sp->functions);
|
||||
#ifdef SABERTOOTH
|
||||
if (Serial2 && sp->loco == SABERTOOTH) {
|
||||
static uint8_t rampingmode = 0;
|
||||
bool direction = (sp->speedCode & 0x80) !=0; // true for forward
|
||||
int32_t speed = sp->speedCode & 0x7f;
|
||||
if (speed == 1) { // emergency stop
|
||||
if (rampingmode != 1) {
|
||||
rampingmode = 1;
|
||||
Serial2.print("R1: 0\r\n");
|
||||
Serial2.print("R2: 0\r\n");
|
||||
}
|
||||
Serial2.print("MD: 0\r\n");
|
||||
} else {
|
||||
if (speed != 0) {
|
||||
// speed is here 2 to 127
|
||||
speed = (speed - 1) * 1625 / 100;
|
||||
speed = speed * (direction ? 1 : -1);
|
||||
// speed is here -2047 to 2047
|
||||
}
|
||||
if (rampingmode != 2) {
|
||||
rampingmode = 2;
|
||||
Serial2.print("R1: 2047\r\n");
|
||||
Serial2.print("R2: 2047\r\n");
|
||||
}
|
||||
Serial2.print("M1: ");
|
||||
Serial2.print(speed);
|
||||
Serial2.print("\r\n");
|
||||
Serial2.print("M2: ");
|
||||
Serial2.print(speed);
|
||||
Serial2.print("\r\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef CD_HANDLE_RING
|
||||
WiThrottle::markForBroadcast(sp->loco);
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "devel-202305091210Z"
|
||||
#define GITHUB_SHA "devel-202305201256Z"
|
||||
|
|
|
@ -87,6 +87,9 @@ void SerialManager::init() {
|
|||
delay(1000);
|
||||
}
|
||||
#endif
|
||||
#ifdef SABERTOOTH
|
||||
Serial2.begin(9600, SERIAL_8N1, 16, 17); // GPIO 16 RXD2; GPIO 17 TXD2 on ESP32
|
||||
#endif
|
||||
}
|
||||
|
||||
void SerialManager::broadcast(char * stringBuffer) {
|
||||
|
|
|
@ -235,5 +235,15 @@ The configuration file for DCC-EX Command Station
|
|||
//
|
||||
//#define SERIAL_BT_COMMANDS
|
||||
|
||||
// SABERTOOTH
|
||||
//
|
||||
// This is a very special option and only useful if you happen to have a
|
||||
// sabertooth motor controller from dimension engineering configured to
|
||||
// take commands from and ESP32 via serial at 9600 baud from GPIO17 (TX)
|
||||
// and GPIO16 (RX, currently unused).
|
||||
// The number defined is the DCC address for which speed controls are sent
|
||||
// to the sabertooth controller _as_well_. Default: Undefined.
|
||||
//
|
||||
//#define SABERTOOTH 1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
#include "StringFormatter.h"
|
||||
|
||||
|
||||
#define VERSION "4.2.51"
|
||||
#define VERSION "4.2.52"
|
||||
// 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.50 - Fixes: estop all, turnout eeprom, cab ID check
|
||||
// 4.2.49 - Exrail SPEED take notice of external direction change
|
||||
|
|
Loading…
Reference in New Issue
Block a user