mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-06-29 10:35:24 +02:00
5.5.33 config_servo
This commit is contained in:
parent
36c773df7a
commit
e6c6f78bb6
@ -95,21 +95,29 @@
|
||||
#define STEALTH_GLOBAL(code...) code
|
||||
#include "myAutomation.h"
|
||||
|
||||
// Pass 1h Implements HAL macro by creating exrailHalSetup function
|
||||
// Pass 1h Implements HAL macro by creating exrailHalSetup1 function
|
||||
// Also allows creating EXTurntable object
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef HAL
|
||||
#define HAL(haltype,params...) haltype::create(params);
|
||||
#undef HAL_IGNORE_DEFAULTS
|
||||
#define HAL_IGNORE_DEFAULTS ignore_defaults=true;
|
||||
bool exrailHalSetup1() {
|
||||
bool ignore_defaults=false;
|
||||
#include "myAutomation.h"
|
||||
return ignore_defaults;
|
||||
}
|
||||
|
||||
// Pass 1s Implements servos by creating exrailHalSetup2
|
||||
// TODO Turnout and turntable creation should be moved to here instead of
|
||||
// the first pass from the opcode table.
|
||||
#include "EXRAIL2MacroReset.h"
|
||||
#undef JMRI_SENSOR
|
||||
#define JMRI_SENSOR(vpin,count...) Sensor::createMultiple(vpin,##count);
|
||||
#undef CONFIGURE_SERVO
|
||||
#define CONFIGURE_SERVO(vpin,pos1,pos2,profile) IODevice::configureServo(vpin,pos1,pos2,PCA9685::profile);
|
||||
bool exrailHalSetup() {
|
||||
bool ignore_defaults=false;
|
||||
void exrailHalSetup2() {
|
||||
#include "myAutomation.h"
|
||||
return ignore_defaults;
|
||||
}
|
||||
|
||||
// Pass 1c detect compile time featurtes
|
||||
|
62
IODevice.cpp
62
IODevice.cpp
@ -33,7 +33,9 @@
|
||||
|
||||
// Link to halSetup function. If not defined, the function reference will be NULL.
|
||||
extern __attribute__((weak)) void halSetup();
|
||||
extern __attribute__((weak)) bool exrailHalSetup();
|
||||
extern __attribute__((weak)) bool exrailHalSetup1();
|
||||
extern __attribute__((weak)) bool exrailHalSetup2();
|
||||
|
||||
|
||||
//==================================================================================================================
|
||||
// Static methods
|
||||
@ -59,32 +61,46 @@ void IODevice::begin() {
|
||||
if (halSetup)
|
||||
halSetup();
|
||||
|
||||
// include any HAL devices defined in exrail.
|
||||
// Include any HAL devices defined in exrail.
|
||||
// The first pass call only creates HAL devices,
|
||||
// the second pass will apply servo settings etc which can only be
|
||||
// done after all devices (including the defaults) are created.
|
||||
// If exrailHalSetup1 is not defined, then it will be NULL and the call
|
||||
// will be ignored.
|
||||
// If it returns true, then the default HAL devices will not be created.
|
||||
|
||||
bool ignoreDefaults=false;
|
||||
if (exrailHalSetup)
|
||||
ignoreDefaults=exrailHalSetup();
|
||||
if (ignoreDefaults) return;
|
||||
if (exrailHalSetup1)
|
||||
ignoreDefaults=exrailHalSetup1();
|
||||
|
||||
// Predefine two PCA9685 modules 0x40-0x41 if no conflicts
|
||||
// Allocates 32 pins 100-131
|
||||
const bool silent=true; // no message if these conflict
|
||||
if (checkNoOverlap(100, 16, 0x40, silent)) {
|
||||
PCA9685::create(100, 16, 0x40);
|
||||
}
|
||||
|
||||
if (checkNoOverlap(116, 16, 0x41, silent)) {
|
||||
PCA9685::create(116, 16, 0x41);
|
||||
}
|
||||
if (!ignoreDefaults) {
|
||||
|
||||
// Predefine two MCP23017 module 0x20/0x21 if no conflicts
|
||||
// Allocates 32 pins 164-195
|
||||
if (checkNoOverlap(164, 16, 0x20, silent)) {
|
||||
MCP23017::create(164, 16, 0x20);
|
||||
}
|
||||
// Predefine two PCA9685 modules 0x40-0x41 if no conflicts
|
||||
// Allocates 32 pins 100-131
|
||||
const bool silent=true; // no message if these conflict
|
||||
if (checkNoOverlap(100, 16, 0x40, silent)) {
|
||||
PCA9685::create(100, 16, 0x40);
|
||||
}
|
||||
|
||||
if (checkNoOverlap(180, 16, 0x21, silent)) {
|
||||
MCP23017::create(180, 16, 0x21);
|
||||
}
|
||||
if (checkNoOverlap(116, 16, 0x41, silent)) {
|
||||
PCA9685::create(116, 16, 0x41);
|
||||
}
|
||||
|
||||
// Predefine two MCP23017 module 0x20/0x21 if no conflicts
|
||||
// Allocates 32 pins 164-195
|
||||
if (checkNoOverlap(164, 16, 0x20, silent)) {
|
||||
MCP23017::create(164, 16, 0x20);
|
||||
}
|
||||
|
||||
if (checkNoOverlap(180, 16, 0x21, silent)) {
|
||||
MCP23017::create(180, 16, 0x21);
|
||||
}
|
||||
}
|
||||
|
||||
// apply any second pass HAL setup from EXRAIL.
|
||||
// This will typically set up servo profiles, or create turnouts.
|
||||
if (exrailHalSetup2)
|
||||
exrailHalSetup2();
|
||||
}
|
||||
|
||||
// reset() function to reinitialise all devices
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.5.32"
|
||||
#define VERSION "5.5.33"
|
||||
// 5.5.33 - Fix CONFIG_SERVO when default PCA9685 definition used.
|
||||
// 5.5.32 - Feature: Enable sniffer on CSB-1
|
||||
// 5.5.31 - <JL screen startRow> track status command
|
||||
// - myTrackStatus.example.h added
|
||||
|
Loading…
x
Reference in New Issue
Block a user