Conditionally compile API user services to save 4.3KB flash (follow-up to #9262) (#9451)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2025-07-11 19:08:03 -10:00
1 parent 0138ef36cf
commit dd5ba5a90c
23 files changed
+345 -52

No files matched your search

+4 -2
View File
@@ -4,6 +4,8 @@
#ifdef USE_API
#include "esphome/components/api/api_server.h"
#endif
#ifdef USE_API_SERVICES
#include "esphome/components/api/user_services.h"
#endif
@@ -148,7 +150,7 @@ void ComponentIterator::advance() {
}
break;
#endif
#ifdef USE_API
#ifdef USE_API_SERVICES
case IteratorState ::SERVICE:
if (this->at_ >= api::global_api_server->get_user_services().size()) {
advance_platform = true;
@@ -383,7 +385,7 @@ void ComponentIterator::advance() {
}
bool ComponentIterator::on_end() { return true; }
bool ComponentIterator::on_begin() { return true; }
#ifdef USE_API
#ifdef USE_API_SERVICES
bool ComponentIterator::on_service(api::UserServiceDescriptor *service) { return true; }
#endif
#ifdef USE_CAMERA