GCodeLine::has_value now uses locale-independent functions for parsing:
This will hopefully fix the mysterious issues #10380 #10331 #10542. The reason is not exactly clear, seems similar to https://stackoverflow.com/questions/76133503/strtod-does-not-respect-locale-on-macos-13-3-1. Possibly a bug in macOS 13.3.1
This commit is contained in:
parent
8806442f55
commit
c843349d35
@ -243,9 +243,10 @@ bool GCodeReader::GCodeLine::has_value(char axis, float &value) const
|
||||
if (c == nullptr)
|
||||
return false;
|
||||
// Try to parse the numeric value.
|
||||
char *pend = nullptr;
|
||||
double v = strtod(++ c, &pend);
|
||||
if (pend != nullptr && is_end_of_word(*pend)) {
|
||||
double v = 0.;
|
||||
const char* end = m_raw.c_str() + m_raw.size();
|
||||
auto [pend, ec] = fast_float::from_chars(++c, end, v);
|
||||
if (pend != c && is_end_of_word(*pend)) {
|
||||
// The axis value has been parsed correctly.
|
||||
value = float(v);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user