mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
ONBUTTON/ONSENSOR use latch
This commit is contained in:
parent
7dafe0383d
commit
ebe8f62cf0
|
@ -253,11 +253,13 @@ if (compileFeatures & FEATURE_SIGNAL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case OPCODE_ONSENSOR:
|
case OPCODE_ONSENSOR:
|
||||||
|
if (compileFeatures & FEATURE_SENSOR)
|
||||||
new EXRAILSensor(operand,progCounter+3,true );
|
new EXRAILSensor(operand,progCounter+3,true );
|
||||||
break;
|
break;
|
||||||
case OPCODE_ONBUTTON:
|
case OPCODE_ONBUTTON:
|
||||||
|
if (compileFeatures & FEATURE_SENSOR)
|
||||||
new EXRAILSensor(operand,progCounter+3,false );
|
new EXRAILSensor(operand,progCounter+3,false );
|
||||||
break;
|
break;
|
||||||
case OPCODE_TURNOUT: {
|
case OPCODE_TURNOUT: {
|
||||||
VPIN id=operand;
|
VPIN id=operand;
|
||||||
int addr=getOperand(progCounter,1);
|
int addr=getOperand(progCounter,1);
|
||||||
|
@ -487,7 +489,8 @@ bool RMFT2::skipIfBlock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RMFT2::loop() {
|
void RMFT2::loop() {
|
||||||
EXRAILSensor::checkAll();
|
if (compileFeatures & FEATURE_SENSOR)
|
||||||
|
EXRAILSensor::checkAll();
|
||||||
|
|
||||||
// Round Robin call to a RMFT task each time
|
// Round Robin call to a RMFT task each time
|
||||||
if (loopTask==NULL) return;
|
if (loopTask==NULL) return;
|
||||||
|
|
|
@ -115,6 +115,7 @@ enum BlinkState: byte {
|
||||||
static const byte FEATURE_ROUTESTATE= 0x10;
|
static const byte FEATURE_ROUTESTATE= 0x10;
|
||||||
static const byte FEATURE_STASH = 0x08;
|
static const byte FEATURE_STASH = 0x08;
|
||||||
static const byte FEATURE_BLINK = 0x04;
|
static const byte FEATURE_BLINK = 0x04;
|
||||||
|
static const byte FEATURE_SENSOR = 0x02;
|
||||||
|
|
||||||
|
|
||||||
// Flag bits for status of hardware and TPL
|
// Flag bits for status of hardware and TPL
|
||||||
|
@ -185,6 +186,7 @@ class LookList {
|
||||||
static const FSH * getTurntableDescription(int16_t id);
|
static const FSH * getTurntableDescription(int16_t id);
|
||||||
static const FSH * getTurntablePositionDescription(int16_t turntableId, uint8_t positionId);
|
static const FSH * getTurntablePositionDescription(int16_t turntableId, uint8_t positionId);
|
||||||
static void startNonRecursiveTask(const FSH* reason, int16_t id,int pc);
|
static void startNonRecursiveTask(const FSH* reason, int16_t id,int pc);
|
||||||
|
static bool readSensor(uint16_t sensorId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
||||||
|
@ -208,7 +210,6 @@ private:
|
||||||
static RMFT2 * pausingTask;
|
static RMFT2 * pausingTask;
|
||||||
void delayMe(long millisecs);
|
void delayMe(long millisecs);
|
||||||
void driveLoco(byte speedo);
|
void driveLoco(byte speedo);
|
||||||
bool readSensor(uint16_t sensorId);
|
|
||||||
bool skipIfBlock();
|
bool skipIfBlock();
|
||||||
bool readLoco();
|
bool readLoco();
|
||||||
void loop2();
|
void loop2();
|
||||||
|
|
|
@ -210,6 +210,10 @@ bool exrailHalSetup() {
|
||||||
#define STASH(id) | FEATURE_STASH
|
#define STASH(id) | FEATURE_STASH
|
||||||
#undef BLINK
|
#undef BLINK
|
||||||
#define BLINK(vpin,onDuty,offDuty) | FEATURE_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
|
const byte RMFT2::compileFeatures = 0
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
|
|
|
@ -59,7 +59,7 @@ void EXRAILSensor::checkAll() {
|
||||||
|
|
||||||
bool EXRAILSensor::check() {
|
bool EXRAILSensor::check() {
|
||||||
// check for debounced change in this sensor
|
// check for debounced change in this sensor
|
||||||
inputState = IODevice::read(pin);
|
inputState = RMFT2::readSensor(pin);
|
||||||
|
|
||||||
// Check if changed since last time, and process changes.
|
// Check if changed since last time, and process changes.
|
||||||
if (inputState == active) {// no change
|
if (inputState == active) {// no change
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#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:
|
// 5.2.49 - EXRAIL additions:
|
||||||
// ONBUTTON, ONSENSOR
|
// ONBUTTON, ONSENSOR
|
||||||
// 5.2.48 - Bugfix: HALDisplay was generating I2C traffic prior to I2C being initialised
|
// 5.2.48 - Bugfix: HALDisplay was generating I2C traffic prior to I2C being initialised
|
||||||
|
|
Loading…
Reference in New Issue
Block a user