Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/Control Tasks/CameraControlTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ void CameraControlTask::execute()

// handle taking and storing photos
if (sfr::camera::take_photo == true && sfr::camera::powered == true) {
if (!adaCam.takePicture()) {
// extra 200ms delay between comanding photo and trigging capture
if (sfr::camera::start_progress < 8) {
#ifdef VERBOSE
Serial.println("photo triggered, delaying 100ms");
#endif
sfr::camera::start_progress++;
} else if (!adaCam.takePicture()) {
#ifdef VERBOSE
Serial.println("Failed to snap!");
#endif
Expand Down Expand Up @@ -206,7 +212,22 @@ void CameraControlTask::execute()
#ifdef VERBOSE
Serial.println("Done writing file");
#endif
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
if (sfr::camera::images_written == 1) {
if (!adaCam.resumeVideo()) {
#ifdef VERBOSE
Serial.println("Failed to resume camera frame!");
#endif
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
} else {
sfr::camera::take_photo = true;
#ifdef VERBOSE
Serial.println("Triggering second activation of optical sensor");
#endif
}
}
if (sfr::camera::images_written >= 2) {
sfr::camera::power_setting = (uint8_t)sensor_power_mode_type::off;
}
}
}
}
Expand Down Expand Up @@ -244,6 +265,7 @@ void CameraControlTask::camera_shutdown()
pinMode(constants::camera::tx, OUTPUT);
Pins::setPinState(constants::camera::rx, LOW);
Pins::setPinState(constants::camera::tx, LOW);
sfr::camera::start_progress = 0;

// if SD.begin succeeds but camera is never able to snap, reduce SD card power consumption
File file = SD.open("-", FILE_WRITE);
Expand Down
2 changes: 1 addition & 1 deletion src/MissionMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void Boot::transition_to()
void Boot::dispatch()
{
if (sfr::eeprom::time_alive >= sfr::boot::max_time) {
sfr::mission::current_mode = sfr::mission::aliveSignal;
sfr::mission::current_mode = sfr::mission::normalInSun;
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/Monitors/ButtonMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ void ButtonMonitor::execute()
fault_groups::hardware_faults::button->force();
}
} else {
sfr::button::pressed = true;
if (sfr::mission::possible_uncovered) {
sfr::button::pressed = false;
} else {
sfr::button::pressed = true;
}
}
}
10 changes: 5 additions & 5 deletions src/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ namespace constants {
constexpr uint16_t fault_opcode_max = 0x6100;

} // namespace opcodes
} // namespace rockblock
} // namespace rockblock
namespace temperature {
constexpr int pin = 39;
constexpr int in_sun_val = 30;
constexpr int in_sun_val = 0;
constexpr int min_temp_c = -100;
constexpr int max_temp_c = 200;
} // namespace temperature
Expand All @@ -98,7 +98,7 @@ namespace constants {
constexpr float in_sun_val = 70; // mA
constexpr int load = 30; // load resister value (kOhm)
constexpr float shunt = 0.1; // shunt resistor value (Ohm)
} // namespace current
} // namespace current
namespace masks {
constexpr uint32_t uint32_byte1_mask = 0b11111111000000000000000000000000;
constexpr uint32_t uint32_byte2_mask = 0b00000000111111110000000000000000;
Expand Down Expand Up @@ -248,7 +248,7 @@ namespace constants {
} // namespace battery
namespace camera {
constexpr int power_on_pin = 31;
constexpr int content_length = 64;
constexpr int content_length = 80;
constexpr int bytes_allocated_fragment = 4;
constexpr int tx = 34;
constexpr int rx = 33;
Expand Down Expand Up @@ -304,6 +304,6 @@ namespace constants {
namespace watchdog {
constexpr uint32_t max_period_ms = 10000;
} // namespace watchdog
}; // namespace constants
}; // namespace constants

#endif
8 changes: 4 additions & 4 deletions src/sfr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace sfr {
} // namespace stabilization
namespace boot {
// OP Codes 1200
SFRField<uint32_t> max_time = SFRField<uint32_t>(2 * constants::time::one_hour, 0x1200);
SFRField<uint32_t> max_time = SFRField<uint32_t>(5 * constants::time::one_minute, 0x1200);
} // namespace boot
namespace detumble {
// OP Codes 1500
Expand All @@ -17,7 +17,7 @@ namespace sfr {
SFRField<uint8_t> max_stable_gyro_y = SFRField<uint8_t>((0.2 * constants::imu::sfr_resolution), 0x1502, constants::imu::sfr_resolution); // rad/s
SFRField<uint8_t> min_unstable_gyro_x = SFRField<uint8_t>((0.7 * constants::imu::sfr_resolution), 0x1503, constants::imu::sfr_resolution); // rad/s
SFRField<uint8_t> min_unstable_gyro_y = SFRField<uint8_t>((0.7 * constants::imu::sfr_resolution), 0x1504, constants::imu::sfr_resolution); // rad/s
} // namespace detumble
} // namespace detumble
namespace aliveSignal {
// OP Codes 1600
SFRField<bool> downlinked = SFRField<bool>(false, 0x1600);
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace sfr {
SFRField<uint32_t> last_downlink = SFRField<uint32_t>(0, 0x2108);
SFRField<uint32_t> downlink_period = SFRField<uint32_t>(20 * constants::time::one_minute, 0, 2 * constants::time::one_day, 0x2109);
SFRField<uint32_t> lp_downlink_period = SFRField<uint32_t>(constants::time::one_hour, constants::time::one_second, 2 * constants::time::one_day, 0x2110);
SFRField<uint32_t> transmit_downlink_period = SFRField<uint32_t>(20 * constants::time::one_minute, constants::time::one_second, 2 * constants::time::one_day, 0x2111);
SFRField<uint32_t> transmit_downlink_period = SFRField<uint32_t>(5 * constants::time::one_minute, constants::time::one_second, 2 * constants::time::one_day, 0x2111);
SFRField<uint32_t> on_time = SFRField<uint32_t>(35 * constants::time::one_minute, 0, constants::time::one_revolution, 0x2112);

char buffer[constants::rockblock::buffer_size] = {0};
Expand Down Expand Up @@ -283,4 +283,4 @@ namespace sfr {
SFRField<uint32_t> dynamic_data_age = SFRField<uint32_t>(0, 0x2809);
SFRField<uint32_t> sfr_data_age = SFRField<uint32_t>(0, 0x2810);
} // namespace eeprom
}; // namespace sfr
}; // namespace sfr