Skip to content

Commit

Permalink
Merge branch 'desktop' of https://github.com/Unreal-Dan/VortexEngine
Browse files Browse the repository at this point in the history
…into desktop
  • Loading branch information
Unreal-Dan committed Sep 20, 2024
2 parents c68b357 + 806412d commit 800a7c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
19 changes: 14 additions & 5 deletions VortexEngine/src/Menus/MenuList/EditorConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
EditorConnection::EditorConnection(VortexEngine &engine, const RGBColor &col, bool advanced) :
Menu(engine, col, advanced),
m_state(STATE_DISCONNECTED),
m_allowReset(true)
m_allowReset(true),
m_previousModeIndex(0),
m_numModesToReceive(0)
{
}

Expand Down Expand Up @@ -106,6 +108,11 @@ Menu::MenuAction EditorConnection::run()
case STATE_IDLE:
// parse the receive buffer for any commands from the editor
handleCommand();
// watch for disconnects
if (!m_engine.serial().isConnected()) {
m_engine.leds().holdAll(RGB_GREEN);
leaveMenu(true);
}
break;
case STATE_PULL_MODES:
// editor requested pull modes, send the modes
Expand Down Expand Up @@ -260,16 +267,18 @@ Menu::MenuAction EditorConnection::run()
// clear the receive buffer and ack the mode, continue receiving
m_receiveBuffer.clear();
m_engine.serial().write(EDITOR_VERB_PUSH_EACH_MODE_ACK);
if (m_engine.modes().numModes() >= m_numModesToReceive) {
if (m_numModesToReceive > 0) {
m_numModesToReceive--;
}
if (!m_numModesToReceive) {
// success modes were received send the done
m_state = STATE_PUSH_EACH_MODE_DONE;
}
}
break;
case STATE_PUSH_EACH_MODE_DONE:
// say we are done
m_receiveBuffer.clear();
m_engine.serial().write(EDITOR_VERB_PUSH_EACH_MODE_DONE);
// did originally receive/send a DONE message here but it wasn't working
// on lightshow.lol so just skip to IDLE
m_state = STATE_IDLE;
break;
}
Expand Down
2 changes: 2 additions & 0 deletions VortexEngine/src/Serial/Serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void SerialComs::write(const char *msg, ...)
m_engine.vortexLib().vcallbacks()->serialWrite(buf, len);
#else
Serial.write(buf, len);
Serial.flush();
#endif
va_end(list);
#endif
Expand All @@ -108,6 +109,7 @@ void SerialComs::write(ByteStream &byteStream)
#else
Serial.write((const uint8_t *)&size, sizeof(size));
Serial.write((const uint8_t *)byteStream.rawData(), byteStream.rawSize());
Serial.flush();
#endif
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// and vice versa. But an engine on 2.0 cannot share savefiles with
// either of the engines on version 1.1 or 1.2
#ifndef VORTEX_VERSION_MINOR
#define VORTEX_VERSION_MINOR 2
#define VORTEX_VERSION_MINOR 3
#endif

// The build or patch number based on the major.minor version, this is
Expand Down

0 comments on commit 800a7c2

Please sign in to comment.