Skip to content

Commit

Permalink
small fixes for timing and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Dec 10, 2024
1 parent 192370b commit d0b0a7e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
7 changes: 1 addition & 6 deletions VortexEngine/src/Buttons/Buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions VortexEngine/src/Time/TimeControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <math.h>

#include "../VortexConfig.h"

#include "../Memory/Memory.h"
#include "../Log/Log.h"

Expand All @@ -22,7 +24,7 @@ static LARGE_INTEGER tps;
static LARGE_INTEGER start;
#endif

#ifdef VORTEX_EMBEDDED
#if VORTEX_EMBEDDED == 1
#include <Arduino.h>
#endif

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions VortexEngine/src/VortexEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit d0b0a7e

Please sign in to comment.