Fix: Incorporate unique serial number in preference's hash for multiple Sensirion sensors (#5479)
This commit is contained in:
1 parent
fdef6c6d46
commit
258b0fbff3
3 files changed
+12
-6
No files matched your search
@@ -73,9 +73,10 @@ void SGP30Component::setup() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hash with compilation time
|
||||
// Hash with compilation time and serial number
|
||||
// This ensures the baseline storage is cleared after OTA
|
||||
uint32_t hash = fnv1_hash(App.get_compilation_time());
|
||||
// Serial numbers are unique to each sensor, so mulitple sensors can be used without conflict
|
||||
uint32_t hash = fnv1_hash(App.get_compilation_time() + std::to_string(this->serial_number_));
|
||||
this->pref_ = global_preferences->make_preference<SGP30Baselines>(hash, true);
|
||||
|
||||
if (this->pref_.load(&this->baselines_storage_)) {
|
||||
|
||||
Reference in new issue
Block a user