mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-31 03:13:45 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a98657fef2 | ||
|
f8fb08e331 | ||
|
50fcbc088a | ||
|
e2263b1e75 | ||
|
5eabe934b8 | ||
|
8f1ed21aa3 | ||
|
2443e5903c | ||
|
a88454dded | ||
|
c292f210a4 | ||
|
cc4de0ad14 | ||
|
1fab0f586b | ||
|
c15d5048b5 | ||
|
ec2295219d | ||
|
d3ef5f53ae | ||
|
1941402c52 | ||
|
7206e46273 | ||
|
f24bcd6819 | ||
|
cb64725b42 | ||
|
129d1c2039 | ||
|
52e8a93945 | ||
|
3fa805c0e7 | ||
|
ba8f625fb0 | ||
|
1baff001f4 |
@@ -27,7 +27,8 @@
|
||||
/*
|
||||
* © 2020,2021 Chris Harlow, Harald Barth, David Cutting,
|
||||
* Fred Decker, Gregor Baues, Anthony W - Dayton All rights reserved.
|
||||
*
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -58,15 +59,18 @@ void setup()
|
||||
// Responsibility 1: Start the usb connection for diagnostics
|
||||
// This is normally Serial but uses SerialUSB on a SAMD processor
|
||||
Serial.begin(115200);
|
||||
|
||||
|
||||
DIAG(F("License GPLv3 fsf.org (c) dcc-ex.com"));
|
||||
|
||||
CONDITIONAL_LCD_START {
|
||||
// This block is still executed for DIAGS if LCD not in use
|
||||
LCD(0,F("DCC++ EX v%S"),F(VERSION));
|
||||
LCD(1,F("Starting"));
|
||||
LCD(1,F("Lic GPLv3"));
|
||||
}
|
||||
|
||||
// Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi
|
||||
|
||||
// Responsibility 2: Start all the communications before the DCC engine
|
||||
// Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi
|
||||
// Start Ethernet if it exists
|
||||
#if WIFI_ON
|
||||
WifiInterface::setup(WIFI_SERIAL_LINK_SPEED, F(WIFI_SSID), F(WIFI_PASSWORD), F(WIFI_HOSTNAME), IP_PORT, WIFI_CHANNEL);
|
||||
#endif // WIFI_ON
|
||||
@@ -79,12 +83,9 @@ void setup()
|
||||
// Note: this provides DCC with two motor drivers, main and prog, which handle the motor shield(s)
|
||||
// Standard supported devices have pre-configured macros but custome hardware installations require
|
||||
// detailed pin mappings and may also require modified subclasses of the MotorDriver to implement specialist logic.
|
||||
|
||||
// STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h
|
||||
DCC::begin(MOTOR_SHIELD_TYPE);
|
||||
|
||||
|
||||
DCC::begin(MOTOR_SHIELD_TYPE);
|
||||
|
||||
#if defined(RMFT_ACTIVE)
|
||||
RMFT::begin();
|
||||
#endif
|
||||
|
21
DCCEX.h
21
DCCEX.h
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
* (c) 2020 Harald Barth. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This include is intended to visually simplify the .ino for the end users.
|
||||
// If there were any #ifdefs required they are much better handled in here.
|
||||
|
||||
|
@@ -578,7 +578,11 @@ bool DCCEXParser::parseZ(Print *stream, int16_t params, int16_t p[])
|
||||
}
|
||||
return true;
|
||||
|
||||
case 3: // <Z ID PIN INVERT>
|
||||
case 3: // <Z ID PIN IFLAG>
|
||||
if (p[0] < 0 ||
|
||||
p[1] > 255 || p[1] <= 1 || // Pins 0 and 1 are Serial to USB
|
||||
p[2] < 0 || p[2] > 7 )
|
||||
return false;
|
||||
if (!Output::create(p[0], p[1], p[2], 1))
|
||||
return false;
|
||||
StringFormatter::send(stream, F("<O>\n"));
|
||||
|
20
DCCTimer.h
20
DCCTimer.h
@@ -1,3 +1,23 @@
|
||||
/*
|
||||
* (c) 2021 Mike S. All rights reserved.
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DCCTimer_h
|
||||
#define DCCTimer_h
|
||||
#include "Arduino.h"
|
||||
|
@@ -156,10 +156,14 @@ void DCCWaveform::checkPowerOverload(bool ackManagerActive) {
|
||||
else
|
||||
if (power_sample_overload_wait>POWER_SAMPLE_OVERLOAD_WAIT) power_sample_overload_wait=POWER_SAMPLE_OVERLOAD_WAIT;
|
||||
} else {
|
||||
setPowerMode(POWERMODE::OVERLOAD);
|
||||
unsigned int mA=motorDriver->raw2mA(lastCurrent);
|
||||
unsigned int maxmA=motorDriver->raw2mA(tripValue);
|
||||
power_good_counter=0;
|
||||
if (power_good_counter > 0) {
|
||||
power_good_counter = 0;
|
||||
DIAG(F("*** %S TRACK POWER WARNING current=%d max=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA);
|
||||
break;
|
||||
}
|
||||
setPowerMode(POWERMODE::OVERLOAD);
|
||||
sampleDelay = power_sample_overload_wait;
|
||||
DIAG(F("*** %S TRACK POWER OVERLOAD current=%d max=%d offtime=%d ***"), isMainTrack ? F("MAIN") : F("PROG"), mA, maxmA, sampleDelay);
|
||||
if (power_sample_overload_wait >= 10000)
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include "MotorDriver.h"
|
||||
|
||||
// Wait times for power management. Unit: milliseconds
|
||||
const int POWER_SAMPLE_ON_WAIT = 100;
|
||||
const int POWER_SAMPLE_ON_WAIT = 50;
|
||||
const int POWER_SAMPLE_OFF_WAIT = 1000;
|
||||
const int POWER_SAMPLE_OVERLOAD_WAIT = 20;
|
||||
|
||||
|
25
EEStore.h
25
EEStore.h
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
* (c) 2020 Harald Barth. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef EEStore_h
|
||||
#define EEStore_h
|
||||
|
||||
@@ -14,9 +33,9 @@ extern ExternalEEPROM EEPROM;
|
||||
|
||||
struct EEStoreData{
|
||||
char id[sizeof(EESTORE_ID)];
|
||||
int nTurnouts;
|
||||
int nSensors;
|
||||
int nOutputs;
|
||||
uint16_t nTurnouts;
|
||||
uint16_t nSensors;
|
||||
uint16_t nOutputs;
|
||||
};
|
||||
|
||||
struct EEStore{
|
||||
|
18
FSH.h
18
FSH.h
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef FSH_h
|
||||
#define FSH_h
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
#define GITHUB_SHA "38be1d6"
|
||||
#define GITHUB_SHA "50fcbc0"
|
||||
|
18
LCN.h
18
LCN.h
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef LCN_h
|
||||
#define LCN_h
|
||||
#include <Arduino.h>
|
||||
|
@@ -47,7 +47,7 @@ LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t lcd_cols,
|
||||
lcdRows = lcd_rows;
|
||||
lcdCols = lcd_cols;
|
||||
|
||||
_backlightval &= ~LCD_BACKLIGHT;
|
||||
_backlightval = 0;
|
||||
|
||||
I2CManager.begin();
|
||||
I2CManager.setClock(100000L); // PCF8574 is spec'd to 100kHz.
|
||||
|
@@ -1,3 +1,24 @@
|
||||
/*
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
* (c) 2020 Harald Barth. All rights reserved.
|
||||
* (c) 2020 Anthony W - Dayton. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef MotorDrivers_h
|
||||
#define MotorDrivers_h
|
||||
#include <Arduino.h>
|
||||
|
53
Outputs.cpp
53
Outputs.cpp
@@ -100,14 +100,14 @@ void Output::activate(int s){
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Output* Output::get(int n){
|
||||
Output* Output::get(uint16_t n){
|
||||
Output *tt;
|
||||
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;tt=tt->nextOutput);
|
||||
return(tt);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool Output::remove(int n){
|
||||
bool Output::remove(uint16_t n){
|
||||
Output *tt,*pp=NULL;
|
||||
|
||||
for(tt=firstOutput;tt!=NULL && tt->data.id!=n;pp=tt,tt=tt->nextOutput);
|
||||
@@ -127,17 +127,46 @@ bool Output::remove(int n){
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Output::load(){
|
||||
struct OutputData data;
|
||||
struct BrokenOutputData bdata;
|
||||
Output *tt;
|
||||
bool isBroken=1;
|
||||
|
||||
for(int i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||
EEPROM.get(EEStore::pointer(),data);
|
||||
tt=create(data.id,data.pin,data.iFlag);
|
||||
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):data.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
||||
digitalWrite(tt->data.pin,tt->data.oStatus ^ bitRead(tt->data.iFlag,0));
|
||||
pinMode(tt->data.pin,OUTPUT);
|
||||
tt->num=EEStore::pointer();
|
||||
EEStore::advance(sizeof(tt->data));
|
||||
// This is a scary kluge. As we have two formats in EEPROM due to an
|
||||
// earlier bug, we don't know which we encounter now. So we guess
|
||||
// that if in all entries this byte has value of 7 or lower this is
|
||||
// an iFlag and thus the broken format. Otherwise it would be a pin
|
||||
// id. If someone uses only pins 0 to 7 of their arduino, they
|
||||
// loose. This is (if you look at an arduino) however unlikely.
|
||||
|
||||
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||
EEPROM.get(EEStore::pointer()+ i*sizeof(struct BrokenOutputData),bdata);
|
||||
if (bdata.iFlag > 7) { // it's a pin and not an iFlag!
|
||||
isBroken=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( isBroken ) {
|
||||
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||
EEPROM.get(EEStore::pointer(),bdata);
|
||||
tt=create(bdata.id,bdata.pin,bdata.iFlag);
|
||||
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):bdata.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
||||
digitalWrite(tt->data.pin,tt->data.oStatus ^ bitRead(tt->data.iFlag,0));
|
||||
pinMode(tt->data.pin,OUTPUT);
|
||||
tt->num=EEStore::pointer();
|
||||
EEStore::advance(sizeof(struct BrokenOutputData));
|
||||
}
|
||||
} else {
|
||||
struct OutputData data;
|
||||
|
||||
for(uint16_t i=0;i<EEStore::eeStore->data.nOutputs;i++){
|
||||
EEPROM.get(EEStore::pointer(),data);
|
||||
tt=create(data.id,data.pin,data.iFlag);
|
||||
tt->data.oStatus=bitRead(tt->data.iFlag,1)?bitRead(tt->data.iFlag,2):data.oStatus; // restore status to EEPROM value is bit 1 of iFlag=0, otherwise set to value of bit 2 of iFlag
|
||||
digitalWrite(tt->data.pin,tt->data.oStatus ^ bitRead(tt->data.iFlag,0));
|
||||
pinMode(tt->data.pin,OUTPUT);
|
||||
tt->num=EEStore::pointer();
|
||||
EEStore::advance(sizeof(struct OutputData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +189,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;
|
||||
|
||||
if(firstOutput==NULL){
|
||||
|
23
Outputs.h
23
Outputs.h
@@ -23,25 +23,34 @@
|
||||
|
||||
struct OutputData {
|
||||
uint8_t oStatus;
|
||||
uint8_t id;
|
||||
uint16_t id;
|
||||
uint8_t pin;
|
||||
uint8_t iFlag;
|
||||
};
|
||||
|
||||
struct BrokenOutputData {
|
||||
uint8_t oStatus;
|
||||
uint8_t id;
|
||||
uint8_t pin;
|
||||
uint8_t iFlag;
|
||||
};
|
||||
|
||||
class Output{
|
||||
public:
|
||||
|
||||
public:
|
||||
void activate(int s);
|
||||
static Output* get(int);
|
||||
static bool remove(int);
|
||||
static Output* get(uint16_t);
|
||||
static bool remove(uint16_t);
|
||||
static void load();
|
||||
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;
|
||||
struct OutputData data;
|
||||
Output *nextOutput;
|
||||
static void printAll(Print *);
|
||||
private:
|
||||
int num; // Chris has no idea what this is all about!
|
||||
|
||||
private:
|
||||
int num; // EEPROM pointer (Chris has no idea what this is all about!)
|
||||
|
||||
}; // Output
|
||||
|
||||
|
@@ -1,5 +1,21 @@
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*!
|
||||
* @file PWMServoDriver.cpp
|
||||
*
|
||||
@@ -16,11 +32,7 @@
|
||||
*
|
||||
* @section author Author
|
||||
* Chris Harlow (TPL)
|
||||
* original by Limor Fried/Ladyada (Adafruit Industries).
|
||||
*
|
||||
* @section license License
|
||||
*
|
||||
* BSD license, all text above must be included in any redistribution
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include "PWMServoDriver.h"
|
||||
|
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*!
|
||||
* @file PWMServoDriver.h
|
||||
*
|
||||
|
@@ -1,6 +1,8 @@
|
||||
/* Based on Arduino SSD1306Ascii Library, Copyright (C) 2015 by William Greiman
|
||||
* Modifications (C) 2021 Neil McKechnie
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This Library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
|
@@ -1,6 +1,8 @@
|
||||
/* Based on Arduino SSD1306Ascii Library, Copyright (C) 2015 by William Greiman
|
||||
* Modifications (C) 2021 Neil McKechnie
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This Library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
|
@@ -184,7 +184,7 @@ void Sensor::load(){
|
||||
struct SensorData data;
|
||||
Sensor *tt;
|
||||
|
||||
for(int i=0;i<EEStore::eeStore->data.nSensors;i++){
|
||||
for(uint16_t i=0;i<EEStore::eeStore->data.nSensors;i++){
|
||||
EEPROM.get(EEStore::pointer(),data);
|
||||
tt=create(data.snum,data.pin,data.pullUp);
|
||||
EEStore::advance(sizeof(tt->data));
|
||||
|
@@ -103,7 +103,7 @@ void Turnout::load(){
|
||||
struct TurnoutData data;
|
||||
Turnout *tt;
|
||||
|
||||
for(int i=0;i<EEStore::eeStore->data.nTurnouts;i++){
|
||||
for(uint16_t i=0;i<EEStore::eeStore->data.nTurnouts;i++){
|
||||
EEPROM.get(EEStore::pointer(),data);
|
||||
if (data.tStatus & STATUS_PWM) tt=create(data.id,data.tStatus & STATUS_PWMPIN, data.inactiveAngle,data.moveAngle);
|
||||
else tt=create(data.id,data.address,data.subAddress);
|
||||
|
@@ -140,7 +140,7 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
}
|
||||
else if (cmd[1]=='T' && cmd[2]=='A') { // PTA accessory toggle
|
||||
int id=getInt(cmd+4);
|
||||
byte newstate=2; // newstate can be 0,1 or 2. 2 is "invalid".
|
||||
bool newstate=false;
|
||||
Turnout * tt=Turnout::get(id);
|
||||
if (!tt) {
|
||||
// If turnout does not exist, create it
|
||||
@@ -150,16 +150,12 @@ void WiThrottle::parse(RingStream * stream, byte * cmdx) {
|
||||
StringFormatter::send(stream, F("HmTurnout %d created\n"),id);
|
||||
}
|
||||
switch (cmd[3]) {
|
||||
// T and C according to RCN-213 where 0 is Stop, Red, Thrown, Diverging.
|
||||
case 'T': newstate=0; break;
|
||||
case 'C': newstate=1; break;
|
||||
case '2': newstate=!Turnout::isActive(id); break;
|
||||
default : /* newstate still invalid */ break;
|
||||
case 'T': newstate=true; break;
|
||||
case 'C': newstate=false; break;
|
||||
case '2': newstate=!Turnout::isActive(id);
|
||||
}
|
||||
if (newstate != 2) {
|
||||
Turnout::activate(id,newstate);
|
||||
StringFormatter::send(stream, F("PTA%c%d\n"),newstate?'4':'2',id );
|
||||
}
|
||||
Turnout::activate(id,newstate);
|
||||
StringFormatter::send(stream, F("PTA%c%d\n"),newstate?'4':'2',id );
|
||||
}
|
||||
break;
|
||||
case 'N': // Heartbeat (2), only send if connection completed by 'HU' message
|
||||
|
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* (c) 2021 Fred Decker. All rights reserved.
|
||||
* (c) 2020 Chris Harlow. All rights reserved.
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef WifiInboundHandler_h
|
||||
#define WifiInboundHandler_h
|
||||
|
||||
|
@@ -1,7 +1,23 @@
|
||||
/**********************************************************************
|
||||
/*
|
||||
* COPYRIGHT (c) 2020 Fred Decker
|
||||
*
|
||||
* This file is part of CommandStation-EX
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* It is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
config.h
|
||||
COPYRIGHT (c) 2020 Fred Decker
|
||||
/**********************************************************************
|
||||
|
||||
The configuration file for DCC-EX Command Station
|
||||
|
||||
|
@@ -3,7 +3,10 @@
|
||||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "3.1.4"
|
||||
|
||||
#define VERSION "3.1.6"
|
||||
// 3.1.6 Make output ID two bytes and guess format/size of registered outputs found in EEPROM
|
||||
// 3.1.5 Fix LCD corruption on power-up
|
||||
// 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.2 Eliminate wait after write when prog is joined or prog power is off
|
||||
|
Reference in New Issue
Block a user