Skip to content

Commit bce3070

Browse files
Merge pull request #155 from DiamondLightSource/fix_CsAxisRBV
Fix CsAxis mapping broken by compiler optimization
2 parents a79c0a4 + 5b32d46 commit bce3070

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pmacApp/src/pmacController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ asynStatus pmacController::mediumUpdate(pmacCommandStore *sPtr) {
15151515
} else {
15161516
setIntegerParam(axis, PMAC_C_GroupCSPortRBV_, 0);
15171517
}
1518-
std::string cs_cmd = pHardware_->getCSMappingCmd(axisCs, axis).c_str();
1518+
std::string cs_cmd = pHardware_->getCSMappingCmd(axisCs, axis);
15191519
if (sPtr->checkForItem(cs_cmd)) {
15201520
const std::string result = pHardware_->parseCSMappingResult(
15211521
sPtr->readValue(cs_cmd));

pmacApp/src/pmacHardwarePower.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ std::string pmacHardwarePower::parseCSMappingResult(const std::string mappingRes
331331
static const char *functionName = "parseCSMappingResult";
332332
debugf(DEBUG_FLOW, functionName, "command %s", mappingResult.c_str());
333333

334-
if (mappingResult.length() > 0) {
335-
const char *mapping = mappingResult.substr(mappingResult.length() - 1, 1).c_str();
336-
char upper_mapping = (char) toupper(mapping[0]);
337-
result = std::string(1, upper_mapping);
334+
if (mappingResult.empty()) {
335+
return std::string();
338336
}
337+
char upper_mapping = (char) toupper(mappingResult.back());
338+
result = std::string(1,upper_mapping);
339339

340340
return result;
341341
}

0 commit comments

Comments
 (0)