Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Temperature Property #2106

Merged
merged 26 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b39b427
Migrate Temperature Property
naheedsa Sep 2, 2024
6da8294
Migrate Bayer Property
naheedsa Sep 2, 2024
9df5ff8
Migrate WorldCoordSP Property
naheedsa Sep 2, 2024
cabe745
Migrate CCDRotationNP, ImageFrameNP and ImageBinNP Properties
naheedsa Sep 3, 2024
a478986
use updateMinMax()
naheedsa Sep 3, 2024
ac1c69f
Migrate FastExposureToggleSP Property
naheedsa Sep 3, 2024
4a8fa82
Migrate ImagePixelSizeNP, ImageExposureNP, FastExposureCountNP, WebSo…
naheedsa Sep 9, 2024
34cbec4
Migrate AbortExposureSP Property
naheedsa Sep 9, 2024
2f2bcd5
Migrate UploadSP Property
naheedsa Sep 9, 2024
02a028f
Migrate CompressSP Property
naheedsa Sep 9, 2024
2fe337c
Migrate FrameTypeSP Property
naheedsa Sep 9, 2024
ef839d7
Migrate ResetSP Property
naheedsa Sep 9, 2024
036feba
Migrate UploadSettingsTP Property
naheedsa Sep 9, 2024
71c3d55
Migrate FileNameTP Property
naheedsa Sep 9, 2024
082859a
Merge branch 'master' into feature/migrate-ccd
naheedsa Sep 9, 2024
ef23262
Fix build issues
naheedsa Sep 10, 2024
70bf1db
Add missing {1}
naheedsa Sep 10, 2024
246abcd
Merge branch 'master' into feature/migrate-ccd
naheedsa Sep 10, 2024
f75b15a
update getCCDInfo condition
naheedsa Sep 10, 2024
fa3d603
use setPermission
naheedsa Sep 10, 2024
904a8e7
Merge branch 'master' into feature/migrate-ccd
naheedsa Sep 10, 2024
7cced0e
Use snoop property
naheedsa Sep 10, 2024
5b924dd
Fix requested changes
naheedsa Sep 12, 2024
12bd405
Remove unnecessary code
naheedsa Sep 12, 2024
e5de53d
Update getFileIndex
naheedsa Sep 12, 2024
43ea92c
update getFileIndex param types
naheedsa Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions drivers/ccd/ccd_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ void CCDSim::setBayerEnabled(bool onOff)
if (onOff)
{
SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
IUSaveText(&BayerT[0], "0");
IUSaveText(&BayerT[1], "0");
IUSaveText(&BayerT[2], "RGGB");
BayerTP[CFA_OFFSET_X].setText("0");
BayerTP[CFA_OFFSET_Y].setText("0");
BayerTP[CFA_TYPE].setText("RGGB");
}
else
{
Expand Down Expand Up @@ -321,9 +321,9 @@ bool CCDSim::updateProperties()
int CCDSim::SetTemperature(double temperature)
{
TemperatureRequest = temperature;
if (fabs(temperature - TemperatureN[0].value) < 0.1)
if (std::abs(temperature - TemperatureNP[0].getValue()) < 0.1)
{
TemperatureN[0].value = temperature;
TemperatureNP[0].setValue(temperature);
return 1;
}

Expand Down Expand Up @@ -492,21 +492,21 @@ void CCDSim::TimerHit()
}
}

if (TemperatureNP.s == IPS_BUSY)
if (TemperatureNP.getState() == IPS_BUSY)
{
if (TemperatureRequest < TemperatureN[0].value)
TemperatureN[0].value = std::max(TemperatureRequest, TemperatureN[0].value - 0.5);
if (TemperatureRequest < TemperatureNP[0].getValue())
TemperatureNP[0].setValue(std::max(TemperatureRequest, TemperatureNP[0].getValue() - 0.5));
else
TemperatureN[0].value = std::min(TemperatureRequest, TemperatureN[0].value + 0.5);
TemperatureNP[0].setValue(std::min(TemperatureRequest, TemperatureNP[0].getValue() + 0.5));

if (std::abs(TemperatureN[0].value - m_LastTemperature) > 0.1)
if (std::abs(TemperatureNP[0].getValue() - m_LastTemperature) > 0.1)
{
m_LastTemperature = TemperatureN[0].value;
IDSetNumber(&TemperatureNP, nullptr);
m_LastTemperature = TemperatureNP[0].getValue();
TemperatureNP.apply();
}

// Above 20, cooler is off
if (TemperatureN[0].value >= 20)
if (TemperatureNP[0].getValue() >= 20)
{
CoolerSP[INDI_ENABLED].setState(ISS_OFF);
CoolerSP[INDI_DISABLED].setState(ISS_ON);
Expand Down Expand Up @@ -1183,7 +1183,7 @@ bool CCDSim::ISNewSwitch(const char * dev, const char * name, ISState * states,
{
CoolerSP.setState(IPS_IDLE);
m_TargetTemperature = 20;
TemperatureNP.s = IPS_BUSY;
TemperatureNP.setState(IPS_BUSY);
m_TemperatureCheckTimer.start();
m_TemperatureElapsedTimer.start();
}
Expand Down Expand Up @@ -1601,9 +1601,9 @@ bool CCDSim::loadNextImage()
if (channels == 1 && strlen(bayer_pattern) == 4)
{
SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
IUSaveText(&BayerT[0], "0");
IUSaveText(&BayerT[1], "0");
IUSaveText(&BayerT[2], bayer_pattern);
BayerTP[CFA_OFFSET_X].setText("0");
BayerTP[CFA_OFFSET_Y].setText("0");
BayerTP[CFA_TYPE].setText(bayer_pattern);
}
else
{
Expand Down
28 changes: 14 additions & 14 deletions drivers/ccd/guide_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ bool GuideSim::SetupParms()

if (HasCooler())
{
TemperatureN[0].value = 20;
IDSetNumber(&TemperatureNP, nullptr);
TemperatureNP[0].setValue(20);
TemperatureNP.apply();
}

// Kwiq
Expand Down Expand Up @@ -203,9 +203,9 @@ void GuideSim::setRGB(bool onOff)
if (onOff)
{
SetCCDCapability(GetCCDCapability() | CCD_HAS_BAYER);
IUSaveText(&BayerT[0], "0");
IUSaveText(&BayerT[1], "0");
IUSaveText(&BayerT[2], "RGGB");
BayerTP[CFA_OFFSET_X].setText("0");
BayerTP[CFA_OFFSET_Y].setText("0");
BayerTP[CFA_TYPE].setText("RGGB");
}
else
{
Expand Down Expand Up @@ -256,9 +256,9 @@ bool GuideSim::updateProperties()
int GuideSim::SetTemperature(double temperature)
{
TemperatureRequest = temperature;
if (fabs(temperature - TemperatureN[0].value) < 0.1)
if (fabs(temperature - TemperatureNP[0].getValue()) < 0.1)
{
TemperatureN[0].value = temperature;
TemperatureNP[0].setValue(temperature);
return 1;
}

Expand Down Expand Up @@ -358,18 +358,18 @@ void GuideSim::TimerHit()
}
}

if (TemperatureNP.s == IPS_BUSY)
if (TemperatureNP.getState() == IPS_BUSY)
{
if (TemperatureRequest < TemperatureN[0].value)
TemperatureN[0].value = std::max(TemperatureRequest, TemperatureN[0].value - 0.5);
if (TemperatureRequest < TemperatureNP[0].getValue())
TemperatureNP[0].setValue(std::max(TemperatureRequest, TemperatureNP[0].getValue() - 0.5));
else
TemperatureN[0].value = std::min(TemperatureRequest, TemperatureN[0].value + 0.5);
TemperatureNP[0].setValue(std::min(TemperatureRequest, TemperatureNP[0].getValue() + 0.5));


IDSetNumber(&TemperatureNP, nullptr);
TemperatureNP.apply();

// Above 20, cooler is off
if (TemperatureN[0].value >= 20)
if (TemperatureNP[0].getValue() >= 20)
{
CoolerSP[COOLER_ON].setState(ISS_OFF);
CoolerSP[COOLER_OFF].setState(ISS_ON);
Expand Down Expand Up @@ -1085,7 +1085,7 @@ bool GuideSim::ISNewSwitch(const char * dev, const char * name, ISState * states
{
CoolerSP.setState(IPS_IDLE);
TemperatureRequest = 20;
TemperatureNP.s = IPS_BUSY;
TemperatureNP.setState(IPS_BUSY);
}

CoolerSP.apply();
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/v4l2driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool V4L2_Driver::initProperties()
IUFillNumberVector(&ImageAdjustNP, nullptr, 0, getDeviceName(), "Image Adjustments", "", IMAGE_GROUP, IP_RW, 60,
IPS_IDLE);

PrimaryCCD.getCCDInfo()->p = IP_RW;
PrimaryCCD.getCCDInfo().setPermission(IP_RW);

PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0.001, 3600, 1, false);

Expand Down
12 changes: 6 additions & 6 deletions examples/tutorial_three/simpleccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <memory>

/* Macro shortcut to CCD temperature value */
#define currentCCDTemperature TemperatureN[0].value
#define currentCCDTemperature TemperatureNP[0].value

std::unique_ptr<SimpleCCD> simpleCCD(new SimpleCCD());

Expand Down Expand Up @@ -191,7 +191,7 @@ void SimpleCCD::TimerHit()
}

// TemperatureNP is defined in INDI::CCD
switch (TemperatureNP.s)
switch (TemperatureNP.getState())
{
case IPS_IDLE:
case IPS_OK:
Expand All @@ -207,13 +207,13 @@ void SimpleCCD::TimerHit()
/* If they're equal, stop updating */
else
{
TemperatureNP.s = IPS_OK;
IDSetNumber(&TemperatureNP, "Target temperature reached.");

TemperatureNP.setState(IPS_OK);
LOG_WARN("Target temperature reached.");
TemperatureNP.apply();
break;
}

IDSetNumber(&TemperatureNP, nullptr);
TemperatureNP.apply();

break;

Expand Down
Loading
Loading