1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00
Commit Graph

42 Commits

Author SHA1 Message Date
Harald Barth
9aad2e3206 save another 2 bytes in turnouts if eeprom is disabled 2023-05-09 14:17:30 +02:00
Harald Barth
c0cb643cb5 When sending all turnouts, keep it short 2022-11-04 23:15:29 +01:00
Harald Barth
589336eac3 better bugfix for bitfield in turnout struct 2022-05-07 08:47:34 +02:00
Ash-4
a614a616fa
struct TurnoutData to enable EEPROM from v 4.0 2022-05-04 13:44:12 -05:00
Asbelos
5846e0fe23 J command parsing
JA JR JT commands parsed
EXRAIL sets hidden turnout state
HIDDEN description macro
Turnouts hidden flag bit
UNO seems OK, MEGA UNTESTED
2022-04-08 11:41:50 +01:00
Harald Barth
d45585ce3d update copyright notes 2022-01-07 02:28:35 +01:00
Asbelos
f755c291d5 Turnout typos and power broadcast 2021-12-16 12:32:14 +00:00
Asbelos
0a40ef5ceb Merge branch 'master' into Broadcast 2021-12-05 12:13:39 +00:00
Asbelos
0f36ccdc57 Broadcast changes (1) UNTESTED 2021-12-05 12:08:59 +00:00
Harald Barth
1807189183 make it possible to disable EEPROM code to save flash space 2021-11-08 02:07:21 +01:00
Neil McKechnie
e287af83ff DCC Turnouts: Store address/subaddress separately. Enable address 0.
The range of accessory decoder addresses for the <a> command is 0-511 in line with the DCC packet contents.  The turnout command previously rejected address 0; this has been changed to the same range of addresses can be used by both commands, i.e. address 0-511 and subaddress 0-3.  The linear address mapping remains so that linear address 1 is addr/subaddr 1/0; i.e. the first decoder address is not accessible by linear address.
2021-09-22 10:38:11 +01:00
Neil McKechnie
0d235b65d3 Turnouts - make code clearer.
Overlay of flags bits added in struct TurnoutData,, called flags.  This simplifies the the EEPROM update code.
2021-08-23 17:36:50 +01:00
Neil McKechnie
69c4733f2b Initialise turnouts to Closed by default
Ensure that the servo, VPIN and LCN turnouts are all initialised to closed if no initial state is provided in the create call or in EEPROM.  This applies irrespective of the RCN-213 configuration settings.
2021-08-23 15:26:23 +01:00
Neil McKechnie
f0cd96fed3 Changes associated with RCN-213 DCC Accessory Packet format 2021-08-23 12:43:14 +01:00
Neil McKechnie
fdaa7b51b9 Move Turnout code from .h to .cpp.
Move implementation of Turnout::printState from Turnouts.h to Turnouts.cpp.  No functional changes.
2021-08-22 22:30:09 +01:00
Neil McKechnie
7b47b86143 Turnouts: adjust the split of code between .h and .cpp file. No functional changes. 2021-08-22 22:25:23 +01:00
Neil McKechnie
0875d27b0a Remove 'activate' functions from turnout classes.
Remove the static 'activate' function and rename the virtual 'activate' function to 'setClosedInternal'.
2021-08-22 14:07:16 +01:00
Neil McKechnie
39a69e340e Turnout EEPROM improvements.
Ensure state is saved and restored from EEPROM as expected.
Make constructors for turnouts private.  Otherwise, a statically created turnout may be initialising itself before the underlying HAL device has been created.  By requiring the create() call be used, there is more control over the timing of the turnout object's creation.
2021-08-21 23:16:52 +01:00
Neil McKechnie
071389a04b Remove compiler warnings in Turnout.h 2021-08-21 00:34:28 +01:00
Neil McKechnie
d8366f33c8 Make <s> output turnout state rather than full turnout definition.
<s> command currently prints the current states for outputs and for sensors, but prints the full configuration of turnouts.  This change makes the turnout output consistent, i.e. just <H id state> is output for each turnout.  The <T> command still outputs the full turnout definition.
2021-08-21 00:25:00 +01:00
Neil McKechnie
133c65bc42 Report Turnout configuration in old and new formats.
JMRI currently isn't aware of the newer types of turnout in DCC++EX, so when it receives the definitions of turnouts it barfs on them.  It still knows a turnout exists, but isn't able to display its full configuration.  For DCC Accessory turnouts, the configuration message has changed so that it includes the DCC string (to distinguish them from other types of turnout).  To enable current and older versions of JMRI to continue working with DCC turnouts, CS now reports the old and new formats, i.e. <T id addr subaddr state> and <T id DCC addr subadd state>.  It currently accepts the first one and ignores the second one, but in the fullness of time it might accept the second one too.
2021-08-20 15:43:03 +01:00
Neil McKechnie
482f4b1c79 Tidy up recent changes to Turnout class. 2021-08-20 14:36:18 +01:00
Neil McKechnie
b4a3b503bc Turnout notification handling enhanced.
Ensure that the <H> message is sent on the serial USB (to JMRI) whenever the turnout is closed or thrown, even if the request didn't originate on the serial USB.
2021-08-20 00:07:50 +01:00
Neil McKechnie
7f6173825f Various corrections to Turnout code. 2021-08-19 21:43:55 +01:00
Neil McKechnie
fd36ca2b92 Restructure Turnout class.
Turnout class split into a base class for common code and specific subclasses for Servo, DCC, VPIN and LCN turnouts.
Interface further narrowed to reduce direct access to member variables.
Turnout creation command handling has been moved into the DCCEXParser class.
Turnout function and parameter names changed to make the Throw and Close functionality explicit.
Turnout commands <T id C> (close) and <T id T> (throw) added.
2021-08-19 21:22:59 +01:00
Asbelos
36f6e2f9ce Narrowing Turnout publics 2021-08-18 18:55:22 +01:00
FrightRisk
5eff4c5ee5 Squash all commits on RMFT branch to create EX-RAIL branch 2021-08-03 17:12:25 -04:00
Neil McKechnie
107e9d1d62
Fix turnout handling of EEPROM (#147)
On activation, Turnout code was saving entire EEPROM twice, even if EEPROM save was switched off with the <e> command.  It's now been changed so that only the tStatus byte is updated, and only if the turnout has previously been saved into EEPROM.
2021-05-07 00:12:33 +01:00
Fred
d7b2cf3d76
Assorted bits (#138)
* LCN

* Prevent deprecated compiler warning

* Implement huge function numbers

* new commands

<! [cab]> forget locos.
<9> ESTOP ALL.
<D RESET> reboot arduino

* Waveform accuracy msg

* Drop post-write verify

* UNUSED_PIN current measure

and callback -2 for cv actions.

* Correct diags

* ESTOP a forget loco

* ESTOP loco on forget

* Avoid compiler warning

* current sensor offset

* Restore <1 JOIN> after prog track operation

* <!> ESTOP <-> FORGET

* Auto current offset detection

* manage current offset and diagnostics

* neater msg at startup

* Add startup message to LCN master

* DCC::setJoinRelayPin

Co-authored-by: Asbelos <asbelos@btinternet.com>
2021-03-23 10:37:05 -04:00
mstevetodd
42075f838e
<T> should send turnout definitions, not just states (#110)
* use int, not byte for witSpeed

* add turnout, sensor and output states to 's'tatus message

* <T> should send turnout definitions, not just states
2021-01-04 10:57:03 -05:00
Harald Barth
75d7547f11 Turnouts stored to EEPROM without trashing other stuff 2020-10-03 14:07:25 +02:00
Asbelos
4e0c227012 Cleaning of Turnout/Output/Sensor
PLEASE BE AWARE, I have not tested Outputs or Sensors either before or after this change.
(and they were certainly wrong before!)
2020-09-06 12:44:19 +01:00
Asbelos
f7557f1436 Turn out changes for WiThrottle 2020-08-20 12:38:09 +01:00
Asbelos
9044cce2a3 Change Stream refernces to pointers
I misunderstood that references can never be changed.
2020-08-01 16:32:16 +01:00
Asbelos
575b5da606 WiThrottle turnout improvement 2020-07-23 17:34:35 +01:00
Asbelos
964f39d376 Fix hanging turnouts
Caused by tt->activate call when Turnouts was a struct not a class!
2020-07-23 12:48:38 +01:00
Asbelos
46d1f3e237 Copyrights etc 2020-07-03 17:35:02 +01:00
Asbelos
e7e4d4fbd9 Drop railcom and prepare for servo turnouts 2020-06-23 17:43:50 +01:00
Asbelos
7c68a9de70 virtual turnout activate 2020-06-22 11:58:33 +01:00
Asbelos
e0c76a9dc4 Alter Stream to Print
In prep for Wifi siolution, all output  functions changed to expect Print class instead of Stream... Can still pass Serial1 etc because Stream extends Print, but this allows for an output-only class extending Print to collect a response buffer for Wifi sending with AT commands.
2020-06-12 14:28:35 +01:00
Asbelos
7a20896c8c RTFM not the comments
Comments have a horrible habit of getting out of date.
2020-06-07 20:11:44 +01:00
Asbelos
b89c9068ff Compileable JMRIParser
Has Turnout, Output Sensor support.
Needs further cleaning and cross checking against spec.
May implement Daves Comms manager etc.
2020-06-03 14:26:49 +01:00