1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

Merge branch 'dont-touch-wifi'

This commit is contained in:
Harald Barth 2020-11-14 13:21:55 +01:00
commit 48d03cc82f
3 changed files with 12 additions and 1 deletions

View File

@ -18,7 +18,7 @@
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 "DIAG.h"
#include "StringFormatter.h"
@ -157,6 +157,9 @@ wifiSerialState WifiInterface::setup2(const __FlashStringHelper* SSid, const __F
StringFormatter::send(wifiStream, F("AT+GMR\r\n"));
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
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
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
if (!checkForOK(10000, OK_SEARCH, true, false)) return WIFI_DISCONNECTED;

View File

@ -19,6 +19,7 @@
*/
#ifndef WifiInterface_h
#define WifiInterface_h
#include "config.h"
#include "DCCEXParser.h"
#include <Arduino.h>
#include <avr/pgmspace.h>

View File

@ -44,6 +44,12 @@ The configuration file for DCC++ EX Command Station
//
// 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_PASSWORD "Your network passwd"
#define WIFI_HOSTNAME "dccex"