Skip to content

Commit

Permalink
Escape backslashes in custom FITS values. Do not add TELESCOP keyword…
Browse files Browse the repository at this point in the history
… if already exists in custom headers
  • Loading branch information
knro committed Oct 28, 2023
1 parent 1a85d81 commit 16fef45
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/indibase/indiccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,8 @@ bool CCD::ISNewText(const char * dev, const char * name, char * texts[], char *
else
{
// String
// Escape the value since backslashes are reserved /
std::replace(value.begin(), value.end(), '/', '\\');
FITSRecord record(name.c_str(), value.c_str(), comment.c_str());
m_CustomFITSKeywords[name.c_str()] = record;
}
Expand All @@ -1032,6 +1034,7 @@ bool CCD::ISNewText(const char * dev, const char * name, char * texts[], char *
catch (std::exception &e)
{
// String
std::replace(value.begin(), value.end(), '/', '\\');
FITSRecord record(name.c_str(), value.c_str(), comment.c_str());
m_CustomFITSKeywords[name.c_str()] = record;
}
Expand Down Expand Up @@ -1944,17 +1947,18 @@ void CCD::addFITSKeywords(CCDChip * targetChip, std::vector<FITSRecord> &fitsKey
double effectiveFocalLength = std::numeric_limits<double>::quiet_NaN();
double effectiveAperture = std::numeric_limits<double>::quiet_NaN();


AutoCNumeric locale;
fitsKeywords.push_back({"ROWORDER", "TOP-DOWN", "Row Order"});
fitsKeywords.push_back({"INSTRUME", getDeviceName(), "CCD Name"});
fitsKeywords.push_back({"INSTRUME", getDeviceName(), "Camera Name"});

// Telescope
if (strlen(ActiveDeviceT[ACTIVE_TELESCOPE].text) > 0)
// Only add keyword if not already exists in custom keywords
if (m_CustomFITSKeywords.count("TELESCOP") == 0 && strlen(ActiveDeviceT[ACTIVE_TELESCOPE].text) > 0)
{
fitsKeywords.push_back({"TELESCOP", ActiveDeviceT[0].text, "Telescope name"});
}


// Which scope is in effect
// Prefer Scope Info over snooped property which should be deprecated.
effectiveFocalLength = ScopeInfoNP[FocalLength].getValue() > 0 ? ScopeInfoNP[FocalLength].getValue() : snoopedFocalLength;
Expand Down

0 comments on commit 16fef45

Please sign in to comment.