Skip to content

Commit

Permalink
Additional epics fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
slacrherbst committed Sep 17, 2020
1 parent 98e212a commit 81ff148
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions python/pyrogue/_Variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ def __init__(self, *,
self._bitSize = bitSize
self._bitOffset = bitOffset
self._verify = verify
self._typeStr = self._base.name
self._bytes = int(math.ceil(float(self._bitOffset[-1] + self._bitSize[-1]) / 8.0))
self._overlapEn = overlapEn

Expand All @@ -613,7 +612,7 @@ def __init__(self, *,
highWarning=highWarning, highAlarm=highAlarm,
pollInterval=pollInterval)


self._typeStr = self._base.name


@pr.expose
Expand Down
5 changes: 3 additions & 2 deletions src/rogue/protocols/epicsV3/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void rpe::Value::initGdd(std::string typeStr, bool isEnum, uint32_t count) {

// Unsigned Int types, > 32-bits treated as string
else if ( sscanf(typeStr.c_str(),"UInt%i",&bitSize) == 1 ) {
if ( bitSize <= 8 ) { fSize_ = 1; epicsType_ = aitEnumUint8; }
if ( bitSize <= 8 ) { fSize_ = 1; epicsType_ = aitEnumUint8;}
else if ( bitSize <= 16 ) { fSize_ = 2; epicsType_ = aitEnumUint16; }
else if ( bitSize <= 32) { fSize_ = 4; epicsType_ = aitEnumUint32; }
else { epicsType_ = aitEnumString; }
Expand Down Expand Up @@ -194,6 +194,7 @@ void rpe::Value::initGdd(std::string typeStr, bool isEnum, uint32_t count) {
log_->info("Create scalar GDD for %s epicsType_=%i",epicsName_.c_str(),epicsType_);
pValue_ = new gddScalar(gddAppType_value, epicsType_);
}

}

void rpe::Value::updated() {
Expand Down Expand Up @@ -243,7 +244,7 @@ caStatus rpe::Value::readValue(gdd &value) {
std::lock_guard<std::mutex> lock(mtx_);

// Make sure access types match
if ( (array_ && value.isAtomic()) || ((!array_) && value.isScalar()) ) {
if ( (array_ && value.isAtomic()) || (array_ && value.isScalar()) || ((!array_) && value.isScalar()) ) {

// Call value get within lock
ret = valueGet();
Expand Down
6 changes: 3 additions & 3 deletions src/rogue/protocols/epicsV3/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void rpe::Variable::fromPython(bp::object value) {
for ( i = 0; i < size_; i++ ) pF[i] = extractValue<double>(pl[i]);
pValue_->putRef(pF, new rpe::Destructor<aitFloat64 *>);
}
else throw rogue::GeneralError("Variable::fromPython","Invalid Variable Type");
else throw rogue::GeneralError::create("Variable::fromPython","Invalid Variable Type For %s",epicsName_.c_str());

} else {

Expand Down Expand Up @@ -415,13 +415,13 @@ void rpe::Variable::fromPython(bp::object value) {
else if ( enumBool.check() ) idx = (enumBool)?1:0;

// Invalid
else throw rogue::GeneralError("Variable::fromPython","Invalid enum");
else throw rogue::GeneralError::create("Variable::fromPython","Invalid enum for %s",epicsName_.c_str());

log_->info("Python set enum for %s: Enum Value=%i", epicsName_.c_str(),idx);
pValue_->putConvert(idx);
}

else throw rogue::GeneralError("Variable::fromPython","Invalid Variable Type");
else throw rogue::GeneralError::create("Variable::fromPython","Invalid Variable Type for %s",epicsName_.c_str());

}

Expand Down

0 comments on commit 81ff148

Please sign in to comment.