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

ONBUTTON/ONSENSOR use latch

This commit is contained in:
Asbelos 2024-04-13 10:16:26 +01:00
parent 7dafe0383d
commit ebe8f62cf0
5 changed files with 16 additions and 7 deletions

View File

@ -253,11 +253,13 @@ if (compileFeatures & FEATURE_SIGNAL) {
}
case OPCODE_ONSENSOR:
if (compileFeatures & FEATURE_SENSOR)
new EXRAILSensor(operand,progCounter+3,true );
break;
break;
case OPCODE_ONBUTTON:
if (compileFeatures & FEATURE_SENSOR)
new EXRAILSensor(operand,progCounter+3,false );
break;
break;
case OPCODE_TURNOUT: {
VPIN id=operand;
int addr=getOperand(progCounter,1);
@ -487,7 +489,8 @@ bool RMFT2::skipIfBlock() {
}
void RMFT2::loop() {
EXRAILSensor::checkAll();
if (compileFeatures & FEATURE_SENSOR)
EXRAILSensor::checkAll();
// Round Robin call to a RMFT task each time
if (loopTask==NULL) return;

View File

@ -115,6 +115,7 @@ enum BlinkState: byte {
static const byte FEATURE_ROUTESTATE= 0x10;
static const byte FEATURE_STASH = 0x08;
static const byte FEATURE_BLINK = 0x04;
static const byte FEATURE_SENSOR = 0x02;
// Flag bits for status of hardware and TPL
@ -185,7 +186,8 @@ class LookList {
static const FSH * getTurntableDescription(int16_t id);
static const FSH * getTurntablePositionDescription(int16_t turntableId, uint8_t positionId);
static void startNonRecursiveTask(const FSH* reason, int16_t id,int pc);
static bool readSensor(uint16_t sensorId);
private:
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
static bool parseSlash(Print * stream, byte & paramCount, int16_t p[]) ;
@ -208,7 +210,6 @@ private:
static RMFT2 * pausingTask;
void delayMe(long millisecs);
void driveLoco(byte speedo);
bool readSensor(uint16_t sensorId);
bool skipIfBlock();
bool readLoco();
void loop2();

View File

@ -210,6 +210,10 @@ bool exrailHalSetup() {
#define STASH(id) | FEATURE_STASH
#undef BLINK
#define BLINK(vpin,onDuty,offDuty) | FEATURE_BLINK
#undef ONBUTTON
#define ONBUTTON(vpin) | FEATURE_SENSOR
#undef ONSENSOR
#define ONSENSOR(vpin) | FEATURE_SENSOR
const byte RMFT2::compileFeatures = 0
#include "myAutomation.h"

View File

@ -59,7 +59,7 @@ void EXRAILSensor::checkAll() {
bool EXRAILSensor::check() {
// check for debounced change in this sensor
inputState = IODevice::read(pin);
inputState = RMFT2::readSensor(pin);
// Check if changed since last time, and process changes.
if (inputState == active) {// no change

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h"
#define VERSION "5.2.49"
#define VERSION "5.2.50"
// 5.2.50 - EXRAIL ONBUTTON/ONSENSOR observe LATCH
// 5.2.49 - EXRAIL additions:
// ONBUTTON, ONSENSOR
// 5.2.48 - Bugfix: HALDisplay was generating I2C traffic prior to I2C being initialised