diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c index 00f3e940f..8ed8798cb 100644 --- a/src/httpserver/new_http.c +++ b/src/httpserver/new_http.c @@ -2,15 +2,16 @@ #include "../new_common.h" #include "ctype.h" -#include "lwip/sockets.h" #if WINDOWS //#include #include //#include #elif PLATFORM_XR809 +#include "lwip/sockets.h" #include #include #else +#include "lwip/sockets.h" #include "str_pub.h" #endif #include "new_http.h" @@ -1199,7 +1200,26 @@ int HTTP_ProcessPacket(http_request_t *request) { } } // strcat(outbuf,""); + + + if(http_getArg(urlStr,"restart",tmpA,sizeof(tmpA))) { + poststr(request,"
Module will restart soon
"); +#if WINDOWS + +#elif PLATFORM_XR809 + +#else + RESET_ScheduleModuleReset(3); +#endif + } + poststr(request,"
"); + + poststr(request,"
\ + \ + \ +
"); + poststr(request,"
"); diff --git a/src/httpserver/rest_interface.c b/src/httpserver/rest_interface.c index b57a812fb..eebb2ba5e 100644 --- a/src/httpserver/rest_interface.c +++ b/src/httpserver/rest_interface.c @@ -15,9 +15,6 @@ #include "../flash_config/flash_config.h" #include "../new_cfg.h" - -extern int g_reset; - extern UINT32 flash_read(char *user_buf, UINT32 count, UINT32 address); @@ -701,7 +698,7 @@ static int http_rest_post_reboot(http_request_t *request){ http_setup(request, httpMimeTypeJson); hprintf128(request, "{\"reboot\":%d}", 3); ADDLOG_DEBUG(LOG_FEATURE_API, "Rebooting in 3 seconds..."); - g_reset = 3; + RESET_ScheduleModuleReset(3); poststr(request,NULL); return 0; } diff --git a/src/new_cfg.c b/src/new_cfg.c index 615fbc376..dd746e681 100644 --- a/src/new_cfg.c +++ b/src/new_cfg.c @@ -28,7 +28,7 @@ static char g_mqtt_pass[128] = "qqqqqqqqqq"; static char g_wifi_ssid[64] = { 0 }; static char g_wifi_pass[64] = { 0 }; -#if PLATFORM_XR809 +#if PLATFORM_XR809 || WINDOWS #define CONFIG_URL_SIZE_MAX 64 #endif diff --git a/src/new_common.h b/src/new_common.h index 61a396369..4155a40df 100644 --- a/src/new_common.h +++ b/src/new_common.h @@ -81,4 +81,7 @@ int strcpy_safe(char *tg, const char *src, int tgMaxLen); void urldecode2_safe(char *dst, const char *srcin, int maxDstLen); int Time_getUpTimeSeconds(); char Tiny_CRC8(const char *data,int length); +void RESET_ScheduleModuleReset(int delSeconds); + + diff --git a/src/new_pins.c b/src/new_pins.c index 2b7ef5b4b..68d14323f 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -419,6 +419,7 @@ void Channel_OnChanged(int ch) { int i; int iVal; int bOn; + int pwmIndex; //bOn = BIT_CHECK(g_channelStates,ch); @@ -443,7 +444,7 @@ void Channel_OnChanged(int ch) { if(g_channelChangeCallback != 0) { g_channelChangeCallback(ch,iVal); } - int pwmIndex = PIN_GetPWMIndexForPinIndex(i); + pwmIndex = PIN_GetPWMIndexForPinIndex(i); #if WINDOWS diff --git a/src/user_main.c b/src/user_main.c index 9cf40a06a..14f3719b6 100644 --- a/src/user_main.c +++ b/src/user_main.c @@ -72,6 +72,10 @@ int g_savecfg = 0; void bk_reboot(void); +void RESET_ScheduleModuleReset(int delSeconds) { + g_reset = delSeconds; +} + int Time_getUpTimeSeconds() { return g_secondsElapsed; } @@ -377,6 +381,12 @@ void user_main(void) ADDLOG_INFO(LOG_FEATURE_MAIN, "started timer\r\n"); } +#if PLATFORM_BK7231N + +// right now Free is somewhere else + +#else + #undef Free // This is needed by tuya_hal_wifi_release_ap. // How come that the Malloc was not undefined, but Free is? @@ -386,3 +396,5 @@ void Free(void* ptr) os_free(ptr); } + +#endif diff --git a/src/win_main.c b/src/win_main.c index 55d95ab01..be1256da9 100644 --- a/src/win_main.c +++ b/src/win_main.c @@ -96,7 +96,7 @@ int __cdecl main(void) PIN_SetPinChannelForPinIndex(2,2); PIN_SetPinRoleForPinIndex(2,IOR_PWM); - init_rest(); + //init_rest(); // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); diff --git a/windowsTest_msvc2008.vcproj b/windowsTest_msvc2008.vcproj index a3e7a6075..e0a9a1a4f 100644 --- a/windowsTest_msvc2008.vcproj +++ b/windowsTest_msvc2008.vcproj @@ -250,6 +250,14 @@ + + +