2020-05-24 17:07:16 +02:00
|
|
|
#include "DCC.h"
|
2020-05-24 00:02:54 +02:00
|
|
|
#include "DIAG.h"
|
2020-05-25 14:38:18 +02:00
|
|
|
#include "JMRIParser.h"
|
2020-05-24 00:22:12 +02:00
|
|
|
|
|
|
|
/* this code is here to test the waveforwe generator and reveal the issues involved in programming track operations.
|
|
|
|
|
2020-05-26 13:44:02 +02:00
|
|
|
It tests the Waveform genartor and demonstrates how a DCC API function can be simply written
|
|
|
|
to transmit and receive DCC data on the programming track.
|
2020-05-24 00:22:12 +02:00
|
|
|
|
2020-05-26 13:44:02 +02:00
|
|
|
Once soem CVs have been listed, it then drops into JMRI input moce so you can play.
|
|
|
|
|
|
|
|
Important... Config.h contains hardware specific confioguration settings
|
|
|
|
that you will need to check.
|
2020-05-24 17:07:16 +02:00
|
|
|
|
2020-05-26 13:44:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int cvnums[] = {1, 2, 3, 4, 5, 8, 17, 18, 19, 21, 22, 29};
|
2020-05-24 00:02:54 +02:00
|
|
|
|
|
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
2020-05-24 17:07:16 +02:00
|
|
|
DCC::begin();
|
2020-05-26 13:44:02 +02:00
|
|
|
|
2020-06-01 14:56:02 +02:00
|
|
|
// DIAG(F("\n===== CVReader begin ==============================\n"));
|
|
|
|
//
|
|
|
|
// for (byte x = 0; x < sizeof(cvnums) / sizeof(cvnums[0]); x++) {
|
|
|
|
// int value = DCC::readCV(cvnums[x]);
|
|
|
|
// DIAG(F("\nCV %d = %d 0x%x %s\n"), cvnums[x], value, value, value >= 0 ? " VERIFIED OK" : "FAILED VERIFICATION");
|
|
|
|
// }
|
|
|
|
// DIAG(F("\n===== CVReader done ==============================\n"));
|
2020-05-26 00:03:11 +02:00
|
|
|
DIAG(F("\nReady for JMRI commands\n"));
|
2020-05-24 00:02:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2020-05-26 00:03:11 +02:00
|
|
|
DCC::loop(); // required to keep locos running and check powwer
|
2020-05-26 13:44:02 +02:00
|
|
|
|
|
|
|
// This line passes input on Serial to the JMRIparser
|
2020-05-26 00:03:11 +02:00
|
|
|
StringParser::loop(Serial, JMRIParser::parse);
|
|
|
|
}
|