Skip to content

Commit

Permalink
Update ASI_functions.cpp: Misc fixes
Browse files Browse the repository at this point in the history
* Lower decimal points in day and night mean and threshold.
* For ZWO, set AutoExpMaxExpMS's default to the max value.
* Remove duplicate daymean/nightmean in cc_file.
  • Loading branch information
EricClaeys authored Jul 11, 2024
1 parent 778f13b commit c2fa5ee
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/ASI_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,31 +1626,31 @@ void saveCameraInfo(
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "daymean");
fprintf(f, "\t\t\t\"MinValue\" : 0.0,\n");
fprintf(f, "\t\t\t\"MaxValue\" : 1.0,\n");
fprintf(f, "\t\t\t\"DefaultValue\" : %.3f\n", CG.myModeMeanSetting.dayMean);
fprintf(f, "\t\t\t\"DefaultValue\" : %.1f\n", CG.myModeMeanSetting.dayMean);
fprintf(f, "\t\t},\n");

fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "DayMeanThreshold");
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "daymeanthreshold");
fprintf(f, "\t\t\t\"MinValue\" : 0.01,\n");
fprintf(f, "\t\t\t\"MaxValue\" : 1.0,\n");
fprintf(f, "\t\t\t\"DefaultValue\" : %.3f\n", CG.myModeMeanSetting.dayMean_threshold);
fprintf(f, "\t\t\t\"DefaultValue\" : %.2f\n", CG.myModeMeanSetting.dayMean_threshold);
fprintf(f, "\t\t},\n");

fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "nightmean");
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "nightmean");
fprintf(f, "\t\t\t\"MinValue\" : 0.0,\n");
fprintf(f, "\t\t\t\"MaxValue\" : 1.0,\n");
fprintf(f, "\t\t\t\"DefaultValue\" : %.3f\n", CG.myModeMeanSetting.nightMean);
fprintf(f, "\t\t\t\"DefaultValue\" : %.1f\n", CG.myModeMeanSetting.nightMean);
fprintf(f, "\t\t},\n");

fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "NightMeanThreshold");
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "nightmeanthreshold");
fprintf(f, "\t\t\t\"MinValue\" : 0.01,\n");
fprintf(f, "\t\t\t\"MaxValue\" : 1.0,\n");
fprintf(f, "\t\t\t\"DefaultValue\" : %.3f\n", CG.myModeMeanSetting.nightMean_threshold);
fprintf(f, "\t\t\t\"DefaultValue\" : %.2f\n", CG.myModeMeanSetting.nightMean_threshold);
fprintf(f, "\t\t},\n");

if (CG.isColorCamera) {
Expand Down Expand Up @@ -1745,6 +1745,7 @@ void saveCameraInfo(
#endif

double minGain=0.0, maxGain=0.0;
int div_by;

for (int i = 0; i < iNumOfCtrl; i++)
{
Expand Down Expand Up @@ -1780,14 +1781,22 @@ void saveCameraInfo(
continue;
}

int div_by = 1;
if (strcmp(cc.Name, "Exposure") == 0) {
// The camera's values are in microseconds (us), but the WebUI displays in milliseconds (ms).
// The camera's values are in microseconds (us),
// but the WebUI displays in milliseconds (ms) so convert.
div_by = US_IN_MS;
} else {
div_by = 1;
}
double min = cc.MinValue / (double)div_by;
double max = cc.MaxValue / (double)div_by;
double def = cc.DefaultValue / (double)div_by;
#ifdef IS_ZWO
if (strcmp(cc.Name, "AutoExpMaxExpMS") == 0) {
// ZWO defaults for this setting are extremely low, so use the max value.
def = cc.MaxValue / (double)div_by;
}
#endif

// XXXXXXXXX this is to help determine why some float settings are being output as integers
if (strcmp(cc.Name,"Gain") == 0 && CG.debugLevel >= 4)
Expand Down Expand Up @@ -1831,17 +1840,6 @@ printf("MaxValue : %s,\n", LorF(max, "%ld", "%.3f"));
fprintf(f, "\t\t\t\"DefaultValue\" : %d\n", 10 * MS_IN_SEC);
fprintf(f, "\t\t},\n");

fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "daymean");
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "daymean");
fprintf(f, "\t\t\t\"DefaultValue\" : %f\n", CG.myModeMeanSetting.dayMean);
fprintf(f, "\t\t},\n");
fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "nightmean");
fprintf(f, "\t\t\t\"argumentName\" : \"%s\",\n", "nightmean");
fprintf(f, "\t\t\t\"DefaultValue\" : %f\n", CG.myModeMeanSetting.nightMean);
fprintf(f, "\t\t},\n");

// Set the day gain to the minimum possible.
fprintf(f, "\t\t{\n");
fprintf(f, "\t\t\t\"Name\" : \"%s\",\n", "daygain");
Expand All @@ -1865,7 +1863,8 @@ printf("MaxValue : %s,\n", LorF(max, "%ld", "%.3f"));
}

// Output basic camera information.
void outputCameraInfo(ASI_CAMERA_INFO cameraInfo, config cg, long width, long height, double pixelSize, char const *bayer)
void outputCameraInfo(ASI_CAMERA_INFO cameraInfo, config cg,
long width, long height, double pixelSize, char const *bayer)
{
printf(" Camera Information:\n");
printf(" - Type: %s\n", CAMERA_TYPE);
Expand Down

0 comments on commit c2fa5ee

Please sign in to comment.