1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-30 03:26:13 +01:00

Serials 1-6 in exrail

This commit is contained in:
Asbelos 2022-11-29 20:08:26 +00:00
parent 7840c24e21
commit 3507631b22
5 changed files with 52 additions and 6 deletions

View File

@ -1141,9 +1141,36 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) {
break; break;
case thrunge_serial: stream=&Serial; break; case thrunge_serial: stream=&Serial; break;
case thrunge_serial1: stream=&Serial1; break; case thrunge_serial1:
case thrunge_serial2: stream=&Serial2; break; #ifdef SERIAL1_COMMANDS
case thrunge_serial3: stream=&Serial3; break; stream=&Serial1;
#endif
break;
case thrunge_serial2:
#ifdef SERIAL2_COMMANDS
stream=&Serial2;
#endif
break;
case thrunge_serial3:
#ifdef SERIAL3_COMMANDS
stream=&Serial3;
#endif
break;
case thrunge_serial4:
#ifdef SERIAL4_COMMANDS
stream=&Serial4;
#endif
break;
case thrunge_serial5:
#ifdef SERIAL5_COMMANDS
stream=&Serial5;
#endif
break;
case thrunge_serial6:
#ifdef SERIAL6_COMMANDS
stream=&Serial6;
#endif
break;
// TODO more serials for SAMx case thrunge_serial4: stream=&Serial4; break; // TODO more serials for SAMx case thrunge_serial4: stream=&Serial4; break;
case thrunge_lcn: case thrunge_lcn:
#if defined(LCN_SERIAL) #if defined(LCN_SERIAL)
@ -1170,7 +1197,7 @@ void RMFT2::thrungeString(uint32_t strfar, thrunger mode, byte id) {
#else #else
// UNO/NANO CPUs dont have high memory // UNO/NANO CPUs dont have high memory
// 32 bit cpus dont care anyway // 32 bit cpus dont care anyway
stream.print((FSH *)strfar) stream->print((FSH *)strfar);
#endif #endif
// and decide what to do next // and decide what to do next

View File

@ -70,6 +70,7 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
enum thrunger: byte { enum thrunger: byte {
thrunge_print, thrunge_broadcast, thrunge_serial,thrunge_parse, thrunge_print, thrunge_broadcast, thrunge_serial,thrunge_parse,
thrunge_serial1, thrunge_serial2, thrunge_serial3, thrunge_serial1, thrunge_serial2, thrunge_serial3,
thrunge_serial4, thrunge_serial5, thrunge_serial6,
thrunge_lcd, thrunge_lcn}; thrunge_lcd, thrunge_lcn};

View File

@ -110,6 +110,9 @@
#undef SERIAL1 #undef SERIAL1
#undef SERIAL2 #undef SERIAL2
#undef SERIAL3 #undef SERIAL3
#undef SERIAL4
#undef SERIAL5
#undef SERIAL6
#undef SERVO #undef SERVO
#undef SERVO2 #undef SERVO2
#undef SERVO_TURNOUT #undef SERVO_TURNOUT
@ -220,6 +223,9 @@
#define SERIAL1(msg) #define SERIAL1(msg)
#define SERIAL2(msg) #define SERIAL2(msg)
#define SERIAL3(msg) #define SERIAL3(msg)
#define SERIAL4(msg)
#define SERIAL5(msg)
#define SERIAL6(msg)
#define SERVO(id,position,profile) #define SERVO(id,position,profile)
#define SERVO2(id,position,duration) #define SERVO2(id,position,duration)
#define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos) #define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos)

View File

@ -123,6 +123,12 @@ const int StringMacroTracker1=__COUNTER__;
#define SERIAL2(msg) THRUNGE(msg,thrunge_serial2) #define SERIAL2(msg) THRUNGE(msg,thrunge_serial2)
#undef SERIAL3 #undef SERIAL3
#define SERIAL3(msg) THRUNGE(msg,thrunge_serial3) #define SERIAL3(msg) THRUNGE(msg,thrunge_serial3)
#undef SERIAL4
#define SERIAL4(msg) THRUNGE(msg,thrunge_serial4)
#undef SERIAL5
#define SERIAL5(msg) THRUNGE(msg,thrunge_serial5)
#undef SERIAL6
#define SERIAL6(msg) THRUNGE(msg,thrunge_serial6)
#undef LCD #undef LCD
#define LCD(id,msg) \ #define LCD(id,msg) \
case (__COUNTER__ - StringMacroTracker1) : {\ case (__COUNTER__ - StringMacroTracker1) : {\
@ -317,6 +323,9 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
#define SERIAL1(msg) PRINT(msg) #define SERIAL1(msg) PRINT(msg)
#define SERIAL2(msg) PRINT(msg) #define SERIAL2(msg) PRINT(msg)
#define SERIAL3(msg) PRINT(msg) #define SERIAL3(msg) PRINT(msg)
#define SERIAL4(msg) PRINT(msg)
#define SERIAL5(msg) PRINT(msg)
#define SERIAL6(msg) PRINT(msg)
#define SERVO(id,position,profile) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::profile),OPCODE_PAD,V(0), #define SERVO(id,position,profile) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::profile),OPCODE_PAD,V(0),
#define SERVO2(id,position,ms) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::Instant),OPCODE_PAD,V(ms/100L), #define SERVO2(id,position,ms) OPCODE_SERVO,V(id),OPCODE_PAD,V(position),OPCODE_PAD,V(PCA9685::Instant),OPCODE_PAD,V(ms/100L),
#define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos) #define SERVO_SIGNAL(vpin,redpos,amberpos,greenpos)

7
FSH.h
View File

@ -59,7 +59,7 @@ typedef __FlashStringHelper FSH;
// AVR_UNO/NANO runtime does not support _far functions so just use _near equivalent // AVR_UNO/NANO runtime does not support _far functions so just use _near equivalent
// as there is no progmem above 32kb anyway. // as there is no progmem above 32kb anyway.
#define HIGHFLASH PROGMEM #define HIGHFLASH PROGMEM
#define GETFARPTR(data) ((const byte *)(data)) #define GETFARPTR(data) ((uint32_t)(data))
#define GETHIGHFLASH(data,offset) pgm_read_byte_near(GETFARPTR(data)+(offset)) #define GETHIGHFLASH(data,offset) pgm_read_byte_near(GETFARPTR(data)+(offset))
#define GETHIGHFLASHW(data,offset) pgm_read_word_near(GETFARPTR(data)+(offset)) #define GETHIGHFLASHW(data,offset) pgm_read_word_near(GETFARPTR(data)+(offset))
#endif #endif
@ -69,11 +69,14 @@ typedef __FlashStringHelper FSH;
#ifdef F #ifdef F
#undef F #undef F
#endif #endif
#ifdef FLASH
#undef FLASH
#endif
#define F(str) (str) #define F(str) (str)
typedef char FSH; typedef char FSH;
#define FLASH #define FLASH
#define HIGHFLASH #define HIGHFLASH
#define GETFARPTR(data) ((const byte *)(data)) #define GETFARPTR(data) ((uint32_t)(data))
#define GETFLASH(addr) (*(const byte *)(addr)) #define GETFLASH(addr) (*(const byte *)(addr))
#define GETHIGHFLASH(data,offset) (*(const byte *)(GETFARPTR(data)+offset)) #define GETHIGHFLASH(data,offset) (*(const byte *)(GETFARPTR(data)+offset))
#define GETHIGHFLASHW(data,offset) (*(const uint16_t *)(GETFARPTR(data)+offset)) #define GETHIGHFLASHW(data,offset) (*(const uint16_t *)(GETFARPTR(data)+offset))