SoC Calculator #754
@ -26,6 +26,7 @@ enum commonObjects : uint32_t {
|
|||||||
THERMAL_CONTROLLER = 0x43400001,
|
THERMAL_CONTROLLER = 0x43400001,
|
||||||
ACS_CONTROLLER = 0x43000002,
|
ACS_CONTROLLER = 0x43000002,
|
||||||
CORE_CONTROLLER = 0x43000003,
|
CORE_CONTROLLER = 0x43000003,
|
||||||
|
POWER_CONTROLLER = 0x43000004,
|
||||||
GLOBAL_JSON_CFG = 0x43000006,
|
GLOBAL_JSON_CFG = 0x43000006,
|
||||||
|
|
||||||
/* 0x44 ('D') for device handlers */
|
/* 0x44 ('D') for device handlers */
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <linux/tcs/Max31865RtdPolling.h>
|
#include <linux/tcs/Max31865RtdPolling.h>
|
||||||
#include <mission/acs/SusHandler.h>
|
#include <mission/acs/SusHandler.h>
|
||||||
#include <mission/controller/AcsController.h>
|
#include <mission/controller/AcsController.h>
|
||||||
|
#include <mission/controller/PowerController.h>
|
||||||
#include <mission/genericFactory.h>
|
#include <mission/genericFactory.h>
|
||||||
#include <mission/payload/ScexDeviceHandler.h>
|
#include <mission/payload/ScexDeviceHandler.h>
|
||||||
#include <mission/system/acs/SusAssembly.h>
|
#include <mission/system/acs/SusAssembly.h>
|
||||||
@ -337,6 +338,11 @@ AcsController* ObjectFactory::createAcsController(bool connectSubsystem, bool en
|
|||||||
return acsCtrl;
|
return acsCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PowerController* ObjectFactory::createPowerController(bool enableHkSets) {
|
||||||
|
auto pwrCtrl = new PowerController(objects::POWER_CONTROLLER, enableHkSets);
|
||||||
|
return pwrCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
|
||||||
|
54
mission/controller/PowerController.cpp
Normal file
54
mission/controller/PowerController.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
#include <mission/controller/PowerController.h>
|
||||||
|
|
||||||
|
PowerController::PowerController(object_id_t objectId, bool enableHkSets)
|
||||||
|
: ExtendedControllerBase(objectId), enableHkSets(enableHkSets) {}
|
||||||
|
|
||||||
|
ReturnValue_t PowerController::initialize() {
|
||||||
|
ReturnValue_t result = parameterHelper.initialize();
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return ExtendedControllerBase::initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PowerController::handleCommandMessage(CommandMessage *message) {
|
||||||
|
ReturnValue_t result = actionHelper.handleActionMessage(message);
|
||||||
|
if (result == returnvalue::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = parameterHelper.handleParameterMessage(message);
|
||||||
|
if (result == returnvalue::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerController::performControlOperation() {
|
||||||
|
switch (internalState) {
|
||||||
|
case InternalState::STARTUP: {
|
||||||
|
initialCountdown.resetTimer();
|
||||||
|
internalState = InternalState::INITIAL_DELAY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case InternalState::INITIAL_DELAY: {
|
||||||
|
if (initialCountdown.hasTimedOut()) {
|
||||||
|
internalState = InternalState::READY;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case InternalState::READY: {
|
||||||
|
if (mode != MODE_OFF) {
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t PowerController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
|
LocalDataPoolManager &poolManager) {
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
38
mission/controller/PowerController.h
Normal file
38
mission/controller/PowerController.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef MISSION_CONTROLLER_POWERCONTROLLER_H_
|
||||||
|
#define MISSION_CONTROLLER_POWERCONTROLLER_H_
|
||||||
|
|
||||||
|
#include <eive/objects.h>
|
||||||
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
|
#include <fsfw/parameters/ParameterHelper.h>
|
||||||
|
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||||
|
|
||||||
|
class PowerController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
|
||||||
|
public:
|
||||||
|
static constexpr dur_millis_t INIT_DELAY = 500;
|
||||||
|
|
||||||
|
PowerController(object_id_t objectId, bool enableHkSets);
|
||||||
|
|
||||||
|
MessageQueueId_t getCommandQueue() const;
|
||||||
|
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
|
||||||
|
ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues,
|
||||||
|
uint16_t startAtIndex) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool enableHkSets = false;
|
||||||
|
ParameterHelper parameterHelper;
|
||||||
|
|
||||||
|
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
|
||||||
|
InternalState internalState = InternalState::STARTUP;
|
||||||
|
|
||||||
|
// Initial delay to make sure all pool variables have been initialized their owners
|
||||||
|
Countdown initialCountdown = Countdown(INIT_DELAY);
|
||||||
|
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||||
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
|
void performControlOperation() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MISSION_CONTROLLER_POWERCONTROLLER_H_ */
|
Loading…
Reference in New Issue
Block a user