[core] Conditionally compile get_loop_priority with USE_LOOP_PRIORITY (#14210)

This commit is contained in:
J. Nick Koston
2026-02-23 10:57:23 +13:00
committed by GitHub
parent 509f06afac
commit ede2da2fbc
20 changed files with 45 additions and 0 deletions
+2
View File
@@ -109,9 +109,11 @@ void Application::setup() {
if (component->can_proceed())
continue;
#ifdef USE_LOOP_PRIORITY
// Sort components 0 through i by loop priority
insertion_sort_by_priority<decltype(this->components_.begin()), &Component::get_loop_priority>(
this->components_.begin(), this->components_.begin() + i + 1);
#endif
do {
uint8_t new_app_state = STATUS_LED_WARNING;
+2
View File
@@ -85,7 +85,9 @@ void store_component_error_message(const Component *component, const char *messa
static constexpr uint16_t WARN_IF_BLOCKING_INCREMENT_MS =
10U; ///< How long the blocking time must be larger to warn again
#ifdef USE_LOOP_PRIORITY
float Component::get_loop_priority() const { return 0.0f; }
#endif
float Component::get_setup_priority() const { return setup_priority::DATA; }
+3
View File
@@ -5,6 +5,7 @@
#include <functional>
#include <string>
#include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/optional.h"
@@ -117,7 +118,9 @@ class Component {
*
* @return The loop priority of this component
*/
#ifdef USE_LOOP_PRIORITY
virtual float get_loop_priority() const;
#endif
void call();
+1
View File
@@ -312,6 +312,7 @@
#ifdef USE_RP2040
#define USE_ARDUINO_VERSION_CODE VERSION_CODE(3, 3, 0)
#define USE_LOOP_PRIORITY
#define USE_HTTP_REQUEST_RESPONSE
#define USE_I2C
#define USE_LOGGER_USB_CDC