...
This commit is contained in:
@@ -323,6 +323,18 @@ Asibfm700Mount::error_t Asibfm700Mount::updateMountConfig(const Asibfm700MountCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Asibfm700Mount::error_t Asibfm700Mount::updateMountConfig(const std::string& cfg_filename)
|
||||||
|
{
|
||||||
|
Asibfm700MountConfig new_config;
|
||||||
|
auto err = new_config.load(cfg_filename);
|
||||||
|
if (err) {
|
||||||
|
return mcc::mcc_deduced_err(err, std::make_error_code(std::errc::file_exists));
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateMountConfig(new_config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* PROTECTED METHODS */
|
/* PROTECTED METHODS */
|
||||||
|
|
||||||
void Asibfm700Mount::errorLogging(const std::string& msg, const std::error_code& err)
|
void Asibfm700Mount::errorLogging(const std::string& msg, const std::error_code& err)
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public:
|
|||||||
error_t initMount();
|
error_t initMount();
|
||||||
|
|
||||||
error_t updateMountConfig(Asibfm700MountConfig const&);
|
error_t updateMountConfig(Asibfm700MountConfig const&);
|
||||||
|
error_t updateMountConfig(std::string const&);
|
||||||
Asibfm700MountConfig currentMountConfig();
|
Asibfm700MountConfig currentMountConfig();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -56,9 +56,21 @@ Asibfm700MountNetServer::Asibfm700MountNetServer(asio::io_context& ctx,
|
|||||||
|
|
||||||
output_msg.construct(mcc::network::MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR,
|
output_msg.construct(mcc::network::MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR,
|
||||||
ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR, lon, lat);
|
ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR, lon, lat);
|
||||||
|
} else if (input_msg.withKey(ASIBFM700_COMMPROTO_KEYWORD_RELOADCFG_STR)) {
|
||||||
|
if (input_msg.paramSize()) {
|
||||||
|
auto vp = input_msg.paramValue<std::string>(0);
|
||||||
|
auto err = mount_ptr->updateMountConfig(vp.value());
|
||||||
|
if (err) {
|
||||||
|
output_msg.construct(mcc::network::MCC_COMMPROTO_KEYWORD_SERVER_ERROR_STR, err);
|
||||||
|
} else {
|
||||||
|
output_msg.construct(mcc::network::MCC_COMMPROTO_KEYWORD_SERVER_ACK_STR,
|
||||||
|
ASIBFM700_COMMPROTO_KEYWORD_RELOADCFG_STR);
|
||||||
}
|
}
|
||||||
|
} else { // a filename must be given
|
||||||
else {
|
output_msg.construct(mcc::network::MCC_COMMPROTO_KEYWORD_SERVER_ERROR_STR,
|
||||||
|
std::make_error_code(std::errc::invalid_argument));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// basic network message processing
|
// basic network message processing
|
||||||
output_msg = base_t::handleMessage<output_msg_t>(input_msg, mount_ptr);
|
output_msg = base_t::handleMessage<output_msg_t>(input_msg, mount_ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,13 +91,19 @@ static constexpr auto merge_arrays(const std::array<VT, N1>& arr1, const std::ar
|
|||||||
|
|
||||||
// meteo parameters (ambient air temperature, humidity and atmosperic pressure)
|
// meteo parameters (ambient air temperature, humidity and atmosperic pressure)
|
||||||
constexpr static std::string_view ASIBFM700_COMMPROTO_KEYWORD_METEO_STR{"METEO"};
|
constexpr static std::string_view ASIBFM700_COMMPROTO_KEYWORD_METEO_STR{"METEO"};
|
||||||
|
|
||||||
// current site geodetic longtude and latitude
|
// current site geodetic longtude and latitude
|
||||||
constexpr static std::string_view ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR{"SITEGEO"};
|
constexpr static std::string_view ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR{"SITEGEO"};
|
||||||
|
|
||||||
|
// reload mount configuration file
|
||||||
|
constexpr static std::string_view ASIBFM700_COMMPROTO_KEYWORD_RELOADCFG_STR{"RELOADCFG"};
|
||||||
|
|
||||||
|
|
||||||
struct Asibfm700NetMessageValidKeywords {
|
struct Asibfm700NetMessageValidKeywords {
|
||||||
static constexpr std::array NETMSG_VALID_KEYWORDS = details::merge_arrays(
|
static constexpr std::array NETMSG_VALID_KEYWORDS =
|
||||||
mcc::network::MccNetMessageValidKeywords::NETMSG_VALID_KEYWORDS,
|
details::merge_arrays(mcc::network::MccNetMessageValidKeywords::NETMSG_VALID_KEYWORDS,
|
||||||
std::array{ASIBFM700_COMMPROTO_KEYWORD_METEO_STR, ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR});
|
std::array{ASIBFM700_COMMPROTO_KEYWORD_METEO_STR, ASIBFM700_COMMPROTO_KEYWORD_SITEGEO_STR,
|
||||||
|
ASIBFM700_COMMPROTO_KEYWORD_RELOADCFG_STR});
|
||||||
|
|
||||||
// hashes of valid keywords
|
// hashes of valid keywords
|
||||||
static constexpr std::array NETMSG_VALID_KEYWORD_HASHES = []<size_t... Is>(std::index_sequence<Is...>) {
|
static constexpr std::array NETMSG_VALID_KEYWORD_HASHES = []<size_t... Is>(std::index_sequence<Is...>) {
|
||||||
|
|||||||
@@ -159,13 +159,14 @@ AsibFM700ServoController::error_t AsibFM700ServoController::hardwareSetState(har
|
|||||||
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
// according to"SiTech protocol notes" X is DEC-axis and Y is HA-axis
|
||||||
coordval_pair_t cvalpair{.X{.val = state.XY.y(), .t = tp}, .Y{.val = state.XY.x(), .t = tp}};
|
coordval_pair_t cvalpair{.X{.val = state.XY.y(), .t = tp}, .Y{.val = state.XY.x(), .t = tp}};
|
||||||
|
|
||||||
|
coordpair_t cp{.X = state.XY.y(), .Y = state.XY.x()};
|
||||||
|
|
||||||
// correctTo is asynchronous function!!!
|
// correctTo is asynchronous function!!!
|
||||||
//
|
//
|
||||||
// according to the Eddy's implementation of the LibSidServo library it is safe
|
// according to the Eddy's implementation of the LibSidServo library it is safe
|
||||||
// to pass the addresses of 'cvalpair' and 'cpair' automatic variables
|
// to pass the addresses of 'cvalpair' and 'cpair' automatic variables
|
||||||
// auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.correctTo(&cvalpair, &cpair));
|
auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.moveTo(&cp));
|
||||||
auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.correctTo(&cvalpair));
|
// auto err = static_cast<AsibFM700ServoControllerErrorCode>(Mount.correctTo(&cvalpair));
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user