Bi-monthly release with minor bug fixes and improvements
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
IPState SmartFocus::MoveAbsFocuser(uint32_t targetPosition) {
static const char move_abs = 'g';
static const char expected_respons = move_abs;
static const char complete = 'c';
IPState result = IPS_ALERT;
if (targetPosition < FocusAbsPosN[0].min || targetPosition > FocusAbsPosN[0].max)
IDMessage(getDeviceName(), "Error, requested absolute position is out of range.");
else {
const Ticks destination = static_cast<Ticks>(targetPosition);
char command[3];
command[0] = move_abs;
command[1] = ((destination>>8) & 0xFF);
command[2] = ( destination & 0xFF);
IDMessage(getDeviceName() , "Focuser is moving to requested position...");
DEBUGF(INDI::Logger::DBG_SESSION, "MoveAbsFocuser: destination= %d", destination);
if (!isSimulation()) {
//tcflush(PortFD, TCIOFLUSH);
if (send(command, sizeof(command), "MoveAbsFocuser")) {
char respons;
if (recv(&respons, sizeof(respons), 1, "MoveAbsFocuser")) {
DEBUGF(INDI::Logger::DBG_SESSION, "MoveAbsFocuser received echo: %c", respons);
// A 20 second time out should be long enough for any focuser movement to finish
if (recv(&respons, sizeof(respons), 20, "MoveAbsFocuser")) {
DEBUGF(INDI::Logger::DBG_SESSION, "MoveAbsFocuser received code: %c (0x%02x)", respons, respons);
SFgetParameters();
result = ( respons == complete ? IPS_OK : IPS_ALERT );
DEBUGF(INDI::Logger::DBG_SESSION, "MoveAbsFocuser position: %d %f", position, FocusAbsPosN[0].value);
}
}
}
}
}
return result;
}
void SmartFocus::SFgetParameters(void) {
const Flags flags = SFgetFlags();
FlagsL[STATUS_SERIAL_FRAMING_ERROR].s = ( flags & SerFramingError ? IPS_ALERT : IPS_OK );
FlagsL[STATUS_SERIAL_OVERRUN_ERROR].s = ( flags & SerOverrunError ? IPS_ALERT : IPS_OK );
FlagsL[STATUS_MOTOR_ENCODE_ERROR ].s = ( flags & MotorEncoderError ? IPS_ALERT : IPS_OK );
FlagsL[STATUS_AT_ZERO_POSITION ].s = ( flags & AtZeroPosition ? IPS_ALERT : IPS_OK );
FlagsL[STATUS_AT_MAX_POSITION ].s = ( flags & AtMaxPosition ? IPS_ALERT : IPS_OK );
IDSetLight(&FlagsLP,NULL);
if ( (position = SFgetPosition()) == TicksInvalid ) {
FocusAbsPosNP.s = IPS_ALERT;
IDSetNumber(&FocusAbsPosNP, "Error while reading SmartFocus position");
}
else {
FocusAbsPosN[0].value = position;
FocusAbsPosNP.s = IPS_OK;
IDSetNumber(&FocusAbsPosNP, NULL);
}
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
...
if (recv(&respons, sizeof(respons), 20, "MoveAbsFocuser")) {
DEBUGF(INDI::Logger::DBG_SESSION, "MoveAbsFocuser received code: %c (0x%02x)", respons, respons);
SFgetParameters();
...
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.