1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-22 15:46:14 +01:00

Start motordriver as soon as possible but without waveform

This commit is contained in:
Harald Barth 2023-06-22 22:57:59 +02:00
parent 0d679ad993
commit db555e8820
6 changed files with 12 additions and 11 deletions

View File

@ -77,6 +77,8 @@ void setup()
// Initialise HAL layer before reading EEprom or setting up MotorDrivers // Initialise HAL layer before reading EEprom or setting up MotorDrivers
IODevice::begin(); IODevice::begin();
// Set up MotorDrivers early to initialize all pins
TrackManager::Setup(MOTOR_SHIELD_TYPE);
DISPLAY_START ( DISPLAY_START (
// This block is still executed for DIAGS if display not in use // This block is still executed for DIAGS if display not in use
@ -104,11 +106,7 @@ void setup()
// let's make sure to initialise the ADCee class! // let's make sure to initialise the ADCee class!
ADCee::begin(); ADCee::begin();
// Responsibility 3: Start the DCC engine. // Responsibility 3: Start the DCC engine.
// Note: this provides DCC with two motor drivers, main and prog, which handle the motor shield(s) DCC::begin();
// Standard supported devices have pre-configured macros but custome hardware installations require
// detailed pin mappings and may also require modified subclasses of the MotorDriver to implement specialist logic.
// STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h
TrackManager::Setup(MOTOR_SHIELD_TYPE);
// Start RMFT aka EX-RAIL (ignored if no automnation) // Start RMFT aka EX-RAIL (ignored if no automnation)
RMFT::begin(); RMFT::begin();

View File

@ -60,8 +60,7 @@ const byte FN_GROUP_5=0x10;
FSH* DCC::shieldName=NULL; FSH* DCC::shieldName=NULL;
byte DCC::globalSpeedsteps=128; byte DCC::globalSpeedsteps=128;
void DCC::begin(const FSH * motorShieldName) { void DCC::begin() {
shieldName=(FSH *)motorShieldName;
StringFormatter::send(&USB_SERIAL,F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE), shieldName, F(GITHUB_SHA)); StringFormatter::send(&USB_SERIAL,F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE), shieldName, F(GITHUB_SHA));
#ifndef DISABLE_EEPROM #ifndef DISABLE_EEPROM
// Load stuff from EEprom // Load stuff from EEprom

5
DCC.h
View File

@ -51,7 +51,10 @@ const byte MAX_LOCOS = 30;
class DCC class DCC
{ {
public: public:
static void begin(const FSH * motorShieldName); static inline void setShieldName(const FSH * motorShieldName) {
shieldName=(FSH *)motorShieldName;
};
static void begin();
static void loop(); static void loop();
// Public DCC API functions // Public DCC API functions

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202306210849Z" #define GITHUB_SHA "devel-202306222055Z"

View File

@ -134,7 +134,7 @@ void TrackManager::Setup(const FSH * shieldname,
} }
} }
} }
DCC::begin(shieldname); DCC::setShieldName(shieldname);
} }
void TrackManager::addTrack(byte t, MotorDriver* driver) { void TrackManager::addTrack(byte t, MotorDriver* driver) {

View File

@ -4,7 +4,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "4.2.57" #define VERSION "4.2.58"
// 4.2.58 - Start motordriver as soon as possible but without waveform
// 4.2.57 - New overload handling (faster and handles commonFaultPin again) // 4.2.57 - New overload handling (faster and handles commonFaultPin again)
// - Optimize analog read STM32 // - Optimize analog read STM32
// 4.2.56 - Update IO_RotaryEncoder.h: // 4.2.56 - Update IO_RotaryEncoder.h: