dummy faking the PT1000 Temperature Sensors for host build
This commit is contained in:
parent
e9725e3093
commit
4a0aa6443b
@ -2,3 +2,4 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp)
|
|||||||
|
|
||||||
add_subdirectory(fsfwconfig)
|
add_subdirectory(fsfwconfig)
|
||||||
add_subdirectory(boardconfig)
|
add_subdirectory(boardconfig)
|
||||||
|
add_subdirectory(dummies)
|
||||||
|
@ -143,6 +143,14 @@ void initmission::initTasks() {
|
|||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
|
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needs high priority to be able to run before the controller tasks
|
||||||
|
PeriodicTaskIF* dummyTask = factory->createPeriodicTask(
|
||||||
|
"THERMAL_CTL_TASK", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
|
||||||
|
result = dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
initmission::printAddObjectError("RTD_0", objects::RTD_0_IC3_PLOC_HEATSPREADER);
|
||||||
|
}
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
result = testTask->addComponent(objects::TEST_TASK);
|
result = testTask->addComponent(objects::TEST_TASK);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@ -163,6 +171,8 @@ void initmission::initTasks() {
|
|||||||
|
|
||||||
thermalControllerTask->startTask();
|
thermalControllerTask->startTask();
|
||||||
|
|
||||||
|
dummyTask->startTask();
|
||||||
|
|
||||||
#if OBSW_ADD_TEST_CODE == 1
|
#if OBSW_ADD_TEST_CODE == 1
|
||||||
testTask->startTask();
|
testTask->startTask();
|
||||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <test/testtasks/TestTask.h>
|
#include <test/testtasks/TestTask.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "dummies/TemperatureSensorsDummy.h"
|
||||||
|
|
||||||
void Factory::setStaticFrameworkObjectIds() {
|
void Factory::setStaticFrameworkObjectIds() {
|
||||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||||
@ -45,6 +47,8 @@ void ObjectFactory::produce(void* args) {
|
|||||||
Factory::setStaticFrameworkObjectIds();
|
Factory::setStaticFrameworkObjectIds();
|
||||||
ObjectFactory::produceGenericObjects();
|
ObjectFactory::produceGenericObjects();
|
||||||
|
|
||||||
|
|
||||||
|
new TemperatureSensorsDummy();
|
||||||
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
|
new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT);
|
||||||
|
|
||||||
//new TestTask(objects::TEST_TASK);
|
//new TestTask(objects::TEST_TASK);
|
||||||
|
@ -1 +1 @@
|
|||||||
target_sources(${TARGET_NAME} PUBLIC ArduinoComIF.cpp ArduinoCookie.cpp)
|
target_sources(${OBSW_NAME} PUBLIC ArduinoComIF.cpp ArduinoCookie.cpp)
|
||||||
|
1
bsp_hosted/dummies/CMakeLists.txt
Normal file
1
bsp_hosted/dummies/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp)
|
83
bsp_hosted/dummies/TemperatureSensorsDummy.cpp
Normal file
83
bsp_hosted/dummies/TemperatureSensorsDummy.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
#include "TemperatureSensorsDummy.h"
|
||||||
|
|
||||||
|
#include <objects/systemObjectList.h>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
TemperatureSensorsDummy::TemperatureSensorsDummy()
|
||||||
|
: ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::NO_OBJECT),
|
||||||
|
max31865Set(this) {
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_1_IC4_PLOC_MISSIONBOARD, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_2_IC5_4K_CAMERA, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_3_IC6_DAC_HEATSPREADER, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_4_IC7_STARTRACKER, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_5_IC8_RW1_MX_MY, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_6_IC9_DRO, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_7_IC10_SCEX, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_8_IC11_X8, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_9_IC12_HPA, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_10_IC13_PL_TX, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_11_IC14_MPA, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_12_IC15_ACU, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_14_IC17_TCS_BOARD, this);
|
||||||
|
ObjectManager::instance()->insert(objects::RTD_15_IC18_IMTQ, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TemperatureSensorsDummy::initialize() {
|
||||||
|
static bool done = false;
|
||||||
|
if (not done) {
|
||||||
|
done = true;
|
||||||
|
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) {
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TemperatureSensorsDummy::performControlOperation() {
|
||||||
|
iteration++;
|
||||||
|
value = sin(iteration / 80. * M_PI) * 10;
|
||||||
|
|
||||||
|
max31865Set.read();
|
||||||
|
max31865Set.temperatureCelcius = value;
|
||||||
|
max31865Set.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool(
|
||||||
|
localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) {
|
||||||
|
localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry<float>({0}));
|
||||||
|
localDataPoolMap.emplace(Max31865Definitions::PoolIds::TEMPERATURE_C,
|
||||||
|
new PoolEntry<float>({0}, 1, true));
|
||||||
|
localDataPoolMap.emplace(Max31865Definitions::PoolIds::FAULT_BYTE, new PoolEntry<uint8_t>({0}));
|
||||||
|
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) {
|
||||||
|
sif::debug << "getHandle" << std::endl;
|
||||||
|
switch (sid.ownerSetId) {
|
||||||
|
case Max31865Definitions::MAX31865_SET_ID:
|
||||||
|
return &max31865Set;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t TemperatureSensorsDummy::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
|
uint32_t* msToReachTheMode) {
|
||||||
|
if (submode != SUBMODE_NONE) {
|
||||||
|
return INVALID_SUBMODE;
|
||||||
|
}
|
||||||
|
if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) {
|
||||||
|
return INVALID_MODE;
|
||||||
|
}
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
29
bsp_hosted/dummies/TemperatureSensorsDummy.h
Normal file
29
bsp_hosted/dummies/TemperatureSensorsDummy.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
|
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||||
|
|
||||||
|
class TemperatureSensorsDummy : public ExtendedControllerBase {
|
||||||
|
public:
|
||||||
|
TemperatureSensorsDummy();
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
|
virtual void performControlOperation() override;
|
||||||
|
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
|
|
||||||
|
// Mode abstract functions
|
||||||
|
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||||
|
uint32_t* msToReachTheMode) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int iteration = 0;
|
||||||
|
float value = 0;
|
||||||
|
Max31865Definitions::Max31865Set max31865Set;
|
||||||
|
|
||||||
|
void noise();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user