add sensorname console command

This commit is contained in:
MichaelDvP
2021-07-16 10:33:12 +02:00
parent 1f793c49ae
commit 0f48d3e72c
13 changed files with 177 additions and 28 deletions

View File

@@ -417,12 +417,15 @@ bool Helpers::value2number(const char * v, int & value) {
// checks if we can convert a char string to a float value
bool Helpers::value2float(const char * v, float & value) {
value = 0;
if ((v == nullptr) || (strlen(v) == 0)) {
value = 0;
return false;
}
value = atof((char *)v);
return true;
if (v[0] == '-' || v[0] == '.' || (v[0] >= '0' && v[0] <= '9')) {
value = atof((char *)v);
return true;
}
return false;
}
// https://stackoverflow.com/questions/313970/how-to-convert-stdstring-to-lower-case