From c126d69e2b13c1ec168a08b86e77d2649f7f1f24 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Wed, 10 Dec 2014 15:33:02 +0100 Subject: [PATCH] Added demo mode define, in which users cant mess with wifi settings --- user/cgiwifi.c | 11 ++++++++--- user/stdout.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/user/cgiwifi.c b/user/cgiwifi.c index 91f6d4b..3744e21 100644 --- a/user/cgiwifi.c +++ b/user/cgiwifi.c @@ -21,6 +21,9 @@ Cgi/template routines for the /wifi url. #include "io.h" #include "espmissingincludes.h" +//Enable this to disallow any changes in AP settings +//#define DEMO_MODE + //WiFi access point data typedef struct { char ssid[32]; @@ -195,11 +198,11 @@ int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) { os_timer_disarm(&reassTimer); os_timer_setfn(&reassTimer, reassTimerCb, NULL); //Set to 0 if you want to disable the actual reconnecting bit -#if 1 +#ifdef DEMO_MODE + httpdRedirect(connData, "/wifi"); +#else os_timer_arm(&reassTimer, 1000, 0); httpdRedirect(connData, "connecting.html"); -#else - httpdRedirect(connData, "/wifi"); #endif return HTTPD_CGI_DONE; } @@ -218,8 +221,10 @@ int ICACHE_FLASH_ATTR cgiWifiSetMode(HttpdConnData *connData) { len=httpdFindArg(connData->getArgs, "mode", buff, sizeof(buff)); if (len!=0) { os_printf("cgiWifiSetMode: %s\n", buff); +#ifndef DEMO_MODE wifi_set_opmode(atoi(buff)); system_restart(); +#endif } httpdRedirect(connData, "/wifi"); return HTTPD_CGI_DONE; diff --git a/user/stdout.c b/user/stdout.c index 68efd54..04473cc 100644 --- a/user/stdout.c +++ b/user/stdout.c @@ -47,4 +47,4 @@ void stdoutInit() { //Install our own putchar handler os_install_putc1((void *)stdoutPutchar); -} \ No newline at end of file +}