Skip to content

Commit 916fea0

Browse files
author
Dilawar Singh
committed
How stupid of me. Raise error when file exists.
Start trial from 1. Fixes #41
1 parent 2eddf22 commit 916fea0

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

PointGreyCamera/src/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,12 @@ void SaveAllFrames(vector<Mat>& frames, const size_t trial)
122122
// Check if file arealy exists. If yes, raise all the hell.
123123
using namespace boost::filesystem;
124124
path p(outfile);
125-
if(! exists(p))
125+
if(exists(p))
126126
{
127127
cout << "[ERROR] Files " << outfile << " already exists. I will not overwrite " << p << endl;
128128
throw runtime_error( "WILL NOT OVERWRITE EXISTING DATA.");
129129
}
130130

131-
132-
133131
write_frames_to_tiff(outfile, frames);
134132
cout << "[INFO] Saved data to " << outfile << endl;
135133

src/main.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,14 @@ void loop()
540540
unsigned numProbeTrials = 0;
541541
unsigned nextProbeTrialIndex = random(5, 10);
542542

543-
for (size_t i = 0; i <= PROTO_NumTrialsInABlock; i++)
543+
for (size_t i = 1; i <= PROTO_NumTrialsInABlock; i++)
544544
{
545545

546546
reset_watchdog( );
547+
trial_count_ = i;
547548
if(String("TONE/LIGHT") == String(PROTO_CSValue))
548549
{
549-
// mixed trials.
550+
// FOR Shomu. Mixed trials.
550551
bool isprobe = false;
551552
if( i % 5 == 0 )
552553
isprobe = true;
@@ -564,7 +565,6 @@ void loop()
564565
}
565566
do_trial(i, isprobe);
566567
}
567-
trial_count_ += 1;
568568
}
569569

570570
// Don't do anything once all trails are over.

0 commit comments

Comments
 (0)