Skip to content

Commit 3a21948

Browse files
committed
add second ODS capture + delayed first ODS capture
1 parent 2382798 commit 3a21948

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

src/Control Tasks/CameraControlTask.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ void CameraControlTask::execute()
155155

156156
// handle taking and storing photos
157157
if (sfr::camera::take_photo == true && sfr::camera::powered == true) {
158-
if (!adaCam.takePicture()) {
158+
// extra 200ms delay between commanding photo and triggering capture
159+
if (sfr::camera::start_progress < 8) {
160+
sfr::camera::start_progress++;
161+
#ifdef VERBOSE
162+
Serial.println("Photo triggered, delaying additional 100ms");
163+
#endif
164+
} else if (!adaCam.takePicture()) {
159165
#ifdef VERBOSE
160166
Serial.println("Failed to snap!");
161167
#endif
@@ -206,7 +212,21 @@ void CameraControlTask::execute()
206212
#ifdef VERBOSE
207213
Serial.println("Done writing file");
208214
#endif
209-
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
215+
if (sfr::camera::images_written == 1) {
216+
if (!adaCam.resumeVideo()) {
217+
#ifdef VERBOSE
218+
Serial.println("Failed to resume ODS frame!");
219+
#endif
220+
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
221+
} else {
222+
sfr::camera::take_photo = true;
223+
#ifdef VERBOSE
224+
Serial.println("Triggering second activation of optical sensor");
225+
#endif
226+
}
227+
} else {
228+
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
229+
}
210230
}
211231
}
212232
}
@@ -244,6 +264,7 @@ void CameraControlTask::camera_shutdown()
244264
pinMode(constants::camera::tx, OUTPUT);
245265
Pins::setPinState(constants::camera::rx, LOW);
246266
Pins::setPinState(constants::camera::tx, LOW);
267+
sfr::camera::start_progress = 0;
247268

248269
// if SD.begin succeeds but camera is never able to snap, reduce SD card power consumption
249270
File file = SD.open("-", FILE_WRITE);

src/constants.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace constants {
8686
constexpr uint16_t fault_opcode_max = 0x6100;
8787

8888
} // namespace opcodes
89-
} // namespace rockblock
89+
} // namespace rockblock
9090
namespace temperature {
9191
constexpr int pin = 39;
9292
constexpr int in_sun_val = 30;
@@ -98,7 +98,7 @@ namespace constants {
9898
constexpr float in_sun_val = 70; // mA
9999
constexpr int load = 30; // load resister value (kOhm)
100100
constexpr float shunt = 0.1; // shunt resistor value (Ohm)
101-
} // namespace current
101+
} // namespace current
102102
namespace masks {
103103
constexpr uint32_t uint32_byte1_mask = 0b11111111000000000000000000000000;
104104
constexpr uint32_t uint32_byte2_mask = 0b00000000111111110000000000000000;
@@ -248,7 +248,7 @@ namespace constants {
248248
} // namespace battery
249249
namespace camera {
250250
constexpr int power_on_pin = 31;
251-
constexpr int content_length = 64;
251+
constexpr int content_length = 80;
252252
constexpr int bytes_allocated_fragment = 4;
253253
constexpr int tx = 34;
254254
constexpr int rx = 33;
@@ -304,6 +304,6 @@ namespace constants {
304304
namespace watchdog {
305305
constexpr uint32_t max_period_ms = 10000;
306306
} // namespace watchdog
307-
}; // namespace constants
307+
}; // namespace constants
308308

309309
#endif

0 commit comments

Comments
 (0)