From d0b0a7e2e5c756d7891b85e8db84e3c3fac3f6cb Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 10 Dec 2024 00:25:53 -0800 Subject: [PATCH] small fixes for timing and stuff --- VortexEngine/src/Buttons/Buttons.cpp | 7 +------ VortexEngine/src/Time/TimeControl.cpp | 13 ++++++------- VortexEngine/src/VortexEngine.cpp | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/VortexEngine/src/Buttons/Buttons.cpp b/VortexEngine/src/Buttons/Buttons.cpp index b146ac3118..b17c2f36b1 100644 --- a/VortexEngine/src/Buttons/Buttons.cpp +++ b/VortexEngine/src/Buttons/Buttons.cpp @@ -7,13 +7,8 @@ #include "../Time/Timings.h" #endif -#if SPARK_HANDLE == 1 -// handle is on 47 -#define BUTTON_PIN 47 -#else -// orbit is on 7 +// spark button pin #define BUTTON_PIN 5 -#endif // Since there is only one button I am just going to expose a global pointer to // access it, instead of making the Button class static in case a second button diff --git a/VortexEngine/src/Time/TimeControl.cpp b/VortexEngine/src/Time/TimeControl.cpp index 631b624171..ba13756287 100644 --- a/VortexEngine/src/Time/TimeControl.cpp +++ b/VortexEngine/src/Time/TimeControl.cpp @@ -2,6 +2,8 @@ #include +#include "../VortexConfig.h" + #include "../Memory/Memory.h" #include "../Log/Log.h" @@ -22,7 +24,7 @@ static LARGE_INTEGER tps; static LARGE_INTEGER start; #endif -#ifdef VORTEX_EMBEDDED +#if VORTEX_EMBEDDED == 1 #include #endif @@ -194,7 +196,7 @@ uint32_t Time::microseconds() void Time::delayMicroseconds(uint32_t us) { -#ifdef _WIN32 +#if VORTEX_EMBEDDED == 1 || defined(_WIN32) uint32_t newtime = microseconds() + us; while (microseconds() < newtime) { // busy loop @@ -206,11 +208,8 @@ void Time::delayMicroseconds(uint32_t us) void Time::delayMilliseconds(uint32_t ms) { -#ifdef VORTEX_EMBEDDED - // not very accurate - for (uint16_t i = 0; i < ms; ++i) { - delayMicroseconds(1000); - } +#if VORTEX_EMBEDDED == 1 + delay(ms); #elif defined(_WIN32) Sleep(ms); #else diff --git a/VortexEngine/src/VortexEngine.cpp b/VortexEngine/src/VortexEngine.cpp index 1d366932a8..f247a81141 100644 --- a/VortexEngine/src/VortexEngine.cpp +++ b/VortexEngine/src/VortexEngine.cpp @@ -31,7 +31,7 @@ bool VortexEngine::init() { // all of the global controllers if (!Time::init()) { - DEBUG_LOG("Time failed to initialize"); + //DEBUG_LOG("Time failed to initialize"); return false; } if (!SerialComs::init()) { @@ -180,7 +180,7 @@ void VortexEngine::runMainLogic() // check for serial first before anything runs, but as a result if we open // editor we have to call modes load inside here - if (!Menus::checkInMenu() && SerialComs::checkSerial()) { + if ((Menus::curMenuID() != MENU_EDITOR_CONNECTION) && SerialComs::checkSerial()) { // directly open the editor connection menu because we are connected to USB serial Menus::openMenu(MENU_EDITOR_CONNECTION); }