19static void ftoa(
float value,
char *buffer,
int precision = 2) {
25 sprintf(buffer,
"%f", value);
36 uint32_t intPart = (uint32_t)value;
42 intBuf[i++] =
'0' + (intPart % 10);
48 *buffer++ = intBuf[i];
54 float fracPart = value - (uint32_t)value;
55 for (
int j = 0; j < precision; ++j) {
57 int digit = (int)fracPart;
58 *buffer++ =
'0' + digit;
66static int itoa(
int value,
char *sp,
int radix) {
72 int sign = (radix == 10 && value < 0);
78 while (v || tp == tmp) {
80 v = radix ? v / radix : 0;
100static float atoff(
const char *str,
size_t len) {
103 float fraction = 0.0f;
104 float divisor = 1.0f;
105 int isFractional = 0;
116 (str[
pos] ==
' ' || str[
pos] ==
'\t' || str[
pos] ==
'\n' ||
117 str[
pos] ==
'\r' || str[
pos] ==
'\f' || str[
pos] ==
'\v')) {
122 if (
pos < len && str[
pos] ==
'-') {
125 }
else if (
pos < len && str[
pos] ==
'+') {
131 if (str[
pos] >=
'0' && str[
pos] <=
'9') {
134 fraction += (str[
pos] -
'0') / divisor;
136 result = result * 10.0f + (str[
pos] -
'0');
138 }
else if (str[
pos] ==
'.' && !isFractional) {
148 result = result + fraction;
151 return sign * result;
159 dst->
write(buf, strlen(buf));
201 char *newData = (
char *)realloc(
mData, newLength + 1);
209 char *newData = (
char *)malloc(newLength + 1);
227 append(
"\n FFTImpl Bins:\n ");
230 append(
" FFTImpl Bins DB:\n ");
246 if (
this != &other) {
248 char temp[FASTLED_STR_INLINED_SIZE];
249 memcpy(temp,
mInlineData, FASTLED_STR_INLINED_SIZE);
251 memcpy(other.
mInlineData, temp, FASTLED_STR_INLINED_SIZE);
257 static_assert(FASTLED_STR_INLINED_SIZE > 0,
258 "FASTLED_STR_INLINED_SIZE must be greater than 0");
260 "If you want to change the FASTLED_STR_INLINED_SIZE, then it "
261 "must be through a build define and not an include define.");
278 dst->
write(buf, strlen(buf));
static void compileTimeAssertions()
Str & append(const T &val)
size_t write(const uint8_t *data, size_t n)
StringHolderPtr mHeapData
StringHolder(const char *str)
void grow(size_t newLength)
Defines the red, green, and blue (RGB) pixel struct.
Implements the FastLED namespace macros.
static float atoff(const char *str, size_t len)
static void ftoa(float value, char *buffer, int precision=2)
static int itoa(int value, char *sp, int radix)
void swap(array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)
fl::vector< float > bins_raw
fl::vector< float > bins_db
#define FASTLED_UNUSED(x)