Skip to content

Commit 1c5a894

Browse files
authored
Update capture_RPi.cpp: Always save stdout/stderr to debug file
Also, a slight efficiency improvement with metadata.
1 parent 149b01d commit 1c5a894

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/capture_RPi.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ raspistillSetting myRaspistillSetting;
5757
modeMeanSetting myModeMeanSetting;
5858
std::string errorOutput;
5959
std::string metadataFile = "";
60+
std::string metadataArgs = "";
6061

6162

6263
//---------------------------------------------------------------------------------------------
@@ -323,14 +324,9 @@ int RPicapture(config cg, cv::Mat *image)
323324
string s2 = "";
324325
if (cg.isLibcamera)
325326
{
326-
command += " --metadata '" + metadataFile + "' --metadata-format txt";
327+
command += metadataArgs;
327328

328-
// If there have been 2 consecutive errors, chances are this one will fail too,
329-
// so capture the error message.
330-
if (cg.debugLevel >= 3 || numConsecutiveErrors >= 2)
331-
s2 = " > " + errorOutput + " 2>&1";
332-
else
333-
s2 = " 2> /dev/null"; // gets rid of a bunch of libcamera verbose messages
329+
s2 = " > " + errorOutput + " 2>&1";
334330
}
335331

336332
// Create the command we'll actually run.
@@ -531,6 +527,7 @@ int main(int argc, char *argv[])
531527
errorOutput += "/capture_RPi_debug.txt";
532528
metadataFile = CG.saveDir;
533529
metadataFile += "/metadata.txt";
530+
metadataArgs = " --metadata '" + metadataFile + "' --metadata-format txt";
534531

535532
int iMaxWidth, iMaxHeight;
536533
double pixelSize;

0 commit comments

Comments
 (0)