From 695b776493d70202dc1564de8b9b822906bbd4a4 Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 4 Jul 2022 22:42:04 +0200 Subject: [PATCH 1/4] add Pololu TB9051FTG --- MotorDrivers.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MotorDrivers.h b/MotorDrivers.h index b2b798d..d2dc027 100644 --- a/MotorDrivers.h +++ b/MotorDrivers.h @@ -65,6 +65,13 @@ // new MotorDriver(2, 8, UNUSED_PIN, -10, A1, 18, 3000, 12) // See Pololu dial_mc33926_shield_schematic.pdf and truth table on page 17 of the MC33926 data sheet. +// Pololu Dual TB9051FTG Motor Shield +// This is the shield without modifications which means +// no HA waveform and no RailCom on an Arduino Mega 2560 +#define POLOLU_TB9051FTG F("POLOLU_TB9051FTG"), \ + new MotorDriver(2, 7, UNUSED_PIN, -9, A0, 10, 2500, 6), \ + new MotorDriver(4, 8, UNUSED_PIN, -10, A1, 10, 2500, 12) + // Firebox Mk1 #define FIREBOX_MK1 F("FIREBOX_MK1"), \ new MotorDriver(3, 6, 7, UNUSED_PIN, A5, 9.766, 5500, UNUSED_PIN), \ From 0406ca69cfeeeac0e07b32b6400d8ba5afcea5fe Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 4 Jul 2022 22:50:19 +0200 Subject: [PATCH 2/4] add comment Pololu TB9051FTG --- config.example.h | 1 + 1 file changed, 1 insertion(+) diff --git a/config.example.h b/config.example.h index 3dac207..d6d60dc 100644 --- a/config.example.h +++ b/config.example.h @@ -37,6 +37,7 @@ The configuration file for DCC-EX Command Station // // STANDARD_MOTOR_SHIELD : Arduino Motor shield Rev3 based on the L298 with 18V 2A per channel // POLOLU_MOTOR_SHIELD : Pololu MC33926 Motor Driver (not recommended for prog track) +// POLOLU_TB9051FTG : Pololu Dual TB9051FTG Motor Driver // FUNDUMOTO_SHIELD : Fundumoto Shield, no current sensing (not recommended, no short protection) // FIREBOX_MK1 : The Firebox MK1 // FIREBOX_MK1S : The Firebox MK1S From 6687c6f46d59eb5989c237ba7cae5706df342c9e Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Mon, 4 Jul 2022 23:15:02 +0200 Subject: [PATCH 3/4] when brake pin has inverted sense, honor that when running in DC mode as well --- MotorDriver.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 9aadbe6..0c6cef1 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -179,6 +179,8 @@ void MotorDriver::setDCSignal(byte speedcode) { if (tSpeed <= 1) brake = 255; else if (tSpeed >= 127) brake = 0; else brake = 2 * (128-tSpeed); + if (invertBrake) + brake=255-brake; analogWrite(brakePin,brake); // as the port registers can be shadowed to get syncronized DCC signals // we need to take care of that and we have to turn off interrupts during From 5cef1ac864d72e915b963f2163bf7feba582e00f Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 5 Jul 2022 15:09:32 +0200 Subject: [PATCH 4/4] answer always with hearbeat number --- WiThrottle.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/WiThrottle.cpp b/WiThrottle.cpp index 5a835ce..66463de 100644 --- a/WiThrottle.cpp +++ b/WiThrottle.cpp @@ -211,9 +211,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) { } break; case 'N': // Heartbeat (2), only send if connection completed by 'HU' message - if (initSent) { - StringFormatter::send(stream, F("*%d\n"),HEARTBEAT_SECONDS); // return timeout value - } + StringFormatter::send(stream, F("*%d\n"), initSent ? HEARTBEAT_SECONDS : 1); // return timeout value break; case 'M': // multithrottle multithrottle(stream, cmd);