Skip to content

Commit

Permalink
Apply clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Action committed Nov 11, 2023
1 parent 62a9d4b commit 325afb8
Show file tree
Hide file tree
Showing 67 changed files with 1,816 additions and 628 deletions.
10 changes: 5 additions & 5 deletions Components/FlightControl/MEVManager.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#include "MEVManager.hpp"
#include "MEVManager.hpp"
#include "CommandMessage.hpp"
#include "PBBRxProtocolTask.hpp"
#include "PBBRxProtocolTask.hpp"

MEVManager::MEVState MEVManager::shouldMevBeOpen = INDETERMINATE;

void MEVManager::OpenMEV() {
shouldMevBeOpen = OPEN;
shouldMevBeOpen = OPEN;
PBBRxProtocolTask::SendPBBCommand(Proto::PBBCommand::Command::PBB_OPEN_MEV);
}

void MEVManager::CloseMEV() {
shouldMevBeOpen = CLOSE;
PBBRxProtocolTask::SendPBBCommand(
PBBRxProtocolTask::SendPBBCommand(
Proto::PBBCommand::Command::PBB_CLOSE_MEV);
}

void MEVManager::HandleMEVTelemetry(Proto::TelemetryMessage& msg) {
if (shouldMevBeOpen == INDETERMINATE || !msg.has_mevstate()) {
// Do nothing
return;
return;
}

if (!msg.mevstate().mev_open() && shouldMevBeOpen == OPEN) {
Expand Down
20 changes: 8 additions & 12 deletions Components/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,23 @@ constexpr uint16_t ERRVAL = 0xDEAD; // Error value for debugging
// Math macros and conversions
constexpr double MATH_PI = 3.14159265358979323846;
#define DEG_TO_RAD(degrees) \
((degrees) * \
0.01745329251994329576923690768489f) // Degrees to radians (PI/180)
((degrees)*0.01745329251994329576923690768489f) // Degrees to radians (PI/180)
#define RAD_TO_DEG(radians) \
((radians) * \
57.295779513082320876798154814105f) // Radians to degrees (180/PI)
#define MILLIG_TO_MPS2(millig) ((millig) * 9.80665f) // Milli-g to m/s^2
((radians)*57.295779513082320876798154814105f) // Radians to degrees (180/PI)
#define MILLIG_TO_MPS2(millig) ((millig)*9.80665f) // Milli-g to m/s^2
#define MILLIDPS_TO_RADPS(millidps) \
((millidps) * \
0.00017453292519943295769236907684886f) // Milli-degrees per second to radians per second (PI/180/1000)
#define LBS_TO_GRAMS(lbs) ((lbs) * 453.59237f) // Pounds to grams
((millidps)*0.00017453292519943295769236907684886f) // Milli-degrees per second to radians per second (PI/180/1000)
#define LBS_TO_GRAMS(lbs) ((lbs)*453.59237f) // Pounds to grams
#define GET_COBS_MAX_LEN(len) \
(((len) + ((len) / 254) + 1) + \
1) // Get the max length of a COBS encoded string, we add 1 for the 0x00 delimiter

// Conversion macros (SYSTEM)
#define TICKS_TO_MS(time_ticks) \
((time_ticks) * 1000 / \
((time_ticks)*1000 / \
osKernelSysTickFrequency) // System ticks to milliseconds
#define MS_TO_TICKS(time_ms) \
((time_ms) * osKernelSysTickFrequency / \
1000) // Milliseconds to system ticks
#define MS_TO_TICKS(time_ms) \
((time_ms)*osKernelSysTickFrequency / 1000) // Milliseconds to system ticks

// System Time Macros
constexpr uint32_t MAX_DELAY_MS = TICKS_TO_MS(portMAX_DELAY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,67 +274,93 @@ class array_view {
//*************************************************************************
/// Returns a reference to the first element.
//*************************************************************************
reference front() { return *mbegin; }
reference front() {
return *mbegin;
}

//*************************************************************************
/// Returns a const reference to the first element.
//*************************************************************************
const_reference front() const { return *mbegin; }
const_reference front() const {
return *mbegin;
}

//*************************************************************************
/// Returns a reference to the last element.
//*************************************************************************
reference back() { return *(mend - 1); }
reference back() {
return *(mend - 1);
}

//*************************************************************************
/// Returns a const reference to the last element.
//*************************************************************************
const_reference back() const { return *(mend - 1); }
const_reference back() const {
return *(mend - 1);
}

//*************************************************************************
/// Returns a pointer to the first element of the internal storage.
//*************************************************************************
pointer data() { return mbegin; }
pointer data() {
return mbegin;
}

//*************************************************************************
/// Returns a const pointer to the first element of the internal storage.
//*************************************************************************
const_pointer data() const { return mbegin; }
const_pointer data() const {
return mbegin;
}

//*************************************************************************
/// Returns an iterator to the beginning of the array.
//*************************************************************************
iterator begin() { return mbegin; }
iterator begin() {
return mbegin;
}

//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator begin() const { return mbegin; }
const_iterator begin() const {
return mbegin;
}

//*************************************************************************
/// Returns a const iterator to the beginning of the array.
//*************************************************************************
const_iterator cbegin() const { return mbegin; }
const_iterator cbegin() const {
return mbegin;
}

//*************************************************************************
/// Returns an iterator to the end of the array.
//*************************************************************************
iterator end() { return mend; }
iterator end() {
return mend;
}

//*************************************************************************
/// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator end() const { return mend; }
const_iterator end() const {
return mend;
}

//*************************************************************************
// Returns a const iterator to the end of the array.
//*************************************************************************
const_iterator cend() const { return mend; }
const_iterator cend() const {
return mend;
}

//*************************************************************************
// Returns an reverse iterator to the reverse beginning of the array.
//*************************************************************************
reverse_iterator rbegin() { return reverse_iterator(mend); }
reverse_iterator rbegin() {
return reverse_iterator(mend);
}

//*************************************************************************
/// Returns a const reverse iterator to the reverse beginning of the array.
Expand All @@ -353,7 +379,9 @@ class array_view {
//*************************************************************************
/// Returns a reverse iterator to the end of the array.
//*************************************************************************
reverse_iterator rend() { return reverse_iterator(mbegin); }
reverse_iterator rend() {
return reverse_iterator(mbegin);
}

//*************************************************************************
/// Returns a const reverse iterator to the end of the array.
Expand All @@ -372,17 +400,23 @@ class array_view {
//*************************************************************************
/// Returns <b>true</b> if the array size is zero.
//*************************************************************************
bool empty() const { return (mbegin == mend); }
bool empty() const {
return (mbegin == mend);
}

//*************************************************************************
/// Returns the size of the array.
//*************************************************************************
size_t size() const { return (mend - mbegin); }
size_t size() const {
return (mend - mbegin);
}

//*************************************************************************
/// Returns the maximum possible size of the array.
//*************************************************************************
size_t max_size() const { return size(); }
size_t max_size() const {
return size();
}

//*************************************************************************
/// Assign from a view.
Expand Down Expand Up @@ -415,13 +449,17 @@ class array_view {
//*************************************************************************
/// Returns a reference to the indexed value.
//*************************************************************************
reference operator[](const size_t i) { return mbegin[i]; }
reference operator[](const size_t i) {
return mbegin[i];
}
#endif

//*************************************************************************
/// Returns a const reference to the indexed value.
//*************************************************************************
const_reference operator[](const size_t i) const { return mbegin[i]; }
const_reference operator[](const size_t i) const {
return mbegin[i];
}

#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
//*************************************************************************
Expand Down Expand Up @@ -478,7 +516,9 @@ class array_view {
//*************************************************************************
/// Fills the array.
//*************************************************************************
void fill(const T& value) { etl::fill(begin(), end(), value); }
void fill(const T& value) {
etl::fill(begin(), end(), value);
}

//*************************************************************************
/// Equality for array views.
Expand Down
Loading

0 comments on commit 325afb8

Please sign in to comment.