mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
977802f160
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>
79 lines
3.0 KiB
C++
79 lines
3.0 KiB
C++
/*
|
|
* © 2021 Mike S
|
|
* © 2021 Fred Decker
|
|
* © 2020-2021 Chris Harlow
|
|
* All rights reserved.
|
|
*
|
|
* This file is part of Asbelos DCC API
|
|
*
|
|
* 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 DCCEXParser_h
|
|
#define DCCEXParser_h
|
|
#include <Arduino.h>
|
|
#include "FSH.h"
|
|
#include "RingStream.h"
|
|
|
|
typedef void (*FILTER_CALLBACK)(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
|
|
typedef void (*AT_COMMAND_CALLBACK)(HardwareSerial * stream,const byte * command);
|
|
|
|
struct DCCEXParser
|
|
{
|
|
|
|
static void parse(Print * stream, byte * command, RingStream * ringStream);
|
|
static void parse(const FSH * cmd);
|
|
static void setFilter(FILTER_CALLBACK filter);
|
|
static void setRMFTFilter(FILTER_CALLBACK filter);
|
|
static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);
|
|
static const int MAX_COMMAND_PARAMS=10; // Must not exceed this
|
|
|
|
private:
|
|
|
|
static const int16_t MAX_BUFFER=50; // longest command sent in
|
|
static int16_t splitValues( int16_t result[MAX_COMMAND_PARAMS], const byte * command, bool usehex);
|
|
|
|
static bool parseT(Print * stream, int16_t params, int16_t p[]);
|
|
static bool parseZ(Print * stream, int16_t params, int16_t p[]);
|
|
static bool parseS(Print * stream, int16_t params, int16_t p[]);
|
|
static bool parsef(Print * stream, int16_t params, int16_t p[]);
|
|
static bool parseD(Print * stream, int16_t params, int16_t p[]);
|
|
|
|
static Print * getAsyncReplyStream();
|
|
static void commitAsyncReplyStream();
|
|
|
|
static bool stashBusy;
|
|
static byte stashTarget;
|
|
static Print * stashStream;
|
|
static RingStream * stashRingStream;
|
|
|
|
static int16_t stashP[MAX_COMMAND_PARAMS];
|
|
static bool stashCallback(Print * stream, int16_t p[MAX_COMMAND_PARAMS], RingStream * ringStream);
|
|
static void callback_W(int16_t result);
|
|
static void callback_W4(int16_t result);
|
|
static void callback_B(int16_t result);
|
|
static void callback_R(int16_t result);
|
|
static void callback_Rloco(int16_t result);
|
|
static void callback_Wloco(int16_t result);
|
|
static void callback_Vbit(int16_t result);
|
|
static void callback_Vbyte(int16_t result);
|
|
static FILTER_CALLBACK filterCallback;
|
|
static FILTER_CALLBACK filterRMFTCallback;
|
|
static AT_COMMAND_CALLBACK atCommandCallback;
|
|
static void funcmap(int16_t cab, byte value, byte fstart, byte fstop);
|
|
static void sendFlashList(Print * stream,const int16_t flashList[]);
|
|
|
|
};
|
|
|
|
#endif
|