mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Add new KNX_NO_STRTOx_CONVERSION define for footprint reduction (#137)
* Remove uniqueSerialNumber debug log to reduce footprint * add KNX_NO_STRTOx_CONVERSION to avoid expensive strtod conversion
This commit is contained in:
parent
ed54da7089
commit
75c863bffe
@ -65,6 +65,16 @@
|
||||
// this option might be also set via compiler flag -DSMALL_GROUPOBJECT if required
|
||||
//#define SMALL_GROUPOBJECT
|
||||
|
||||
// Some defines to reduce footprint
|
||||
// Do not perform conversion from KNXValue(const char*) to other types, it mainly avoids the expensive strtod
|
||||
//#define KNX_NO_STRTOx_CONVERSION
|
||||
// Do not print messages
|
||||
//#define KNX_NO_PRINT
|
||||
// Do not use SPI (Arduino variants)
|
||||
//#define KNX_NO_SPI
|
||||
// Do not use the default UART (Arduino variants), it must be defined by ArduinoPlatform::knxUart
|
||||
// (combined with other flags (HWSERIAL_NONE for stm32) - avoid allocation of RX/TX buffers for all serial lines)
|
||||
//#define KNX_NO_DEFAULT_UART
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -343,7 +343,11 @@ uint64_t KNXValue::ulongValue() const
|
||||
case DoubleType:
|
||||
return (uint64_t)_value.doubleValue;
|
||||
case StringType:
|
||||
#ifndef KNX_NO_STRTOx_CONVERSION
|
||||
return (uint64_t)strtoul(_value.stringValue, NULL, 0);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -444,7 +448,11 @@ int64_t KNXValue::longValue() const
|
||||
case DoubleType:
|
||||
return (int64_t)_value.doubleValue;
|
||||
case StringType:
|
||||
#ifndef KNX_NO_STRTOx_CONVERSION
|
||||
return strtol(_value.stringValue, NULL, 0);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -476,7 +484,11 @@ double KNXValue::doubleValue() const
|
||||
case LongType:
|
||||
return _value.longValue;
|
||||
case StringType:
|
||||
#ifndef KNX_NO_STRTOx_CONVERSION
|
||||
return strtod(_value.stringValue, NULL);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user