1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 07:45:56 +00:00

[wifi] Use FixedVector for scan results to reduce flash usage (#11216)

This commit is contained in:
J. Nick Koston
2025-10-14 14:45:28 -10:00
committed by GitHub
parent 63a87a5ef3
commit 00230f7cc6
6 changed files with 22 additions and 6 deletions

View File

@@ -549,7 +549,7 @@ void WiFiComponent::start_scanning() {
// Using insertion sort instead of std::stable_sort saves flash memory
// by avoiding template instantiations (std::rotate, std::stable_sort, lambdas)
// IMPORTANT: This sort is stable (preserves relative order of equal elements)
static void insertion_sort_scan_results(std::vector<WiFiScanResult> &results) {
template<typename VectorType> static void insertion_sort_scan_results(VectorType &results) {
const size_t size = results.size();
for (size_t i = 1; i < size; i++) {
// Make a copy to avoid issues with move semantics during comparison