Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 9c78bf9

Browse files
committed
fix logic error: moved start measurement to setup()
1 parent 4309fb5 commit 9c78bf9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

examples/sps30/sps30.ino

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// #define PLOTTER_FORMAT
99

1010
void setup() {
11+
s16 ret;
12+
u8 auto_clean_days = 4;
13+
u32 auto_clean;
14+
1115
Serial.begin(9600);
1216
delay(2000);
1317

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

24-
void loop() {
25-
struct sps30_measurement m;
26-
char serial[SPS_MAX_SERIAL_LEN];
27-
u8 auto_clean_days = 4;
28-
u32 auto_clean;
29-
u16 data_ready;
30-
s16 ret;
31-
3227
ret = sps30_set_fan_auto_cleaning_interval_days(auto_clean_days);
3328
if (ret) {
3429
Serial.print("error setting the auto-clean interval: ");
@@ -44,6 +39,13 @@ void loop() {
4439
Serial.print("measurements started\n");
4540
#endif /* PLOTTER_FORMAT */
4641
delay(1000);
42+
}
43+
44+
void loop() {
45+
struct sps30_measurement m;
46+
char serial[SPS_MAX_SERIAL_LEN];
47+
u16 data_ready;
48+
s16 ret;
4749

4850
do {
4951
ret = sps30_read_data_ready(&data_ready);

0 commit comments

Comments
 (0)