diff --git a/CommandStation-EX.ino b/CommandStation-EX.ino index cba919c..5f1f87e 100644 --- a/CommandStation-EX.ino +++ b/CommandStation-EX.ino @@ -2,14 +2,11 @@ // © 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 +// Command station with optional support for 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. +// THE WIFI FEATURE IS NOT SUPPORTED ON ARDUINO DEVICES WITH ONLY 2KB RAM. //////////////////////////////////////////////////////////////////////////////////// #include "config.h" @@ -28,74 +25,14 @@ LiquidCrystal_I2C lcdDisplay = LiquidCrystal_I2C(LCD_ADDRESS, LCD_COLUMNS, LCD_L #endif #endif -// this code is here to demonstrate use of the DCC API and other techniques - -// myFilter is an example of an OPTIONAL command filter used to intercept < > commands from -// the usb or wifi streamm. It demonstrates how a command may be intercepted -// or even a new command created without having to break open the API library code. -// The filter is permitted to use or modify the parameter list before passing it on to -// the standard parser. By setting the opcode to 0, the standard parser will -// just ignore the command on the assumption that you have already handled it. -// -// The filter must be enabled by calling the DCC EXParser::setFilter method, see use in setup(). -#if ENABLE_CUSTOM_FILTER -void myComandFilter(Print *stream, byte &opcode, byte ¶mCount, int p[]) -{ - (void)stream; // avoid compiler warning if we don't access this parameter - switch (opcode) - { - case '!': // Create a bespoke new command to clear all loco reminders or specific locos e.g - if (paramCount == 0) - DCC::forgetAllLocos(); - else - for (int i = 0; i < paramCount; i++) - DCC::forgetLoco(p[i]); - opcode = 0; // tell parser to ignore this command as we have done it already - break; - default: // drop through and parser will use the command unaltered. - break; - } -} - -// This is an OPTIONAL example of a HTTP filter... -// If you have configured wifi and an HTTP request is received on the Wifi connection -// it will normally be rejected 404 Not Found. - -// If you wish to handle HTTP requests, you can create a filter and ask the WifiInterface to -// call your code for each detected http request. - -void myHttpFilter(Print *stream, byte *cmd) -{ - (void)cmd; // Avoid compiler warning because this example doesnt use this parameter - - // BEWARE - As soon as you start responding, the cmd buffer is trashed! - // You must get everything you need from it before using StringFormatter::send! - - StringFormatter::send(stream, F("HTTP/1.1 200 OK\nContent-Type: text/html\nConnnection: close\n\n")); - StringFormatter::send(stream, F("
This is my HTTP filter responding.