mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Rename .ino to match folder name and make changes for WiFi
This commit is contained in:
parent
6eec133b24
commit
ae2869ba8d
15
.gitignore
vendored
15
.gitignore
vendored
|
@ -1,7 +1,8 @@
|
||||||
.vscode/*
|
Release/*
|
||||||
!.vscode/settings.json
|
.ino.cpp
|
||||||
!.vscode/extensions.json
|
.pioenvs
|
||||||
*.code-workspace
|
.piolibdeps
|
||||||
|
.clang_complete
|
||||||
# Local History for Visual Studio Code
|
.gcc-flags.json
|
||||||
.history/
|
.pio/
|
||||||
|
.vscode/
|
||||||
|
|
74
CommandStation-EX.ino
Normal file
74
CommandStation-EX.ino
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* © 2020, Chris Harlow. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is a demonstattion of setting up a DCC-EX
|
||||||
|
* Command station to support direct connection of WiThrottle devices
|
||||||
|
* such as "Engine Driver". If you contriol your layout through JMRI
|
||||||
|
* then DON'T connect throttles to this wifi, connect them to JMRI.
|
||||||
|
*
|
||||||
|
* This is just 3 statements longer than the basic setup.
|
||||||
|
*
|
||||||
|
* THIS SETUP DOES NOT APPLY TO ARDUINO UNO WITH ONLY A SINGLE SERIAL PORT.
|
||||||
|
* REFER TO SEPARATE EXAMPLE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "DCCEX.h"
|
||||||
|
|
||||||
|
#ifdef ARDUINO_AVR_UNO
|
||||||
|
#include <SoftwareSerial.h>
|
||||||
|
SoftwareSerial Serial1(15,16); // YOU must get these pins correct to use Wifi on a UNO
|
||||||
|
#define WIFI_BAUD 9600
|
||||||
|
#else
|
||||||
|
#define WIFI_BAUD 115200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Create a serial command parser... Enables certain diagnostics and commands
|
||||||
|
// to be issued from the USB serial console
|
||||||
|
// This is NOT intended for JMRI....
|
||||||
|
|
||||||
|
DCCEXParser serialParser;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
// The main sketch has responsibilities during setup()
|
||||||
|
|
||||||
|
// Responsibility 1: Start the usb connection for diagnostics
|
||||||
|
// This is normally Serial but uses SerialUSB on a SAMD processor
|
||||||
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
// Start the WiFi interface on a MEGA, Uno cannot currently handle WiFi
|
||||||
|
// NOTE: References to Serial1 are for the serial port used to connect
|
||||||
|
// your wifi chip/shield.
|
||||||
|
|
||||||
|
Serial1.begin(WIFI_BAUD);
|
||||||
|
WifiInterface::setup(Serial1, F("Your network name"), F("your network password"),F("DCCEX"),3532);
|
||||||
|
|
||||||
|
// Responsibility 3: Start the DCC engine.
|
||||||
|
// Note: this provides DCC with two motor drivers, main and prog, which handle the motor shield(s)
|
||||||
|
// Standard supported devices have pre-configured macros but custome hardware installations require
|
||||||
|
// detailed pin mappings and may also require modified subclasses of the MotorDriver to implement specialist logic.
|
||||||
|
|
||||||
|
// STANDARD_MOTOR_SHIELD, POLOLU_MOTOR_SHIELD, FIREBOX_MK1, FIREBOX_MK1S are pre defined in MotorShields.h
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
DCC::begin(STANDARD_MOTOR_SHIELD);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// The main sketch has responsibilities during loop()
|
||||||
|
|
||||||
|
// Responsibility 1: Handle DCC background processes
|
||||||
|
// (loco reminders and power checks)
|
||||||
|
DCC::loop();
|
||||||
|
|
||||||
|
// Responsibility 2: handle any incoming commands on USB connection
|
||||||
|
serialParser.loop(Serial);
|
||||||
|
|
||||||
|
// Responsibility 3: Optionally handle any incoming WiFi traffic
|
||||||
|
WifiInterface::loop();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -115,7 +115,7 @@ void setup() {
|
||||||
WifiInterface::setHTTPCallback(myHttpFilter);
|
WifiInterface::setHTTPCallback(myHttpFilter);
|
||||||
|
|
||||||
// This is just for demonstration purposes
|
// This is just for demonstration purposes
|
||||||
DIAG(F("\n===== CVReader demonstrating DCC::getLocoId() call ==========\n"));
|
DIAG(F("\n===== DCCEX demonstrating DCC::getLocoId() call ==========\n"));
|
||||||
DCC::getLocoId(myCallback); // myCallback will be called with the result
|
DCC::getLocoId(myCallback); // myCallback will be called with the result
|
||||||
DIAG(F("\n===== DCC::getLocoId has returned, but the callback wont be executed until we are in loop() ======\n"));
|
DIAG(F("\n===== DCC::getLocoId has returned, but the callback wont be executed until we are in loop() ======\n"));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* © 2020, Chris Harlow. All rights reserved.
|
* © 2020, Chris Harlow. All rights reserved.
|
||||||
*
|
*
|
||||||
* This is a basic, no frills CVreader example of a DCC++ compatible setup.
|
* This is a basic, no frills DCC-EX example of a DCC++ compatible setup.
|
||||||
* There are more advanced examples in the examples folder i
|
* There are more advanced examples in the examples folder i
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "DCCEX.h"
|
#include "DCCEX.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create a serial command parser... Enables certain diagnostics and commands
|
// Create a serial command parser... Enables certain diagnostics and commands
|
||||||
// to be issued from the USB serial console
|
// to be issued from the USB serial console
|
||||||
// This is NOT intended for JMRI....
|
// This is NOT intended for JMRI....
|
|
@ -1,12 +1,12 @@
|
||||||
ECHO ON
|
ECHO ON
|
||||||
FOR /F "delims=" %%i IN ('dir %TMP%\arduino_build_* /b /ad-h /t:c /od') DO SET a=%%i
|
FOR /F "delims=" %%i IN ('dir %TMP%\arduino_build_* /b /ad-h /t:c /od') DO SET a=%%i
|
||||||
echo Most recent subfolder: %a% >%TMP%\OBJDUMP_%a%.txt
|
echo Most recent subfolder: %a% >%TMP%\OBJDUMP_%a%.txt
|
||||||
avr-objdump --private=mem-usage %TMP%\%a%\CVReader.ino.elf >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump --private=mem-usage %TMP%\%a%\DCCEX.ino.elf >>%TMP%\OBJDUMP_%a%.txt
|
||||||
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
||||||
avr-objdump -x -C %TMP%\%a%\CVReader.ino.elf | find ".text" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump -x -C %TMP%\%a%\DCCEX.ino.elf | find ".text" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
||||||
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
||||||
avr-objdump -x -C %TMP%\%a%\CVReader.ino.elf | find ".data" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump -x -C %TMP%\%a%\DCCEX.ino.elf | find ".data" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
||||||
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
ECHO ++++++++++++++++++++++++++++++++++ >>%TMP%\OBJDUMP_%a%.txt
|
||||||
avr-objdump -x -C %TMP%\%a%\CVReader.ino.elf | find ".bss" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
avr-objdump -x -C %TMP%\%a%\DCC.ino.elf | find ".bss" | sort /+25 /R >>%TMP%\OBJDUMP_%a%.txt
|
||||||
notepad %TMP%\OBJDUMP_%a%.txt
|
notepad %TMP%\OBJDUMP_%a%.txt
|
||||||
EXIT
|
EXIT
|
||||||
|
|
Loading…
Reference in New Issue
Block a user