mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-11 21:31:02 +01:00
make output ID two bytes
This commit is contained in:
parent
88949358b4
commit
cb64725b42
@ -579,6 +579,12 @@ bool DCCEXParser::parseZ(Print *stream, int16_t params, int16_t p[])
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 3: // <Z ID PIN INVERT>
|
case 3: // <Z ID PIN INVERT>
|
||||||
|
if (p[0] < 0)
|
||||||
|
return false;
|
||||||
|
if (p[1] > 255 || p[1] < 0)
|
||||||
|
return false;
|
||||||
|
if (!(p[2] == 0 || p[2] == 1))
|
||||||
|
return false;
|
||||||
if (!Output::create(p[0], p[1], p[2], 1))
|
if (!Output::create(p[0], p[1], p[2], 1))
|
||||||
return false;
|
return false;
|
||||||
StringFormatter::send(stream, F("<O>\n"));
|
StringFormatter::send(stream, F("<O>\n"));
|
||||||
|
@ -100,14 +100,14 @@ void Output::activate(int s){
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Output* Output::get(int n){
|
Output* Output::get(uint16_t n){
|
||||||
Output *tt;
|
Output *tt;
|
||||||
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;tt=tt->nextOutput);
|
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;tt=tt->nextOutput);
|
||||||
return(tt);
|
return(tt);
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool Output::remove(int n){
|
bool Output::remove(uint16_t n){
|
||||||
Output *tt,*pp=NULL;
|
Output *tt,*pp=NULL;
|
||||||
|
|
||||||
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;pp=tt,tt=tt->nextOutput);
|
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;pp=tt,tt=tt->nextOutput);
|
||||||
@ -160,7 +160,7 @@ void Output::store(){
|
|||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Output *Output::create(int id, int pin, int iFlag, int v){
|
Output *Output::create(uint16_t id, uint8_t pin, uint8_t iFlag, uint8_t v){
|
||||||
Output *tt;
|
Output *tt;
|
||||||
|
|
||||||
if(firstOutput==NULL){
|
if(firstOutput==NULL){
|
||||||
|
12
Outputs.h
12
Outputs.h
@ -23,25 +23,27 @@
|
|||||||
|
|
||||||
struct OutputData {
|
struct OutputData {
|
||||||
uint8_t oStatus;
|
uint8_t oStatus;
|
||||||
uint8_t id;
|
uint16_t id;
|
||||||
uint8_t pin;
|
uint8_t pin;
|
||||||
uint8_t iFlag;
|
uint8_t iFlag;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Output{
|
class Output{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void activate(int s);
|
void activate(int s);
|
||||||
static Output* get(int);
|
static Output* get(uint16_t);
|
||||||
static bool remove(int);
|
static bool remove(uint16_t);
|
||||||
static void load();
|
static void load();
|
||||||
static void store();
|
static void store();
|
||||||
static Output *create(int, int, int, int=0);
|
static Output *create(uint16_t, uint8_t, uint8_t, uint8_t=0);
|
||||||
static Output *firstOutput;
|
static Output *firstOutput;
|
||||||
struct OutputData data;
|
struct OutputData data;
|
||||||
Output *nextOutput;
|
Output *nextOutput;
|
||||||
static void printAll(Print *);
|
static void printAll(Print *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int num; // Chris has no idea what this is all about!
|
int num; // EEPROM pointer (Chris has no idea what this is all about!)
|
||||||
|
|
||||||
}; // Output
|
}; // Output
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "3.1.4"
|
#define VERSION "3.1.5"
|
||||||
|
// 3.1.5 Make output ID two bytes
|
||||||
// 3.1.4 Refactor OLED and LCD drivers and remove unused code
|
// 3.1.4 Refactor OLED and LCD drivers and remove unused code
|
||||||
// 3.1.3 Add a loop delay to give more time for sensing an Ethernet cable connection
|
// 3.1.3 Add a loop delay to give more time for sensing an Ethernet cable connection
|
||||||
// 3.1.2 Eliminate wait after write when prog is joined or prog power is off
|
// 3.1.2 Eliminate wait after write when prog is joined or prog power is off
|
||||||
|
Loading…
Reference in New Issue
Block a user