1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 16:16:13 +01:00
Commit Graph

247 Commits

Author SHA1 Message Date
Neil McKechnie
86c3020672 Correct display of high VPIN numbers in diagnostic output.
No functional change.
VPINs are unsigned integers in the range 0-65535 (although the highest values are special, 65535=VPIN_NONE).  Values above 32767 were erroneously being displayed as negative.  This has been fixed, which is a pre-requisite for allowing VPINs above 32767 to be used.
2023-03-27 13:08:14 +01:00
Asbelos
f0ee8aeb85 z Commands 2023-03-23 19:52:49 +00:00
Asbelos
b969563d35 Squashed commit of the following:
commit 4d8efcdd05
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Mar 1 16:32:05 2023 +0000

    Reinstate obsolete <s>

commit 003313998b
Author: Asbelos <asbelos@btinternet.com>
Date:   Wed Mar 1 16:07:11 2023 +0000

    Change <I><G> to <JI><JG>

commit c72bf51959
Author: Asbelos <asbelos@btinternet.com>
Date:   Sat Feb 25 17:38:39 2023 +0000

    G and I commands
2023-03-02 12:56:30 +00:00
Neil McKechnie
7e2487ffbb Avoid compiler error when no HAL installed. 2023-02-10 15:29:09 +00:00
Neil McKechnie
7de46a0c17 Add <D HAL RESET> command to attempt to reset failed devices. 2023-02-09 00:16:39 +00:00
Neil McKechnie
d8881deb6a Merge branch 'devel' into devel-nmck 2023-02-07 18:05:18 +00:00
Harald Barth
212bf8d80e Broadcast power for <s> again 2023-01-29 08:13:52 +01:00
Harald Barth
2a7588b1b5 jT answer should contain empty string 2023-01-28 19:07:59 +01:00
Harald Barth
9e5d780c14 Bugfix for issue #299 TurnoutDescription NULL 2023-01-27 18:42:26 +01:00
Neil McKechnie
10c8915d33 Ensure correct functions are called for strcpy_P, strncmp_P, strlen_P etc. on non-AVR targets.. 2023-01-23 22:28:43 +00:00
Colin Murdoch
cd46d3c9e0 Remove #ifdef and merge calcs
Remove #idfef statements and merge duplicate routines into CommandDistributor
2023-01-21 10:18:54 +00:00
Colin Murdoch
8fac20a451 Add #ifdef selections
Add #ifdef selections linked to #define in config.exampe.h
2023-01-16 18:16:25 +00:00
Colin Murdoch
ff7260b9bc Added code for FastClock
Added code for both I2C fastclock and serial clocks
2023-01-11 17:36:11 +00:00
Asbelos
1d61a8f3f9 HIGHMEM + WITHROTTLE
EXRAIL HIGHMEM feature affects parser and withrottle.

Ringstream and wifi fixes

Withrottle connecting / reconnecting
2022-12-16 13:14:48 +00:00
Harald Barth
2b3ba514b0 Use X as the questionmark sign in <T 17 X> 2022-11-05 23:11:54 +01:00
Harald Barth
a199de6d3e Make <T nn ?> return long config print 2022-11-04 23:43:26 +01:00
Harald Barth
c0cb643cb5 When sending all turnouts, keep it short 2022-11-04 23:15:29 +01:00
Harald Barth
a9ce9101e6 return success/fail from <f> and <F> command handling (setFn, parsef) 2022-08-20 18:15:18 +02:00
peteGSX
0a6d023373 Add <D TT ...> ready to test 2022-08-14 06:58:20 +10:00
Harald Barth
704fabd1a4 check M command against max DCC packet size 2022-08-05 15:15:42 +02:00
Asbelos
3681f0e445 Serial/SerialUSB cleanup 2022-07-08 15:52:46 +01:00
Asbelos
9768083bfe DCCTimer::reset
Moves CPU dependent reset code into correct place.
2022-07-08 15:01:40 +01:00
Asbelos
090acdae44 More SAMD cleanup 2022-07-08 10:46:52 +01:00
Asbelos
385afdeb6c Merge remote-tracking branch 'origin/TrackManager_SAMD' into PORTX_HAL 2022-07-07 10:02:28 +01:00
Asbelos
12b5c2cdba Merge branch 'PORTX_HAL' of https://github.com/DCC-EX/CommandStation-EX into PORTX_HAL 2022-07-06 22:26:44 +01:00
Harald Barth
76d6759d98 improve parameter check for 'a' command 2022-07-06 21:13:22 +02:00
Harald Barth
632e9335f3 fix broken 'a' command after broken commit c7b3817 2022-07-06 20:37:17 +02:00
Asbelos
06d1040da0 Merge remote-tracking branch 'origin/SAMD_Integration_PMA' into PORTX_HAL 2022-07-06 17:13:59 +01:00
pmantoine
44b21fd987 Added code to respond to <D RESET> 2022-07-05 12:40:00 +07:00
Harald Barth
5eb9678437 Merge branch 'master' into TrackManager-PORTX 2022-06-11 21:40:08 +02:00
Harald Barth
c7b38170c1 Parse ONOFF with 4 param <a> command 2022-05-22 23:39:46 +02:00
pmantoine
dd58e2c462 Fix ESP32 define 2022-05-17 20:04:19 +08:00
pmantoine
6135272c32 SAMD Support Initial Patches 2022-05-17 18:06:08 +08:00
Harald Barth
ff73a60874 Parse strings with more than one command (<s><Q>) correct 2022-05-13 16:18:47 +02:00
Fred
977802f160
Servo signal (#227)
Prepping for version 4.1

SERVO_SIGNAL definition in EXRAIL
SERVO_SIGNAL(vpin, redpos, amberpos, greenpos)

use RED/AMBER/GREEN as for led signals.

* SIGNALH, ATGTE, ATLT

UNTESTED

* Automatic ALIAS(name)

and _ in keywords

* EXRAIL FORGET current loco

* EXRAIL </KILL ALL>

* EXRAIL VIRTUAL_TURNOUT

* Cleanup version.h

* Update version.h (#223)

Rewrite & Updated the 4.0.0 Section

* </KILL ALL> fix

* Incoming LCN turnout throw.

* KILLALL macro

and DIAGNOSTIC messages when KILL command used.

* EXRAIL PARSE

* Rebuild throttle info getters

UNTESTED... create different methods to obtain throttle info without being withrottle specific.

Also implements turnout description of "*" as hidden.

* 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

* Assist notes draft & syntax tweaks

* Throttle notes

* uno memory saver

* JA JR and <t cab>

* Subtle corrections

* Update version.h

* I2C code corrections

Corrections to I2C code:
1) I2CManager_Mega4809.h: Correct bitwise 'and' to logical 'and' - no impact.
2) I2CManager_Wire.h: Ensure that error codes from Wire subsystem are passed back to caller in queueRequest().

* RAG Ifs and cmds

* IF block perf/memory

* Allow negative route ids.

* correct GREEN keyword

* Update version.h

* myFilter auto detect

* Update version.h

* fix weak ref to myFilter

* ACK defaults now 50-2000-20000

* Update version.h

* Improved SIGNALs startup and diagnostics

* Update IO_PCA9685.cpp

* Allow turnout id 0

* Position servo pin used as GPIO

* NoPowerOff LEDS

* CALLBACK parameter optional for Write

* WRITE CV ON PROG <W CV VALUE>

Callback parameters are now optional on PROG

* Updated CV read command <R cv>

Equivalent to <V cv 0>  uses the verify callback.

Co-authored-by: Asbelos <asbelos@btinternet.com>
Co-authored-by: Kcsmith0708 <kcsmith0708@wowway.com>
Co-authored-by: Neil McKechnie <neilmck999@gmail.com>
Co-authored-by: Ash-4 <81280775+Ash-4@users.noreply.github.com>
2022-05-03 16:53:33 -04:00
Harald Barth
ac32cd5528 guess value should be 0 not random bute in RAM 2022-05-03 08:38:35 +02:00
Ash-4
e721457844
Updated CV read command <R cv>
Updated CV read command <R cv>
2022-05-02 19:14:04 -05:00
Ash-4
7b40bd3290
Updated CV read command <R cv>
Equivalent to <V cv 0>  uses the verify callback.
2022-05-02 18:58:03 -05:00
Ash-4
6994139e57
Merge pull request #230 from DCC-EX/ServoSignal
WRITE CV ON PROG <W CV VALUE>
2022-04-30 22:33:54 -05:00
Ash-4
b2df10a99a
WRITE CV ON PROG <W CV VALUE>
Callback parameters are now optional on PROG
2022-04-29 23:23:15 -05:00
Asbelos
724dea22d5 Merge branch 'ServoSignal' into TrackManager 2022-04-20 09:10:44 +01:00
Asbelos
17eb7c560e fix weak ref to myFilter 2022-04-20 09:10:27 +01:00
Asbelos
21d1f482cf Merge branch 'ServoSignal' into TrackManager 2022-04-19 11:35:17 +01:00
Asbelos
9cf70f5870 myFilter auto detect 2022-04-19 09:35:03 +01:00
Asbelos
1b0d700009 Merge branch 'ThrottleInfo' into TrackManager 2022-04-12 23:16:41 +01:00
Asbelos
28a4406044 Subtle corrections 2022-04-12 23:10:29 +01:00
Asbelos
20b12bcb7c JA JR and <t cab> 2022-04-12 18:47:06 +01:00
Asbelos
e13175635c uno memory saver 2022-04-12 17:05:55 +01:00
Asbelos
bfb88bb30a Assist notes draft & syntax tweaks 2022-04-08 16:13:15 +01: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
pmantoine
5dfc014f49 Some useful code plug debug goo 2022-04-05 09:24:29 +08:00
Asbelos
dea55fec79 Merge branch 'ServoSignal' into TrackManager 2022-03-21 16:32:45 +00:00
Asbelos
269e1b36ea Automatic ALIAS(name)
and _ in keywords
2022-03-21 16:29:35 +00:00
Asbelos
be186b967b CODE TIDY
Moved join code out of DCCWaveform to reduce footprint for ESP32 waveform replacement.
2022-03-19 11:22:31 +00:00
Asbelos
75b16c9047 Change track manager cmd to =
And fix the wrong param number at the same time!
2022-03-18 16:41:52 +00:00
Harald Barth
2890a7928b restart with AVR WDT or ESP.restart() 2022-03-04 23:36:31 +01:00
Asbelos
524afc6caf move more cpu specifics 2022-03-02 14:24:49 +00:00
Asbelos
6fc223d80b Timer stuff with incomplete teensy 2022-03-01 12:52:25 +00:00
Asbelos
a7740d652d It builds....
massive track reorganization
2022-02-23 15:44:34 +00:00
Asbelos
8db937e985 Initial Track Manager code 2022-02-22 01:27:27 +00:00
Harald Barth
b6501c7e3e revert to write ERROR 2022-01-30 23:58:34 +01:00
Asbelos
f577c11eb7 Correct ack diag msgs
Bug caused by unsigned ints >32k being displayed as negative int.
2022-01-17 15:56:16 +00:00
Harald Barth
e0a7c4d155 Fixed regression: Shields with common fault pin works again 2022-01-08 21:44:32 +01:00
Harald Barth
d45585ce3d update copyright notes 2022-01-07 02:28:35 +01:00
Harald Barth
b0915e8332 format/indentation change only 2022-01-06 23:03:57 +01:00
Asbelos
52e7929b08 Correcting <+> command any-serial 2021-12-20 10:33:48 +00:00
Asbelos
c15d536e9b Merge branch 'Broadcast' into EXRAILPlus 2021-12-20 10:21:44 +00:00
Asbelos
cbf9f39ea6 AT passthrough from any HardwareSerial stream
IE cant passthrough from wifi!
2021-12-19 10:24:18 +00:00
Asbelos
65ce238bfb Merge branch 'ATpassthrough' into Broadcast 2021-12-18 22:06:31 +00:00
Asbelos
10828bc6b8 catch bad params in F 2021-12-17 21:19:55 +00:00
Asbelos
aa40231ac7 catch bad param count in F 2021-12-17 21:19:16 +00:00
Asbelos
6bfe18bb21 Parser hex code save 2021-12-16 11:23:20 +00:00
Asbelos
b0c9806f3b Withrottle broadcast functions and speeds 2021-12-15 19:51:01 +00:00
Asbelos
18695888dd Fixing broadcast 2021-12-07 00:24:48 +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
b5af39dfc9 Merge branch 'RCN213-fixes' into master 2021-12-02 08:31:33 +01:00
Harald Barth
5c18f4a19d Merge branch 'short-long-addr' into master 2021-11-30 20:07:52 +01:00
Harald Barth
43538d3b32 smaller code 2021-11-26 19:32:45 +01:00
Harald Barth
fd43a9b88b defines to reverse accessories and turnouts renamed 2021-11-25 23:10:03 +01:00
Harald Barth
3bddeeda3e better long/short addr handling under <R>; configurable long/short border 2021-11-25 00:10:11 +01: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
9097a62f42 Add new <D ANIN vpin> and <D ANOUT vpin value> commands.
Alias for existing <D SERVO ...> command added as <D ANOUT ...> (since not all analogue outputs are servos).  Also, <D ANIN vpin> added to display the value of an analogue input pin.
2021-10-08 13:30:23 +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
Ash-4
b4fb76b6c8
Display running total ackRetrySum
RCOUNT added to Verify program to report if Read step occurs.
Report ackRetrySum on LCD when <D ACK RETRY nn> is sent
2021-08-30 17:02:05 -05:00
Neil McKechnie
fb6ab85c4a Add flag to invert DCC Accessory command <a> behaviour
<a addr subaddr 1> command puts a D=1 into the DCC packet for a DCC Accessory Decoder.  This was previously though to correspond to a 'throw' request and a D=0 to a 'close' request.  RCN-213 standard identifies that D=1 is 'close' and D=0 is 'throw', so this change allows CS to be configured to invert the states to conform to the RCN-213 definition.
2021-08-27 21:43:24 +01:00
Neil McKechnie
93dfdcce53 Add <D HAL SHOW> command to list HAL device configuration.
Also, only display HAL device configurations at startup if DIAG_IO is #defined.
2021-08-27 15:44:26 +01:00
Neil McKechnie
77d4d7c400
Merge branch 'EX-RAIL' into EX-RAIL-neil-RCN213 2021-08-25 00:38:38 +01:00
Neil McKechnie
08cfe41cf3 Revert to original DCC++ Classic Turnout command polarity.
Revert to <T id 1> command being 'throw' and <T id 0> being 'close', for turnouts.
2021-08-24 22:18:51 +01:00
Neil McKechnie
f0cd96fed3 Changes associated with RCN-213 DCC Accessory Packet format 2021-08-23 12:43:14 +01:00
Asbelos
161b35ae84 indentation and LCD macro use
No actual code change.
2021-08-23 12:35:42 +01:00
Asbelos
214e6c643f Squashed commit of the following:
commit b34205b142
Merge: 8703248 2829716
Author: Neil McKechnie <75813993+Neil-McK@users.noreply.github.com>
Date:   Mon Aug 23 10:05:54 2021 +0100

    Merge branch 'EX-RAIL' into ackRetry

commit 8703248c49
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sun Aug 22 16:47:38 2021 -0500

    ACK RETRY max 255 with fallback to 3 if greater

    And includes LCD lines for power and ACK diags.

commit f5d4522ed7
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sun Aug 22 16:40:13 2021 -0500

    ACK RETRY updated datatypes

commit 1dbf236697
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sun Aug 22 16:35:14 2021 -0500

    ACK RETRY updated datatypes

commit d93584e9a4
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sun Aug 22 13:16:24 2021 -0500

    ACK RETRY updated default is 2 retries.

commit f58ebac670
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sat Aug 21 16:43:21 2021 -0500

    ACK RETRY is 3 or less (default is 1)

commit 08350b215a
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sat Aug 21 11:55:17 2021 -0500

    ACK RETRY

    LCD display update.
    lcd(0, F("RETRY %d %d %d %d"), ackManagerCv, ackManagerRetry, ackRetry, ackRetrySum);

commit 11cd216017
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sat Aug 21 00:54:28 2021 -0500

    ACK RETRY

    ACK retry code added to ackManagerSetup and callback.
    The default is <D ACK RETRY 1>.  For ACK tuning, set retry to zero.
    Retry count is captured on the LCD display, and lines in the serial monitor.

commit b67027a1ed
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sat Aug 21 00:33:01 2021 -0500

    ACK RETRY variables added

commit 34d2ab3543
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Sat Aug 21 00:23:34 2021 -0500

    Update DCCEXParser.cpp

    LCD lines added to display power commands and ACK settings, when updated.
    Also new command <D ACK RETRY 1>.

commit 8ca4011cb0
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com>
Date:   Fri Aug 20 23:58:13 2021 -0500

    Update CommandStation-EX.ino

    Update LCD row number for Ready and Free RAM.

commit 6571138389
Author: Harald Barth <haba@kth.se>
Date:   Sun Aug 1 22:08:34 2021 +0200

    optimize command parser for size

commit c4f659243e
Author: Harald Barth <haba@kth.se>
Date:   Sun Aug 1 15:07:06 2021 +0200

    optimize for loops for size (and speed)

commit 55b7091d5a
Author: Harald Barth <haba@kth.se>
Date:   Sun Aug 1 12:45:29 2021 +0200

    take less progmem for messages

commit 6d7c1925b0
Author: Harald Barth <haba@kth.se>
Date:   Sun Aug 1 11:56:12 2021 +0200

    only pragma -O3 critical functions
2021-08-23 11:58:48 +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
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
FrightRisk
5eff4c5ee5 Squash all commits on RMFT branch to create EX-RAIL branch 2021-08-03 17:12:25 -04:00
Harald Barth
8f1ed21aa3 Allow some pins that might be useful 2021-07-27 19:53:21 +02:00