Skip to content

Commit

Permalink
Preventing recording start on uncalibrated tracker
Browse files Browse the repository at this point in the history
updated changelog
  • Loading branch information
BuzzteeBear committed Jan 13, 2024
1 parent 525c63d commit 56c04e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
28 changes: 19 additions & 9 deletions XR_APILAYER_NOVENDOR_motion_compensation/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ namespace output
TraceLoggingWriteStop(local, "AudioOut::CountDown");
}

bool NoRecorder::Toggle(bool isCalibrated)
{
ErrorLog("%s: unable to toggle recording", __FUNCTION__);
AudioOut::Execute(Event::Error);
return false;
}

PoseRecorder::PoseRecorder()
{
m_FileStream << std::fixed << std::setprecision(5);
Expand All @@ -90,11 +97,17 @@ namespace output
TraceLoggingWriteStop(local, "PoseRecorder::Destroy");
}

bool PoseRecorder::Toggle()
bool PoseRecorder::Toggle(bool isCalibrated)
{
if (!m_Started)
if (!m_Started )
{
return Start();
if (isCalibrated)
{
return Start();
}
ErrorLog("%s: recording requires the tracker to be calibrated", __FUNCTION__);
AudioOut::Execute(Event::Error);
return false;
}
Stop();
return false;
Expand Down Expand Up @@ -146,11 +159,7 @@ namespace output

if (++m_Counter > m_RecorderMax)
{
m_Started = Start();
TraceLoggingWriteTagged(local,
"PoseRecorder::AddReference",
TLArg(true, "Size_Exceeded"),
TLArg(m_Started, "Started"));
Start();
}
if (m_FileStream.is_open())
{
Expand Down Expand Up @@ -216,6 +225,7 @@ namespace output

if (m_FileStream.is_open())
{
m_Started = true;
m_FileStream << m_HeadLine << "\n";
m_FileStream.flush();

Expand Down Expand Up @@ -244,7 +254,7 @@ namespace output
return;
}
AudioOut::Execute(Event::Error);
ErrorLog("%s: recording started but output stream is closed", __FUNCTION__);
ErrorLog("%s: recording stopped but output stream is already closed", __FUNCTION__);
TraceLoggingWriteStop(local, "PoseRecorder::Stop", TLArg(false, "Stream_Closed"));
}

Expand Down
9 changes: 3 additions & 6 deletions XR_APILAYER_NOVENDOR_motion_compensation/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace output
public:
RecorderBase() = default;
virtual ~RecorderBase() = default;
virtual bool Toggle() = 0;
virtual bool Toggle(bool isCalibrated) = 0;
virtual void AddPose(const XrPosef& pose, RecorderPoseInput type) = 0;
virtual void AddMmfValue(const MmfValueSample& mmfValue) = 0;
virtual void Write(XrTime time, bool newLine = true) = 0;
Expand All @@ -128,10 +128,7 @@ namespace output
class NoRecorder final : public RecorderBase
{
public:
bool Toggle() override
{
return false;
};
bool Toggle(bool isCalibrated) override;
void AddPose(const XrPosef& pose, RecorderPoseInput type) override{};
void AddMmfValue(const MmfValueSample& mmfValue) override{};
void Write(XrTime time, bool newLine = true) override{};
Expand All @@ -142,7 +139,7 @@ namespace output
public:
PoseRecorder();
~PoseRecorder() override;
bool Toggle() override;
bool Toggle(bool isCalibrated) override;
void AddPose(const XrPosef& pose, RecorderPoseInput type) override;
void AddMmfValue(const MmfValueSample& mmfValue) override{};
void Write(XrTime time, bool newLine = true) override;
Expand Down
2 changes: 1 addition & 1 deletion XR_APILAYER_NOVENDOR_motion_compensation/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ namespace tracker

bool TrackerBase::ToggleRecording() const
{
return m_Recorder->Toggle();
return m_Recorder->Toggle(m_Calibrated);
}

void TrackerBase::SetReferencePose(const XrPosef& pose)
Expand Down
7 changes: 3 additions & 4 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ Version 0.3.2
- added ability to log tracker pose values into .CSV-file

Bugfixes
- removed upside_down workaround for iRacing (no longer required)
- removed (false positive) error log entries on auto activation
- fixed automatic activation (caused ctd instead of activating)
- unified keyboard shortcut for toggling verbose logging (installation/update)
- removed upside_down workaround (no longer required for iRacing)
- removed false positive error log entries on auto activation
- fixed verbose logging toggle shortcut default for updating pre-existing .ini file

Version 0.3.1

Expand Down

0 comments on commit 56c04e3

Please sign in to comment.