Skip to content

Commit

Permalink
V1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Trusty77 committed Nov 8, 2020
1 parent 4429d07 commit 6f1bbd9
Show file tree
Hide file tree
Showing 149 changed files with 5,718 additions and 601 deletions.
Binary file modified DCCpp.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions VStudio/ArduinoIno.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
//#include "../examples/Autotest/Autotest.ino"
//#include "../examples/EthernetDcc/EthernetDcc.ino"
//#include "../examples/EthernetDcc/WiFiDcc.ino"
//#include "../examples/MaxiDcc/MaxiDcc.ino"
#include "../examples/MaxiDcc/MaxiDcc.ino"
//#include "../examples/MiniDcc/MiniDcc.ino"
#include "../examples/SerialDcc/SerialDcc.ino"
//#include "../examples/SerialDcc/SerialDcc.ino"
//#include "../../..//TPC/DCC/DCC.ino"

//#include "TestExe.ino"
Expand Down
16 changes: 10 additions & 6 deletions examples/Autotest/Autotest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct StateMachineItem
StateMachineItem *StateMachineItem::first = NULL;

StateMachineItem *currentItem = NULL;
unsigned long time = 0;
unsigned long currentTime = 0;

void setup()
{
Expand All @@ -82,15 +82,19 @@ void setup()
new StateMachineItem(500, "f 3 128", "Light off"); // Light off

DCCpp::begin();
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
DCCpp::beginMain(UNDEFINED_PIN, DCC_SIGNAL_PIN_MAIN, 11, A0);
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
#if defined(ARDUINO_ARCH_ESP32)
DCCpp::beginMain(UNDEFINED_PIN, 33, 32, 36);
#else
DCCpp::beginMain(UNDEFINED_PIN, DCC_SIGNAL_PIN_MAIN, 11, A0);
#endif

DCCpp::powerOn();

// Start on first item
// Start timer too.
currentItem = StateMachineItem::first;
time = millis();
currentTime = millis();

TextCommand::parse(currentItem->command);
}
Expand All @@ -100,7 +104,7 @@ void loop()
{
DCCpp::loop();

if ((int)(millis() - time) >= currentItem->delay)
if ((int)(millis() - currentTime) >= currentItem->delay)
{
currentItem = currentItem->next;
if (currentItem == NULL)
Expand All @@ -109,7 +113,7 @@ void loop()
Serial.println("Restart");
}

time = millis();
currentTime = millis();
TextCommand::parse(currentItem->command);
Serial.println(currentItem->comment);
}
Expand Down
57 changes: 57 additions & 0 deletions examples/EthernetDcc/DCCpp.h.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//-------------------------------------------------------------------
#ifndef __DCCpp_H__
#define __DCCpp_H__
//-------------------------------------------------------------------

/** @file DCCpp.h
Main include file of the library.*/

#define DCCPP_LIBRARY_VERSION "VERSION DCCpp library: 1.4.1"

#pragma warning (disable : 4005)
//#define DCCPP_DEBUG_MODE
//#define DCCPP_DEBUG_VERBOSE_MODE
#define DCCPP_PRINT_DCCPP
#pragma warning (default : 4005)

//#define USE_ONLY1_INTERRUPT
//#define USE_TURNOUT
//#define USE_EEPROM
//#define USE_OUTPUT
//#define USE_SENSOR
#define USE_TEXTCOMMAND
#define USE_ETHERNET_WIZNET_5100
//#define USE_ETHERNET_WIZNET_5500
//#define USE_ETHERNET_WIZNET_5200
//#define USE_ETHERNET_ENC28J60


#if defined(USE_ETHERNET_WIZNET_5100) || defined(USE_ETHERNET_WIZNET_5500) || defined(USE_ETHERNET_WIZNET_5200) || defined(USE_ETHERNET_ENC28J60)
#define USE_ETHERNET
#endif

/////////////////////////////////////

#include "DCCpp_Uno.h"
#include "PacketRegister.h"
#include "CurrentMonitor.h"
#include "Config.h"
#include "Comm.h"
#ifdef USE_TURNOUT
#include "Turnout.h"
#endif
#ifdef USE_EEPROM
#include "EEStore.h"
#endif
#ifdef USE_OUTPUT
#include "Outputs.h"
#endif
#ifdef USE_SENSOR
#include "Sensor.h"
#endif
#ifdef USE_TEXTCOMMAND
#include "TextCommand.h"
#endif

#include "DCCpp.hpp"
#endif
6 changes: 5 additions & 1 deletion examples/EthernetDcc/EthernetDcc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ void setup()
Serial.begin(115200);

DCCpp::begin();
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
#if defined(ARDUINO_ARCH_ESP32)
DCCpp::beginMain(UNDEFINED_PIN, 33, 32, 36);
#else
DCCpp::beginMain(UNDEFINED_PIN, DCC_SIGNAL_PIN_MAIN, 3, A0);
#endif
DCCpp::beginEthernet(mac, ip, EthernetProtocol::TCP);
}

Expand Down
57 changes: 57 additions & 0 deletions examples/MaxiDcc/DCCpp.h.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//-------------------------------------------------------------------
#ifndef __DCCpp_H__
#define __DCCpp_H__
//-------------------------------------------------------------------

/** @file DCCpp.h
Main include file of the library.*/

#define DCCPP_LIBRARY_VERSION "VERSION DCCpp library: 1.4.1"

#pragma warning (disable : 4005)
//#define DCCPP_DEBUG_MODE
//#define DCCPP_DEBUG_VERBOSE_MODE
#define DCCPP_PRINT_DCCPP
#pragma warning (default : 4005)

//#define USE_ONLY1_INTERRUPT
#define USE_TURNOUT
#define USE_EEPROM
#define USE_OUTPUT
#define USE_SENSOR
#define USE_TEXTCOMMAND
//#define USE_ETHERNET_WIZNET_5100
//#define USE_ETHERNET_WIZNET_5500
//#define USE_ETHERNET_WIZNET_5200
//#define USE_ETHERNET_ENC28J60


#if defined(USE_ETHERNET_WIZNET_5100) || defined(USE_ETHERNET_WIZNET_5500) || defined(USE_ETHERNET_WIZNET_5200) || defined(USE_ETHERNET_ENC28J60)
#define USE_ETHERNET
#endif

/////////////////////////////////////

#include "DCCpp_Uno.h"
#include "PacketRegister.h"
#include "CurrentMonitor.h"
#include "Config.h"
#include "Comm.h"
#ifdef USE_TURNOUT
#include "Turnout.h"
#endif
#ifdef USE_EEPROM
#include "EEStore.h"
#endif
#ifdef USE_OUTPUT
#include "Outputs.h"
#endif
#ifdef USE_SENSOR
#include "Sensor.h"
#endif
#ifdef USE_TEXTCOMMAND
#include "TextCommand.h"
#endif

#include "DCCpp.hpp"
#endif
19 changes: 13 additions & 6 deletions examples/MaxiDcc/MaxiDcc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,25 @@ void setup()
buttonEncoder.begin(EVENT_ENCODER, 14, 8, 2);
buttonCancel.begin(EVENT_CANCEL, A3);
buttonEmergency.begin(EVENT_EMERGENCY, A4);
buttonF0.begin(EVENT_FUNCTION0, A1);
buttonF1.begin(EVENT_FUNCTION1, A2);
#if defined(ARDUINO_ARCH_ESP32)
buttonF0.begin(EVENT_FUNCTION0, A5);
buttonF1.begin(EVENT_FUNCTION1, A6);
#else
buttonF0.begin(EVENT_FUNCTION0, A1);
buttonF1.begin(EVENT_FUNCTION1, A2);
#endif
buttonTurnout1.begin(EVENT_TURNOUT1, 30);
buttonTurnout2.begin(EVENT_TURNOUT2, 31);

DCCpp::begin();
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
// Configuration for my LMD18200. See the page 'Configuration lines' in the documentation for other samples.
#if defined(ARDUINO_ARCH_ESP32)
DCCpp::beginMain(UNDEFINED_PIN, 33, 32, 36);
DCCpp::beginProg(UNDEFINED_PIN, 21, 22, 23);
#else
DCCpp::beginMain(UNDEFINED_PIN, DCC_SIGNAL_PIN_MAIN, 11, A0);
DCCpp::beginProg(UNDEFINED_PIN, DCC_SIGNAL_PIN_PROG, 3, A1);
#endif

locoId = 3;
locoStepsNumber = 128;
Expand Down Expand Up @@ -140,15 +150,13 @@ void loop()
DCCpp::setFunctionsMain(2, locoId, locoFunctions);
break;

case DCCINT(100, 0):
case EVENT_TURNOUT1:
if (turn1.isActivated())
turn1.inactivate();
else
turn1.activate();
break;

case DCCINT(20, 0):
case EVENT_TURNOUT2:
if (turn2.isActivated())
turn2.inactivate();
Expand All @@ -159,4 +167,3 @@ void loop()

}
}

Loading

0 comments on commit 6f1bbd9

Please sign in to comment.