mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 09:36:13 +01:00
clean up diag, multiple gpio pin test worked
This commit is contained in:
parent
0fbfb5945f
commit
164e1a52f8
7
DCC.cpp
7
DCC.cpp
|
@ -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),
|
||||
MotorDriverContainer::mDC.getMotorShieldName(), F(GITHUB_SHA));
|
||||
|
||||
/*
|
||||
NOT YES, PIN CONFLICTS
|
||||
// BE AWARE, USES I2C PINS, MAY LEAD TO PIN CONFLICTS
|
||||
// Initialise HAL layer before reading EEprom.
|
||||
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
|
||||
(void)EEPROM; // tell compiler not to warn this is unused
|
||||
EEStore::init();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "DIAG.h"
|
||||
#include "DCCRMT.h"
|
||||
#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
|
||||
|
||||
|
@ -104,6 +105,14 @@ RMTChannel::RMTChannel(byte pin, byte ch, byte plen) {
|
|||
// 2 mem block of 64 RMT items should be enough
|
||||
|
||||
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
|
||||
ESP_ERROR_CHECK(rmt_driver_install(config.channel, 0, ESP_INTR_FLAG_LOWMED|ESP_INTR_FLAG_SHARED));
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ class DCCTrack {
|
|||
DCCTrack(DCCWaveform *w);
|
||||
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
|
||||
void schedulePacket(dccPacket packet);
|
||||
inline void addDriver(MotorDriver *m) { mD.push_back(m);
|
||||
DIAG(F("Track: mDType=%d count=%d"),m->type(), mD.size());
|
||||
inline void addDriver(MotorDriver *m) {
|
||||
mD.push_back(m);
|
||||
};
|
||||
static DCCTrack mainTrack;
|
||||
static DCCTrack progTrack;
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define GITHUB_SHA "ESP32-motordriver-2021122-23:21"
|
||||
#define GITHUB_SHA "ESP32-motordriver-2021129-00:12"
|
||||
|
|
|
@ -140,7 +140,6 @@ public:
|
|||
static MotorDriverContainer mDC;
|
||||
inline void add(MotorDriver *m) {
|
||||
mD.push_back(m);
|
||||
DIAG(F("Container: mDType=%d count=%d"),m->type(), mD.size());
|
||||
};
|
||||
// void SetCapability(byte n, byte cap, char [] name);
|
||||
inline FSH *getMotorShieldName() { return shieldName; };
|
||||
|
@ -150,7 +149,7 @@ public:
|
|||
return;
|
||||
}
|
||||
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() {
|
||||
std::vector<MotorDriver *> v = getDriverType(TIMER_MAIN);
|
||||
|
|
|
@ -45,9 +45,12 @@ The configuration file for DCC-EX Command Station
|
|||
|
||||
// https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
|
||||
// 4 high at boot
|
||||
#define ESP8266_MOTOR_SHIELD F("ESP8266"), \
|
||||
new MotorDriver(D3, D5, UNUSED_PIN, UNUSED_PIN, UNUSED_PIN, 2.99, 2000, UNUSED_PIN),\
|
||||
new MotorDriver(D2, D6, UNUSED_PIN, UNUSED_PIN, A0 , 2.99, 2000, UNUSED_PIN)
|
||||
// BUG: WE STILL NEED AT LEAST ONE TIMER_* motor shield defined, otherwise the packet scheduling does not work
|
||||
// BUG: WE DO NOT HAVE ANY RMT_PROG CAPABILITY yet.
|
||||
#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
|
||||
// ADC1 CH4 = GPIO32, ADC1 CH5 = GPIO33, ADC1 CH0 = GPIO36
|
||||
|
|
Loading…
Reference in New Issue
Block a user