Skip to content

Commit

Permalink
Add define switch for remote console
Browse files Browse the repository at this point in the history
  • Loading branch information
nekomona committed Jul 3, 2023
1 parent c30da1c commit e3d2e80
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/GlobalVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ extern SlimeVR::Configuration::Configuration configuration;
extern SlimeVR::Sensors::SensorManager sensorManager;
extern SlimeVR::Network::Manager networkManager;
extern SlimeVR::Network::Connection networkConnection;
#if USE_REMOTE_COMMAND
extern SlimeVR::Network::RemoteCmd networkRemoteCmd;
#endif

#endif
1 change: 1 addition & 0 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#define serialDebug false // Set to true to get Serial output for debugging
#define serialBaudRate 115200
#define USE_REMOTE_COMMAND true
#define LED_INTERVAL_STANDBY 10000
#define PRINT_STATE_EVERY_MS 60000

Expand Down
2 changes: 2 additions & 0 deletions src/logging/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ namespace SlimeVR

Serial.printf("[%-5s] [%s] %s\n", levelToString(level), buf, buffer);

#if USE_REMOTE_COMMAND
if (getRemoteCmdConncted())
{
getRemoteCmdStream().printf("[%-5s] [%s] %s\n", levelToString(level), buf, buffer);
}
#endif
}
}
}
2 changes: 2 additions & 0 deletions src/logging/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ namespace SlimeVR

Serial.println();

#if USE_REMOTE_COMMAND
if (getRemoteCmdConncted())
{
Stream & networkStream = getRemoteCmdStream();
Expand All @@ -112,6 +113,7 @@ namespace SlimeVR

networkStream.println();
}
#endif
}

const char *const m_Prefix;
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ SlimeVR::Status::StatusManager statusManager;
SlimeVR::Configuration::Configuration configuration;
SlimeVR::Network::Manager networkManager;
SlimeVR::Network::Connection networkConnection;
#if USE_REMOTE_COMMAND
SlimeVR::Network::RemoteCmd networkRemoteCmd;
#endif

int sensorToCalibrate = -1;
bool blinking = false;
Expand Down
4 changes: 4 additions & 0 deletions src/network/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ void Manager::update() {
if (!wasConnected) {
// WiFi was reconnected, rediscover the server and reconnect
networkConnection.reset();
#ifdef USE_REMOTE_COMMAND
networkRemoteCmd.reset();
#endif
}

networkConnection.update();
#ifdef USE_REMOTE_COMMAND
networkRemoteCmd.update();
#endif
}

} // namespace Network
Expand Down
2 changes: 2 additions & 0 deletions src/serial/serialcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,13 @@ namespace SerialCommands {

void update() {
cmdCallbacks.updateCmdProcessing(&cmdParser, &cmdBuffer, &Serial);
#if USE_REMOTE_COMMAND
if (networkRemoteCmd.isConnected()) {
Stream & networkStream = networkRemoteCmd.getStream();
while (networkStream.available()) {
cmdCallbacks.updateCmdProcessing(&cmdParser, &cmdBuffer, &networkStream);
}
}
#endif
}
}

0 comments on commit e3d2e80

Please sign in to comment.