add hardwareShutdown method requirement to mcc_hardware_c concept
This commit is contained in:
@@ -706,75 +706,12 @@ concept mcc_hardware_c = requires(T t) {
|
|||||||
}(); // to ensure 'mountType' can be used in compile-time context
|
}(); // to ensure 'mountType' can be used in compile-time context
|
||||||
|
|
||||||
|
|
||||||
// a type that defines at least HW_MOVE_ERROR, HW_MOVE_STOPPING, HW_MOVE_STOPPED, HW_MOVE_SLEWING,
|
|
||||||
// HW_MOVE_ADJUSTING, HW_MOVE_TRACKING and HW_MOVE_GUIDING compile-time constants. The main purpose of this type is
|
|
||||||
// a possible tunning of hardware hardwareSetState-related commands and detect the stop and error states from
|
|
||||||
// hardware
|
|
||||||
//
|
|
||||||
// e.g. an implementations can be as follows:
|
|
||||||
// enum class hardware_movement_state_t: int {HW_MOVE_ERROR = -1, HW_MOVE_STOPPED = 0, HW_MOVE_STOPPING,
|
|
||||||
// HW_MOVE_SLEWING, HW_MOVE_ADJUSTING, HW_MOVE_TRACKING, HW_MOVE_GUIDING}
|
|
||||||
//
|
|
||||||
// struct hardware_movement_state_t {
|
|
||||||
// static constexpr uint16_t HW_MOVE_STOPPED = 0;
|
|
||||||
// static constexpr uint16_t HW_MOVE_SLEWING = 111;
|
|
||||||
// static constexpr uint16_t HW_MOVE_ADJUSTING = 222;
|
|
||||||
// static constexpr uint16_t HW_MOVE_TRACKING = 333;
|
|
||||||
// static constexpr uint16_t HW_MOVE_GUIDING = 444;
|
|
||||||
// static constexpr uint16_t HW_MOVE_ERROR = 555;
|
|
||||||
// static constexpr uint16_t HW_MOVE_STOPPING = 666;
|
|
||||||
// }
|
|
||||||
|
|
||||||
requires mcc_hardware_movement_state_c<typename T::hardware_movement_state_t>;
|
requires mcc_hardware_movement_state_c<typename T::hardware_movement_state_t>;
|
||||||
|
|
||||||
// requires requires(typename T::hardware_movement_state_t type) {
|
|
||||||
// []() {
|
|
||||||
// // mount axes were stopped
|
|
||||||
// static constexpr auto v0 = T::hardware_movement_state_t::HW_MOVE_STOPPED;
|
|
||||||
|
|
||||||
// // hardware was asked for slewing (move to given celestial point)
|
|
||||||
// static constexpr auto v1 = T::hardware_movement_state_t::HW_MOVE_SLEWING;
|
|
||||||
|
|
||||||
// // hardware was asked for adjusting after slewing
|
|
||||||
// // (adjusting actual mount position to align with target celestial point at the end of slewing process)
|
|
||||||
// static constexpr auto v2 = T::hardware_movement_state_t::HW_MOVE_ADJUSTING;
|
|
||||||
|
|
||||||
// // hardware was asked for tracking (track target celestial point)
|
|
||||||
// static constexpr auto v3 = T::hardware_movement_state_t::HW_MOVE_TRACKING;
|
|
||||||
|
|
||||||
// // hardware was asked for guiding
|
|
||||||
// // (small corrections to align actual mount position with target celestial point)
|
|
||||||
// static constexpr auto v4 = T::hardware_movement_state_t::HW_MOVE_GUIDING;
|
|
||||||
|
|
||||||
// // to detect possible hardware error
|
|
||||||
// static constexpr auto v5 = T::hardware_movement_state_t::HW_MOVE_ERROR;
|
|
||||||
// }();
|
|
||||||
// };
|
|
||||||
|
|
||||||
requires mcc_hardware_state_c<typename T::hardware_state_t> && requires(typename T::hardware_state_t state) {
|
requires mcc_hardware_state_c<typename T::hardware_state_t> && requires(typename T::hardware_state_t state) {
|
||||||
requires std::same_as<decltype(state.movementState), typename T::hardware_movement_state_t>;
|
requires std::same_as<decltype(state.movementState), typename T::hardware_movement_state_t>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// requires requires(typename T::hardware_state_t state) {
|
|
||||||
// // encoder co-longitude and co-latiitude positions, as well as its measurement time point
|
|
||||||
// // the given constrains on coordinate pair kind can be used to deduce mount type
|
|
||||||
// requires mcc_coord_pair_c<decltype(state.XY)> &&
|
|
||||||
// ( // for equathorial mount:
|
|
||||||
// decltype(state.XY)::pairKind == impl::MccCoordPairKind::COORDS_KIND_HADEC_OBS ||
|
|
||||||
// // for alt-azimuthal mount:
|
|
||||||
// decltype(state.XY)::pairKind == impl::MccCoordPairKind::COORDS_KIND_AZALT ||
|
|
||||||
// decltype(state.XY)::pairKind == impl::MccCoordPairKind::COORDS_KIND_AZZD);
|
|
||||||
|
|
||||||
// // co-longitude and co-latiitude axis angular speeds, as well as its measurement/computation time point
|
|
||||||
// requires mcc_coord_pair_c<decltype(state.speedXY)> &&
|
|
||||||
// (decltype(state.XY)::pairKind == impl::MccCoordPairKind::COORDS_KIND_GENERIC ||
|
|
||||||
// decltype(state.XY)::pairKind == impl::MccCoordPairKind::COORDS_KIND_XY);
|
|
||||||
|
|
||||||
|
|
||||||
// requires std::same_as<typename T::hardware_movement_state_t, decltype(state.movementState)>;
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
// set hardware state:
|
// set hardware state:
|
||||||
{ t.hardwareSetState(std::declval<typename T::hardware_state_t const&>()) } -> std::same_as<typename T::error_t>;
|
{ t.hardwareSetState(std::declval<typename T::hardware_state_t const&>()) } -> std::same_as<typename T::error_t>;
|
||||||
|
|
||||||
@@ -783,6 +720,8 @@ concept mcc_hardware_c = requires(T t) {
|
|||||||
|
|
||||||
// { t.hardwareStop() } -> std::same_as<typename T::error_t>; // stop any moving
|
// { t.hardwareStop() } -> std::same_as<typename T::error_t>; // stop any moving
|
||||||
{ t.hardwareInit() } -> std::same_as<typename T::error_t>; // initialize hardware
|
{ t.hardwareInit() } -> std::same_as<typename T::error_t>; // initialize hardware
|
||||||
|
|
||||||
|
{ t.hardwareShutdown() } -> std::same_as<typename T::error_t>; // shutdown hardware
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user