diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-05-06 11:09:54 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-05-06 11:09:54 +0300 |
commit | 462ff1348a91212ea206787dcea17207cbc22534 (patch) | |
tree | a40a727d365145cb59dad703c4dc08962daba105 /src/ObjectModel | |
parent | 2c1390e3fc56e231b1ad7a98542bb7eecb00d6d2 (diff) |
Fix bug with reporting expansion board name or firmware version
It was clearing any existing data in the result string
Diffstat (limited to 'src/ObjectModel')
-rw-r--r-- | src/ObjectModel/ObjectModel.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/ObjectModel/ObjectModel.cpp b/src/ObjectModel/ObjectModel.cpp index cd3ca13c..6a1dfd51 100644 --- a/src/ObjectModel/ObjectModel.cpp +++ b/src/ObjectModel/ObjectModel.cpp @@ -186,7 +186,7 @@ void ExpressionValue::Release() noexcept #if SUPPORT_CAN_EXPANSION -// Given that this is a CanExpansionBoardDetails value, extract the part requested according to the parameter +// Given that this is a CanExpansionBoardDetails value, extract the part requested according to the parameter and append it to the string // sVal is a string of the form shortName|version void ExpressionValue::ExtractRequestedPart(const StringRef& rslt) const noexcept { @@ -199,22 +199,15 @@ void ExpressionValue::ExtractRequestedPart(const StringRef& rslt) const noexcept switch((ExpansionDetail)param) { case ExpansionDetail::shortName: - rslt.copy(sVal, indexOfDivider); + rslt.catn(sVal, indexOfDivider); break; case ExpansionDetail::firmwareVersion: - if (p == nullptr) - { - rslt.Clear(); - } - else - { - rslt.copy(sVal + indexOfDivider + 1); - } + rslt.cat((p == nullptr) ? "unknown" : sVal + indexOfDivider + 1); break; case ExpansionDetail::firmwareFileName: - rslt.copy("Duet3Firmware_"); + rslt.cat("Duet3Firmware_"); rslt.catn(sVal, indexOfDivider); rslt.cat(".bin"); break; |