From 3507a7297dc667931f9ecbfefafe41be39937b58 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 12 Dec 2022 17:10:07 -0500 Subject: [PATCH] added read_time for bme and mpg --- cubesatsim/cubesatsim.ino | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index dc381b2a..c940a370 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -2645,6 +2645,7 @@ void start_payload() { void read_payload() { + unsigned long read_time = millis(); payload_str[0] = '\0'; // clear the payload string // print_string(payload_str); @@ -2664,8 +2665,13 @@ void read_payload() else sprintf(str, "0.0 0.0 0.0 0.0 "); strcat(payload_str, str); -// print_string(payload_str); - +// print_string(payload_str); + if ((millis() - read_time) > 500) { + Serial.println("There is a bme280 sensor problem"); + bnePresent = false; + } + read_time = millis(); + if (mpuPresent) { // print_string(payload_str); mpu6050.update(); @@ -2688,8 +2694,12 @@ void read_payload() if (rotation > 5) led_set(STEM_LED_BLUE, HIGH); else - led_set(STEM_LED_BLUE, LOW); + led_set(STEM_LED_BLUE, LOW); + if ((millis() - read_time) > 500) { + Serial.println("There is an mpu6050 sensor problem"); + mpuPresent = false; + } } else sprintf(str, "MPU6050 0.0 0.0 0.0 0.0 0.0 0.0 "); strcat(payload_str, str);