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

1178 Commits

Author SHA1 Message Date
Neil McKechnie
00138be90d Increase default display line length to 20 (from 16). 2021-08-22 22:39:00 +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
3e50a6bdad Add include guard to defines.h
Ensure that defines.h is only process once, even if included multiple times.
2021-08-22 22:23:08 +01:00
Asbelos
240b18a0df Merge branch 'EX-RAIL-neil2' into EX-RAIL 2021-08-22 19:36:08 +01:00
Asbelos
b35ce88fdd Deeay long values 2021-08-22 17:01:55 +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
dbabfdca80 Improvements to PCA9685 operation
Rationalise duplicated code;  improve initialisation;
2021-08-21 23:13:34 +01:00
Asbelos
60718f5eac int->int16_t to keep pedantic compilers happy 2021-08-21 13:17:14 +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
Asbelos
ddcd40860f UNTESTED Allow ALIAS of ROUTE/AUTOMATION id
Runs ALIAS on first pass and creates a routine to emit the route stuff to withrottle because previous technique wouldnt compile for aliased ids.
2021-08-20 19:18:30 +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
Neil McKechnie
776a098a72 Bump EESTORE_ID version.
TurnoutData struct size has been reduced by one byte during rewrite of Turnout class.  Consequently, this renders any previous turnout definitions in EEPROM incompatible with the new format.  For safety, the version is increased so that incompatible EEPROM contents are discarded.
2021-08-19 20:17:48 +01:00
Asbelos
36f6e2f9ce Narrowing Turnout publics 2021-08-18 18:55:22 +01:00
Neil McKechnie
9dacd24d27
Various HAL enhancements. (#182)
* Add <D SERVO vpin position> command

Allow a PWM servo to be driven to any arbitrary position.

* Enhancements for HAL drivers

Add state change notification for external GPIO module drivers;
Allow drivers to be installed statically by declaration (as an alternative to the 'create' call).

* Create IO_HCSR04.h

HAL driver for HC-SR04 ultrasonic distance sensor (sonar).

* Enable servo commands in NO-HAL mode, but return error.

Avoid compile errors in RMFT.cpp when compiled with basic HAL by including the Turnout::createServo function as a stub that returns NULL.

* Update IO_HCSR04.h

Minor changes

* Change <D SERVO>

Give the <D SERVO> command an optional parameter of the profile.  For example, <D SERVO 100 200 3> will slowly move the servo on pin 100 to PWM position corresponding to 200.  If omitted, the servo will move immediately (no animation).

* IODevice (HAL) changes

1) Put new devices on the end of the chain instead of the beginning.  This will give better performance for devices created first (ArduinoPins and extender GPIO devices, typically).
2) Remove unused functions.

* Update IO_HCSR04.h

Allow thresholds for ON and OFF to be separately configured at creation.

* Update IODevice.cpp

Fix compile error on IO_NO_HAL minimal HAL version.

* Update IO_PCA9685.cpp

Remove unnecessary duplicated call to min() function.
2021-08-17 23:41:34 +01:00
Asbelos
552e1bf3d8 Merge remote-tracking branch 'origin/RCN-213' into EX-RAIL 2021-08-17 19:48:06 +01:00
Asbelos
edefd638f1 Handoff immediately after acquire 2021-08-17 18:32:11 +01:00
Asbelos
71486beb16 Stop loco on DONE/KILL 2021-08-16 22:27:50 +01:00
Asbelos
d8f23c58da SENDLOCO/START bug 2021-08-16 16:30:30 +01:00
Asbelos
7227a0696e task Id and KILL
Also fixes a long standing flags bug  no idea where that line went!
2021-08-15 23:15:02 +01:00
Asbelos
3a6e41ac49 Ptevent accidental broadcast throttles 2021-08-15 20:38:55 +01:00
Asbelos
1e61c2cd61 SENDLOCO/START mixup 2021-08-15 17:17:41 +01:00
Asbelos
3ee7ba0b53 Servo profiles 2021-08-15 16:39:21 +01:00
Asbelos
264908dc24 Merge branch 'EX-RAIL' of https://github.com/DCC-EX/CommandStation-EX into EX-RAIL 2021-08-14 16:43:05 +01:00
Asbelos
f1e84330ca PIN and SERVO turnout ids 2021-08-14 16:42:56 +01:00
Neil McKechnie
3b1759a88e Update IODevice.h to include other device includes files.. 2021-08-12 21:18:46 +01:00
Neil McKechnie
5f5efa7d23 Correct number of usable pins for ArduinoPins class. 2021-08-12 21:18:06 +01:00
Neil McKechnie
f86a14ceab Servo profile - avoid overrun of array bounds. 2021-08-12 21:17:40 +01:00
Asbelos
329df3a3ee correct example sensors 2021-08-12 20:35:56 +01:00
Neil McKechnie
5932b4d101 Remove unnecessary servo output demands.
If start and end position of a servo movement are identical, skip all but the last step.
2021-08-12 12:02:18 +01:00
Neil McKechnie
ec503e7d3e Make IODevice::read function return type consistent with underlying _read calls.
IODevice::read() now returns int, instead of bool.  This is consistent with the IODevice::_read() return and also allows for future devices that return a non-boolean value.
2021-08-12 12:01:10 +01:00
Neil McKechnie
2a79f67308 Fix EEPROM handling for outputs.
Output definitions in EEPROM were being lost once the output was activated or deactivated.  The handling has been corrected and tested.
2021-08-12 11:59:32 +01:00
Asbelos
23291b499f EXRAIL LCD macro 2021-08-12 08:53:52 +01:00
Asbelos
22b5d5e4c4 default off DIAG_LOOPTIMES 2021-08-12 08:32:48 +01:00
Asbelos
a0791b041c Fix status display 2021-08-12 08:25:51 +01:00
Asbelos
a93f88d3b7 PRINT command 2021-08-10 16:32:23 +01:00
Asbelos
b06db69b53 correct example 2021-08-10 10:41:35 +01:00
Asbelos
67be436898 Correct throw/close re haba 2021-08-08 18:48:51 +01:00
Asbelos
270b9df523 Remove obsolete docs 2021-08-04 08:54:29 +01:00
FrightRisk
5eff4c5ee5 Squash all commits on RMFT branch to create EX-RAIL branch 2021-08-03 17:12:25 -04:00
Harald Barth
f8fb08e331 Committing a SHA 2021-07-31 13:41:32 +00:00
Harald Barth
50fcbc088a fix version.h of merge 2021-07-31 15:40:32 +02:00
Harald Barth
e2263b1e75 Committing a SHA 2021-07-31 13:35:39 +00:00
Harald Barth
5eabe934b8 Merge branch 'master' into copyrightmessages 2021-07-31 15:32:02 +02:00