diff --git a/openBeken_win32_mvsc2017.vcxproj b/openBeken_win32_mvsc2017.vcxproj
index 51e7b39b9..274533e46 100644
--- a/openBeken_win32_mvsc2017.vcxproj
+++ b/openBeken_win32_mvsc2017.vcxproj
@@ -293,6 +293,7 @@
true
+
true
@@ -306,6 +307,7 @@
true
+
true
@@ -506,6 +508,7 @@
+
diff --git a/openBeken_win32_mvsc2017.vcxproj.filters b/openBeken_win32_mvsc2017.vcxproj.filters
index 808ba70c7..a250631fa 100644
--- a/openBeken_win32_mvsc2017.vcxproj.filters
+++ b/openBeken_win32_mvsc2017.vcxproj.filters
@@ -417,6 +417,15 @@
HAL
+
+ SelfTest
+
+
+ Drv
+
+
+ Drv
+
diff --git a/src/driver/drv_main.c b/src/driver/drv_main.c
index 6d5ff07c2..99286e51a 100644
--- a/src/driver/drv_main.c
+++ b/src/driver/drv_main.c
@@ -82,10 +82,10 @@ static driver_t g_drivers[] = {
#if PLATFORM_BEKEN
{ "SM16703P", SM16703P_Init, NULL, NULL, NULL, NULL, NULL, false },
{ "IR", DRV_IR_Init, NULL, NULL, DRV_IR_RunFrame, NULL, NULL, false },
+#endif
+#if defined(PLATFORM_BEKEN) || defined(WINDOWS)
{ "DDP", DRV_DDP_Init, NULL, NULL, DRV_DDP_RunFrame, DRV_DDP_Shutdown, NULL, false },
{ "SSDP", DRV_SSDP_Init, DRV_SSDP_RunEverySecond, NULL, DRV_SSDP_RunQuickTick, DRV_SSDP_Shutdown, NULL, false },
-#endif
-#if defined(PLATFORM_BEKEN) || defined(WINDOWS)
{ "PWMToggler", DRV_InitPWMToggler, NULL, DRV_Toggler_AppendInformationToHTTPIndexPage, NULL, NULL, NULL, false },
{ "DGR", DRV_DGR_Init, DRV_DGR_RunEverySecond, NULL, DRV_DGR_RunQuickTick, DRV_DGR_Shutdown, DRV_DGR_OnChannelChanged, false },
#endif
diff --git a/src/httpserver/http_tcp_server_nonblocking.c b/src/httpserver/http_tcp_server_nonblocking.c
index ff0e206aa..6f0ae4557 100644
--- a/src/httpserver/http_tcp_server_nonblocking.c
+++ b/src/httpserver/http_tcp_server_nonblocking.c
@@ -133,7 +133,7 @@ void HTTPServer_RunQuickTick() {
request.replymaxlen = DEFAULT_BUFLEN;
- printf("HTTP Server for Windows: Bytes received: %d \n", iResult);
+ //printf("HTTP Server for Windows: Bytes received: %d \n", iResult);
len = HTTP_ProcessPacket(&request);
if(len > 0) {
@@ -180,7 +180,7 @@ void HTTPServer_RunQuickTick() {
break;
}
long delta = timeGetTime() - firstAttempt;
- if (delta > 100) {
+ if (delta > 2) {
printf("HTTP server would freeze to long!\n");
break; // too long freeze!
diff --git a/src/new_pins.h b/src/new_pins.h
index 3fa7f9e9c..d34ebc84a 100644
--- a/src/new_pins.h
+++ b/src/new_pins.h
@@ -279,8 +279,8 @@ typedef struct mainConfig_s {
// 0x000005A0
char ping_host[64];
char initCommandLine[512];
-} mainConfig_t; // size 0x000007E0
-
+} mainConfig_t; // size 0x000007E0 (2016 decimal)
+#define MAGIC_CONFIG_SIZE 2016
extern mainConfig_t g_cfg;
extern char g_enable_pins;
diff --git a/src/sim/Controller_Button.cpp b/src/sim/Controller_Button.cpp
index d747745c7..bd06e1e5b 100644
--- a/src/sim/Controller_Button.cpp
+++ b/src/sim/Controller_Button.cpp
@@ -2,6 +2,7 @@
#include "Controller_Button.h"
#include "Shape.h"
#include "Junction.h"
+#include "sim_import.h"
CControllerButton::CControllerButton(class CJunction *_a, class CJunction *_b) {
timeAfterMouseHold = 99.0f;
@@ -41,7 +42,8 @@ void CControllerButton::sendEvent(int code, const class Coord &mouseOfs) {
}
}
void CControllerButton::onDrawn() {
- float speed = 2.0f;
+ float dt = SIM_GetDeltaTimeSeconds();
+ float speed = 160.0f * dt;
if (timeAfterMouseHold < 0.2f) {
remDist = mover->moveTowards(closedPos, speed);
}
@@ -49,7 +51,7 @@ void CControllerButton::onDrawn() {
remDist = 9999;
mover->moveTowards(openPos, speed);
}
- timeAfterMouseHold += 0.1f;
+ timeAfterMouseHold += dt;
}
#endif
diff --git a/src/sim/Text.cpp b/src/sim/Text.cpp
index 17022fe7f..8e031a0b2 100644
--- a/src/sim/Text.cpp
+++ b/src/sim/Text.cpp
@@ -5,7 +5,7 @@ void CText::recalcBoundsSelf() {
bounds.clear();
int line = 0;
int ch = 0;;
- char buffer[512];
+ char buffer[4096];
CMD_ExpandConstantsWithinString(txt.c_str(), buffer, sizeof(buffer));
const char *p = buffer;
bounds.addPoint(Coord(0, -8));
@@ -74,7 +74,7 @@ float CText::getFloat() const {
}
void CText::setTextf(const char *fmt, ...) {
va_list argList;
- char buffer[512];
+ char buffer[4096];
va_start(argList, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, argList);
va_end(argList);
@@ -89,7 +89,7 @@ void CText::appendText(const char *s) {
void CText::drawShape() {
- char buffer[512];
+ char buffer[4096];
if (bTextEditMode) {
recalcBoundsSelf();
}
diff --git a/src/sim/sim_import.h b/src/sim/sim_import.h
index ec3199fe4..641e7b11c 100644
--- a/src/sim/sim_import.h
+++ b/src/sim/sim_import.h
@@ -18,6 +18,7 @@ extern "C" {
void SIM_DoFreshOBKBoot();
void SIM_ClearOBK();
bool SIM_IsFlashModified();
+ float SIM_GetDeltaTimeSeconds();
#ifdef __cplusplus
}
#endif
diff --git a/src/sim/sim_sdl.cpp b/src/sim/sim_sdl.cpp
index 917f211f9..145f383e2 100644
--- a/src/sim/sim_sdl.cpp
+++ b/src/sim/sim_sdl.cpp
@@ -52,8 +52,8 @@ int drawTextInternal(float x, float y, const char *buffer) {
int drawText(class CStyle *style, int x, int y, const char* fmt, ...) {
va_list argList;
- char buffer2[512];
- char buffer[512];
+ char buffer2[4096];
+ char buffer[4096];
va_start(argList, fmt);
vsnprintf(buffer2, sizeof(buffer2), fmt, argList);
va_end(argList);
diff --git a/src/user_main.c b/src/user_main.c
index 548c14517..3cb4efdf0 100644
--- a/src/user_main.c
+++ b/src/user_main.c
@@ -276,6 +276,10 @@ void Main_OnEverySecond()
const char *safe;
int i;
+#ifdef WINDOWS
+ g_bHasWiFiConnected = 1;
+#endif
+
// run_adc_test();
newMQTTState = MQTT_RunEverySecondUpdate();
if(newMQTTState != bMQTTconnected) {
diff --git a/src/win_main.c b/src/win_main.c
index 8931ee51f..45df20eaf 100644
--- a/src/win_main.c
+++ b/src/win_main.c
@@ -145,6 +145,10 @@ void Win_DoUnitTests() {
// reset whole device
SIM_ClearOBK();
}
+long g_delta;
+float SIM_GetDeltaTimeSeconds() {
+ return g_delta * 0.001f;
+}
long start_time = 0;
bool bStartTimeSet = false;
long SIM_GetTime() {
@@ -172,8 +176,10 @@ int __cdecl main(int argc, char **argv)
printf("WSAStartup failed with error: %d\n", iResult);
return 1;
}
-
-
+ if (sizeof(mainConfig_t) != MAGIC_CONFIG_SIZE) {
+ printf("sizeof(mainConfig_t) != MAGIC_CONFIG_SIZE!: %i\n", sizeof(mainConfig_t));
+ system("pause");
+ }
if (bWantsUnitTests) {
SIM_DoFreshOBKBoot();
// let things warm up a little
@@ -195,10 +201,10 @@ int __cdecl main(int argc, char **argv)
long prev_time = SIM_GetTime();
while (1) {
long cur_time = SIM_GetTime();
- long delta = cur_time - prev_time;
- if (delta <= 0)
+ g_delta = cur_time - prev_time;
+ if (g_delta <= 0)
continue;
- Sim_RunFrame(delta);
+ Sim_RunFrame(g_delta);
SIM_RunWindow();
prev_time = cur_time;
}