Skip to content

Commit

Permalink
5.4.0 Raw Restriction Setting, Apply Offsets (#577)
Browse files Browse the repository at this point in the history
* Crash Recovery Defaults to Off, add option to use space drag w/ uncalibrated playspace

* increment version 5.3.3

* Feat/apply offsets binding (#576)

* add apply offsets steamvr input

* add new binding to Readme

Co-authored-by: TheMrGong <gongora656@gmail.com>

* increment version 5.4.0

* added LH Console Interface class, WIP TX/RX list via lh console

* switch over to property based dongle information

* add ovr system wrapper

* add use of parameter to avoid warning as error

* openXR fix, and Change Display State of Chaperone Disabled

* update text

* format files

* clang 9.0.0 format

* add documentation update

* remove windows header include

* remove filesystem header

* fix uncal motion switching issue

Co-authored-by: TheMrGong <gongora656@gmail.com>
  • Loading branch information
ykeara and TheMrGong authored Feb 23, 2022
1 parent 522ba46 commit eea7134
Show file tree
Hide file tree
Showing 24 changed files with 991 additions and 13 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Override actions will take priority over non-override actions during simultaneou
| Gravity Toggle | Binary/Button | Toggles Gravity state when pressed. |
| Gravity Reverse | Binary/Button | Temporarily Reverses Gravity while held. |
| Reset Offsets | Binary/Button | Resets your offset and rotation to 0. |
| Apply Offsets | Binary/Button | Recalibrates center/rotation from offsets |
| Height Toggle | Binary/Button | Shifts the gravity floor level by offset configured in motion tab. If gravity is inactive: also shifts the user's current y-axis position by offset configured in motion tab. |
| Snap-Turn Left | Binary/Button | Rotates a set value to the left based on settings in motion tab. |
| Snap-Turn Right | Binary/Button | Rotates a set value to the right based on settings in motion tab. |
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/compile_version_string.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.2-release
5.4.0-release
1 change: 1 addition & 0 deletions build_scripts/qt/resources.pri
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ DISTFILES += \
src/res/qml/SettingsPage.qml \
src/res/qml/StatisticsPage.qml \
src/res/qml/steamvr_page/SteamVRPage.qml \
src/res/qml/steamvr_page/steamvr_additional/* \
src/res/qml/steamvr_page/camera/* \
src/res/qml/steamvr_page/steamvrmisc/* \
src/res/qml/utilities_page/* \
Expand Down
4 changes: 4 additions & 0 deletions build_scripts/qt/sources.pri
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ SOURCES += src/main.cpp\
src/openvr/ivrinput.cpp \
src/openvr/ovr_settings_wrapper.cpp \
src/openvr/ovr_overlay_wrapper.cpp \
src/openvr/ovr_system_wrapper.cpp \
src/openvr/lh_console_util.cpp \
src/utils/setup.cpp \
src/utils/paths.cpp \
src/utils/FrameRateUtils.cpp \
Expand Down Expand Up @@ -52,6 +54,8 @@ HEADERS += src/overlaycontroller.h \
src/openvr/ivrinput.h \
src/openvr/ovr_settings_wrapper.h \
src/openvr/ovr_overlay_wrapper.h \
src/openvr/ovr_system_wrapper.h \
src/openvr/lh_console_util.h \
src/utils/setup.h \
src/utils/paths.h \
src/utils/FrameRateUtils.h \
Expand Down
1 change: 1 addition & 0 deletions docs/building_for_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For pushing changes to the repo:


2. Clang format. Part of the [LLVM collection](https://releases.llvm.org/download.html).
- **note** use version 9.0.1/9.0.0 of LLVM

Additionally, for fully building portable and installer release versions:

Expand Down
6 changes: 6 additions & 0 deletions src/openvr/ivrinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ SteamIVRInput::SteamIVRInput()
m_gravityReverse( action_keys::gravityReverse ),
m_heightToggle( action_keys::heightToggle ),
m_resetOffsets( action_keys::resetOffsets ),
m_applyOffsets( action_keys::applyOffsets ),
m_snapTurnLeft( action_keys::snapTurnLeft ),
m_snapTurnRight( action_keys::snapTurnRight ),
m_smoothTurnLeft( action_keys::smoothTurnLeft ),
Expand Down Expand Up @@ -277,6 +278,11 @@ bool SteamIVRInput::resetOffsets()
return isDigitalActionActivatedOnce( m_resetOffsets );
}

bool SteamIVRInput::applyOffsets()
{
return isDigitalActionActivatedOnce( m_applyOffsets );
}

bool SteamIVRInput::snapTurnLeft()
{
return isDigitalActionActivatedOnce( m_snapTurnLeft );
Expand Down
3 changes: 3 additions & 0 deletions src/openvr/ivrinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace action_keys
constexpr auto gravityToggle = "/actions/motion/in/GravityToggle";
constexpr auto gravityReverse = "/actions/motion/in/GravityReverse";
constexpr auto resetOffsets = "/actions/motion/in/ResetOffsets";
constexpr auto applyOffsets = "/actions/motion/in/ApplyOffsets";
constexpr auto heightToggle = "/actions/motion/in/HeightToggle";
constexpr auto snapTurnLeft = "/actions/motion/in/SnapTurnLeft";
constexpr auto snapTurnRight = "/actions/motion/in/SnapTurnRight";
Expand Down Expand Up @@ -146,6 +147,7 @@ class SteamIVRInput
bool gravityReverse();
bool heightToggle();
bool resetOffsets();
bool applyOffsets();
bool snapTurnLeft();
bool snapTurnRight();
bool smoothTurnLeft();
Expand Down Expand Up @@ -228,6 +230,7 @@ class SteamIVRInput
DigitalAction m_gravityReverse;
DigitalAction m_heightToggle;
DigitalAction m_resetOffsets;
DigitalAction m_applyOffsets;
DigitalAction m_snapTurnLeft;
DigitalAction m_snapTurnRight;
DigitalAction m_smoothTurnLeft;
Expand Down
151 changes: 151 additions & 0 deletions src/openvr/lh_console_util.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#include "lh_console_util.h"

namespace lh_con_util
{
bool LHCUtil::FindAll()
{
if ( !FindAllRX() )
{
LOG( ERROR ) << "Find All Recievers Failed";
return false;
}
if ( !FindAllTX() )
{
LOG( ERROR ) << "Find All Transmitters Failed";
return false;
}
return true;
}

bool LHCUtil::FindAllRX()
{
QProcess* lhProcess = new QProcess();
QString program = "lighthouse_console.exe";
lhProcess->start( path_, QStringList() << "" );
lhProcess->waitForFinished();

QString output = QString( lhProcess->readAllStandardOutput() );
QStringList outputLines
= output.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts );
bool RecieverStart = false;

for ( auto OutputLine : outputLines )
{
if ( OutputLine.contains( "Attached lighthouse receiver devices:" ) )
{
RecieverStart = true;
continue;
}
if ( RecieverStart )
{
if ( OutputLine.contains( "lighthouse_console" ) )
{
break;
}
OutputLine.simplified().remove( " " );
OutputLine.remove( 0, 1 );
// LOG( WARNING ) << OutputLine << std::endl;
RXTX_Pairs_.push_back( RXTX_Pair{ OutputLine, " ", true, false } );
}
}
return !RXTX_Pairs_.empty();
}

bool LHCUtil::FindConnectedTX( QString RXSerial )
{
LOG( WARNING ) << RXSerial;
QProcess* lhProcess = new QProcess();
lhProcess->start( path_, QStringList() << "/serial" << RXSerial << "exit" );
lhProcess->waitForFinished();

QString output = QString( lhProcess->readAllStandardOutput() );
QStringList outputLines
= output.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts );
// std::vector<std::string> OutputLines
// = exec( ( "\"" + path_ + "\" /serial " + RXSerial + " exit" ).c_str()
// );
bool lhConFound = false;
for ( auto outputLine : outputLines )
{
// LOG( WARNING ) << outputLine;
if ( outputLine.contains( "Connected to receiver" ) )
{
auto splitList = outputLine.split( ":" );
QString TXSerial = splitList[0];
if ( TXSerial == "lighthouse_console" )
{
lhConFound = true;
continue;
}
for ( auto& rxtx : RXTX_Pairs_ )
{
if ( rxtx.RX_Serial == RXSerial )
{
rxtx.TX_Serial = TXSerial;
rxtx.Is_Paired = true;
rxtx.Is_Init = true;
LOG( WARNING )
<< "tx serial stored: " << TXSerial.toStdString();
return true;
}
}
// TODO error handling
return false;
}
}
if ( lhConFound )
{
for ( auto rxtx : RXTX_Pairs_ )
{
if ( rxtx.RX_Serial == RXSerial )
{
rxtx.TX_Serial = "";
rxtx.Is_Paired = false;
rxtx.Is_Init = true;
LOG( WARNING ) << "tx oops";
return true;
}
}
}
// TODO error handling
return false;
}

bool LHCUtil::FindAllTX()
{
bool NoError = true;
for ( auto rxtx : RXTX_Pairs_ )
{
if ( !FindConnectedTX( rxtx.RX_Serial ) )
{
NoError = false;
}
}
return NoError;
}

QString LHCUtil::GetLinkedTX( QString RXSerial )
{
for ( auto rxtx : RXTX_Pairs_ )
{
if ( rxtx.RX_Serial == RXSerial )
{
return rxtx.TX_Serial;
}
}
return "";
}

QString LHCUtil::GetLinkedRX( QString TXSerial )
{
for ( auto rxtx : RXTX_Pairs_ )
{
if ( rxtx.TX_Serial == TXSerial )
{
return rxtx.RX_Serial;
}
}
return "";
}

} // namespace lh_con_util
48 changes: 48 additions & 0 deletions src/openvr/lh_console_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#pragma once
#include "openvr.h"
#include <vector>
#include <utility>
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <array>
#include <QProcess>
#include <QString>
#include <QStringList>
#include <QRegularExpression>
#include <easylogging++.h>

namespace lh_con_util
{
struct RXTX_Pair
{
QString RX_Serial = "";
QString TX_Serial = "";
bool Is_Init = false;
bool Is_Paired = false;
};
class LHCUtil
{
private:
QString path_;
bool InPairs( std::string RXSerial );
bool FindAllRX();
bool FindAllTX();
bool path_Init = false;

public:
explicit LHCUtil( QString path )
{
path_ = path;
}
std::vector<RXTX_Pair> RXTX_Pairs_;
bool FindAll();
bool FindConnectedTX( QString RXSerial );
QString GetLinkedTX( QString RXSerial );
QString GetLinkedRX( QString TXSerial );
RXTX_Pair GetConnectedTXRXPair();
bool pairDevice( QString RXSerial );
};
} // namespace lh_con_util
Loading

0 comments on commit eea7134

Please sign in to comment.