mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
DONT_TOUCH_WIFI_CONFIG feature
This commit is contained in:
parent
b1ac7feb01
commit
e809a460cc
|
@ -18,7 +18,7 @@
|
||||||
along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WifiInterface.h" /* config.h and defines.h included here */
|
#include "WifiInterface.h" /* config.h included there */
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
@ -157,6 +157,9 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F
|
||||||
StringFormatter::send(wifiStream, F("AT+GMR\r\n"));
|
StringFormatter::send(wifiStream, F("AT+GMR\r\n"));
|
||||||
checkForOK(2000, OK_SEARCH, true, false); // Makes this visible on the console
|
checkForOK(2000, OK_SEARCH, true, false); // Makes this visible on the console
|
||||||
|
|
||||||
|
#ifdef DONT_TOUCH_WIFI_CONF
|
||||||
|
DIAG(F("\nDONT_TOUCH_WIFI_CONF was set: Using existing config\n"));
|
||||||
|
#else
|
||||||
StringFormatter::send(wifiStream, F("AT+CWMODE=1\r\n")); // configure as "station" = WiFi client
|
StringFormatter::send(wifiStream, F("AT+CWMODE=1\r\n")); // configure as "station" = WiFi client
|
||||||
checkForOK(1000, OK_SEARCH, true); // Not always OK, sometimes "no change"
|
checkForOK(1000, OK_SEARCH, true); // Not always OK, sometimes "no change"
|
||||||
|
|
||||||
|
@ -256,6 +259,7 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F
|
||||||
|
|
||||||
StringFormatter::send(wifiStream, F("AT+CIPSERVER=1,%d\r\n"), port); // turn on server on port
|
StringFormatter::send(wifiStream, F("AT+CIPSERVER=1,%d\r\n"), port); // turn on server on port
|
||||||
if (!checkForOK(10000, OK_SEARCH, true)) return WIFI_DISCONNECTED;
|
if (!checkForOK(10000, OK_SEARCH, true)) return WIFI_DISCONNECTED;
|
||||||
|
#endif //DONT_TOUCH_WIFI_CONF
|
||||||
|
|
||||||
StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); // Display ip addresses to the DIAG
|
StringFormatter::send(wifiStream, F("AT+CIFSR\r\n")); // Display ip addresses to the DIAG
|
||||||
if (!checkForOK(10000, OK_SEARCH, true, false)) return WIFI_DISCONNECTED;
|
if (!checkForOK(10000, OK_SEARCH, true, false)) return WIFI_DISCONNECTED;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
#ifndef WifiInterface_h
|
#ifndef WifiInterface_h
|
||||||
#define WifiInterface_h
|
#define WifiInterface_h
|
||||||
|
#include "config.h"
|
||||||
#include "DCCEXParser.h"
|
#include "DCCEXParser.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
|
|
@ -44,6 +44,12 @@ The configuration file for DCC++ EX Command Station
|
||||||
//
|
//
|
||||||
// DEFINE WiFi Parameters (only in effect if WIFI is on)
|
// DEFINE WiFi Parameters (only in effect if WIFI is on)
|
||||||
//
|
//
|
||||||
|
//#define DONT_TOUCH_WIFI_CONF
|
||||||
|
//
|
||||||
|
// if DONT_TOUCH_WIFI_CONF is set, all WIFI config will be done with
|
||||||
|
// the <+> commands and this sketch will not change anything over
|
||||||
|
// AT commands and the WIFI_* defines below do not have any effect.
|
||||||
|
//
|
||||||
#define WIFI_SSID "Your network name"
|
#define WIFI_SSID "Your network name"
|
||||||
#define WIFI_PASSWORD "Your network passwd"
|
#define WIFI_PASSWORD "Your network passwd"
|
||||||
#define WIFI_HOSTNAME "dccex"
|
#define WIFI_HOSTNAME "dccex"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user