fixed merge conflicts
This commit is contained in:
@ -30,7 +30,7 @@ ReturnValue_t ThermalController::initializeAfterTaskCreation() {
|
||||
sif::error << "ThermalController::initializeAfterTaskCreation: Base"
|
||||
<< " class initialization failed!" << std::endl;
|
||||
}
|
||||
HasLocalDataPoolIF* testHkbHandler = objectManager->get<HasLocalDataPoolIF>(
|
||||
HasLocalDataPoolIF* testHkbHandler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
TSensorDefinitions::ObjIds::TEST_HKB_HANDLER);
|
||||
if(testHkbHandler == nullptr) {
|
||||
sif::warning << "ThermalController::initializeAfterTaskCreation: Test"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <fsfw/action/HasActionsIF.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw_hal/linux/utility.h>
|
||||
|
||||
@ -14,7 +15,7 @@
|
||||
GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
|
||||
object_id_t deviceCommunication, CookieIF * comCookie):
|
||||
DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this),
|
||||
configDataset(this) {
|
||||
configDataset(this), breakCountdown() {
|
||||
#if ADIS16507_DEBUG == 1
|
||||
debugDivider = new PeriodicOperationDivider(5);
|
||||
#endif
|
||||
@ -28,18 +29,34 @@ GyroADIS16507Handler::GyroADIS16507Handler(object_id_t objectId,
|
||||
}
|
||||
|
||||
void GyroADIS16507Handler::doStartUp() {
|
||||
// Initial 310 ms start up time after power-up
|
||||
if(internalState == InternalState::STARTUP) {
|
||||
if(not commandExecuted) {
|
||||
breakCountdown.setTimeout(ADIS16507::START_UP_TIME);
|
||||
commandExecuted = true;
|
||||
}
|
||||
if(breakCountdown.hasTimedOut()) {
|
||||
internalState = InternalState::CONFIG;
|
||||
commandExecuted = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Read all configuration registers first
|
||||
if(internalState == InternalState::CONFIG) {
|
||||
if(commandExecuted) {
|
||||
commandExecuted = false;
|
||||
internalState = InternalState::IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
if(internalState == InternalState::IDLE) {
|
||||
setMode(MODE_NORMAL);
|
||||
// setMode(MODE_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void GyroADIS16507Handler::doShutDown() {
|
||||
commandExecuted = false;
|
||||
}
|
||||
|
||||
ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
||||
@ -49,11 +66,14 @@ ReturnValue_t GyroADIS16507Handler::buildNormalDeviceCommand(DeviceCommandId_t *
|
||||
|
||||
ReturnValue_t GyroADIS16507Handler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
switch(internalState) {
|
||||
case(InternalState::STARTUP): {
|
||||
case(InternalState::CONFIG): {
|
||||
*id = ADIS16507::READ_OUT_CONFIG;
|
||||
buildCommandFromCommand(*id, nullptr, 0);
|
||||
break;
|
||||
}
|
||||
case(InternalState::STARTUP): {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
/* Might be a configuration error. */
|
||||
sif::debug << "GyroADIS16507Handler::buildTransitionDeviceCommand: "
|
||||
@ -80,6 +100,10 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::READ_SENSOR_DATA): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// A glob command is pending and sensor data can't be read currently
|
||||
return NO_REPLY_EXPECTED;
|
||||
}
|
||||
std::memcpy(commandBuffer.data(), ADIS16507::BURST_READ_ENABLE.data(),
|
||||
ADIS16507::BURST_READ_ENABLE.size());
|
||||
std::memset(commandBuffer.data() + 2, 0, 10 * 2);
|
||||
@ -87,6 +111,62 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
|
||||
this->rawPacket = commandBuffer.data();
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::SELF_TEST_SENSORS): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// Another glob command is pending
|
||||
return HasActionsIF::IS_BUSY;
|
||||
}
|
||||
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SENSOR_SELF_TEST, 0x00);
|
||||
breakCountdown.setTimeout(ADIS16507::SELF_TEST_BREAK);
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::SELF_TEST_MEMORY): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// Another glob command is pending
|
||||
return HasActionsIF::IS_BUSY;
|
||||
}
|
||||
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_TEST, 0x00);
|
||||
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_TEST_BREAK);
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::UPDATE_NV_CONFIGURATION): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// Another glob command is pending
|
||||
return HasActionsIF::IS_BUSY;
|
||||
}
|
||||
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FLASH_MEMORY_UPDATE, 0x00);
|
||||
breakCountdown.setTimeout(ADIS16507::FLASH_MEMORY_UPDATE_BREAK);
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::RESET_SENSOR_CONFIGURATION): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// Another glob command is pending
|
||||
return HasActionsIF::IS_BUSY;
|
||||
}
|
||||
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::FACTORY_CALIBRATION, 0x00);
|
||||
breakCountdown.setTimeout(ADIS16507::FACTORY_CALIBRATION_BREAK);
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::SW_RESET): {
|
||||
if(breakCountdown.isBusy()) {
|
||||
// Another glob command is pending
|
||||
return HasActionsIF::IS_BUSY;
|
||||
}
|
||||
prepareWriteCommand(ADIS16507::GLOB_CMD, ADIS16507::GlobCmds::SOFTWARE_RESET, 0x00);
|
||||
breakCountdown.setTimeout(ADIS16507::SW_RESET_BREAK);
|
||||
break;
|
||||
}
|
||||
case(ADIS16507::PRINT_CURRENT_CONFIGURATION): {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
PoolReadGuard pg(&configDataset);
|
||||
sif::info << "ADIS16507 Sensor configuration: DIAG_STAT: 0x" << std::hex << std::setw(4) <<
|
||||
std::setfill('0') << "0x" << configDataset.diagStatReg.value << std::endl;
|
||||
sif::info << "MSC_CTRL: " << std::hex << std::setw(4) << "0x" <<
|
||||
configDataset.mscCtrlReg.value << " | FILT_CTRL: 0x" <<
|
||||
configDataset.filterSetting.value << " | DEC_RATE: 0x" <<
|
||||
configDataset.decRateReg.value << std::setfill(' ') << std::endl;
|
||||
#endif /* OBSW_VERBOSE_LEVEL >= 1 */
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
@ -94,6 +174,12 @@ ReturnValue_t GyroADIS16507Handler::buildCommandFromCommand(DeviceCommandId_t de
|
||||
void GyroADIS16507Handler::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(ADIS16507::READ_SENSOR_DATA, 1, &primaryDataset);
|
||||
insertInCommandAndReplyMap(ADIS16507::READ_OUT_CONFIG, 1, &configDataset);
|
||||
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_SENSORS, 1);
|
||||
insertInCommandAndReplyMap(ADIS16507::SELF_TEST_MEMORY, 1);
|
||||
insertInCommandAndReplyMap(ADIS16507::UPDATE_NV_CONFIGURATION, 1);
|
||||
insertInCommandAndReplyMap(ADIS16507::RESET_SENSOR_CONFIGURATION, 1);
|
||||
insertInCommandAndReplyMap(ADIS16507::SW_RESET, 1);
|
||||
insertInCommandAndReplyMap(ADIS16507::PRINT_CURRENT_CONFIGURATION, 1);
|
||||
}
|
||||
|
||||
ReturnValue_t GyroADIS16507Handler::scanForReply(const uint8_t *start, size_t remainingSize,
|
||||
@ -123,7 +209,7 @@ ReturnValue_t GyroADIS16507Handler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
configDataset.mscCtrlReg.value = packet[6] << 8 | packet[7];
|
||||
configDataset.decRateReg.value = packet[8] << 8 | packet[9];
|
||||
configDataset.setValidity(true, true);
|
||||
if(internalState == InternalState::STARTUP) {
|
||||
if(internalState == InternalState::CONFIG) {
|
||||
commandExecuted = true;
|
||||
}
|
||||
break;
|
||||
@ -223,6 +309,19 @@ uint32_t GyroADIS16507Handler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mode
|
||||
return 5000;
|
||||
}
|
||||
|
||||
void GyroADIS16507Handler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne,
|
||||
uint8_t valueTwo) {
|
||||
uint8_t secondReg = startReg + 1;
|
||||
startReg |= ADIS16507::WRITE_MASK;
|
||||
secondReg |= ADIS16507::WRITE_MASK;
|
||||
commandBuffer[0] = startReg;
|
||||
commandBuffer[1] = valueOne;
|
||||
commandBuffer[2] = secondReg;
|
||||
commandBuffer[3] = valueTwo;
|
||||
this->rawPacketLen = 4;
|
||||
this->rawPacket = commandBuffer.data();
|
||||
}
|
||||
|
||||
void GyroADIS16507Handler::prepareReadCommand(uint8_t *regList, size_t len) {
|
||||
for(size_t idx = 0; idx < len; idx++) {
|
||||
commandBuffer[idx * 2] = regList[idx];
|
||||
|
@ -40,6 +40,7 @@ private:
|
||||
|
||||
enum class InternalState {
|
||||
STARTUP,
|
||||
CONFIG,
|
||||
IDLE
|
||||
};
|
||||
|
||||
@ -65,6 +66,8 @@ private:
|
||||
#if ADIS16507_DEBUG == 1
|
||||
PeriodicOperationDivider* debugDivider;
|
||||
#endif
|
||||
Countdown breakCountdown;
|
||||
void prepareWriteCommand(uint8_t startReg, uint8_t valueOne, uint8_t valueTwo);
|
||||
|
||||
ReturnValue_t handleSensorData(const uint8_t* packet);
|
||||
};
|
||||
|
@ -276,9 +276,9 @@ ReturnValue_t IMTQHandler::initializeLocalDataPool(localpool::DataPool& localDat
|
||||
localDataPoolMap.emplace(IMTQ::MCU_TEMPERATURE, new PoolEntry<uint16_t>( { 0 }));
|
||||
|
||||
/** Entries of calibrated MTM measurement dataset */
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_X, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_Y, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_Z, new PoolEntry<uint32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_X, new PoolEntry<int32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_Y, new PoolEntry<int32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::MTM_CAL_Z, new PoolEntry<int32_t>( { 0 }));
|
||||
localDataPoolMap.emplace(IMTQ::ACTUATION_CAL_STATUS, new PoolEntry<uint8_t>( { 0 }));
|
||||
|
||||
/** Entries of raw MTM measurement dataset */
|
||||
|
@ -33,7 +33,7 @@ ReturnValue_t PCDUHandler::initialize() {
|
||||
|
||||
ReturnValue_t result;
|
||||
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (IPCStore == nullptr) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
@ -44,7 +44,8 @@ ReturnValue_t PCDUHandler::initialize() {
|
||||
}
|
||||
|
||||
/* Subscribing for housekeeping table update messages of the PDU2 */
|
||||
HasLocalDataPoolIF* pdu2Handler = objectManager->get<HasLocalDataPoolIF>(objects::PDU2_HANDLER);
|
||||
HasLocalDataPoolIF* pdu2Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::PDU2_HANDLER);
|
||||
if(pdu2Handler == nullptr) {
|
||||
sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
@ -58,7 +59,8 @@ ReturnValue_t PCDUHandler::initialize() {
|
||||
}
|
||||
|
||||
/* Subscribing for housekeeping table update messages of the PDU1 */
|
||||
HasLocalDataPoolIF* pdu1Handler = objectManager->get<HasLocalDataPoolIF>(objects::PDU1_HANDLER);
|
||||
HasLocalDataPoolIF* pdu1Handler = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::PDU1_HANDLER);
|
||||
if(pdu1Handler == nullptr) {
|
||||
sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
@ -207,11 +209,11 @@ void PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) const
|
||||
switch (switchNr) {
|
||||
case pcduSwitches::TCS_BOARD_8V_HEATER_IN:
|
||||
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN;
|
||||
pdu = objectManager->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
break;
|
||||
case pcduSwitches::DEPLOYMENT_MECHANISM:
|
||||
memoryAddress = PDU2::CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM;
|
||||
pdu = objectManager->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
pdu = ObjectManager::instance()->get<GomspaceDeviceHandler>(objects::PDU2_HANDLER);
|
||||
break;
|
||||
default:
|
||||
sif::error << "PCDUHandler::sendSwitchCommand: Invalid switch number " << std::endl;
|
||||
|
@ -8,6 +8,7 @@
|
||||
namespace ADIS16507 {
|
||||
|
||||
static constexpr size_t MAXIMUM_REPLY_SIZE = 64;
|
||||
static constexpr uint8_t WRITE_MASK = 0b1000'0000;
|
||||
|
||||
static constexpr uint32_t GYRO_RANGE = 125;
|
||||
static constexpr uint32_t ACCELEROMETER_RANGE = 392;
|
||||
@ -18,6 +19,13 @@ static constexpr uint16_t PROD_ID = 16507;
|
||||
|
||||
static constexpr std::array<uint8_t, 2> BURST_READ_ENABLE = {0x68, 0x00};
|
||||
|
||||
static constexpr dur_millis_t START_UP_TIME = 310;
|
||||
static constexpr dur_millis_t SW_RESET_BREAK = 255;
|
||||
static constexpr dur_millis_t FACTORY_CALIBRATION_BREAK = 136;
|
||||
static constexpr dur_millis_t FLASH_MEMORY_UPDATE_BREAK = 70;
|
||||
static constexpr dur_millis_t FLASH_MEMORY_TEST_BREAK = 30;
|
||||
static constexpr dur_millis_t SELF_TEST_BREAK = 24;
|
||||
|
||||
static constexpr uint8_t DIAG_STAT_REG = 0x02;
|
||||
static constexpr uint8_t FILTER_CTRL_REG = 0x5c;
|
||||
static constexpr uint8_t MSC_CTRL_REG = 0x60;
|
||||
@ -47,6 +55,14 @@ static constexpr size_t SENSOR_READOUT_SIZE = 20 + 2;
|
||||
static constexpr uint32_t ADIS_DATASET_ID = READ_SENSOR_DATA;
|
||||
static constexpr uint32_t ADIS_CFG_DATASET_ID = READ_OUT_CONFIG;
|
||||
|
||||
enum GlobCmds: uint8_t {
|
||||
FACTORY_CALIBRATION = 0b0000'0010,
|
||||
SENSOR_SELF_TEST = 0b0000'0100,
|
||||
FLASH_MEMORY_UPDATE = 0b0000'1000,
|
||||
FLASH_MEMORY_TEST = 0b0001'0000,
|
||||
SOFTWARE_RESET = 0b1000'0000
|
||||
};
|
||||
|
||||
enum PrimaryPoolIds: lp_id_t {
|
||||
ANG_VELOC_X,
|
||||
ANG_VELOC_Y,
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketPusC.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
@ -79,7 +80,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
||||
|
||||
ReturnValue_t TmFunnel::initialize() {
|
||||
|
||||
tmPool = objectManager->get<StorageManagerIF>(objects::TM_STORE);
|
||||
tmPool = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
|
||||
if(tmPool == nullptr) {
|
||||
sif::error << "TmFunnel::initialize: TM store not set."
|
||||
<< std::endl;
|
||||
@ -89,7 +90,7 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF* tmTarget =
|
||||
objectManager->get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(downlinkDestination);
|
||||
if(tmTarget == nullptr){
|
||||
sif::error << "TmFunnel::initialize: Downlink Destination not set."
|
||||
<< std::endl;
|
||||
@ -105,7 +106,7 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF* storageTarget =
|
||||
objectManager->get<AcceptsTelemetryIF>(storageDestination);
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
|
||||
if(storageTarget != nullptr) {
|
||||
storageQueue->setDefaultDestination(
|
||||
storageTarget->getReportReceptionQueue());
|
||||
|
Reference in New Issue
Block a user