Skip to content

Commit

Permalink
Update capture_RPi.cpp: add checks for nighttime capture and focus
Browse files Browse the repository at this point in the history
  • Loading branch information
EricClaeys authored Oct 27, 2023
1 parent 766b122 commit f1c8abc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/capture_RPi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,9 @@ int main(int argc, char *argv[])
int originalITextY = CG.overlay.iTextY;
int originalFontsize = CG.overlay.fontsize;
int originalLinewidth = CG.overlay.linewidth;
// Have we displayed "not taking picture during day" message, if applicable?
// Have we displayed "not taking picture during day/night" messages, if applicable?
bool displayedNoDaytimeMsg = false;
bool displayedNoNighttimeMsg = false;

// Start taking pictures

Expand Down Expand Up @@ -605,7 +606,8 @@ int main(int argc, char *argv[])

if (! CG.daytimeCapture)
{
displayedNoDaytimeMsg = daytimeSleep(displayedNoDaytimeMsg, CG);
// true == for daytime
displayedNoDaytimeMsg = day_night_timeSleep(displayedNoDaytimeMsg, CG, true);

// No need to do any of the code below so go back to the main loop.
continue;
Expand Down Expand Up @@ -653,6 +655,15 @@ int main(int argc, char *argv[])
justTransitioned = false;
}

if (! CG.nighttimeCapture)
{
// false == for nighttime
displayedNoNighttimeMsg = day_night_timeSleep(displayedNoNighttimeMsg, CG, false);

// No need to do any of the code below so go back to the main loop.
continue;
}

Log(1, "==========\n=== Starting nighttime capture ===\n==========\n");

// We only skip initial frames if we are starting in nighttime and using auto-exposure.
Expand Down Expand Up @@ -777,7 +788,7 @@ myModeMeanSetting.modeMean = CG.myModeMeanSetting.modeMean;
CG.lastWBR = CG.currentWBR;
CG.lastWBB = CG.currentWBB;

CG.lastFocusMetric = CG.overlay.showFocus ? (int)round(get_focus_metric(pRgb)) : -1;
CG.lastFocusMetric = CG.determineFocus ? (int)round(get_focus_metric(pRgb)) : -1;

// If takeDarkFrames is off, add overlay text to the image
if (! CG.takeDarkFrames)
Expand Down

0 comments on commit f1c8abc

Please sign in to comment.