Skip to content

Commit

Permalink
Removed timesync hang from cmd line. Closes #115.
Browse files Browse the repository at this point in the history
  • Loading branch information
produceconsumerobot committed May 11, 2022
1 parent a0847e5 commit 3f86ef5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions EmotiBitDataParser/src/main.cpp
Expand Up @@ -13,6 +13,7 @@ int main(int argc, char *argv[]){
ofApp *app = new ofApp();
if (argc != 1) {
app->argFileName = argv[1];
app->cmdLineStart = true;
}
ofRunApp(app);

Expand Down
21 changes: 11 additions & 10 deletions EmotiBitDataParser/src/ofApp.cpp
Expand Up @@ -220,7 +220,7 @@ void ofApp::update() {
if (allTimestampData.size() < 2)
{
ofLogNotice() << ofToString(allTimestampData.size()) + " Timesyncs Found";
ofLog(OF_LOG_NOTICE, "Follow instructions on screen to improve data recording processes");
ofLog(OF_LOG_NOTICE, timesyncsWarning);
currentState = State::WARNING_INSUFFICIENT_TIMESYNCS;
}
else
Expand All @@ -242,7 +242,14 @@ void ofApp::update() {
{
guiPanels.at(0).getControl(GUI_PANEL_LOAD_FILE)->setBackgroundColor(ofColor(0, 0, 0));
processStatus.setBackgroundColor(ofColor(0, 0, 0));
processStatus.getParameter().fromString(GUI_STATUS_IDLE);
if (cmdLineStart)
{
ofExit();
}
else
{
processStatus.getParameter().fromString(GUI_STATUS_IDLE);
}
}
}

Expand Down Expand Up @@ -558,14 +565,8 @@ void ofApp::draw() {
else if (currentState == State::WARNING_INSUFFICIENT_TIMESYNCS)
{
ofSetColor(255, 128, 0);
std::string instructions = "WARNING: Data file was parsed with less than 2 time-sync events, which can reduce the timestamp accuracy.\n"
"\nEmotiBit periodically generates time-sync events while a connection is established with the EmotiBit Oscilloscope software.\n"
"At a minimum, it's recommended to keep EmotiBit connected to the EmotiBit Oscilloscope software\n"
"for at least one minute after starting data recording AND re-establish connection with EmotiBit Oscilloscope\n"
"software (using the same computer on which recording was started) for at least one minute before stopping data recording.\n"
"\nTo further improve timestamp accuracy, it's optimal to keep EmotiBit connected to the EmotiBit Oscilloscope software\n"
"throughout recording to generate many time-sync events in the data file.\n";
legendFont.drawString(instructions, 10, 100);

legendFont.drawString(timesyncsWarning, 10, 100);
}
if (currentState != State::WARNING_INSUFFICIENT_TIMESYNCS)
{
Expand Down
9 changes: 9 additions & 0 deletions EmotiBitDataParser/src/ofApp.h
Expand Up @@ -15,6 +15,7 @@ class ofApp : public ofBaseApp {

string argFileName;
string stringData;
bool cmdLineStart = false;

ofTrueTypeFont legendFont;
ofTrueTypeFont subLegendFont;
Expand Down Expand Up @@ -108,6 +109,14 @@ class ofApp : public ofBaseApp {
long double c1 = 1;
} timeSyncMap;

std::string timesyncsWarning = "WARNING: Data file was parsed with less than 2 time-sync events, which can reduce the timestamp accuracy.\n"
"\nEmotiBit periodically generates time-sync events while a connection is established with the EmotiBit Oscilloscope software.\n"
"At a minimum, it's recommended to keep EmotiBit connected to the EmotiBit Oscilloscope software\n"
"for at least one minute after starting data recording AND re-establish connection with EmotiBit Oscilloscope\n"
"software (using the same computer on which recording was started) for at least one minute before stopping data recording.\n"
"\nTo further improve timestamp accuracy, it's optimal to keep EmotiBit connected to the EmotiBit Oscilloscope software\n"
"throughout recording to generate many time-sync events in the data file.\n";

struct RecordedDataTimeRange {
long double emotibitStartTime = INT_MAX;
long double emotibitEndTime = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ofxEmotiBitVersion.h
@@ -1,7 +1,7 @@
#pragma once
//#include <string>
#include "ofMain.h"
const std::string ofxEmotiBitVersion = "1.4.4-feat-parserSyncMap.0";
const std::string ofxEmotiBitVersion = "1.4.4-feat-parserSyncMap.1";

static void writeOfxEmotiBitVersionFile() {
string filename = "ofxEmotiBit_Version.txt";
Expand Down

0 comments on commit 3f86ef5

Please sign in to comment.