2022-09-19 15:37:05 +02:00
|
|
|
/*
|
|
|
|
* SensorValues.cpp
|
|
|
|
*
|
|
|
|
* Created on: 30 Mar 2022
|
|
|
|
* Author: rooob
|
|
|
|
*/
|
2022-09-27 11:06:11 +02:00
|
|
|
#include "SensorValues.h"
|
2022-10-10 16:02:57 +02:00
|
|
|
|
|
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
|
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
|
|
|
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
2022-09-19 15:37:05 +02:00
|
|
|
#include <stddef.h>
|
2022-10-10 16:02:57 +02:00
|
|
|
|
2022-09-19 15:37:05 +02:00
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
namespace ACS {
|
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
SensorValues::SensorValues() {}
|
2022-09-19 15:37:05 +02:00
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
SensorValues::~SensorValues() {}
|
2022-09-19 15:37:05 +02:00
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
ReturnValue_t SensorValues::updateMgm() {
|
2023-02-08 15:30:14 +01:00
|
|
|
std::vector<ReturnValue_t> results;
|
|
|
|
|
|
|
|
{
|
2023-02-08 17:02:59 +01:00
|
|
|
PoolReadGuard pgMgm(&mgm0Lis3Set);
|
|
|
|
results.push_back(pgMgm.getReadResult());
|
2023-02-08 15:30:14 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgMgm(&mgm1Rm3100Set);
|
|
|
|
results.push_back(pgMgm.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgMgm(&mgm2Lis3Set);
|
|
|
|
results.push_back(pgMgm.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgMgm(&mgm3Rm3100Set);
|
|
|
|
results.push_back(pgMgm.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgMgm(&imtqMgmSet);
|
|
|
|
results.push_back(pgMgm.getReadResult());
|
|
|
|
}
|
|
|
|
for (const auto& result : results) {
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return returnvalue::OK;
|
2022-09-19 15:37:05 +02:00
|
|
|
}
|
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
ReturnValue_t SensorValues::updateSus() {
|
2023-02-08 17:02:59 +01:00
|
|
|
std::vector<ReturnValue_t> results;
|
|
|
|
for (auto& susSet : susSets) {
|
|
|
|
{
|
|
|
|
PoolReadGuard pgSus(&susSet);
|
|
|
|
results.push_back(pgSus.getReadResult());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const auto& result : results) {
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return returnvalue::OK;
|
2022-10-10 16:02:57 +02:00
|
|
|
}
|
2022-09-19 15:37:05 +02:00
|
|
|
|
2022-10-11 15:01:32 +02:00
|
|
|
ReturnValue_t SensorValues::updateGyr() {
|
2023-02-08 17:02:59 +01:00
|
|
|
std::vector<ReturnValue_t> results;
|
|
|
|
{
|
|
|
|
PoolReadGuard pgGyr(&gyr0AdisSet);
|
|
|
|
results.push_back(pgGyr.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgGyr(&gyr1L3gSet);
|
|
|
|
results.push_back(pgGyr.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgGyr(&gyr2AdisSet);
|
|
|
|
results.push_back(pgGyr.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgGyr(&gyr3L3gSet);
|
|
|
|
results.push_back(pgGyr.getReadResult());
|
|
|
|
}
|
|
|
|
for (const auto& result : results) {
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return returnvalue::OK;
|
2022-10-11 15:01:32 +02:00
|
|
|
}
|
|
|
|
|
2022-10-12 10:27:01 +02:00
|
|
|
ReturnValue_t SensorValues::updateStr() {
|
|
|
|
PoolReadGuard pgStr(&strSet);
|
2023-02-08 15:30:14 +01:00
|
|
|
return pgStr.getReadResult();
|
2022-10-12 10:27:01 +02:00
|
|
|
}
|
|
|
|
|
2022-10-12 15:06:24 +02:00
|
|
|
ReturnValue_t SensorValues::updateGps() {
|
|
|
|
PoolReadGuard pgGps(&gpsSet);
|
2023-02-08 15:30:14 +01:00
|
|
|
return pgGps.getReadResult();
|
2022-10-12 15:06:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t SensorValues::updateRw() {
|
2023-02-08 17:02:59 +01:00
|
|
|
std::vector<ReturnValue_t> results;
|
|
|
|
{
|
|
|
|
PoolReadGuard pgRw(&rw1Set);
|
|
|
|
results.push_back(pgRw.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgRw(&rw2Set);
|
|
|
|
results.push_back(pgRw.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgRw(&rw3Set);
|
|
|
|
results.push_back(pgRw.getReadResult());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
PoolReadGuard pgRw(&rw4Set);
|
|
|
|
results.push_back(pgRw.getReadResult());
|
|
|
|
}
|
|
|
|
for (const auto& result : results) {
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return returnvalue::OK;
|
2022-10-12 15:06:24 +02:00
|
|
|
}
|
|
|
|
|
2022-10-11 15:01:32 +02:00
|
|
|
ReturnValue_t SensorValues::update() {
|
|
|
|
ReturnValue_t mgmUpdate = updateMgm();
|
|
|
|
ReturnValue_t susUpdate = updateSus();
|
|
|
|
ReturnValue_t gyrUpdate = updateGyr();
|
2022-10-12 10:27:01 +02:00
|
|
|
ReturnValue_t strUpdate = updateStr();
|
2022-11-17 13:01:29 +01:00
|
|
|
ReturnValue_t gpsUpdate = updateGps();
|
|
|
|
ReturnValue_t rwUpdate = updateRw();
|
2022-10-12 15:18:07 +02:00
|
|
|
|
2022-11-17 13:01:29 +01:00
|
|
|
if ((mgmUpdate && susUpdate && gyrUpdate && strUpdate && gpsUpdate && rwUpdate) ==
|
|
|
|
returnvalue::FAILED) {
|
2022-10-11 15:01:32 +02:00
|
|
|
return returnvalue::FAILED;
|
|
|
|
};
|
2022-10-10 16:02:57 +02:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
2022-10-11 15:01:32 +02:00
|
|
|
|
2022-10-10 16:02:57 +02:00
|
|
|
} // namespace ACS
|