Added doReset wrapper around reset and added two functions to set and

retrieve the motor position which handle the conversion via
motorRecResolution.
This commit is contained in:
2025-03-28 14:51:09 +01:00
parent 828e9bc59c
commit 7729eceb28
6 changed files with 198 additions and 94 deletions

View File

@@ -14,8 +14,10 @@
class msgPrintControlKey {
public:
std::string controller_;
// -1 is a non-axis specific message
// -1 indicates a non-axis specific message
int axisNo_;
const char *functionName_;
int line_;
@@ -32,7 +34,7 @@ class msgPrintControlKey {
};
/**
* @brief Implementation of the hash functionality for msgPrintControlKey
* @brief Implementation of the hash functionality for `msgPrintControlKey`
*
*/
namespace std {
@@ -57,7 +59,7 @@ template <> struct hash<msgPrintControlKey> {
* axis fails, a corresponding error message is created in each poll. This
* could "flood" the IOC shell with noise. To prevent this, this class keeps
* track of the number of subsequent error message repetition. Each message is
* uniquely identified by "msgPrintControlKey". The function shouldBePrinted
* uniquely identified by `msgPrintControlKey`. The function `shouldBePrinted`
* can be used in order to see if a message should be printed or not:
*
* ```
@@ -67,7 +69,6 @@ template <> struct hash<msgPrintControlKey> {
* if (msgPrintControl.shouldBePrinted(controller, axisNo, __PRETTY_FUNCTION__,
* __LINE__, wantToPrint)) { asynPrint(...)
* }
*
* ```
*/
class msgPrintControl {
@@ -76,17 +77,17 @@ class msgPrintControl {
/**
* @brief Checks if the error message associated with "key" has been printed
* more than "maxRepetitions_" times in a row. If yes, returns false,
* otherwise true. Counter is reset if wantToPrint is false.
* more than `this->maxRepetitions_` times in a row. If yes, returns false,
* otherwise true. Counter is reset if `wantToPrint` is false.
*
* If the conditions for printing a message are met, "wantToPrint" must be
* set to true. The function then checks if "maxRepetitions_" has been
* If the conditions for printing a message are met, `wantToPrint` must be
* set to true. The function then checks if `maxRepetitions_` has been
* exceeded. If yes, the function returns no, indicating that the message
* should not be printed. If no, the number of repetitions stored in the map
* is incremented and the function returns true, indicating that the message
* should be printed.
*
* If the conditions for printing a message are not met, "wantToPrint" must
* If the conditions for printing a message are not met, `wantToPrint` must
* be set to false. This resets the map entry.
*
* @param key Key associated with the message, used to
@@ -117,13 +118,13 @@ class msgPrintControl {
int line, bool wantToPrint, asynUser *pasynUser);
/**
* @brief Reset the error message count incremented in shouldBePrinted for
* @brief Reset the error message count incremented in `shouldBePrinted` for
* the given key
*
* @param key Key associated with the message, used to
* identify individual messages
* @param pasynUser If the problem has been resolved (wantToPrint =
* false), a corresponding status message is printed using the given
* @param pasynUser If the problem has been resolved (`wantToPrint =
* false`), a corresponding status message is printed using the given
* asynUser. If this pointer is a nullptr, no message is printed.
*/
void resetCount(msgPrintControlKey &key, asynUser *pasynUser);