...
This commit is contained in:
parent
7e62c1d44a
commit
022ff155a9
@ -90,12 +90,42 @@ std::string_view AsibFM700Hardware::id() const
|
||||
}
|
||||
|
||||
|
||||
AsibFM700Hardware::error_t AsibFM700Hardware::getState(AsibFM700Hardware::hw_state_t& state) const
|
||||
{
|
||||
mountdata_t data;
|
||||
error_t err = static_cast<AsibFM700HardwareErrorCode>(Mount.getMountData(&data));
|
||||
|
||||
if (err == AsibFM700HardwareErrorCode::ERROR_OK) {
|
||||
// are both motors stopped?
|
||||
bool stop_motors = (data.extradata.ExtraBits & XMOTOR_STOP_BIT) && (data.extradata.ExtraBits & YMOTOR_STOP_BIT);
|
||||
if (stop_motors) {
|
||||
state = hw_state_t::HW_STATE_STOP;
|
||||
return AsibFM700HardwareErrorCode::ERROR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
AsibFM700Hardware::error_t AsibFM700Hardware::setPos(AsibFM700Hardware::axes_pos_t pos)
|
||||
{
|
||||
// according to hardware configuration (encoders pins (Eddy said)) X is DEC-axis and Y is HA-axis
|
||||
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||
double X = pos.y, Y = pos.x;
|
||||
auto err = static_cast<AsibFM700HardwareErrorCode>(Mount.moveTo(&X, &Y));
|
||||
error_t err = static_cast<AsibFM700HardwareErrorCode>(Mount.moveTo(&X, &Y));
|
||||
|
||||
coordpair_t hw_pos{.X = pos.y, .Y = pos.x};
|
||||
switch (pos.state) {
|
||||
case hw_state_t::HW_STATE_SLEW: // slew mount
|
||||
err = static_cast<AsibFM700HardwareErrorCode>(Mount.slewTo(&hw_pos, pos.flags));
|
||||
break;
|
||||
case hw_state_t::HW_STATE_TRACK: // interpretate as guiding correction
|
||||
break;
|
||||
case hw_state_t::HW_STATE_STOP:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -105,7 +135,7 @@ AsibFM700Hardware::error_t AsibFM700Hardware::setPos(AsibFM700Hardware::axes_pos
|
||||
AsibFM700Hardware::error_t AsibFM700Hardware::getPos(AsibFM700Hardware::axes_pos_t& pos)
|
||||
{
|
||||
mountdata_t data;
|
||||
auto err = static_cast<AsibFM700HardwareErrorCode>(Mount.getMountData(&data));
|
||||
error_t err = static_cast<AsibFM700HardwareErrorCode>(Mount.getMountData(&data));
|
||||
|
||||
if (err == AsibFM700HardwareErrorCode::ERROR_OK) {
|
||||
// time point from sidservo library is 'double' number represented UNIXTIME with
|
||||
@ -124,13 +154,7 @@ AsibFM700Hardware::error_t AsibFM700Hardware::getPos(AsibFM700Hardware::axes_pos
|
||||
pos.yrate = data.encXspeed.val;
|
||||
|
||||
// mount state
|
||||
|
||||
// are both motors stopped?
|
||||
bool stop_motors = (data.extradata.ExtraBits & XMOTOR_STOP_BIT) && (data.extradata.ExtraBits & YMOTOR_STOP_BIT);
|
||||
if (stop_motors) {
|
||||
pos.state = hw_state_t::HW_STATE_STOP;
|
||||
return AsibFM700HardwareErrorCode::ERROR_OK;
|
||||
}
|
||||
err = getState(pos.state);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
@ -35,7 +35,7 @@ struct AsibFM700HardwareErrorCategory : public std::error_category {
|
||||
};
|
||||
|
||||
|
||||
inline std::error_code make_error_code(AsibFM700HardwareErrorCode ec)
|
||||
static inline std::error_code make_error_code(AsibFM700HardwareErrorCode ec)
|
||||
{
|
||||
return std::error_code(static_cast<int>(ec), AsibFM700HardwareErrorCategory::get());
|
||||
}
|
||||
@ -77,6 +77,7 @@ public:
|
||||
coord_t xrate, yrate;
|
||||
|
||||
hw_state_t state;
|
||||
slewflags_t flags;
|
||||
};
|
||||
|
||||
|
||||
@ -105,6 +106,7 @@ public:
|
||||
|
||||
std::string_view id() const;
|
||||
|
||||
error_t getState(hw_state_t&) const;
|
||||
error_t setPos(axes_pos_t);
|
||||
error_t getPos(axes_pos_t&);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user