From 8e5b4909eb20e30501362e6dfc75b79154971b72 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sat, 20 Jul 2024 16:00:28 -0600 Subject: [PATCH 1/2] Update allsky_common.cpp: Only output AWB values for color cameras --- src/allsky_common.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/allsky_common.cpp b/src/allsky_common.cpp index 1c3202b4b..85f15d793 100644 --- a/src/allsky_common.cpp +++ b/src/allsky_common.cpp @@ -236,22 +236,24 @@ void add_variables_to_command(config cg, char *cmd, timeval startDateTime) strcat(cmd, tmp); } - snprintf(tmp, s, " AUTOWB=%d", cg.currentAutoAWB ? 1 : 0); - strcat(cmd, tmp); - snprintf(tmp, s, " sAUTOAWB='%s'", cg.currentAutoAWB ? "(auto)" : ""); - strcat(cmd, tmp); - if (cg.lastWBR >= 0.0) { - snprintf(tmp, s, " WBR=%s", LorF(cg.lastWBR, "%d", "%f")); - strcat(cmd, tmp); - } - if (cg.lastWBB >= 0.0) { - snprintf(tmp, s, " WBB=%s", LorF(cg.lastWBB, "%d", "%f")); + if (cg.isColorCamera) + { + snprintf(tmp, s, " AUTOWB=%d", cg.currentAutoAWB ? 1 : 0); strcat(cmd, tmp); - } - - if (cg.lastMean >= 0.0) { - snprintf(tmp, s, " MEAN=%f", cg.lastMean); + snprintf(tmp, s, " sAUTOAWB='%s'", cg.currentAutoAWB ? "(auto)" : ""); strcat(cmd, tmp); + if (cg.lastWBR >= 0.0) { + snprintf(tmp, s, " WBR=%s", LorF(cg.lastWBR, "%d", "%f")); + strcat(cmd, tmp); + } + if (cg.lastWBB >= 0.0) { + snprintf(tmp, s, " WBB=%s", LorF(cg.lastWBB, "%d", "%f")); + strcat(cmd, tmp); + } + if (cg.lastMean >= 0.0) { + snprintf(tmp, s, " MEAN=%f", cg.lastMean); + strcat(cmd, tmp); + } } // Since negative temperatures are valid, check against an impossible temperature. From 8dbca5bd7cf5b3c7a5083e932eda949935ad19f2 Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 21 Jul 2024 15:55:17 -0600 Subject: [PATCH 2/2] Update capture_ZWO.cpp: only get AWB values when in auto mode --- src/capture_ZWO.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/capture_ZWO.cpp b/src/capture_ZWO.cpp index 63b39c919..12cf71747 100644 --- a/src/capture_ZWO.cpp +++ b/src/capture_ZWO.cpp @@ -380,7 +380,7 @@ ASI_ERROR_CODE takeOneExposure(config *cg, unsigned char *imageBuffer) long timeout = ((cg->currentExposure_us * 2) / US_IN_MS) + 5000; // timeout is in ms // Sanity check. - if (cg->HB.useHistogram && cg->currentAutoExposure == ASI_TRUE) + if (cg->HB.useHistogram && cg->currentAutoExposure) Log(0, " > %s: ERROR: HB.useHistogram AND currentAutoExposure are both set\n", cg->ME); if (cg->ZWOexposureType != ZWOsnap) @@ -1232,6 +1232,7 @@ int main(int argc, char *argv[]) length_in_units(CG.currentMaxAutoExposure_us, true)); CG.currentExposure_us = CG.currentMaxAutoExposure_us; } + // Don't use camera auto-exposure since we mimic it ourselves. CG.HB.useHistogram = CG.dayAutoExposure; // With the histogram method we NEVER use ZWO auto exposure - either the user said @@ -1361,13 +1362,21 @@ int main(int argc, char *argv[]) { setControl(CG.cameraNumber, ASI_WB_R, CG.currentWBR, CG.currentAutoAWB ? ASI_TRUE : ASI_FALSE); setControl(CG.cameraNumber, ASI_WB_B, CG.currentWBB, CG.currentAutoAWB ? ASI_TRUE : ASI_FALSE); + + if (! CG.currentAutoAWB && ! CG.takeDarkFrames) + { + // We only read the actual values if in auto white balance; since we're not, + // set the "last" values to the user-specified numbers. + CG.lastWBR = CG.currentWBR; + CG.lastWBB = CG.currentWBB; + } + else + { + CG.lastWBR = NOT_SET; + CG.lastWBB = NOT_SET; + } } - else if (! CG.currentAutoAWB && ! CG.takeDarkFrames) - { - // We only read the actual values if in auto white balance; since we're not, get them now. - CG.lastWBR = CG.currentWBR; - CG.lastWBB = CG.currentWBB; - } + if (CG.isCooledCamera) { setControl(CG.cameraNumber, ASI_COOLER_ON, CG.currentEnableCooler ? ASI_TRUE : ASI_FALSE, ASI_FALSE);