1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 09:36:13 +01:00

JMRI_SENSOR exrail

This commit is contained in:
Asbelos 2024-02-07 22:11:27 +00:00
parent 4931c5ed75
commit 8293749ac7
5 changed files with 15 additions and 1 deletions

View File

@ -84,6 +84,7 @@
#undef IFTTPOSITION
#undef IFRE
#undef INVERT_DIRECTION
#undef JMRI_SENSOR
#undef JOIN
#undef KILLALL
#undef LATCH
@ -236,6 +237,7 @@
#define IFTTPOSITION(turntable_id,position)
#define IFRE(sensor_id,value)
#define INVERT_DIRECTION
#define JMRI_SENSOR(vpin,count...)
#define JOIN
#define KILLALL
#define LATCH(sensor_id)

View File

@ -149,6 +149,8 @@ static_assert(!hasdup(compileTimeSequenceList[0],1),"Duplicate SEQUENCE/ROUTE/AU
#define HAL(haltype,params...) haltype::create(params);
#undef HAL_IGNORE_DEFAULTS
#define HAL_IGNORE_DEFAULTS ignore_defaults=true;
#undef JMRI_SENSOR
#define JMRI_SENSOR(vpin,count...) Sensor::createMultiple(vpin,##count);
bool exrailHalSetup() {
bool ignore_defaults=false;
#include "myAutomation.h"
@ -487,6 +489,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#endif
#define IFRE(sensor_id,value) OPCODE_IFRE,V(sensor_id),OPCODE_PAD,V(value),
#define INVERT_DIRECTION OPCODE_INVERT_DIRECTION,0,0,
#define JMRI_SENSOR(vpin,count...)
#define JOIN OPCODE_JOIN,0,0,
#define KILLALL OPCODE_KILLALL,0,0,
#define LATCH(sensor_id) OPCODE_LATCH,V(sensor_id),

View File

@ -230,6 +230,13 @@ Sensor *Sensor::create(int snum, VPIN pin, int pullUp){
return tt;
}
// Creet multiple eponymous sensors based on vpin alone.
void Sensor::createMultiple(VPIN firstPin, byte count) {
for (byte i=0;i<count;i++) {
create(firstPin+i,firstPin+i,1);
}
}
///////////////////////////////////////////////////////////////////////////////
// Object method to directly change the input state, for sensors such as LCN which are updated
// by means other than by polling an input.

View File

@ -76,6 +76,7 @@ public:
static void store();
#endif
static Sensor *create(int id, VPIN vpin, int pullUp);
static void createMultiple(VPIN firstPin, byte count=1);
static Sensor* get(int id);
static bool remove(int id);
static void checkAll();

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h"
#define VERSION "5.2.30"
#define VERSION "5.2.31"
// 5.2.31 - Exrail JMRI_SENSORS(vpin [,count]) creates <S> types.
// 5.2.40 - Bugfix: WiThrottle sendIntro after initial N message as well
// 5.2.29 - Added IO_I2CDFPlayer.h to support DFPLayer over I2C connected to NXP SC16IS750/SC16IS752 (currently only single UART for SC16IS752)
// - Added enhanced IO_I2CDFPLayer enum commands to EXRAIL2.h