mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-06 01:46:04 +08:00
Trim trailing zeros in nozzle string from connect.
This commit is contained in:
parent
a2568c3449
commit
13ac78f8e9
@ -297,6 +297,15 @@ std::string UserAccount::get_nozzle_from_json(const std::string& message) const
|
|||||||
catch (const std::exception& e) {
|
catch (const std::exception& e) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "Could not parse prusaconnect message. " << e.what();
|
BOOST_LOG_TRIVIAL(error) << "Could not parse prusaconnect message. " << e.what();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get rid of trailing zeros.
|
||||||
|
// This is because somtimes we get "nozzle_diameter":0.40000000000000002
|
||||||
|
// This will return wrong result for f.e. 0.05. But we dont have such profiles right now.
|
||||||
|
if (size_t fist_dot = out.find('.'); fist_dot != std::string::npos) {
|
||||||
|
if (size_t first_zero = out.find('0', fist_dot); first_zero != std::string::npos) {
|
||||||
|
return out.substr(0, first_zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user