mirror of
https://github.com/esphome/esphome.git
synced 2026-10-05 10:31:29 +00:00
[core] Conditionally compile get_loop_priority with USE_LOOP_PRIORITY (#14210)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user