Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
SVM30: Fix feature set check (#41)
Browse files Browse the repository at this point in the history
* Fix the feature set test to check if humidity compensation is
  available for the SGP.
* Use the SGP_REQUIRE_FS macro for testing

Note that this issue would never be encountered on any sold SVM30, and
pre-production SVM30 with a lower feature set would not be affected
either since the call to set_absolute_humidity would simply fail
without side-effects, other than wasted communication.
  • Loading branch information
abrauchli authored and rnestler committed Jan 30, 2019
1 parent 567f4e8 commit fab36ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions svm30/svm30.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sensirion_common.h"
#include "sgp_git_version.h"
#include "sgp30.h"
#include "sgp_featureset.h"
#include "sht.h"

#define T_LO (-20000)
Expand Down Expand Up @@ -105,7 +106,7 @@ s16 svm_measure_iaq_blocking_read(u16 *tvoc_ppb, u16 *co2_eq_ppm,
return err;

sgp_get_feature_set_version(&sgp_feature_set, &sgp_product_type);
if (sgp_feature_set >= 0x20) {
if (SGP_REQUIRE_FS(sgp_feature_set, 1, 0)) {
absolute_humidity = sensirion_calc_absolute_humidity(temperature, humidity);
sgp_set_absolute_humidity(absolute_humidity);
}
Expand Down Expand Up @@ -144,7 +145,7 @@ s16 svm_measure_signals_blocking_read(u16 *ethanol_signal, u16 *h2_signal,
return err;

sgp_get_feature_set_version(&sgp_feature_set, &sgp_product_type);
if (sgp_feature_set >= 0x06) {
if (SGP_REQUIRE_FS(sgp_feature_set, 1, 0)) {
absolute_humidity = sensirion_calc_absolute_humidity(temperature, humidity);
sgp_set_absolute_humidity(absolute_humidity);
}
Expand Down

0 comments on commit fab36ac

Please sign in to comment.