refactor LTC2620 writedac
All checks were successful
Build on RHEL9 / build (push) Successful in 3m17s
Build on RHEL8 / build (push) Successful in 4m43s

This commit is contained in:
2026-01-14 14:59:02 +01:00
parent c04e8e0beb
commit ae793af7b9
5 changed files with 18 additions and 6 deletions

View File

@@ -31,7 +31,8 @@ int LTC2620_D_DacToVoltage(int dacval, int *voltage);
int LTC2620_D_WriteDACValue(int dacnum, int dacvalue, char *dacname);
/**
* Set value for dac only
* Only for DACs (not power regulators) to validate indices and convert values
* to dac units if needed
* @param dacval if val is in mV, returns dac units set
*/
int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,

View File

@@ -4,7 +4,7 @@
#include "clogger.h"
#include "common.h"
// to include power down file name suffix
// to include power down file name suffix directly
#ifdef XILINX_CHIPTESTBOARDD
#include "slsDetectorServer_defs.h"
#else
@@ -70,13 +70,24 @@ int LTC2620_D_WriteDACValue(int dacnum, int dacvalue, char *dacname) {
return FAIL;
}
// validate value
if ((dacvalue < 0 && dacvalue != LTC2620_D_PWR_DOWN_VAL) ||
(dacvalue > LTC2620_D_MAX_DAC_VAL)) {
// validate max value
if (dacvalue > LTC2620_D_MAX_DAC_VAL) {
LOG(logERROR,
("Dac %d %s: Invalid dac value %d\n", dacnum, dacname, dacvalue));
return FAIL;
}
// validate negative values
if (dacvalue < 0) {
// dacs only: allow power down value (-100)
if ((dacnum < LTC2620_D_NumDacsOnly &&
dacvalue != LTC2620_D_PWR_DOWN_VAL) ||
// power regulators: allow no negative values
(dacnum >= LTC2620_D_NumDacsOnly)) {
LOG(logERROR, ("Dac %d %s: Invalid dac value %d\n", dacnum, dacname,
dacvalue));
return FAIL;
}
}
// print info
if (dacvalue == LTC2620_D_PWR_DOWN_VAL) {

View File

@@ -4,7 +4,7 @@
#define APILIB "0.0.0 0x250909"
#define APIRECEIVER "0.0.0 0x250822"
#define APICTB "0.0.0 0x250922"
#define APIGOTTHARD2 "0.0.0 0x260113"
#define APIGOTTHARD2 "0.0.0 0x260114"
#define APIMOENCH "0.0.0 0x250909"
#define APIEIGER "0.0.0 0x250909"
#define APIXILINXCTB "0.0.0 0x260114"