From f6835eeff50889fc4f63d584ae8e5800b548b678 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 14 Dec 2022 13:53:20 -0500 Subject: [PATCH] added writing to Serial2 in get_camera_image and timeout 20 seconds --- cubesatsim/pico-get-jpeg-serial.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cubesatsim/pico-get-jpeg-serial.cpp b/cubesatsim/pico-get-jpeg-serial.cpp index 67842501..44a7b685 100644 --- a/cubesatsim/pico-get-jpeg-serial.cpp +++ b/cubesatsim/pico-get-jpeg-serial.cpp @@ -21,7 +21,7 @@ int start_flag_complete = false; int end_flag_detected = false; int jpeg_start = 0; FastCRC8 CRC8; -#define CAMERA_TIMEOUT 12000 // Camera timeout in milli seconds +#define CAMERA_TIMEOUT 20000 // Camera timeout in milli seconds //#define GET_IMAGE_DEBUG @@ -66,10 +66,10 @@ bool start_camera() { delay(100); Serial2.begin(115200); #ifdef GET_IMAGE_DEBUG - Serial.println("Started Serial2 to camera v0.1"); + Serial.println("Started Serial2 to camera v0.2"); #endif LittleFS.begin(); - + bool camera_present = false; // int tries = 0; // while ((tries++ < 5) && !camera_present) { @@ -178,7 +178,8 @@ bool get_camera_image() { Serial.println("Starting get_image_file"); #endif finished = false; - + Serial2.write(1); + Serial.println("writing to Serial2"); unsigned long time_start = millis(); while ((!finished) && ((millis() - time_start) < CAMERA_TIMEOUT)) { @@ -271,6 +272,8 @@ bool get_camera_image() { // Serial.println("Resetting. Not start flag."); } } + Serial2.write(1); + Serial.println("writing to Serial2"); } return(finished); }