1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Add Ardunio and Motor Board types to <s> cmd

This commit is contained in:
FrightRisk 2020-09-23 15:17:01 -04:00
parent 00fb7c6d04
commit ba79668a8f
3 changed files with 29 additions and 2 deletions

View File

@ -146,7 +146,7 @@ void setup()
// Optionally a Timer number (1..4) may be passed to DCC::begin to override the default Timer1 used for the // Optionally a Timer number (1..4) may be passed to DCC::begin to override the default Timer1 used for the
// waveform generation. e.g. DCC::begin(STANDARD_MOTOR_SHIELD,2); to use timer 2 // waveform generation. e.g. DCC::begin(STANDARD_MOTOR_SHIELD,2); to use timer 2
DCC::begin(MOTOR_SHIELD_TYPE); DCC::begin(MOTOR_BOARD);
} }
void loop() void loop()

27
DCC.h
View File

@ -139,4 +139,31 @@ private:
static const byte BIT_OFF=0x00; static const byte BIT_OFF=0x00;
}; };
#ifdef ARDUINO_AVR_MEGA // is using Mega 1280, define as Mega 2560 (pinouts and functionality are identical)
#define ARDUINO_AVR_MEGA2560
#endif
#if defined(ARDUINO_AVR_UNO)
#define ARDUINO_TYPE "UNO"
#elif defined(ARDUINO_AVR_NANO)
#define ARDUINO_TYPE "NANO"
#elif defined(ARDUINO_AVR_MEGA2560)
#define ARDUINO_TYPE "MEGA"
#else
#error CANNOT COMPILE - DCC++ EX ONLY WORKS WITH AN ARDUINO UNO, NANO 328, OR ARDUINO MEGA 1280/2560
#endif
#if defined(STANDARD_MOTOR_SHIELD)
#define MOTOR_BOARD_TYPE "Ardu"
#elif defined(POLOLU_MOTOR_SHIELD)
#define MOTOR_BOARD_TYPE "Polo"
#elif defined(FUNDUMOTO_SHIELD)
#define MOTOR_BOARD_TYPE "Fundu"
#elif defined(FIREBOX_MK1)
#define MOTOR_BOARD_TYPE "FireBox1"
#elif if defined(FIREBOX_MK1S)
#define MOTOR_BOARD_TYPE "FireBox1S"
#endif
#endif #endif

View File

@ -304,7 +304,7 @@ void DCCEXParser::parse(Print * stream, byte *com, bool blocking) {
case 's': // <s> case 's': // <s>
StringFormatter::send(stream,F("<p%d>"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON ); StringFormatter::send(stream,F("<p%d>"),DCCWaveform::mainTrack.getPowerMode()==POWERMODE::ON );
StringFormatter::send(stream,F("<iDCC-EX-API / V-%S G-%S>"), VERSION, F(GITHUB_SHA)); StringFormatter::send(stream,F("<iDCC-EX V-%S / %S / %S G-%S>"), VERSION, F(ARDUINO_TYPE), F(MOTOR_BOARD_TYPE), F(GITHUB_SHA));
// TODO Send stats of speed reminders table // TODO Send stats of speed reminders table
// TODO send status of turnouts etc etc // TODO send status of turnouts etc etc
return; return;