Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.

Commit

Permalink
fix logic error: moved start measurement to setup()
Browse files Browse the repository at this point in the history
  • Loading branch information
winkj committed Mar 12, 2019
1 parent 4309fb5 commit 9c78bf9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions examples/sps30/sps30.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
// #define PLOTTER_FORMAT

void setup() {
s16 ret;
u8 auto_clean_days = 4;
u32 auto_clean;

Serial.begin(9600);
delay(2000);

Expand All @@ -19,16 +23,7 @@ void setup() {
#ifndef PLOTTER_FORMAT
Serial.print("SPS sensor probing successful\n");
#endif /* PLOTTER_FORMAT */
}

void loop() {
struct sps30_measurement m;
char serial[SPS_MAX_SERIAL_LEN];
u8 auto_clean_days = 4;
u32 auto_clean;
u16 data_ready;
s16 ret;

ret = sps30_set_fan_auto_cleaning_interval_days(auto_clean_days);
if (ret) {
Serial.print("error setting the auto-clean interval: ");
Expand All @@ -44,6 +39,13 @@ void loop() {
Serial.print("measurements started\n");
#endif /* PLOTTER_FORMAT */
delay(1000);
}

void loop() {
struct sps30_measurement m;
char serial[SPS_MAX_SERIAL_LEN];
u16 data_ready;
s16 ret;

do {
ret = sps30_read_data_ready(&data_ready);
Expand Down

0 comments on commit 9c78bf9

Please sign in to comment.