This commit is contained in:
J. Nick Koston
2025-11-30 23:40:25 -06:00
parent edf19b8dd4
commit ae6c123784
4 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -157,7 +157,7 @@ void SEN5XComponent::setup() {
// Hash with compilation time and serial number
// This ensures the baseline storage is cleared after OTA
// Serial numbers are unique to each sensor, so mulitple sensors can be used without conflict
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(combined_serial).c_str());
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(combined_serial));
this->pref_ = global_preferences->make_preference<Sen5xBaselines>(hash, true);
if (this->pref_.load(&this->voc_baselines_storage_)) {
+1 -1
View File
@@ -75,7 +75,7 @@ void SGP30Component::setup() {
// Hash with compilation time and serial number
// This ensures the baseline storage is cleared after OTA
// Serial numbers are unique to each sensor, so mulitple sensors can be used without conflict
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(this->serial_number_).c_str());
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(this->serial_number_));
this->pref_ = global_preferences->make_preference<SGP30Baselines>(hash, true);
if (this->store_baseline_ && this->pref_.load(&this->baselines_storage_)) {
+1 -1
View File
@@ -59,7 +59,7 @@ void SGP4xComponent::setup() {
// Hash with compilation time and serial number
// This ensures the baseline storage is cleared after OTA
// Serial numbers are unique to each sensor, so mulitple sensors can be used without conflict
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(this->serial_number_).c_str());
uint32_t hash = fnv1_hash(App.get_compilation_time_ref() + std::to_string(this->serial_number_));
this->pref_ = global_preferences->make_preference<SGP4xBaselines>(hash, true);
if (this->pref_.load(&this->voc_baselines_storage_)) {
+6
View File
@@ -128,6 +128,12 @@ inline std::string operator+(const StringRef &lhs, const char *rhs) {
return str;
}
inline std::string operator+(const StringRef &lhs, const std::string &rhs) {
auto str = lhs.str();
str.append(rhs);
return str;
}
#ifdef USE_JSON
// NOLINTNEXTLINE(readability-identifier-naming)
inline void convertToJson(const StringRef &src, JsonVariant dst) { dst.set(src.c_str()); }