Simplified paramLib access and show error messages for one poll cycle

Simplified getting and setting paramLib entries via a macro and created
a mechanism within poll() which makes sure that error messages are shown
for at least one poll cycle. Also moved MAXBUF_ to the SinqController
level.
This commit is contained in:
2025-05-14 15:49:37 +02:00
parent 9792697d03
commit 9bc90cff61
5 changed files with 48 additions and 70 deletions

View File

@@ -500,40 +500,8 @@ asynStatus getAxisParam(sinqAxis *axis, const char *indexName,
* return asynSuccess;
* }
* ```
*
* If `readValue` is a `char *`, the size of the buffer needs to be provided as
* well:
* ```
* char readValue[20] = {0};
* getAxisParamChecked(this, motorStatusProblem_, &readValue, sizeof(readValue))
* ```
* expands to
* ```
* {
* int indexValue = axis->pController()->motorStatusProblem_();
* asynStatus status = axis->pController()->getStringParam(axis->axisNo(),
* indexValue, sizeof(readValue), readValue); if (status != asynSuccess) {
* return axis->pController()->paramLibAccessFailed( status,
* "motorStatusProblem_", axis->axisNo(), __PRETTY_FUNCTION__,
* __LINE__);
* }
* return asynSuccess;
* }
* ```
* =============================================================================
*/
// #define getAxisParamChecked(axis, indexGetterFunction, readValue, ...) \
// { \
// asynStatus getStatus = getAxisParam( \
// axis, #indexGetterFunction, \
// &std::remove_pointer< \
// decltype(axis->pController())>::type::indexGetterFunction, \
// readValue, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \
// if (getStatus != asynSuccess) { \
// return getStatus; \
// } \
// }
#define getAxisParamChecked(axis, indexGetterFunction, readValue) \
{ \
asynStatus getStatus = getAxisParam( \