ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
espectre.cpp
Go to the documentation of this file.
1#include "espectre.h"
2
3#ifdef USE_ESPECTRE
4
5#include <cinttypes>
6#include <cmath>
8#include "esphome/core/log.h"
9#if defined(USE_ESP32) && defined(USE_WIFI_RUNTIME_ROAMING_SUPPRESSION)
11#endif
12
14
15ESPHOME_LOG_TAG(TAG, "espectre");
16
17static const char *csi_capture_profile_name(::espectre::CsiCapturePolicy profile) {
18 switch (profile) {
19 case ::espectre::CsiCapturePolicy::LLTF:
20 return LOG_STR_LITERAL("lltf");
21 case ::espectre::CsiCapturePolicy::HT_VHT:
22 return LOG_STR_LITERAL("ht_vht");
23 default:
24 return LOG_STR_LITERAL("auto");
25 }
26}
27
28#ifdef USE_SELECT
29void ESPectreComponent::request_traffic_generator_mode(const char *name) {
30 this->pending_traffic_mode_ = ::espectre::parse_traffic_generator_mode(name);
31}
32
33void ESPectreComponent::request_detection_algorithm(const char *name) {
34 this->pending_detection_algorithm_ = ::espectre::parse_detection_algorithm(name);
35}
36
37void ESPectreComponent::request_csi_sample_spacing(const char *name) {
38 this->pending_csi_sample_spacing_ = ::espectre::parse_csi_sample_spacing(name);
39}
40#endif
41
42#ifdef USE_ESPECTRE_TARGET_MAC_TEXT
43static bool parse_target_mac(const std::string &value, TargetMac &mac) {
44 if (value == "auto") {
45 mac = {};
46 return true;
47 }
48 if (value.size() != MAC_ADDRESS_PRETTY_BUFFER_SIZE - 1)
49 return false;
50 for (size_t i = 0; i < mac.size(); i++) {
51 if ((i != 0 && value[i * 3 - 1] != ':') || parse_hex(value.data() + i * 3, 2, &mac[i], 1) != 2)
52 return false;
53 }
54 return mac != TargetMac{} && (mac[0] & 1) == 0;
55}
56
57static const char *format_target_mac(const TargetMac &mac, char (&buffer)[MAC_ADDRESS_PRETTY_BUFFER_SIZE]) {
58 return mac == TargetMac{} ? "auto" : format_hex_pretty_to(buffer, mac);
59}
60
61void ESPectreComponent::request_traffic_generator_target_mac(const std::string &target) {
62 if (!parse_target_mac(target, this->pending_target_mac_)) {
63 // A group address marks a rejected request until loop() republishes the active state.
64 this->pending_target_mac_[0] = 0xff;
65 ESP_LOGW(TAG, "Invalid target MAC");
66 }
67 this->target_mac_pending_ = true;
68}
69
70void ESPectreComponent::restore_target_mac_() {
71 if (this->target_mac_text_ == nullptr)
72 return;
73 this->target_mac_pref_ = this->target_mac_text_->make_entity_preference<TargetMac>(
74 fnv1a_hash(this->runtime_.config().traffic_generator_target_mac));
75 TargetMac saved;
76 char buffer[MAC_ADDRESS_PRETTY_BUFFER_SIZE];
77 if (this->target_mac_pref_.load(&saved))
78 this->runtime_.set_traffic_generator_target_mac(format_target_mac(saved, buffer));
79}
80#endif
81
82static int log_level(::espectre::LogLevel level) {
83 switch (level) {
84 case ::espectre::LogLevel::ERROR:
85 return ESPHOME_LOG_LEVEL_ERROR;
86 case ::espectre::LogLevel::WARNING:
87 return ESPHOME_LOG_LEVEL_WARN;
88 case ::espectre::LogLevel::INFO:
89 return ESPHOME_LOG_LEVEL_INFO;
90 case ::espectre::LogLevel::DEBUG:
91 return ESPHOME_LOG_LEVEL_DEBUG;
92 default:
93 return ESPHOME_LOG_LEVEL_VERBOSE;
94 }
95}
96
98 // ESPHome owns scan results, including scans requested by the SDK's CSI recovery.
99 this->runtime_.config().wifi_scan_results_managed_externally = true;
100 this->restore_controls_();
101 this->start_runtime_();
102}
103
104void ESPectreComponent::start_runtime_() {
105#if defined(USE_ESP32) && defined(USE_WIFI_RUNTIME_ROAMING_SUPPRESSION)
106 // A sensor stays in one place, and each roaming scan takes the radio off-channel for
107 // seconds, emptying the CSI window. Losing the access point still reconnects normally.
108 if (wifi::global_wifi_component != nullptr) {
110 this->roaming_suppressed_ = true;
111 }
112#endif
113 ::espectre::set_log_sink({
114 .context = nullptr,
115 .enabled = [](void *, ::espectre::LogLevel level, const char *) { return log_level(level) <= ESPHOME_LOG_LEVEL; },
116 .write = [](void *, ::espectre::LogLevel level, const char *tag, int line, const char *format,
117 va_list args) { esp_log_vprintf_(log_level(level), tag, line, format, args); },
118 });
119 if (!this->runtime_.setup(this)) {
120 ESP_LOGE(TAG, "Runtime setup failed");
121 this->stop_();
122 this->schedule_restart_();
123 return;
124 }
125 this->running_ = true;
126 this->status_clear_error();
127#ifdef USE_SELECT
128 this->publish_traffic_mode_();
129#endif
130 this->publish_controls_();
131}
132
133void ESPectreComponent::schedule_restart_() {
134 // A fault can be transient, such as a Wi-Fi stall, so retry instead of failing for good.
135 this->runtime_fault_ = false;
136 this->status_set_error(LOG_STR("Runtime stopped"));
137 ESP_LOGW(TAG, "Restarting the runtime in %" PRIu32 " s", RESTART_DELAY_MS / 1000);
138 this->restart_pending_ = true;
139 this->restart_requested_ms_ = App.get_loop_component_start_time();
140}
141
142#ifdef USE_SELECT
143// Selections are saved as SDK enum values, so renumbering an enum would restore the wrong option.
144static_assert(static_cast<uint8_t>(::espectre::TrafficGeneratorMode::PING) == 0 &&
145 static_cast<uint8_t>(::espectre::TrafficGeneratorMode::DNS) == 1 &&
146 static_cast<uint8_t>(::espectre::TrafficGeneratorMode::DNS_TCP) == 2 &&
147 static_cast<uint8_t>(::espectre::TrafficGeneratorMode::WIFI_RAW) == 3 &&
148 static_cast<uint8_t>(::espectre::TrafficGeneratorMode::EXTERNAL_HOST) == 4,
149 "Saved traffic generator modes depend on these values");
150static_assert(static_cast<uint8_t>(::espectre::DetectionAlgorithm::LIGHTWEIGHT) == 0 &&
151 static_cast<uint8_t>(::espectre::DetectionAlgorithm::HIGH_ACCURACY) == 1,
152 "Saved detection algorithms depend on these values");
153static_assert(static_cast<uint8_t>(::espectre::TemporalCsiSpacing::HALF_SLOT) == 0 &&
154 static_cast<uint8_t>(::espectre::TemporalCsiSpacing::DISTINCT) == 1,
155 "Saved CSI sample spacings depend on these values");
156
157template<typename T, typename F>
158static void restore_select_choice(select::Select *select, ESPPreferenceObject &pref, T &value, F accept) {
159 if (select == nullptr)
160 return;
161 pref = select->make_entity_preference<uint8_t>(static_cast<uint32_t>(value) + 1);
162 uint8_t saved;
163 if (pref.load(&saved) && accept(static_cast<T>(saved)))
164 value = static_cast<T>(saved);
165}
166
167// Returns false when no choice was queued; otherwise the caller republishes the active option.
168template<typename T>
169static bool apply_select_choice(::espectre::RuntimeFrontendController &runtime, optional<T> &pending,
170 ESPPreferenceObject &pref, bool (::espectre::RuntimeFrontendController::*set)(T),
171 const char *(*name)(T)) {
172 if (!pending.has_value())
173 return false;
174 const T value = *pending;
175 pending.reset();
176 if ((runtime.*set)(value)) {
177 const auto saved = static_cast<uint8_t>(value);
178 pref.save(&saved);
179 } else {
180 ESP_LOGW(TAG, "Option %s was rejected", name(value));
181 }
182 return true;
183}
184
185void ESPectreComponent::apply_pending_traffic_mode_() {
186 if (apply_select_choice(this->runtime_, this->pending_traffic_mode_, this->traffic_mode_pref_,
187 &::espectre::RuntimeFrontendController::set_traffic_generator_mode,
188 ::espectre::traffic_generator_mode_name))
189 this->publish_traffic_mode_();
190}
191
192void ESPectreComponent::publish_traffic_mode_() {
193 if (this->traffic_mode_select_ == nullptr)
194 return;
195 this->traffic_mode_select_->publish_state(
196 ::espectre::traffic_generator_mode_name(this->runtime_.config().traffic_generator_mode));
197}
198#endif
199
200#ifdef USE_NUMBER
201static void restore_motion_hits(number::Number *number, ESPPreferenceObject &pref, uint8_t &hits) {
202 if (number == nullptr)
203 return;
204 pref = number->make_entity_preference<uint8_t>(hits);
205 uint8_t saved;
206 if (pref.load(&saved) && saved >= ::espectre::RUNTIME_MOTION_HITS_MIN && saved <= ::espectre::RUNTIME_MOTION_HITS_MAX)
207 hits = saved;
208}
209#endif
210
211void ESPectreComponent::restore_controls_() {
212 // Saved values are keyed by the YAML value, so a YAML change discards what the entities saved.
213 auto &config = this->runtime_.config();
214#ifdef USE_NUMBER
215 restore_motion_hits(this->motion_on_hits_number_, this->motion_on_hits_pref_, config.motion_on_hits);
216 restore_motion_hits(this->motion_off_hits_number_, this->motion_off_hits_pref_, config.motion_off_hits);
217#endif
218#ifdef USE_SELECT
219 restore_select_choice(this->traffic_mode_select_, this->traffic_mode_pref_, config.traffic_generator_mode,
220 [this](::espectre::TrafficGeneratorMode mode) {
221 return ::espectre::runtime_traffic_generator_mode_valid(mode) &&
222 this->traffic_mode_select_->has_option(::espectre::traffic_generator_mode_name(mode));
223 });
224 // Without this the SDK rejects every detector change once the runtime runs.
225 if (this->detection_algorithm_select_ != nullptr)
226 config.runtime_detector_selection_enabled = true;
227 restore_select_choice(this->detection_algorithm_select_, this->detection_algorithm_pref_, config.detection_algorithm,
228 ::espectre::runtime_detection_algorithm_valid);
229 restore_select_choice(this->csi_sample_spacing_select_, this->csi_sample_spacing_pref_, config.csi_sample_spacing,
230 ::espectre::runtime_csi_sample_spacing_valid);
231#endif
232#ifdef USE_ESPECTRE_TARGET_MAC_TEXT
233 this->restore_target_mac_();
234#endif
235#ifdef USE_SWITCH
236 // Applied before the first runtime starts, so a disabled sensor never starts sensing.
237 if (this->sensing_switch_ != nullptr)
238 this->runtime_.set_services_armed(this->sensing_switch_->get_initial_state_with_restore_mode().value_or(true));
239#endif
240}
241
242void ESPectreComponent::apply_pending_controls_() {
243#ifdef USE_NUMBER
244 if (!std::isnan(this->pending_threshold_)) {
245 const float threshold = this->pending_threshold_;
246 this->pending_threshold_ = NAN;
247 if (!this->runtime_.set_threshold(threshold)) {
248 ESP_LOGW(TAG, "Threshold %.2f was rejected", threshold);
249 }
250 // Republished even when rejected, so the entity drops the value it was asked for.
251 PUBLISH_STATE(this->threshold_number_, this->runtime_.snapshot().threshold);
252 }
253 if (this->pending_motion_on_hits_ != 0 || this->pending_motion_off_hits_ != 0) {
254 const auto &config = this->runtime_.config();
255 const uint8_t on_hits = this->pending_motion_on_hits_ != 0 ? this->pending_motion_on_hits_ : config.motion_on_hits;
256 const uint8_t off_hits =
257 this->pending_motion_off_hits_ != 0 ? this->pending_motion_off_hits_ : config.motion_off_hits;
258 this->pending_motion_on_hits_ = 0;
259 this->pending_motion_off_hits_ = 0;
260 if (this->runtime_.set_motion_hits(on_hits, off_hits)) {
261 this->motion_on_hits_pref_.save(&on_hits);
262 this->motion_off_hits_pref_.save(&off_hits);
263 } else {
264 ESP_LOGW(TAG, "Motion on/off hits %u/%u were rejected", on_hits, off_hits);
265 }
266 PUBLISH_STATE(this->motion_on_hits_number_, config.motion_on_hits);
267 PUBLISH_STATE(this->motion_off_hits_number_, config.motion_off_hits);
268 }
269#endif
270#ifdef USE_SELECT
271 // Only the changed entity is republished, because numbers and selects run on_value on every publish.
272 // loop() republishes the threshold that a detector change replaces.
273 if (apply_select_choice(this->runtime_, this->pending_detection_algorithm_, this->detection_algorithm_pref_,
274 &::espectre::RuntimeFrontendController::set_detection_algorithm,
275 ::espectre::detection_algorithm_name)) {
276 PUBLISH_STATE(this->detection_algorithm_select_,
277 ::espectre::detection_algorithm_name(this->runtime_.config().detection_algorithm));
278 }
279 if (apply_select_choice(this->runtime_, this->pending_csi_sample_spacing_, this->csi_sample_spacing_pref_,
280 &::espectre::RuntimeFrontendController::set_csi_sample_spacing,
281 ::espectre::csi_sample_spacing_name)) {
282 PUBLISH_STATE(this->csi_sample_spacing_select_,
283 ::espectre::csi_sample_spacing_name(this->runtime_.config().csi_sample_spacing));
284 }
285#endif
286#ifdef USE_ESPECTRE_TARGET_MAC_TEXT
287 if (this->target_mac_pending_) {
288 this->target_mac_pending_ = false;
289 // An SDK log callback can queue the next request while this one is being applied.
290 const TargetMac target = this->pending_target_mac_;
291 char buffer[MAC_ADDRESS_PRETTY_BUFFER_SIZE];
292 const char *value = (target[0] & 1) == 0 ? format_target_mac(target, buffer) : nullptr;
293 if (value != nullptr && this->runtime_.set_traffic_generator_target_mac(value)) {
294 this->target_mac_pref_.save(&target);
295 this->target_mac_text_->publish_state(value);
296 } else {
297 if (value != nullptr) {
298 ESP_LOGW(TAG, "Target MAC '%s' was rejected", value);
299 }
300 this->target_mac_text_->publish_state(this->target_mac_text_->state);
301 }
302 }
303#endif
304#ifdef USE_SWITCH
305 if (this->pending_sensing_.has_value()) {
306 this->runtime_.set_services_armed(*this->pending_sensing_);
307 this->pending_sensing_.reset();
308 PUBLISH_STATE(this->sensing_switch_, this->runtime_.services_armed());
309 }
310#endif
311}
312
313void ESPectreComponent::publish_controls_() {
314#ifdef USE_NUMBER
315 PUBLISH_STATE(this->threshold_number_, this->runtime_.snapshot().threshold);
316 PUBLISH_STATE(this->motion_on_hits_number_, this->runtime_.config().motion_on_hits);
317 PUBLISH_STATE(this->motion_off_hits_number_, this->runtime_.config().motion_off_hits);
318#endif
319#ifdef USE_SELECT
320 PUBLISH_STATE(this->detection_algorithm_select_,
321 ::espectre::detection_algorithm_name(this->runtime_.config().detection_algorithm));
322 PUBLISH_STATE(this->csi_sample_spacing_select_,
323 ::espectre::csi_sample_spacing_name(this->runtime_.config().csi_sample_spacing));
324#endif
325#ifdef USE_ESPECTRE_TARGET_MAC_TEXT
326 // The text shows the effective config until a command stages the next target.
327 const auto &value = this->runtime_.config().traffic_generator_target_mac;
328 TargetMac target;
329 char buffer[MAC_ADDRESS_PRETTY_BUFFER_SIZE];
330 PUBLISH_STATE(this->target_mac_text_,
331 parse_target_mac(value, target) ? format_target_mac(target, buffer) : value.c_str());
332#endif
333#ifdef USE_SWITCH
334 PUBLISH_STATE(this->sensing_switch_, this->runtime_.services_armed());
335#endif
336}
337
338void ESPectreComponent::loop() {
339 if (this->runtime_fault_) {
340 this->stop_();
341 this->schedule_restart_();
342 return;
343 }
344 if (!this->running_) {
345 // Without a backend this only reaps a traffic worker that outlived the last runtime.
346 this->runtime_.loop();
347 if (this->restart_pending_ &&
348 App.get_loop_component_start_time() - this->restart_requested_ms_ >= RESTART_DELAY_MS) {
349 this->restart_pending_ = false;
350 this->start_runtime_();
351 }
352 return;
353 }
354 if (this->recalibrate_pending_) {
355 this->recalibrate_pending_ = false;
356 if (!this->runtime_.trigger_recalibration()) {
357 ESP_LOGW(TAG, "Recalibration is not available");
358 }
359 }
360#ifdef USE_SELECT
361 this->apply_pending_traffic_mode_();
362#endif
363 this->apply_pending_controls_();
364 this->runtime_.loop();
365 if (this->runtime_fault_)
366 return;
367
368 // Read once after the SDK finishes dispatching callbacks, including readiness changes.
369 const auto &snapshot = this->runtime_.snapshot();
370#ifdef USE_NUMBER
371 // Calibration and a detector change both replace the threshold.
372 if (this->threshold_number_ != nullptr && this->threshold_number_->state != snapshot.threshold)
373 this->threshold_number_->publish_state(snapshot.threshold);
374#endif
375#ifdef USE_BINARY_SENSOR
376 if (this->calibrating_binary_sensor_ != nullptr &&
377 (!this->calibrating_published_ || this->calibrating_state_ != snapshot.calibrating)) {
378 this->calibrating_state_ = snapshot.calibrating;
379 this->calibrating_published_ = true;
380 this->calibrating_binary_sensor_->publish_state(snapshot.calibrating);
381 }
382#endif
383 if (!snapshot.ready_to_publish) {
384 if (this->ready_)
385 this->invalidate_sensing_();
386 this->movement_pending_ = false;
387 return;
388 }
389
390#ifdef USE_BINARY_SENSOR
391 const bool motion = snapshot.motion_state == ::espectre::MotionState::MOTION;
392 if (this->motion_binary_sensor_ != nullptr && (!this->ready_ || this->motion_state_ != motion)) {
393 this->motion_state_ = motion;
394 this->motion_binary_sensor_->publish_state(motion);
395 }
396#endif
397#ifdef USE_SENSOR
398 if (this->movement_sensor_ != nullptr && (this->movement_pending_ || !this->ready_))
399 this->movement_sensor_->publish_state(snapshot.movement_metric);
400#endif
401 this->movement_pending_ = false;
402 this->ready_ = true;
403}
404
405void ESPectreComponent::invalidate_sensing_() {
406#ifdef USE_BINARY_SENSOR
407 if (this->motion_binary_sensor_ != nullptr)
408 this->motion_binary_sensor_->invalidate_state();
409#endif
410#ifdef USE_SENSOR
411 PUBLISH_STATE(this->movement_sensor_, NAN);
412#endif
413 this->ready_ = false;
414}
415
416void ESPectreComponent::on_calibration_finished(const ::espectre::RuntimeSnapshot &snapshot, bool success) {
417 if (success) {
418 this->calibrated_ = true;
419 this->status_clear_warning();
420 ESP_LOGI(TAG, "Calibration complete");
421 return;
422 }
423 // After a successful calibration, a failed one keeps that calibrated threshold.
424 if (!this->calibrated_)
425 this->status_set_warning(LOG_STR("Calibration failed"));
426 ESP_LOGW(TAG, "Calibration failed; retaining the previous threshold");
427}
428
429void ESPectreComponent::on_runtime_fault(const char *message) {
430 ESP_LOGE(TAG, "Runtime fault: %s", message);
431 this->runtime_fault_ = true;
432}
433
434void ESPectreComponent::stop_() {
435#if defined(USE_ESP32) && defined(USE_WIFI_RUNTIME_ROAMING_SUPPRESSION)
436 if (this->roaming_suppressed_ && wifi::global_wifi_component != nullptr) {
438 }
439#endif
440 this->roaming_suppressed_ = false;
441 this->running_ = false;
442 // The next runtime reports its own calibration, so forget this one's.
443 this->calibrated_ = false;
444 this->calibrating_published_ = false;
445 this->runtime_.shutdown();
446 ::espectre::clear_log_sink();
447 this->invalidate_sensing_();
448#ifdef USE_BINARY_SENSOR
449 if (this->calibrating_binary_sensor_ != nullptr)
450 this->calibrating_binary_sensor_->invalidate_state();
451#endif
452}
453
454void ESPectreComponent::on_shutdown() {
455 this->restart_pending_ = false;
456 this->stop_();
457}
458
459void ESPectreComponent::dump_config() {
460 const auto &config = this->runtime_.config();
461 ESP_LOGCONFIG(TAG,
462 "ESPectre:\n"
463 " Detection algorithm: %s\n"
464 " CSI capture profile: %s\n"
465 " Traffic generator mode: %s\n"
466 " Traffic generator target MAC: %s\n"
467 " CSI sample spacing: %s\n"
468 " Motion on/off hits: %u/%u\n"
469 " Window size: %" PRIu32 " ms\n"
470 " CSI target rate: %" PRIu32 " pps\n"
471 " Evaluation interval: %" PRIu32 " ms\n"
472 " Low-pass filter: %s (%.1f Hz)\n"
473 " Hampel filter: %s (window %u, threshold %.1f)",
474 ::espectre::detection_algorithm_name(config.detection_algorithm),
475 csi_capture_profile_name(config.csi_capture_policy),
476 ::espectre::traffic_generator_mode_name(config.traffic_generator_mode),
477 config.traffic_generator_target_mac.c_str(),
478 ::espectre::csi_sample_spacing_name(config.csi_sample_spacing), config.motion_on_hits,
479 config.motion_off_hits, config.window_size_ms, config.csi_target_pps, config.evaluation_interval_ms,
480 ONOFF(config.lowpass_enabled), config.lowpass_cutoff, ONOFF(config.hampel_enabled),
481 config.hampel_window, config.hampel_threshold);
482#ifdef USE_BINARY_SENSOR
483 LOG_BINARY_SENSOR(" ", "Motion", this->motion_binary_sensor_);
484 LOG_BINARY_SENSOR(" ", "Calibrating", this->calibrating_binary_sensor_);
485#endif
486#ifdef USE_SENSOR
487 LOG_SENSOR(" ", "Movement score", this->movement_sensor_);
488#endif
489#ifdef USE_NUMBER
490 LOG_NUMBER(" ", "Threshold", this->threshold_number_);
491 LOG_NUMBER(" ", "Motion on hits", this->motion_on_hits_number_);
492 LOG_NUMBER(" ", "Motion off hits", this->motion_off_hits_number_);
493#endif
494#ifdef USE_SELECT
495 LOG_SELECT(" ", "Traffic generator mode", this->traffic_mode_select_);
496 LOG_SELECT(" ", "Detection algorithm", this->detection_algorithm_select_);
497 LOG_SELECT(" ", "CSI sample spacing", this->csi_sample_spacing_select_);
498#endif
499#ifdef USE_ESPECTRE_TARGET_MAC_TEXT
500 LOG_TEXT(" ", "Traffic generator target MAC", this->target_mac_text_);
501#endif
502#ifdef USE_SWITCH
503 LOG_SWITCH(" ", "Sensing", this->sensing_switch_);
504#endif
505}
506
507} // namespace esphome::espectre
508
509#endif // USE_ESPECTRE
BedjetMode mode
BedJet operating mode.
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
void status_clear_error()
Definition component.h:324
void status_clear_warning()
Definition component.h:318
ESPPreferenceObject make_entity_preference(uint32_t version=0)
Create a preference object for storing this entity's state/settings.
void publish_state(const std::string &state)
Definition text.h:25
std::string state
Definition text.h:22
void release_roaming_suppression()
Same as set_roaming_suppressed(false); must be paired with a prior request.
void request_roaming_suppression()
Same as set_roaming_suppressed(true).
const LogString * message
Definition component.cpp:35
uint32_t buffer
Definition gif.cpp:50
ESPHOME_LOG_TAG(TAG, "espectre")
std::array< uint8_t, 6 > TargetMac
Definition espectre.h:37
char name[sizeof(ORIGIN)]
WiFiComponent * global_wifi_component
uint32_t value
Definition hal.cpp:59
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.
Definition helpers.cpp:401
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).
Definition helpers.cpp:529
void const char int line
Definition log.h:110
void HOT esp_log_vprintf_(int level, const char *tag, int line, const char *format, va_list args)
Definition log.cpp:79
void const char int const char * format
Definition log.h:110
Application App
Global storage of Application pointer - only one Application can exist.
constexpr uint32_t fnv1a_hash(const char *str)
Calculate a FNV-1a hash of str.
Definition helpers.h:1192
void const char * tag
Definition log.h:110
static void uint32_t