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

clean up diag, multiple gpio pin test worked

This commit is contained in:
Harald Barth 2021-11-29 00:14:24 +01:00
parent 0fbfb5945f
commit 164e1a52f8
6 changed files with 22 additions and 12 deletions

View File

@ -56,13 +56,12 @@ void DCC::begin() {
StringFormatter::send(Serial,F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE), StringFormatter::send(Serial,F("<iDCC-EX V-%S / %S / %S G-%S>\n"), F(VERSION), F(ARDUINO_TYPE),
MotorDriverContainer::mDC.getMotorShieldName(), F(GITHUB_SHA)); MotorDriverContainer::mDC.getMotorShieldName(), F(GITHUB_SHA));
/* // BE AWARE, USES I2C PINS, MAY LEAD TO PIN CONFLICTS
NOT YES, PIN CONFLICTS
// Initialise HAL layer before reading EEprom. // Initialise HAL layer before reading EEprom.
IODevice::begin(); IODevice::begin();
*/
//MotorDriverContainer::mDC.add(new MotorDriver(16, 21, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 2.00, 2000, UNUSED_PIN, RMT_MAIN));
//example how to use add:
//MotorDriverContainer::mDC.add(new MotorDriver(16, 21, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 2.00, 2000, UNUSED_PIN, RMT_MAIN));
// Load stuff from EEprom // Load stuff from EEprom
(void)EEPROM; // tell compiler not to warn this is unused (void)EEPROM; // tell compiler not to warn this is unused
EEStore::init(); EEStore::init();

View File

@ -23,6 +23,7 @@
#include "DIAG.h" #include "DIAG.h"
#include "DCCRMT.h" #include "DCCRMT.h"
#include "DCCWaveform.h" // for MAX_PACKET_SIZE #include "DCCWaveform.h" // for MAX_PACKET_SIZE
#include "soc/gpio_sig_map.h"
#define DATA_LEN(X) ((X)*9+1) // Each byte has one bit extra and we have one EOF marker #define DATA_LEN(X) ((X)*9+1) // Each byte has one bit extra and we have one EOF marker
@ -104,6 +105,14 @@ RMTChannel::RMTChannel(byte pin, byte ch, byte plen) {
// 2 mem block of 64 RMT items should be enough // 2 mem block of 64 RMT items should be enough
ESP_ERROR_CHECK(rmt_config(&config)); ESP_ERROR_CHECK(rmt_config(&config));
/*
// test: config another gpio pin
gpio_num_t gpioNum = (gpio_num_t)(pin-1);
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpioNum], PIN_FUNC_GPIO);
gpio_set_direction(gpioNum, GPIO_MODE_OUTPUT);
gpio_matrix_out(gpioNum, RMT_SIG_OUT0_IDX, 0, 0);
*/
// NOTE: ESP_INTR_FLAG_IRAM is *NOT* included in this bitmask // NOTE: ESP_INTR_FLAG_IRAM is *NOT* included in this bitmask
ESP_ERROR_CHECK(rmt_driver_install(config.channel, 0, ESP_INTR_FLAG_LOWMED|ESP_INTR_FLAG_SHARED)); ESP_ERROR_CHECK(rmt_driver_install(config.channel, 0, ESP_INTR_FLAG_LOWMED|ESP_INTR_FLAG_SHARED));

View File

@ -10,8 +10,8 @@ class DCCTrack {
DCCTrack(DCCWaveform *w); DCCTrack(DCCWaveform *w);
void schedulePacket(const byte buffer[], byte byteCount, byte repeats); void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
void schedulePacket(dccPacket packet); void schedulePacket(dccPacket packet);
inline void addDriver(MotorDriver *m) { mD.push_back(m); inline void addDriver(MotorDriver *m) {
DIAG(F("Track: mDType=%d count=%d"),m->type(), mD.size()); mD.push_back(m);
}; };
static DCCTrack mainTrack; static DCCTrack mainTrack;
static DCCTrack progTrack; static DCCTrack progTrack;

View File

@ -1 +1 @@
#define GITHUB_SHA "ESP32-motordriver-2021122-23:21" #define GITHUB_SHA "ESP32-motordriver-2021129-00:12"

View File

@ -140,7 +140,6 @@ public:
static MotorDriverContainer mDC; static MotorDriverContainer mDC;
inline void add(MotorDriver *m) { inline void add(MotorDriver *m) {
mD.push_back(m); mD.push_back(m);
DIAG(F("Container: mDType=%d count=%d"),m->type(), mD.size());
}; };
// void SetCapability(byte n, byte cap, char [] name); // void SetCapability(byte n, byte cap, char [] name);
inline FSH *getMotorShieldName() { return shieldName; }; inline FSH *getMotorShieldName() { return shieldName; };
@ -150,7 +149,7 @@ public:
return; return;
} }
for(const auto& d: mD) for(const auto& d: mD)
DIAG(F("Container: mDType=%d count=%d"),d->type(), mD.size()); DIAG(F("Container: mDType=%d"),d->type());
}; };
inline MotorDriver *mainTrack() { inline MotorDriver *mainTrack() {
std::vector<MotorDriver *> v = getDriverType(TIMER_MAIN); std::vector<MotorDriver *> v = getDriverType(TIMER_MAIN);

View File

@ -45,9 +45,12 @@ The configuration file for DCC-EX Command Station
// https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ // https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
// 4 high at boot // 4 high at boot
#define ESP8266_MOTOR_SHIELD F("ESP8266"), \ // BUG: WE STILL NEED AT LEAST ONE TIMER_* motor shield defined, otherwise the packet scheduling does not work
new MotorDriver(D3, D5, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 2.99, 2000, UNUSED_PIN),\ // BUG: WE DO NOT HAVE ANY RMT_PROG CAPABILITY yet.
new MotorDriver(D2, D6, UNUSED_PIN, UNUSED_PIN, A0 , 2.99, 2000, UNUSED_PIN) #define ESP32_MOTOR_SHIELD F("ESP32"), \
NULL /*new MotorDriver(16, 17, UNUSED_PIN, UNUSED_PIN, 36, 2.00, 2000, UNUSED_PIN, TIMER_MAIN)*/, \
new MotorDriver(18, 19, UNUSED_PIN, UNUSED_PIN, 39, 2.00, 2000, UNUSED_PIN, TIMER_PROG), \
new MotorDriver(16, 23, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 2.00, 2000, UNUSED_PIN, RMT_MAIN)
// ESP32 ADC1 only supported GPIO pins 32 to 39, for example // ESP32 ADC1 only supported GPIO pins 32 to 39, for example
// ADC1 CH4 = GPIO32, ADC1 CH5 = GPIO33, ADC1 CH0 = GPIO36 // ADC1 CH4 = GPIO32, ADC1 CH5 = GPIO33, ADC1 CH0 = GPIO36