mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
Merge branch 'devel' of https://github.com/DCC-EX/CommandStation-EX into devel
This commit is contained in:
commit
22c0bff697
|
@ -79,6 +79,8 @@ const int16_t HASH_KEYWORD_TT=2688;
|
||||||
const int16_t HASH_KEYWORD_VPIN=-415;
|
const int16_t HASH_KEYWORD_VPIN=-415;
|
||||||
const int16_t HASH_KEYWORD_A='A';
|
const int16_t HASH_KEYWORD_A='A';
|
||||||
const int16_t HASH_KEYWORD_C='C';
|
const int16_t HASH_KEYWORD_C='C';
|
||||||
|
const int16_t HASH_KEYWORD_G='G';
|
||||||
|
const int16_t HASH_KEYWORD_I='I';
|
||||||
const int16_t HASH_KEYWORD_R='R';
|
const int16_t HASH_KEYWORD_R='R';
|
||||||
const int16_t HASH_KEYWORD_T='T';
|
const int16_t HASH_KEYWORD_T='T';
|
||||||
const int16_t HASH_KEYWORD_X='X';
|
const int16_t HASH_KEYWORD_X='X';
|
||||||
|
@ -501,8 +503,10 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'c': // SEND METER RESPONSES <c>
|
case 'c': // SEND METER RESPONSES <c>
|
||||||
// No longer supported because of multiple tracks <c MeterName value C/V unit min max res warn>
|
// No longer useful because of multiple tracks See <JG> and <JI>
|
||||||
break;
|
if (params>0) break;
|
||||||
|
TrackManager::reportObsoleteCurrent(stream);
|
||||||
|
return;
|
||||||
|
|
||||||
case 'Q': // SENSORS <Q>
|
case 'Q': // SENSORS <Q>
|
||||||
Sensor::printAll(stream);
|
Sensor::printAll(stream);
|
||||||
|
@ -584,6 +588,16 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
CommandDistributor::setClockTime(p[1], p[2], 1);
|
CommandDistributor::setClockTime(p[1], p[2], 1);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case HASH_KEYWORD_G: // <JG> current gauge limits
|
||||||
|
if (params>1) break;
|
||||||
|
TrackManager::reportGauges(stream); // <g limit...limit>
|
||||||
|
return;
|
||||||
|
|
||||||
|
case HASH_KEYWORD_I: // <JI> current values
|
||||||
|
if (params>1) break;
|
||||||
|
TrackManager::reportCurrent(stream); // <g limit...limit>
|
||||||
|
return;
|
||||||
|
|
||||||
case HASH_KEYWORD_A: // <JA> returns automations/routes
|
case HASH_KEYWORD_A: // <JA> returns automations/routes
|
||||||
StringFormatter::send(stream, F("<jA"));
|
StringFormatter::send(stream, F("<jA"));
|
||||||
if (params==1) {// <JA>
|
if (params==1) {// <JA>
|
||||||
|
|
|
@ -90,9 +90,8 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
|
||||||
else brakePin=UNUSED_PIN;
|
else brakePin=UNUSED_PIN;
|
||||||
|
|
||||||
currentPin=current_pin;
|
currentPin=current_pin;
|
||||||
if (currentPin!=UNUSED_PIN) {
|
if (currentPin!=UNUSED_PIN) ADCee::init(currentPin);
|
||||||
senseOffset = ADCee::init(currentPin);
|
senseOffset=0; // value can not be obtained until waveform is activated
|
||||||
}
|
|
||||||
|
|
||||||
faultPin=fault_pin;
|
faultPin=fault_pin;
|
||||||
if (faultPin != UNUSED_PIN) {
|
if (faultPin != UNUSED_PIN) {
|
||||||
|
@ -121,8 +120,8 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
|
||||||
if (currentPin==UNUSED_PIN)
|
if (currentPin==UNUSED_PIN)
|
||||||
DIAG(F("** WARNING ** No current or short detection"));
|
DIAG(F("** WARNING ** No current or short detection"));
|
||||||
else {
|
else {
|
||||||
DIAG(F("CurrentPin=A%d, Offset=%d, TripValue=%d"),
|
DIAG(F("CurrentPin=A%d, TripValue=%d"),
|
||||||
currentPin-A0, senseOffset,rawCurrentTripValue);
|
currentPin-A0, rawCurrentTripValue);
|
||||||
|
|
||||||
// self testing diagnostic for the non-float converters... may be removed when happy
|
// self testing diagnostic for the non-float converters... may be removed when happy
|
||||||
// DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"),
|
// DIAG(F("senseFactorInternal=%d raw2mA(1000)=%d mA2Raw(1000)=%d"),
|
||||||
|
@ -144,6 +143,12 @@ bool MotorDriver::isPWMCapable() {
|
||||||
void MotorDriver::setPower(POWERMODE mode) {
|
void MotorDriver::setPower(POWERMODE mode) {
|
||||||
bool on=mode==POWERMODE::ON;
|
bool on=mode==POWERMODE::ON;
|
||||||
if (on) {
|
if (on) {
|
||||||
|
// when switching a track On, we need to check the crrentOffset with the pin OFF
|
||||||
|
if (powerMode==POWERMODE::OFF && currentPin!=UNUSED_PIN) {
|
||||||
|
senseOffset = ADCee::read(currentPin);
|
||||||
|
DIAG(F("CurrentPin A%d sensOffset=%d"),currentPin-A0,senseOffset);
|
||||||
|
}
|
||||||
|
|
||||||
IODevice::write(powerPin,invertPower ? LOW : HIGH);
|
IODevice::write(powerPin,invertPower ? LOW : HIGH);
|
||||||
if (isProgTrack)
|
if (isProgTrack)
|
||||||
DCCWaveform::progTrack.clearResets();
|
DCCWaveform::progTrack.clearResets();
|
||||||
|
|
171
Release_Notes/CommandRef.md
Normal file
171
Release_Notes/CommandRef.md
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
This file is being used to consolidate the command reference information.
|
||||||
|
|
||||||
|
General points:
|
||||||
|
- Commands below have a single character opcode and parameters.
|
||||||
|
Even <JA> is actually read as <J A>
|
||||||
|
- Keyword parameters are shown in upper case but may be entered in mixed case.
|
||||||
|
- value parameters are numeric.
|
||||||
|
- [something] indicates its optional.
|
||||||
|
- Not all commands have a response, and not all responses come from the last commands that you have issued.
|
||||||
|
|
||||||
|
Startup status
|
||||||
|
<s>
|
||||||
|
|
||||||
|
Track power management
|
||||||
|
<1>
|
||||||
|
<1 MAIN|PROG|JOIN>
|
||||||
|
<0>
|
||||||
|
<0 MAIN|PROG>
|
||||||
|
|
||||||
|
Basic manual control
|
||||||
|
<t cab speed direction>
|
||||||
|
<F cab function 1|0>
|
||||||
|
<!>
|
||||||
|
<T id 0|1|T|C>
|
||||||
|
|
||||||
|
DCC accessory control
|
||||||
|
<a address subaddress activate [onoff]>
|
||||||
|
<a linearaddress activate>
|
||||||
|
|
||||||
|
|
||||||
|
Turnout definition
|
||||||
|
Note: Turnouts are best defined in myAutomation.h where a turnout description can also be provided ( refer to EXRAIL documentation) or by using these commands in a mySetup.h file.
|
||||||
|
|
||||||
|
<T id SERVO vpin thrown closed profile>
|
||||||
|
<T id VPIN vpin>
|
||||||
|
<T id DCC addr subaddr>
|
||||||
|
<T id DCC linearaddr>
|
||||||
|
|
||||||
|
|
||||||
|
Outputs
|
||||||
|
<Z id activate>
|
||||||
|
<Z id vpin iflag>
|
||||||
|
|
||||||
|
Sensors
|
||||||
|
<S id vpin pullup>
|
||||||
|
|
||||||
|
Decoder programming
|
||||||
|
<w cab cv value>
|
||||||
|
<b cab cv bit value>
|
||||||
|
<W cabid>
|
||||||
|
<W cv value>
|
||||||
|
<V cv value>
|
||||||
|
<V cv bit value>
|
||||||
|
<R>
|
||||||
|
<R cv>
|
||||||
|
<B cv bit value>
|
||||||
|
<D ACK ON|OFF>
|
||||||
|
<D ACK LIMIT|MIN|MAX|RETRY value>
|
||||||
|
<D PROGBOOST>
|
||||||
|
|
||||||
|
Advanced DCC control
|
||||||
|
<M packet.... >
|
||||||
|
<P packet ...>
|
||||||
|
<f map1 map2 [map3]>
|
||||||
|
<#>
|
||||||
|
<->
|
||||||
|
<- cabid>
|
||||||
|
<D CABS>
|
||||||
|
<D SPEED28>
|
||||||
|
<D SPEED128>
|
||||||
|
|
||||||
|
|
||||||
|
EEPROM commands
|
||||||
|
These commands exist for
|
||||||
|
backwards JMRI compatibility.
|
||||||
|
You are strongly discouraged from maintaining your configuration settings in EEPROM.
|
||||||
|
<E>
|
||||||
|
<e>
|
||||||
|
<D EEPROM>
|
||||||
|
<T>
|
||||||
|
<T id>
|
||||||
|
<S>
|
||||||
|
<S id>
|
||||||
|
<Z>
|
||||||
|
<Z id>
|
||||||
|
|
||||||
|
Diagnostic commands
|
||||||
|
<D CMD ON|OFF>
|
||||||
|
<D WIFI ON|OFF>
|
||||||
|
<D ETHERNET ON|OFF>
|
||||||
|
<D WIT ON|OFF>
|
||||||
|
<D LCN ON|OFF>
|
||||||
|
<D EXRAIL ON|OFF>
|
||||||
|
<D RESET>
|
||||||
|
<D SERVO|ANOUT vpin position [profile]>
|
||||||
|
<D ANIN vpin>
|
||||||
|
<D HAL SHOW>
|
||||||
|
<D HAL RESET>
|
||||||
|
<+ cmd>
|
||||||
|
<+>
|
||||||
|
<Q>
|
||||||
|
|
||||||
|
User defined filter commands
|
||||||
|
<U ....>
|
||||||
|
<u ....>
|
||||||
|
|
||||||
|
Track Management
|
||||||
|
<=>
|
||||||
|
<= track DCC|PROG|OFF>
|
||||||
|
<= track DC|DCX cabid>
|
||||||
|
<JG>
|
||||||
|
<JI>
|
||||||
|
|
||||||
|
|
||||||
|
Turntable interface
|
||||||
|
<D TT vpin steps [activity]>
|
||||||
|
|
||||||
|
Fast clock interface
|
||||||
|
<JC>
|
||||||
|
<JC mins rate>
|
||||||
|
|
||||||
|
|
||||||
|
Advanced Throttle access to features
|
||||||
|
<t cab>
|
||||||
|
<JA>
|
||||||
|
<JA id>
|
||||||
|
<JR>
|
||||||
|
<JR id>
|
||||||
|
<JT>
|
||||||
|
<JT id>
|
||||||
|
|
||||||
|
*******************
|
||||||
|
EXRAIL Commands
|
||||||
|
*******************
|
||||||
|
|
||||||
|
</>
|
||||||
|
</PAUSE>
|
||||||
|
</RESUME>
|
||||||
|
</START cab sequence>
|
||||||
|
</START sequence>
|
||||||
|
</KILL taskid>
|
||||||
|
</KILL ALL>
|
||||||
|
</RESERVE|FREE blockid>
|
||||||
|
</LATCH|UNLATCH latchid>
|
||||||
|
</RED|AMBER|GREEN signalid>
|
||||||
|
|
||||||
|
Obsolete commands/formats
|
||||||
|
<c>
|
||||||
|
<t ignored cab speed direction>
|
||||||
|
<T id vpin thrown closed>
|
||||||
|
<T id addr subaddr>
|
||||||
|
<B cv bit value obsolete obsolete>
|
||||||
|
<R cv obsolete obsolete>
|
||||||
|
<W cv value obsolete obsolete>
|
||||||
|
|
||||||
|
Broadcast responses
|
||||||
|
Note: broadcasts are sent to all throttles when appropriate (usually because something has changed)
|
||||||
|
|
||||||
|
<p0>
|
||||||
|
<p1>
|
||||||
|
<p1 MAIN|PROG|JOIN>
|
||||||
|
|
||||||
|
<l cab slot dccspeed functionmap>
|
||||||
|
<H id 1|0>
|
||||||
|
<jC mmmm speed>
|
||||||
|
|
||||||
|
Diagnostic responses
|
||||||
|
These are not meant to be software readable. They contain diagnostic information for programmers to identify issues.
|
||||||
|
<X>
|
||||||
|
<* ... *>
|
||||||
|
|
|
@ -424,6 +424,34 @@ POWERMODE TrackManager::getProgPower() {
|
||||||
return POWERMODE::OFF;
|
return POWERMODE::OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackManager::reportObsoleteCurrent(Print* stream) {
|
||||||
|
// This function is for backward JMRI compatibility only
|
||||||
|
// It reports the first track only, as main, regardless of track settings.
|
||||||
|
// <c MeterName value C/V unit min max res warn>
|
||||||
|
int maxCurrent=track[0]->raw2mA(track[0]->getRawCurrentTripValue());
|
||||||
|
StringFormatter::send(stream, F("<c CurrentMAIN %d C Milli 0 %d 1 %d>\n"),
|
||||||
|
track[0]->raw2mA(track[0]->getCurrentRaw(false)), maxCurrent, maxCurrent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackManager::reportCurrent(Print* stream) {
|
||||||
|
StringFormatter::send(stream,F("<jI"));
|
||||||
|
FOR_EACH_TRACK(t) {
|
||||||
|
StringFormatter::send(stream, F(" %d"),
|
||||||
|
(track[t]->getPower()==POWERMODE::OVERLOAD) ? -1 :
|
||||||
|
track[t]->raw2mA(track[t]->getCurrentRaw(false)));
|
||||||
|
}
|
||||||
|
StringFormatter::send(stream,F(">\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackManager::reportGauges(Print* stream) {
|
||||||
|
StringFormatter::send(stream,F("<jG"));
|
||||||
|
FOR_EACH_TRACK(t) {
|
||||||
|
StringFormatter::send(stream, F(" %d"),
|
||||||
|
track[t]->raw2mA(track[t]->getRawCurrentTripValue()));
|
||||||
|
}
|
||||||
|
StringFormatter::send(stream,F(">\n"));
|
||||||
|
}
|
||||||
|
|
||||||
void TrackManager::setJoinRelayPin(byte joinRelayPin) {
|
void TrackManager::setJoinRelayPin(byte joinRelayPin) {
|
||||||
joinRelay=joinRelayPin;
|
joinRelay=joinRelayPin;
|
||||||
if (joinRelay!=UNUSED_PIN) {
|
if (joinRelay!=UNUSED_PIN) {
|
||||||
|
|
|
@ -77,6 +77,9 @@ class TrackManager {
|
||||||
static bool isJoined() { return progTrackSyncMain;}
|
static bool isJoined() { return progTrackSyncMain;}
|
||||||
static void setJoinRelayPin(byte joinRelayPin);
|
static void setJoinRelayPin(byte joinRelayPin);
|
||||||
static void sampleCurrent();
|
static void sampleCurrent();
|
||||||
|
static void reportGauges(Print* stream);
|
||||||
|
static void reportCurrent(Print* stream);
|
||||||
|
static void reportObsoleteCurrent(Print* stream);
|
||||||
static int16_t joinRelay;
|
static int16_t joinRelay;
|
||||||
static bool progTrackSyncMain; // true when prog track is a siding switched to main
|
static bool progTrackSyncMain; // true when prog track is a siding switched to main
|
||||||
static bool progTrackBoosted; // true when prog track is not current limited
|
static bool progTrackBoosted; // true when prog track is not current limited
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "4.2.18"
|
#define VERSION "4.2.20"
|
||||||
|
// 4.2.20 - <JG> & <JI> commands for multi-track gauges
|
||||||
|
// - Reinstate <c> but remember its a bit useless when TM involved.
|
||||||
|
// 4.2.19 - Bugfix for analog reading of track current sensor offset.
|
||||||
// 4.2.18 - I2C Multiplexer support through Extended Addresses,
|
// 4.2.18 - I2C Multiplexer support through Extended Addresses,
|
||||||
// added for Wire, 4209 and AVR I2C drivers.
|
// added for Wire, 4209 and AVR I2C drivers.
|
||||||
// - I2C retries when an operation fails.
|
// - I2C retries when an operation fails.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user