Skip to content
Merged
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
4 changes: 3 additions & 1 deletion lib/fc_pins/fc_pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
#define PIN_QSPI_FLASH_CLK PF10
#define PIN_QSPI_FLASH_CS PG6
#define PIN_QSPI_FLASH_RST_IO3 PD13
#define PIN_QSPI_FLASH_WP_IO2 PF7
#define PIN_QSPI_FLASH_WP_IO2 PF7

#define PIN_TEST_LED PA7
14 changes: 14 additions & 0 deletions lib/trajectory_following/TrajectoryFollower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "elapsedMillis.h"
#include "flight_packet.h"
#include <Arduino.h>
#include "fc_pins.h"

#define TELEMETRY_INTERVAL_US 100000
#define COMMAND_INTERVAL_US 1000
Expand Down Expand Up @@ -59,6 +60,8 @@ void follow_trajectory() {
unsigned long lasttelemetry = timer;
unsigned long lastloop = timer;
unsigned long lastlogx_est = timer;
unsigned long led_on_time = 0;
bool led_on = false;

float last_time_s = timer / 1000000.0;
float mx, my, mz;
Expand All @@ -85,6 +88,15 @@ void follow_trajectory() {
GPS::set_current_position_as_origin();

TrajectoryLogger::log_x_est(); // only log initial controller state, this is too much data to log every frame

led_on_time = millis();
led_on = true;
digitalWrite(PIN_TEST_LED, LOW);
}

if (led_on && millis() - led_on_time > 500)
{
digitalWrite(PIN_TEST_LED, HIGH);
}

Controller_Input ci;
Expand Down Expand Up @@ -244,6 +256,8 @@ void follow_trajectory() {
}
}

digitalWrite(PIN_TEST_LED, HIGH);

Logging::disarm();

Prop::stop();
Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "TrajectoryLoader.h"
#include "TrajectoryLogger.h"
#include <Arduino.h>
#include "fc_pins.h"

CommsSerial_t<HardwareSerial> HW_CommsSerial(PIN_SERIAL_RX, PIN_SERIAL_TX);
CommsSerial_t<USBSerial> USB_CommsSerial;
Expand Down Expand Up @@ -53,6 +54,9 @@ void setup() {

pinMode(PB6, OUTPUT);

pinMode(PIN_TEST_LED, OUTPUT);
digitalWrite(PIN_TEST_LED, HIGH);

CommandRouter::begin();
Prop::begin();
Mag::begin();
Expand Down
Loading