Skip to content

Commit

Permalink
update FocusSimulationNP property
Browse files Browse the repository at this point in the history
  • Loading branch information
naheedsa committed Feb 12, 2024
1 parent 21fe427 commit d14a995
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
26 changes: 13 additions & 13 deletions drivers/ccd/ccd_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ bool CCDSim::initProperties()
ISR_1OFMANY, 60, IPS_IDLE);

// Simulate focusing
IUFillNumber(&FocusSimulationN[0], "SIM_FOCUS_POSITION", "Focus", "%.f", 0.0, 100000.0, 1.0, 36700.0);
IUFillNumber(&FocusSimulationN[1], "SIM_FOCUS_MAX", "Max. Position", "%.f", 0.0, 100000.0, 1.0, 100000.0);
IUFillNumber(&FocusSimulationN[2], "SIM_SEEING", "Seeing (arcsec)", "%4.2f", 0, 60, 0, 3.5);
IUFillNumberVector(&FocusSimulationNP, FocusSimulationN, 3, getDeviceName(), "SIM_FOCUSING", "Focus Simulation",
FocusSimulationNP[SIM_FOCUS_POSITION].fill("SIM_FOCUS_POSITION", "Focus", "%.f", 0.0, 100000.0, 1.0, 36700.0);
FocusSimulationNP[SIM_FOCUS_MAX].fill("SIM_FOCUS_MAX", "Max. Position", "%.f", 0.0, 100000.0, 1.0, 100000.0);
FocusSimulationNP[SIM_SEEING].fill("SIM_SEEING", "Seeing (arcsec)", "%4.2f", 0, 60, 0, 3.5);
FocusSimulationNP.fill(getDeviceName(), "SIM_FOCUSING", "Focus Simulation",
SIMULATOR_TAB, IP_RW, 60, IPS_IDLE);

// Simulate Crash
Expand Down Expand Up @@ -264,7 +264,7 @@ void CCDSim::ISGetProperties(const char * dev)

defineProperty(SimulatorSettingsNP);
defineProperty(&EqPENP);
defineProperty(&FocusSimulationNP);
defineProperty(FocusSimulationNP);
defineProperty(SimulateBayerSP);
defineProperty(CrashSP);
}
Expand Down Expand Up @@ -1134,12 +1134,12 @@ SimulatorSettingsNP.setState(IPS_OK);
INDI::FilterInterface::processNumber(dev, name, values, names, n);
return true;
}
else if (!strcmp(name, FocusSimulationNP.name))
else if (FocusSimulationNP.isNameMatch(name))
{
// update focus simulation parameters
IUUpdateNumber(&FocusSimulationNP, values, names, n);
FocusSimulationNP.s = IPS_OK;
IDSetNumber(&FocusSimulationNP, nullptr);
FocusSimulationNP.update(values, names, n);
FocusSimulationNP.setState(IPS_OK);
FocusSimulationNP.apply();
}
}

Expand Down Expand Up @@ -1323,9 +1323,9 @@ bool CCDSim::ISSnoopDevice(XMLEle * root)
FocuserPos = atol(pcdataXMLEle(ep));

// calculate FWHM
double focus = FocusSimulationN[0].value;
double max = FocusSimulationN[1].value;
double optimalFWHM = FocusSimulationN[2].value;
double focus = FocusSimulationNP[SIM_FOCUS_POSITION].value;
double max = FocusSimulationNP[SIM_FOCUS_MAX].value;
double optimalFWHM = FocusSimulationNP[SIM_SEEING].value;

// limit to +/- 10
double ticks = 20 * (FocuserPos - focus) / max;
Expand Down Expand Up @@ -1403,7 +1403,7 @@ bool CCDSim::saveConfigItems(FILE * fp)
SimulateBayerSP.save(fp);

// Focus simulation
IUSaveConfigNumber(fp, &FocusSimulationNP);
FocusSimulationNP.save(fp);

return true;
}
Expand Down
9 changes: 7 additions & 2 deletions drivers/ccd/ccd_simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,13 @@ class CCDSim : public INDI::CCD, public INDI::FilterInterface
// FocuserPosition[2] is the seeing (in arcsec)
// We need to have these values here, since we cannot snoop it from the focuser (the focuser does not
// publish these values)
INumberVectorProperty FocusSimulationNP;
INumber FocusSimulationN[3];
INDI::PropertyNumber FocusSimulationNP {3};
enum
{
SIM_FOCUS_POSITION,
SIM_FOCUS_MAX,
SIM_SEEING
};

INumberVectorProperty EqPENP;
INumber EqPEN[2];
Expand Down

0 comments on commit d14a995

Please sign in to comment.