Compare commits

..

No commits in common. "15652f73471ff931952b820f0005091ad6fe22a4" and "74d901cc86882c80bef299ab48a409aab7633b10" have entirely different histories.

4 changed files with 8 additions and 21 deletions

View File

@ -214,7 +214,7 @@ public:
float accelerometerRawToReading(const std::int16_t bit) const float accelerometerRawToReading(const std::int16_t bit) const
{ {
return (float(bit) * accel_fs_to_bit_constants_[std::uint32_t(scale_accel_)]) * 9.8f; return float(bit) * accel_fs_to_bit_constants_[std::uint32_t(scale_accel_)];
} }
float gyroRawToReading(const std::int16_t bit) const float gyroRawToReading(const std::int16_t bit) const

View File

@ -17,15 +17,6 @@
namespace Peripherals namespace Peripherals
{ {
struct IrSensorsReading
{
/// Distance as read by the sensor.
float distance;
/// @c true if the @c distance is < the wall threshold.
bool sees_object;
};
template<typename G, std::size_t N, std::size_t Average> template<typename G, std::size_t N, std::size_t Average>
class IrSensors class IrSensors
{ {
@ -70,16 +61,16 @@ public:
} }
} }
std::array<IrSensorsReading, N> getDistanceData() std::array<std::pair<float, bool>, N> getDistanceData()
{ {
std::array<IrSensorsReading, N> data; std::array<std::pair<float, bool>, N> data;
for (std::size_t i = 0; i < N; i++) for (std::size_t i = 0; i < N; i++)
{ {
const float interim = averages_[i] - offsets_[i]; const float interim = averages_[i] - offsets_[i];
data[i].distance = multipliers_[i] * std::pow(interim, exponents_[i]); data[i].first = multipliers_[i] * std::pow(interim, exponents_[i]);
data[i].sees_object = data[i].distance < wall_thresholds_[i]; data[i].second = data[i].first < wall_thresholds_[i];
} }
return data; return data;

View File

@ -8,10 +8,7 @@
#ifndef SKULLC_THREADS_ACTOR_HPP_ #ifndef SKULLC_THREADS_ACTOR_HPP_
#define SKULLC_THREADS_ACTOR_HPP_ #define SKULLC_THREADS_ACTOR_HPP_
#include <cmsis_os.h>
#include <freertos_os2.h>
#include <queue.h> #include <queue.h>
#include <type_traits> #include <type_traits>
#include "threads_primitivethread.hpp" #include "threads_primitivethread.hpp"
@ -26,7 +23,7 @@ class Actor
public: public:
using value_type = T; using value_type = T;
static_assert(std::is_default_constructible_v<value_type>, "T must be default constructible."); static_assert(std::is_trivially_constructible_v<value_type>, "T must be trivially constructible.");
static_assert(std::is_trivially_copyable_v<value_type>, "T must be trivially copyable."); static_assert(std::is_trivially_copyable_v<value_type>, "T must be trivially copyable.");
Actor(const std::uint32_t queue_size, const char* name, const osPriority_t priority, const std::uint32_t stack_size) Actor(const std::uint32_t queue_size, const char* name, const osPriority_t priority, const std::uint32_t stack_size)
@ -57,7 +54,7 @@ private:
{ {
init(); init();
value_type data{}; value_type data;
while (true) while (true)
{ {

View File

@ -20,8 +20,7 @@ struct Signallable
{ {
using value_type = T; using value_type = T;
static_assert(std::is_trivially_copyable_v<value_type>, "T must be trivially copyable."); static_assert(std::is_trivially_constructible_v<value_type>, "T must be trivially constructible.");
static_assert(std::is_default_constructible_v<value_type>, "T must be default constructible.");
virtual bool emit(const T& t) = 0; virtual bool emit(const T& t) = 0;
virtual std::pair<bool, BaseType_t> emitFromIsr(const T& t) = 0; virtual std::pair<bool, BaseType_t> emitFromIsr(const T& t) = 0;