18#include "esp_rom_crc.h"
25 auto *
src =
reinterpret_cast<PGM_P
>(str);
26 std::string result(strlen_P(
src),
'\0');
27 memcpy_P(result.data(),
src, result.size());
36 ESPHOME_DEBUG_ASSERT(
size < UINT16_MAX);
41 ::operator
delete(data);
47static const uint16_t CRC16_A001_LE_LUT_L[] = {0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
48 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440};
49static const uint16_t CRC16_A001_LE_LUT_H[] = {0x0000, 0xcc01, 0xd801, 0x1400, 0xf001, 0x3c00, 0x2800, 0xe401,
50 0xa001, 0x6c00, 0x7800, 0xb401, 0x5000, 0x9c01, 0x8801, 0x4400};
53static const uint16_t CRC16_8408_LE_LUT_L[] = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
54 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7};
55static const uint16_t CRC16_8408_LE_LUT_H[] = {0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
56 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f};
60static const uint16_t CRC16_1021_BE_LUT_L[] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
61 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef};
62static const uint16_t CRC16_1021_BE_LUT_H[] = {0x0000, 0x1231, 0x2462, 0x3653, 0x48c4, 0x5af5, 0x6ca6, 0x7e97,
63 0x9188, 0x83b9, 0xb5ea, 0xa7db, 0xd94c, 0xcb7d, 0xfd2e, 0xef1f};
68uint8_t
crc8(
const uint8_t *data, uint8_t
len, uint8_t crc, uint8_t poly,
bool msb_first) {
69 while ((
len--) != 0u) {
70 uint8_t inbyte = *data++;
74 for (uint8_t i = 8; i != 0u; i--) {
76 crc = (crc << 1) ^ poly;
83 for (uint8_t i = 8; i != 0u; i--) {
84 bool mix = (crc ^ inbyte) & 0x01;
95uint16_t
crc16(
const uint8_t *data, uint16_t
len, uint16_t crc, uint16_t reverse_poly,
bool refin,
bool refout) {
97 if (reverse_poly == 0x8408) {
98 crc = esp_rom_crc16_le(refin ? crc : (crc ^ 0xffff), data,
len);
99 return refout ? crc : (crc ^ 0xffff);
106 if (reverse_poly == 0x8408) {
108 uint8_t combo = crc ^ (uint8_t) *data++;
109 crc = (crc >> 8) ^ CRC16_8408_LE_LUT_L[combo & 0x0F] ^ CRC16_8408_LE_LUT_H[combo >> 4];
114 if (reverse_poly == 0xa001) {
116 uint8_t combo = crc ^ (uint8_t) *data++;
117 crc = (crc >> 8) ^ CRC16_A001_LE_LUT_L[combo & 0x0F] ^ CRC16_A001_LE_LUT_H[combo >> 4];
122 for (uint8_t i = 0; i < 8; i++) {
124 crc = (crc >> 1) ^ reverse_poly;
132 return refout ? (crc ^ 0xffff) : crc;
135uint16_t
crc16be(
const uint8_t *data, uint16_t
len, uint16_t crc, uint16_t poly,
bool refin,
bool refout) {
137 if (poly == 0x1021) {
138 crc = esp_rom_crc16_be(refin ? crc : (crc ^ 0xffff), data,
len);
139 return refout ? crc : (crc ^ 0xffff);
146 if (poly == 0x1021) {
148 uint8_t combo = (crc >> 8) ^ *data++;
149 crc = (crc << 8) ^ CRC16_1021_BE_LUT_L[combo & 0x0F] ^ CRC16_1021_BE_LUT_H[combo >> 4];
155 crc ^= (((uint16_t) *data++) << 8);
156 for (uint8_t i = 0; i < 8; i++) {
158 crc = (crc << 1) ^ poly;
165 return refout ? (crc ^ 0xffff) : crc;
194 if (splitmix32_state == 0) {
195 random_bytes(
reinterpret_cast<uint8_t *
>(&splitmix32_state),
sizeof(splitmix32_state));
196 splitmix32_state |= 1;
198 splitmix32_state += 0x9e3779b9u;
200 z = (
z ^ (
z >> 16)) * 0x85ebca6bu;
201 z = (
z ^ (
z >> 13)) * 0xc2b2ae35u;
202 return z ^ (
z >> 16);
211 return strcasecmp(a.c_str(), b.c_str()) == 0;
214 return a.
size() == b.size() && strncasecmp(a.
c_str(), b.c_str(), a.
size()) == 0;
216#if __cplusplus >= 202002L
217bool str_startswith(
const std::string &str,
const std::string &start) {
return str.starts_with(start); }
220bool str_startswith(
const std::string &str,
const std::string &start) {
return str.rfind(start, 0) == 0; }
222 return str.rfind(
end) == (str.size() -
end.size());
227 if (suffix_len > str_len)
229 return strncasecmp(str + str_len - suffix_len, suffix, suffix_len) == 0;
233 const size_t needle_len = strlen(needle);
234 if (needle_len == 0) {
237 for (
const char *p = haystack; *p !=
'\0'; p++) {
238 if (strncasecmp(p, needle, needle_len) == 0) {
249 if (haystack ==
nullptr || needle ==
nullptr) {
252 const size_t needle_len = strlen_P(needle);
253 if (needle_len == 0) {
256 for (
const char *p = haystack; *p !=
'\0'; p++) {
257 if (strncasecmp_P(p, needle, needle_len) == 0) {
266 if (buffer_size == 0) {
270 while (*str && i < buffer_size - 1) {
278 const char *suffix_ptr,
size_t suffix_len) {
279 size_t total_len = name_len + 1 + suffix_len;
282 if (total_len >= buffer_size) {
286 name_len = buffer_size - suffix_len - 2;
287 total_len = name_len + 1 + suffix_len;
290 memcpy(
buffer, name, name_len);
292 memcpy(
buffer + name_len + 1, suffix_ptr, suffix_len);
298 if (buffer_size == 0) {
301 const size_t max_len = buffer_size - 1;
302 if (name_len <= max_len) {
303 memcpy(
buffer, name, name_len);
307 if (keep_suffix_len > max_len) {
308 keep_suffix_len = max_len;
310 const size_t head_len = max_len - keep_suffix_len;
311 memcpy(
buffer, name, head_len);
312 memcpy(
buffer + head_len, name + name_len - keep_suffix_len, keep_suffix_len);
323static constexpr uint32_t PARSE_FLOAT_MANTISSA_LIMIT = 1000000;
324static constexpr uint32_t PARSE_FLOAT_MAX_FRACTION_DIGITS = 9;
328 const bool negative = *p ==
'-';
329 if (negative || *p ==
'+')
331 const char *digits = p;
332 const char *dot =
nullptr;
335 const uint32_t d =
static_cast<unsigned char>(*p) -
'0';
337 if (*p ==
'.' && dot ==
nullptr) {
343 if (mantissa >= PARSE_FLOAT_MANTISSA_LIMIT)
345 mantissa = mantissa * 10 + d;
347 const uint32_t fraction_digits = dot !=
nullptr ? p - dot - 1 : 0;
348 const bool any_digit = p - digits > (dot !=
nullptr ? 1 : 0);
349 if (*p ==
'\0' && any_digit && fraction_digits <= PARSE_FLOAT_MAX_FRACTION_DIGITS) {
351 float value =
static_cast<float>(mantissa);
354 if (fraction_digits != 0) {
356 for (
uint32_t i = 1; i < fraction_digits; i++)
358 value /=
static_cast<float>(scale);
364 const float value = ::strtof(str, &
end);
365 if (
end == str || *
end !=
'\0' || value == HUGE_VALF)
372 for (
size_t i = 2 *
count - chars; i < 2 *
count; i++, str++) {
374 if (
val == INVALID_HEX_CHAR)
376 data[i >> 1] = (i & 1) ? data[i >> 1] |
val :
val << 4;
384static char *format_hex_internal(
char *
buffer,
size_t buffer_size,
const uint8_t *data,
size_t length,
char separator,
386 if (
length == 0 || buffer_size == 0) {
391 uint8_t stride = separator ? 3 : 2;
392 size_t max_bytes = separator ? (buffer_size / 3) : ((buffer_size - 1) / 2);
393 if (max_bytes == 0) {
400 for (
size_t i = 0; i <
length; i++) {
401 size_t pos = i * stride;
421 *buf++ =
'0' + (
val % 10);
424 std::reverse(start, buf);
429 return format_hex_internal(
buffer, buffer_size, data,
length, 0,
'a');
436 const size_t limit = buf.size() - 1;
438 for (
char ch : value) {
439 auto c =
static_cast<unsigned char>(ch);
470 if (!short_control_escapes && c < 0x20)
472 if (escape !=
'\0') {
477 }
else if (c < 0x20) {
480 if (
pos + JSON_ESCAPE_MAX_EXPANSION > limit)
491 buf[
pos++] =
static_cast<char>(c);
499 return format_hex_internal(
buffer, buffer_size, data,
length, separator,
'A');
503 if (
length == 0 || buffer_size == 0) {
510 uint8_t stride = separator ? 5 : 4;
511 size_t max_values = separator ? (buffer_size / stride) : ((buffer_size - 1) / stride);
512 if (max_values == 0) {
516 if (
length > max_values) {
519 for (
size_t i = 0; i <
length; i++) {
520 size_t pos = i * stride;
525 if (separator && i <
length - 1) {
534 if (buffer_size == 0) {
538 size_t max_bytes = (buffer_size - 1) / 8;
539 if (max_bytes == 0 ||
length == 0) {
543 size_t bytes_to_format = std::min(
length, max_bytes);
545 for (
size_t byte_idx = 0; byte_idx < bytes_to_format; byte_idx++) {
546 for (
size_t bit_idx = 0; bit_idx < 8; bit_idx++) {
547 buffer[byte_idx * 8 + bit_idx] = ((data[byte_idx] >> (7 - bit_idx)) & 1) +
'0';
550 buffer[bytes_to_format * 8] =
'\0';
555 if (on ==
nullptr && ESPHOME_strcasecmp_P(str, ESPHOME_PSTR(
"on")) == 0)
557 if (on !=
nullptr && strcasecmp(str, on) == 0)
559 if (off ==
nullptr && ESPHOME_strcasecmp_P(str, ESPHOME_PSTR(
"off")) == 0)
561 if (off !=
nullptr && strcasecmp(str, off) == 0)
563 if (ESPHOME_strcasecmp_P(str, ESPHOME_PSTR(
"toggle")) == 0)
570 float abs_val = fabsf(value);
572 if (abs_val >= 10.0f) {
573 while (abs_val >= 10.0f) {
577 }
else if (abs_val < 1.0f) {
578 while (abs_val < 1.0f) {
586static inline void normalize_accuracy_decimals(
float &value, int8_t &accuracy_decimals) {
587 if (accuracy_decimals < 0) {
589 if (accuracy_decimals == -1) {
591 }
else if (accuracy_decimals == -2) {
596 value = roundf(value / divisor) * divisor;
597 accuracy_decimals = 0;
604static size_t value_accuracy_to_buf_fast(
char *buf,
float value, int8_t accuracy_decimals,
uint32_t mult) {
606 if (std::signbit(value)) {
615 uint32_t scaled =
static_cast<uint32_t>(llrint(
static_cast<double>(value) * mult));
617 if (accuracy_decimals > 0) {
622 return static_cast<size_t>(p - buf);
626 normalize_accuracy_decimals(value, accuracy_decimals);
630 if (accuracy_decimals <= 4 && std::isfinite(value)) {
632 if (std::fabs(value) <
static_cast<float>(UINT32_MAX) / mult) {
633 return value_accuracy_to_buf_fast(buf.data(), value, accuracy_decimals, mult);
638 int len = snprintf(buf.data(), buf.size(),
"%.*f", accuracy_decimals,
static_cast<double>(value));
641 return static_cast<size_t>(
len) >= buf.size() ? buf.size() - 1 :
static_cast<size_t>(
len);
645 int8_t accuracy_decimals,
StringRef unit_of_measurement) {
647 if (
len == 0 || unit_of_measurement.
empty()) {
651 unit_of_measurement.
size());
652 return static_cast<size_t>(
end - buf.data());
657 if (!std::isfinite(step) || step == 0.0f)
659 float mantissa = std::fabs(step);
661 while (mantissa >= 10.0f) {
665 while (mantissa < 1.0f) {
671 float scaled = mantissa * 10000.0f;
672 auto digits =
static_cast<uint32_t>(scaled);
673 if (scaled -
static_cast<float>(digits) >= 0.5f)
675 while (decimals > 0 && digits % 10 == 0) {
682static constexpr uint8_t INVALID_BASE64_CHAR = 0xFF;
686static constexpr uint8_t base64_char_value(uint8_t c) {
687 if (c >=
'A' && c <=
'Z')
689 if (c >=
'a' && c <=
'z')
691 if (c >=
'0' && c <=
'9')
694 if (c ==
'+' || c ==
'-')
696 if (c ==
'/' || c ==
'_')
698 return INVALID_BASE64_CHAR;
701size_t base64_decode(
const std::string &encoded_string, uint8_t *buf,
size_t buf_len) {
702 return base64_decode(
reinterpret_cast<const uint8_t *
>(encoded_string.data()), encoded_string.size(), buf, buf_len);
705size_t base64_decode(
const uint8_t *encoded_data,
size_t encoded_len, uint8_t *buf,
size_t buf_len) {
710 for (
size_t in = 0; in < encoded_len; in++) {
711 uint8_t value = base64_char_value(encoded_data[in]);
712 if (value == INVALID_BASE64_CHAR)
714 accum = (accum << 6) | value;
718 if (
out == buf_len) {
719 ESP_LOGW(TAG,
"Base64 decode: buffer too small, truncating");
722 buf[
out++] =
static_cast<uint8_t
>(accum >> bits);
734 constexpr size_t chunk_bytes = 48;
735 constexpr size_t chunk_chars = 64;
736 uint8_t chunk[chunk_bytes];
740 const uint8_t *input =
reinterpret_cast<const uint8_t *
>(base64.data());
741 size_t remaining = base64.size();
744 while (remaining > 0) {
745 size_t chars_to_decode = std::min(remaining, chunk_chars);
746 size_t decoded_len =
base64_decode(input +
pos, chars_to_decode, chunk, chunk_bytes);
748 if (decoded_len == 0)
752 for (
size_t i = 0; i + 3 < decoded_len; i += 4) {
753 int32_t timing =
static_cast<int32_t
>(
encode_uint32(chunk[i + 3], chunk[i + 2], chunk[i + 1], chunk[i]));
754 out.push_back(timing);
758 if (remaining <= chunk_chars && (decoded_len % 4) != 0)
761 pos += chars_to_decode;
762 remaining -= chars_to_decode;
770void rgb_to_hsv(
float red,
float green,
float blue,
int &hue,
float &saturation,
float &value) {
771 float max_color_value = std::max({red, green, blue});
772 float min_color_value = std::min({red, green, blue});
773 float delta = max_color_value - min_color_value;
777 }
else if (max_color_value == red) {
778 hue = int(fmodf((60.0f * ((green - blue) / delta)) + 360.0f, 360.0f));
779 }
else if (max_color_value == green) {
780 hue = int(fmodf((60.0f * ((blue - red) / delta)) + 120.0f, 360.0f));
781 }
else if (max_color_value == blue) {
782 hue = int(fmodf((60.0f * ((red - green) / delta)) + 240.0f, 360.0f));
785 if (max_color_value == 0) {
788 saturation = delta / max_color_value;
791 value = max_color_value;
793void hsv_to_rgb(
int hue,
float saturation,
float value,
float &red,
float &green,
float &blue) {
794 float chroma = value * saturation;
795 float hue_prime = fmodf(hue / 60.0f, 6.0f);
796 float intermediate = chroma * (1.0f - fabsf(fmodf(hue_prime, 2.0f) - 1.0f));
797 float delta = value - chroma;
799 if (0 <= hue_prime && hue_prime < 1) {
801 green = intermediate;
803 }
else if (1 <= hue_prime && hue_prime < 2) {
807 }
else if (2 <= hue_prime && hue_prime < 3) {
811 }
else if (3 <= hue_prime && hue_prime < 4) {
813 green = intermediate;
815 }
else if (4 <= hue_prime && hue_prime < 5) {
819 }
else if (5 <= hue_prime && hue_prime < 6) {
849 uint8_t mac[MAC_ADDRESS_SIZE];
855 uint8_t mac[MAC_ADDRESS_SIZE];
866 bool is_all_zeros =
true;
867 bool is_all_ones =
true;
869 for (uint8_t i = 0; i < 6; i++) {
871 is_all_zeros =
false;
873 if (mac[i] != 0xFF) {
877 if (is_all_zeros || is_all_ones) {
897 delay((us - lag) / 1000UL);
898 while (
micros() - start < us - lag)
901 while (
micros() - start < us)
void stop()
Stop running the loop continuously.
static uint8_t num_requests
void start()
Start running the loop continuously.
StringRef is a reference to a string owned by something else.
constexpr const char * c_str() const
constexpr bool empty() const
constexpr size_type size() const
struct @66::@67 __attribute__
Wake the main loop task from an ISR. ISR-safe.
std::vector< uint8_t > & out
ESPHOME_LOG_TAG(TAG, CRASH_LOG_TAG)
value[LAYOUT.day_index()]
std::string progmem_string(ProgmemStr str)
Copies a string stored with ESPHOME_F into a std::string.
bool random_bytes(uint8_t *data, size_t len)
Generate len random bytes using the platform's secure RNG (hardware RNG or OS CSPRNG).
float random_float()
Return a random float between 0 and 1.
ESPHOME_ALWAYS_INLINE char format_hex_char(uint8_t v, char base)
Convert a nibble (0-15) to hex char with specified base ('a' for lowercase, 'A' for uppercase)
uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse_poly, bool refin, bool refout)
Calculate a CRC-16 checksum of data with size len.
size_t make_name_with_suffix_to(char *buffer, size_t buffer_size, const char *name, size_t name_len, char sep, const char *suffix_ptr, size_t suffix_len)
Format name + separator + suffix directly into buffer without heap allocation.
size_t truncate_name_to(char *buffer, size_t buffer_size, const char *name, size_t name_len, size_t keep_suffix_len)
Copy a name into a buffer, cutting it when it does not fit.
constexpr char to_sanitized_char(char c)
Sanitize a single char: keep alphanumerics, dashes, underscores; replace others with underscore.
bool mac_address_is_valid(const uint8_t *mac)
Check if the MAC address is not all zeros or all ones.
ESPHOME_ALWAYS_INLINE char format_hex_pretty_char(uint8_t v)
Convert a nibble (0-15) to uppercase hex char (used for pretty printing)
void format_mac_addr_lower_no_sep(const uint8_t *mac, char *output)
Format MAC address as xxxxxxxxxxxxxx (lowercase, no separators)
constexpr uint32_t FNV1_OFFSET_BASIS
FNV-1 32-bit offset basis.
void rgb_to_hsv(float red, float green, float blue, int &hue, float &saturation, float &value)
Convert red, green and blue (all 0-1) values to hue (0-360), saturation (0-1) and value (0-1).
uint16_t uint16_t size_t elem_size
size_t value_accuracy_to_buf(std::span< char, VALUE_ACCURACY_MAX_LEN > buf, float value, int8_t accuracy_decimals)
Format value with accuracy to buffer, returns chars written (excluding null)
ParseOnOffState parse_on_off(const char *str, const char *on, const char *off)
Parse a string that contains either on, off or toggle.
bool base64_decode_int32_vector(const std::string &base64, std::vector< int32_t > &out)
Decode base64/base64url string directly into vector of little-endian int32 values.
uint32_t small_pow10(int8_t n)
Return 10^n for small non-negative n (0-4) as uint32_t, avoiding float.
std::vector< uint8_t > base64_decode(const std::string &encoded_string)
Decode a base64 string to a byte vector.
bool has_custom_mac_address()
Check if a custom MAC address is set (ESP32 & variants)
size_t parse_hex(const char *str, size_t length, uint8_t *data, size_t count)
Parse bytes from a hex-encoded string into a byte array.
char * format_hex_pretty_to(char *buffer, size_t buffer_size, const uint8_t *data, size_t length, char separator)
Format byte array as uppercase hex to buffer (base implementation).
bool str_contains_ignore_case_fallback(const char *haystack, const char *needle)
Fallback implementation for case insensitive substring comparison.
int8_t ilog10(float value)
Compute floor(log10(fabs(value))) using iterative comparison.
uint32_t fnv1_hash(const char *str)
Calculate a FNV-1 hash of str.
char * frac_to_str_unchecked(char *buf, uint32_t frac, uint32_t divisor)
Write fractional digits with leading zeros to buffer (internal, no size check).
int8_t step_to_accuracy_decimals(float step)
Derive accuracy in decimals from an increment step.
uint32_t IRAM_ATTR HOT micros()
uint32_t random_uint32()
Return a random 32-bit unsigned integer.
const char * get_mac_address_pretty_into_buffer(std::span< char, MAC_ADDRESS_PRETTY_BUFFER_SIZE > buf)
Get the device MAC address into the given buffer, in colon-separated uppercase hex notation.
char * buf_append_sep_str(char *buf, size_t remaining, char separator, const char *str, size_t str_len)
Append a separator char and a string to a buffer, respecting remaining space.
void delay_microseconds_safe(uint32_t us)
Delay for the given amount of microseconds, possibly yielding to other processes during the wait.
bool str_equals_case_insensitive(const std::string &a, const std::string &b)
Compare strings for equality in case-insensitive manner.
bool str_endswith_ignore_case(const char *str, size_t str_len, const char *suffix, size_t suffix_len)
Case-insensitive check if string ends with suffix (no heap allocation).
char * str_sanitize_to(char *buffer, size_t buffer_size, const char *str)
Sanitize a string to buffer, keeping only alphanumerics, dashes, and underscores.
size_t value_accuracy_with_uom_to_buf(std::span< char, VALUE_ACCURACY_MAX_LEN > buf, float value, int8_t accuracy_decimals, StringRef unit_of_measurement)
Format value with accuracy and UOM to buffer, returns chars written (excluding null)
const char * json_escape_into_buffer(std::span< char > buf, StringRef value, bool short_control_escapes)
Copy value into buf, escaping the characters that cannot appear raw inside a JSON string literal.
char * uint32_to_str_unchecked(char *buf, uint32_t val)
Write unsigned 32-bit integer to buffer (internal, no size check).
constexpr uint32_t FNV1_PRIME
FNV-1 32-bit prime.
void hsv_to_rgb(int hue, float saturation, float value, float &red, float &green, float &blue)
Convert hue (0-360), saturation (0-1) and value (0-1) to red, green and blue (all 0-1).
void get_mac_address_into_buffer(std::span< char, MAC_ADDRESS_BUFFER_SIZE > buf)
Get the device MAC address into the given buffer, in lowercase hex notation.
uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout)
constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
Encode a 32-bit value given four bytes in most to least significant byte order.
uint8_t crc8(const uint8_t *data, uint8_t len, uint8_t crc, uint8_t poly, bool msb_first)
Calculate a CRC-8 checksum of data with size len.
void get_mac_address_raw(uint8_t *mac)
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).
constexpr uint8_t parse_hex_char(char c)
bool str_startswith(const std::string &str, const std::string &start)
Check whether a string starts with a value.
void HOT delay(uint32_t ms)
optional< float > parse_float(const char *str)
Parse a decimal floating-point number; plain decimals skip the libc parser.
char * format_hex_to(char *buffer, size_t buffer_size, const uint8_t *data, size_t length)
Format byte array as lowercase hex to buffer (base implementation).
void * callback_manager_grow(void *data, uint16_t size, uint16_t &capacity, size_t elem_size)
Grow a CallbackManager's backing array to exactly size+1. Defined in helpers.cpp.
bool str_endswith(const std::string &str, const std::string &end)
Check whether a string ends with a value.
bool str_contains_ignore_case_p(const char *haystack, PGM_P needle)
ESP8266 internal implementation reading the needle from flash — prefer the str_contains_ignore_case m...
uint16_t uint16_t & capacity
ParseOnOffState
Return values for parse_on_off().
float pow10_int(int8_t exp)
Compute 10^exp using iterative multiplication/division.
char * format_bin_to(char *buffer, size_t buffer_size, const uint8_t *data, size_t length)
Format byte array as binary string to buffer.
char * format_mac_addr_upper(const uint8_t *mac, char *output)
Format MAC address as XX:XX:XX:XX:XX:XX (uppercase, colon separators)
const __FlashStringHelper * ProgmemStr