Skip to content

Commit

Permalink
possible fix for pyrix status issue
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Nov 3, 2024
1 parent 12d6291 commit b41b4c7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/rotator/pyxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ bool Pyxis::initProperties()
// Rotation Rate
RotationRateNP[0].fill("RATE", "Rate", "%.f", 0, 99, 10, 8);
RotationRateNP.fill(getDeviceName(), "ROTATION_RATE", "Rotation", SETTINGS_TAB, IP_RW, 0,
IPS_IDLE);
IPS_IDLE);

// Stepping
SteppingSP[FULL_STEP].fill("FULL_STEP", "Full", ISS_OFF);
SteppingSP[HALF_STEP].fill("HALF_STEP", "Half", ISS_OFF);
SteppingSP.fill( getDeviceName(), "STEPPING_RATE", "Stepping", SETTINGS_TAB, IP_RW,
ISR_ATMOST1, 0, IPS_IDLE);
ISR_ATMOST1, 0, IPS_IDLE);

// Power
PowerSP[POWER_SLEEP].fill("POWER_SLEEP", "Sleep", ISS_OFF);
PowerSP[POWER_WAKEUP].fill("POWER_WAKEUP", "Wake Up", ISS_OFF);
PowerSP.fill(getDeviceName(), "POWER_STATE", "Power", SETTINGS_TAB, IP_RW, ISR_ATMOST1, 0,
IPS_IDLE);
IPS_IDLE);

// Firmware version
FirmwareTP[0].fill("FIRMWARE_VERSION", "Version", "Unknown");
Expand Down Expand Up @@ -530,6 +530,9 @@ void Pyxis::TimerHit()
return;
}

// Record last state
auto currentState = GotoRotatorNP.s;

if (HomeRotatorSP.s == IPS_BUSY)
{
if (isMotionComplete())
Expand All @@ -554,13 +557,18 @@ void Pyxis::TimerHit()
SetTimer(POLL_100MS) ;
return ;
}
GotoRotatorNP.s = IPS_OK;
currentState = IPS_OK;
}

uint16_t PA = 0;
if (getPA(PA) && (PA != static_cast<uint16_t>(GotoRotatorN[0].value)))
// Update PA
uint16_t PA = GotoRotatorN[0].value;
getPA(PA);

// If either PA or state changed, update the property.
if ( (PA != static_cast<uint16_t>(GotoRotatorN[0].value)) || currentState != GotoRotatorNP.s)
{
GotoRotatorN[0].value = PA;
GotoRotatorNP.s = currentState;
IDSetNumber(&GotoRotatorNP, nullptr);
}

Expand Down

0 comments on commit b41b4c7

Please sign in to comment.