Compare commits
55 Commits
Author | SHA1 | Date | |
---|---|---|---|
b2d9582a46 | |||
155bf9eed0
|
|||
15618a4c18 | |||
d07568bbe1 | |||
1267097368 | |||
e746c151d3
|
|||
5958560d00 | |||
e258193713 | |||
8f0b0f47c9 | |||
97f40232d7
|
|||
7c3329abb2
|
|||
acc50ca7aa | |||
6f8ad08e9b
|
|||
1f02c0ef57
|
|||
093f7f3a31
|
|||
a0e4f0a438 | |||
81311770e8 | |||
2132f6bb1f | |||
d2c0c1709e
|
|||
b23ae2e152
|
|||
eae63a8dc9
|
|||
a88725070b
|
|||
39c299e55d
|
|||
0bbcfb34e8
|
|||
7f3c71f4dc | |||
03e0cb4ca4 | |||
5f82b05d3e | |||
004c60030b | |||
c08024bd0b | |||
6bdafe62ad | |||
7fe676fed9
|
|||
2fda3e127e
|
|||
beb79d2fb4
|
|||
f0bbc1d090
|
|||
c120ce8617
|
|||
58c19e90eb
|
|||
833166cc78
|
|||
0ea0322e45 | |||
949ac8942d
|
|||
6d18e21edf
|
|||
d9a010f6bd
|
|||
971fd5b4a3
|
|||
4b4dd35b55
|
|||
988da377b1
|
|||
77ffc62236 | |||
bea918e861 | |||
8105e5f689
|
|||
b27694321f
|
|||
a884176773
|
|||
1f61f7d2e8 | |||
85dc977796
|
|||
5615f51ae7 | |||
9219d2bc8c
|
|||
85a12f071f | |||
1ae2f692ba
|
33
CHANGELOG.md
33
CHANGELOG.md
@ -16,6 +16,38 @@ will consitute of a breaking change warranting a new major release:
|
||||
|
||||
# [unreleased]
|
||||
|
||||
# [v6.3.0] 2023-08-03
|
||||
|
||||
## Fixed
|
||||
|
||||
- Small SCEX fix: The temperatur check option was not passed
|
||||
on for commands with a user data size larger than 1.
|
||||
- SCEX: Properly check whether filesystem is usable for filesystem checks.
|
||||
- ACS Controller strategy is now actually written to the dataset for detumbling.
|
||||
- During detumble the fused rotation rate is now calculated.
|
||||
- Detumbling is now exited when its exit value is undercut and not its entry value.
|
||||
- Rotation rate of last cycle is now stored in all cases for the fused rotational rate
|
||||
calculation.
|
||||
- Fused rotation rate estimation during eclipse can be disabled. This will also prevent
|
||||
detumbling during eclipse, as no relevant rotational rate is available for now.
|
||||
- `EiveSystem`: Add a small delay between triggering an event for FDIR reboots and sending the
|
||||
command to the core controller.
|
||||
- PL PDU: Fixed bounds checking logic. Bound checks will only be performed for modules which are
|
||||
enabled.
|
||||
|
||||
## Changed
|
||||
|
||||
- SCEX: Only perform filesystem checks when not in OFF mode.
|
||||
- The `EiveSystem` now only sends reboot commands targetting the same image.
|
||||
- Added 200 ms delay between switching HPA/MPA/TX/X8 and DRO GPIO pin OFF.
|
||||
- PL PCDU ADC set is now automatically enabled for `NORMAL` mode transitions. It is automatically
|
||||
disabled for `OFF` mode transitions.
|
||||
|
||||
## Added
|
||||
|
||||
- PL PCDU for EM build.
|
||||
- SCEX: Add warning event if filesystem is unusable.
|
||||
|
||||
# [v6.2.0] 2023-07-26
|
||||
|
||||
- `eive-tmtc`: v5.3.1
|
||||
@ -36,6 +68,7 @@ will consitute of a breaking change warranting a new major release:
|
||||
controller as well as settings of the low-pass filters can be handled via parameter commands.
|
||||
- Simplify and fix the chip and copy protection functions in the core controller. This mechanism
|
||||
now is always performed for the target chip and target copy in the reboot handlers.
|
||||
- Improvement in FSFW: HK generation is now countdown based.
|
||||
|
||||
## Added
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(OBSW_VERSION_MAJOR 6)
|
||||
set(OBSW_VERSION_MINOR 2)
|
||||
set(OBSW_VERSION_MINOR 3)
|
||||
set(OBSW_VERSION_REVISION 0)
|
||||
|
||||
# set(CMAKE_VERBOSE TRUE)
|
||||
@ -144,7 +144,7 @@ set(OBSW_ADD_RAD_SENSORS
|
||||
${INIT_VAL}
|
||||
CACHE STRING "Add Rad Sensor module")
|
||||
set(OBSW_ADD_PL_PCDU
|
||||
${INIT_VAL}
|
||||
1
|
||||
CACHE STRING "Add Payload PCDU modukle")
|
||||
set(OBSW_ADD_SYRLINKS
|
||||
1
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @brief Auto-generated event translation file. Contains 302 translations.
|
||||
* @details
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
|
||||
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
|
||||
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
|
||||
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
|
||||
const char *FS_UNUSABLE_STRING = "FS_UNUSABLE";
|
||||
const char *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
|
||||
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
|
||||
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
|
||||
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
|
||||
return EXPERIMENT_TIMEDOUT_STRING;
|
||||
case (13802):
|
||||
return MULTI_PACKET_COMMAND_DONE_STRING;
|
||||
case (13803):
|
||||
return FS_UNUSABLE_STRING;
|
||||
case (13901):
|
||||
return SET_CONFIGFILEVALUE_FAILED_STRING;
|
||||
case (13902):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 171 translations.
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -94,6 +94,9 @@ void ObjectFactory::produce(void* args) {
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
dummyCfg.addAcsBoardDummies = false;
|
||||
#endif
|
||||
#if OBSW_ADD_PL_PCDU == 0
|
||||
dummyCfg.addPlPcduDummy = true;
|
||||
#endif
|
||||
|
||||
PowerSwitchIF* pwrSwitcher = nullptr;
|
||||
#if OBSW_ADD_GOMSPACE_PCDU == 0
|
||||
@ -107,6 +110,8 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER, enableHkSets);
|
||||
|
||||
auto* stackHandler = new Stack5VHandler(*pwrSwitcher);
|
||||
|
||||
// Initialize chip select to avoid SPI bus issues.
|
||||
createRadSensorChipSelect(gpioComIF);
|
||||
|
||||
@ -146,6 +151,9 @@ void ObjectFactory::produce(void* args) {
|
||||
createStrComponents(pwrSwitcher);
|
||||
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
|
||||
|
||||
#if OBSW_ADD_PL_PCDU == 1
|
||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
|
||||
#endif
|
||||
createPayloadComponents(gpioComIF, *pwrSwitcher);
|
||||
|
||||
#if OBSW_ADD_CCSDS_IP_CORES == 1
|
||||
|
@ -81,7 +81,9 @@ void ObjectFactory::produce(void* args) {
|
||||
createTmpComponents(tmpDevsToAdd);
|
||||
#endif
|
||||
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
|
||||
#if OBSW_ADD_PL_PCDU == 1
|
||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
|
||||
#endif
|
||||
#if OBSW_ADD_SYRLINKS == 1
|
||||
createSyrlinksComponents(pwrSwitcher);
|
||||
#endif /* OBSW_ADD_SYRLINKS == 1 */
|
||||
|
@ -902,8 +902,6 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
|
||||
gpioComIF, SdCardManager::instance(), stackHandler, false);
|
||||
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
|
||||
// plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||
// static_cast<void>(plPcduHandler);
|
||||
#if OBSW_TEST_PL_PCDU == 1
|
||||
plPcduHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
@ -248,9 +248,11 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
|
||||
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
auto* plPcduDummy =
|
||||
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
if (cfg.addPlPcduDummy) {
|
||||
auto* plPcduDummy =
|
||||
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
|
||||
}
|
||||
if (cfg.addPlocDummies) {
|
||||
auto* plocMpsocDummy =
|
||||
new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
|
||||
|
@ -30,6 +30,7 @@ struct DummyCfg {
|
||||
bool addStrDummy = true;
|
||||
bool addTmpDummies = true;
|
||||
bool addRadSensorDummy = true;
|
||||
bool addPlPcduDummy = false;
|
||||
Tmp1075Cfg tmp1075Cfg;
|
||||
bool addCamSwitcherDummy = false;
|
||||
bool addScexDummy = false;
|
||||
|
@ -255,6 +255,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/payload/scexHelpers.h
|
||||
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;No description;mission/payload/scexHelpers.h
|
||||
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;No description;mission/payload/scexHelpers.h
|
||||
13803;0x35eb;FS_UNUSABLE;LOW;No description;mission/payload/scexHelpers.h
|
||||
13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13902;0x364e;GET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
|
|
@ -255,6 +255,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13800;0x35e8;MISSING_PACKET;LOW;No description;mission/payload/scexHelpers.h
|
||||
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;No description;mission/payload/scexHelpers.h
|
||||
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;No description;mission/payload/scexHelpers.h
|
||||
13803;0x35eb;FS_UNUSABLE;LOW;No description;mission/payload/scexHelpers.h
|
||||
13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13902;0x364e;GET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
|
||||
|
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @brief Auto-generated event translation file. Contains 302 translations.
|
||||
* @details
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
|
||||
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
|
||||
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
|
||||
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
|
||||
const char *FS_UNUSABLE_STRING = "FS_UNUSABLE";
|
||||
const char *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
|
||||
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
|
||||
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
|
||||
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
|
||||
return EXPERIMENT_TIMEDOUT_STRING;
|
||||
case (13802):
|
||||
return MULTI_PACKET_COMMAND_DONE_STRING;
|
||||
case (13803):
|
||||
return FS_UNUSABLE_STRING;
|
||||
case (13901):
|
||||
return SET_CONFIGFILEVALUE_FAILED_STRING;
|
||||
case (13902):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 301 translations.
|
||||
* @brief Auto-generated event translation file. Contains 302 translations.
|
||||
* @details
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
|
||||
const char *MISSING_PACKET_STRING = "MISSING_PACKET";
|
||||
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
|
||||
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE";
|
||||
const char *FS_UNUSABLE_STRING = "FS_UNUSABLE";
|
||||
const char *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
|
||||
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
|
||||
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
|
||||
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
|
||||
return EXPERIMENT_TIMEDOUT_STRING;
|
||||
case (13802):
|
||||
return MULTI_PACKET_COMMAND_DONE_STRING;
|
||||
case (13803):
|
||||
return FS_UNUSABLE_STRING;
|
||||
case (13901):
|
||||
return SET_CONFIGFILEVALUE_FAILED_STRING;
|
||||
case (13902):
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 175 translations.
|
||||
* Generated on: 2023-07-26 12:51:20
|
||||
* Generated on: 2023-08-02 09:40:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -273,6 +273,8 @@ void AcsController::performDetumble() {
|
||||
|
||||
sensorProcessing.process(now, &sensorValues, &mgmDataProcessed, &susDataProcessed,
|
||||
&gyrDataProcessed, &gpsDataProcessed, &acsParameters);
|
||||
fusedRotationEstimation.estimateFusedRotationRateSafe(&susDataProcessed, &mgmDataProcessed,
|
||||
&gyrDataProcessed, &fusedRotRateData);
|
||||
ReturnValue_t result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed,
|
||||
&susDataProcessed, &mekfData, &acsParameters);
|
||||
if (result != MultiplicativeKalmanFilter::MEKF_RUNNING &&
|
||||
@ -321,18 +323,18 @@ void AcsController::performDetumble() {
|
||||
if (acsParameters.safeModeControllerParameters.useMekf) {
|
||||
if (mekfData.satRotRateMekf.isValid() and
|
||||
VectorOperations<double>::norm(mekfData.satRotRateMekf.value, 3) <
|
||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
||||
acsParameters.detumbleParameter.omegaDetumbleEnd) {
|
||||
detumbleCounter++;
|
||||
}
|
||||
} else if (acsParameters.safeModeControllerParameters.useGyr) {
|
||||
if (gyrDataProcessed.gyrVecTot.isValid() and
|
||||
VectorOperations<double>::norm(gyrDataProcessed.gyrVecTot.value, 3) <
|
||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
||||
acsParameters.detumbleParameter.omegaDetumbleEnd) {
|
||||
detumbleCounter++;
|
||||
}
|
||||
} else if (fusedRotRateData.rotRateTotal.isValid() and
|
||||
VectorOperations<double>::norm(fusedRotRateData.rotRateTotal.value, 3) <
|
||||
acsParameters.detumbleParameter.omegaDetumbleStart) {
|
||||
acsParameters.detumbleParameter.omegaDetumbleEnd) {
|
||||
detumbleCounter++;
|
||||
} else if (detumbleCounter > 0) {
|
||||
detumbleCounter -= 1;
|
||||
@ -345,7 +347,7 @@ void AcsController::performDetumble() {
|
||||
startTransition(mode, acs::SafeSubmode::DEFAULT);
|
||||
}
|
||||
|
||||
disableCtrlValData();
|
||||
updateCtrlValData(safeCtrlStrat);
|
||||
updateActuatorCmdData(cmdDipoleMtqs);
|
||||
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
|
||||
acsParameters.magnetorquerParameter.torqueDuration);
|
||||
@ -616,6 +618,23 @@ void AcsController::updateActuatorCmdData(const double *rwTargetTorque,
|
||||
}
|
||||
}
|
||||
|
||||
void AcsController::updateCtrlValData(uint8_t safeModeStrat) {
|
||||
PoolReadGuard pg(&ctrlValData);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
std::memcpy(ctrlValData.tgtQuat.value, ZERO_VEC4, 4 * sizeof(double));
|
||||
ctrlValData.tgtQuat.setValid(false);
|
||||
std::memcpy(ctrlValData.errQuat.value, ZERO_VEC4, 4 * sizeof(double));
|
||||
ctrlValData.errQuat.setValid(false);
|
||||
ctrlValData.errAng.value = 0;
|
||||
ctrlValData.errAng.setValid(false);
|
||||
std::memcpy(ctrlValData.tgtRotRate.value, ZERO_VEC3, 3 * sizeof(double));
|
||||
ctrlValData.tgtRotRate.setValid(false);
|
||||
ctrlValData.safeStrat.value = safeModeStrat;
|
||||
ctrlValData.safeStrat.setValid(true);
|
||||
ctrlValData.setValidity(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
void AcsController::updateCtrlValData(double errAng, uint8_t safeModeStrat) {
|
||||
PoolReadGuard pg(&ctrlValData);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
@ -646,17 +665,6 @@ void AcsController::updateCtrlValData(const double *tgtQuat, const double *errQu
|
||||
}
|
||||
}
|
||||
|
||||
void AcsController::disableCtrlValData() {
|
||||
PoolReadGuard pg(&ctrlValData);
|
||||
if (pg.getReadResult() == returnvalue::OK) {
|
||||
std::memcpy(ctrlValData.tgtQuat.value, ZERO_VEC4, 4 * sizeof(double));
|
||||
std::memcpy(ctrlValData.errQuat.value, ZERO_VEC4, 4 * sizeof(double));
|
||||
ctrlValData.errAng.value = 0;
|
||||
std::memcpy(ctrlValData.tgtRotRate.value, ZERO_VEC3, 3 * sizeof(double));
|
||||
ctrlValData.setValidity(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
// MGM Raw
|
||||
|
@ -117,10 +117,10 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
|
||||
void updateActuatorCmdData(const int16_t* mtqTargetDipole);
|
||||
void updateActuatorCmdData(const double* rwTargetTorque, const int32_t* rwTargetSpeed,
|
||||
const int16_t* mtqTargetDipole);
|
||||
void updateCtrlValData(uint8_t safeModeStrat);
|
||||
void updateCtrlValData(double errAng, uint8_t safeModeStrat);
|
||||
void updateCtrlValData(const double* tgtQuat, const double* errQuat, double errAng,
|
||||
const double* tgtRotRate);
|
||||
void disableCtrlValData();
|
||||
|
||||
/* ACS Sensor Values */
|
||||
ACS::SensorValues sensorValues;
|
||||
|
@ -26,6 +26,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
case 0x1:
|
||||
parameterWrapper->set(onBoardParams.mekfViolationTimer);
|
||||
break;
|
||||
case 0x2:
|
||||
parameterWrapper->set(onBoardParams.fusedRateSafeDuringEclipse);
|
||||
break;
|
||||
default:
|
||||
return INVALID_IDENTIFIER_ID;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ class AcsParameters : public HasParametersIF {
|
||||
struct OnBoardParams {
|
||||
double sampleTime = 0.4; // [s]
|
||||
uint16_t mekfViolationTimer = 750;
|
||||
uint8_t fusedRateSafeDuringEclipse = true;
|
||||
} onBoardParams;
|
||||
|
||||
struct InertiaEIVE {
|
||||
|
@ -18,10 +18,18 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
|
||||
std::memcpy(fusedRotRateData->rotRateTotal.value, ZERO_VEC, 3 * sizeof(double));
|
||||
fusedRotRateData->setValidity(false, true);
|
||||
}
|
||||
// store for calculation of angular acceleration
|
||||
if (gyrDataProcessed->gyrVecTot.isValid()) {
|
||||
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (not susDataProcessed->susVecTot.isValid()) {
|
||||
estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData);
|
||||
// store for calculation of angular acceleration
|
||||
if (gyrDataProcessed->gyrVecTot.isValid()) {
|
||||
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -42,6 +50,10 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
|
||||
fusedRotRateParallel, 3);
|
||||
} else {
|
||||
estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData);
|
||||
// store for calculation of angular acceleration
|
||||
if (gyrDataProcessed->gyrVecTot.isValid()) {
|
||||
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -58,11 +70,6 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
|
||||
double fusedRotRateTotal[3] = {0, 0, 0};
|
||||
VectorOperations<double>::add(fusedRotRateParallel, fusedRotRateOrthogonal, fusedRotRateTotal);
|
||||
|
||||
// store for calculation of angular acceleration
|
||||
if (gyrDataProcessed->gyrVecTot.isValid()) {
|
||||
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard pg(fusedRotRateData);
|
||||
std::memcpy(fusedRotRateData->rotRateOrthogonal.value, fusedRotRateOrthogonal,
|
||||
@ -71,11 +78,17 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
|
||||
std::memcpy(fusedRotRateData->rotRateTotal.value, fusedRotRateTotal, 3 * sizeof(double));
|
||||
fusedRotRateData->setValidity(true, true);
|
||||
}
|
||||
|
||||
// store for calculation of angular acceleration
|
||||
if (gyrDataProcessed->gyrVecTot.isValid()) {
|
||||
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
void FusedRotationEstimation::estimateFusedRotationRateEclipse(
|
||||
acsctrl::GyrDataProcessed *gyrDataProcessed, acsctrl::FusedRotRateData *fusedRotRateData) {
|
||||
if (not gyrDataProcessed->gyrVecTot.isValid() or
|
||||
if (not acsParameters->onBoardParams.fusedRateSafeDuringEclipse or
|
||||
not gyrDataProcessed->gyrVecTot.isValid() or
|
||||
VectorOperations<double>::norm(fusedRotRateData->rotRateTotal.value, 3) == 0) {
|
||||
{
|
||||
PoolReadGuard pg(fusedRotRateData);
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <mission/payload/PayloadPcduHandler.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "fsfw/thermal/tcsDefinitions.h"
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include <fsfw_hal/linux/UnixFileGuard.h>
|
||||
@ -64,6 +66,16 @@ void PayloadPcduHandler::doShutDown() {
|
||||
return;
|
||||
}
|
||||
state = States::PL_PCDU_OFF;
|
||||
quickTransitionAlreadyCalled = false;
|
||||
{
|
||||
PoolReadGuard pg(&adcSet);
|
||||
adcSet.setReportingEnabled(false);
|
||||
adcSet.tempC = thermal::INVALID_TEMPERATURE;
|
||||
|
||||
std::memset(adcSet.channels.value, 0, sizeof(adcSet.channels.value));
|
||||
std::memset(adcSet.processed.value, 0, sizeof(adcSet.processed.value));
|
||||
adcSet.setValidity(false, true);
|
||||
}
|
||||
// No need to set mode _MODE_POWER_DOWN, power switching was already handled
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
@ -73,14 +85,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
stateMachineToNormal(modeFrom, subModeFrom);
|
||||
return;
|
||||
} else if (getMode() == _MODE_TO_ON and modeFrom == MODE_NORMAL) {
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
pullAllGpiosLow(200);
|
||||
state = States::STACK_5V_CORRECT;
|
||||
}
|
||||
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
||||
@ -89,6 +94,11 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
using namespace plpcdu;
|
||||
bool doFinish = true;
|
||||
if (toNormalOneShot) {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
adcSet.setReportingEnabled(true);
|
||||
toNormalOneShot = false;
|
||||
}
|
||||
if (((getSubmode() >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) {
|
||||
if (state == States::PL_PCDU_OFF) {
|
||||
sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state PL_PCDU_OFF"
|
||||
@ -114,23 +124,23 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
|
||||
state = States::ON_TRANS_ADC_CLOSE_ZERO;
|
||||
adcCountdown.setTimeout(50);
|
||||
adcCountdown.resetTimer();
|
||||
adcState = AdcStates::BOOT_DELAY;
|
||||
adcState = AdcState::BOOT_DELAY;
|
||||
doFinish = false;
|
||||
// If the values are not close to zero, we should not allow transition
|
||||
monMode = MonitoringMode::CLOSE_TO_ZERO;
|
||||
}
|
||||
}
|
||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||
if (adcState == AdcStates::BOOT_DELAY) {
|
||||
if (adcState == AdcState::BOOT_DELAY) {
|
||||
doFinish = false;
|
||||
if (adcCountdown.hasTimedOut()) {
|
||||
adcState = AdcStates::SEND_SETUP;
|
||||
adcState = AdcState::SEND_SETUP;
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
}
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
if (adcState == AdcState::SEND_SETUP) {
|
||||
if (adcCmdExecuted) {
|
||||
adcState = AdcStates::NORMAL;
|
||||
adcState = AdcState::NORMAL;
|
||||
doFinish = true;
|
||||
adcCountdown.setTimeout(100);
|
||||
adcCountdown.resetTimer();
|
||||
@ -167,6 +177,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
|
||||
switchHandler(MPA_ON, gpioIds::PLPCDU_ENB_MPA, "MPA");
|
||||
switchHandler(HPA_ON, gpioIds::PLPCDU_ENB_HPA, "HPA");
|
||||
if (doFinish) {
|
||||
toNormalOneShot = true;
|
||||
setMode(MODE_NORMAL);
|
||||
}
|
||||
return returnvalue::OK;
|
||||
@ -174,11 +185,11 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
switch (adcState) {
|
||||
case (AdcStates::SEND_SETUP): {
|
||||
case (AdcState::SEND_SETUP): {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
case (AdcStates::NORMAL): {
|
||||
case (AdcState::NORMAL): {
|
||||
*id = plpcdu::READ_WITH_TEMP_EXT;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
@ -190,7 +201,7 @@ ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
if (adcState == AdcState::SEND_SETUP) {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
@ -211,9 +222,9 @@ void PayloadPcduHandler::updateSwitchGpio(gpioId_t id, gpio::Levels level) {
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(plpcdu::READ_CMD, 2, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP_EXT, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_CMD, 2);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP_EXT, 1);
|
||||
insertInCommandAndReplyMap(plpcdu::SETUP_CMD, 1);
|
||||
}
|
||||
|
||||
@ -277,27 +288,31 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
break;
|
||||
}
|
||||
case (READ_CMD): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
return pg.getReadResult();
|
||||
{
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
case (READ_WITH_TEMP_EXT): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
return pg.getReadResult();
|
||||
{
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
uint8_t tempStartIdx = ADC_REPLY_SIZE + TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
uint8_t tempStartIdx = ADC_REPLY_SIZE + TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]);
|
||||
checkAdcValues();
|
||||
adcSet.setValidity(true, true);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
@ -367,16 +382,9 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
||||
|
||||
void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir) {
|
||||
States currentState = state;
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
pullAllGpiosLow(200);
|
||||
state = States::STACK_5V_SWITCHING;
|
||||
adcState = AdcStates::OFF;
|
||||
adcState = AdcState::OFF;
|
||||
if (startTransitionToOff) {
|
||||
startTransition(MODE_OFF, 0);
|
||||
}
|
||||
@ -405,10 +413,13 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
adcSet.processed[U_DRO_DIV_6] = static_cast<float>(adcSet.channels[11]) * SCALE_VOLTAGE;
|
||||
float lowerBound = 0.0;
|
||||
float upperBound = 0.0;
|
||||
bool adcTransition = false;
|
||||
adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy();
|
||||
// Now check against voltage and current limits, depending on state
|
||||
if (state >= States::ON_TRANS_DRO and not adcTransition) {
|
||||
bool adcTransition = adcState == AdcState::NORMAL and adcCountdown.isBusy();
|
||||
if (NO_ADC_CHECKS or adcTransition) {
|
||||
return;
|
||||
}
|
||||
// Now check against voltage and current limits.
|
||||
uint8_t submode = getSubmode();
|
||||
if (((submode >> NormalSubmodeBits::DRO_ON) & 0b1) == 0b1) {
|
||||
if (ssrToDroInjectionRequested) {
|
||||
handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS);
|
||||
ssrToDroInjectionRequested = false;
|
||||
@ -435,8 +446,7 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_X8 and not adcTransition) {
|
||||
if (((submode >> NormalSubmodeBits::X8_ON) & 0b1) == 0b1) {
|
||||
if (droToX8InjectionRequested) {
|
||||
handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS);
|
||||
droToX8InjectionRequested = false;
|
||||
@ -453,8 +463,7 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_TX and not adcTransition) {
|
||||
if (((submode >> NormalSubmodeBits::TX_ON) & 0b1) == 0b1) {
|
||||
if (txToMpaInjectionRequested) {
|
||||
handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS);
|
||||
txToMpaInjectionRequested = false;
|
||||
@ -471,8 +480,7 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_MPA and not adcTransition) {
|
||||
if (((submode >> NormalSubmodeBits::MPA_ON) & 0b1) == 0b1) {
|
||||
if (mpaToHpaInjectionRequested) {
|
||||
handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS);
|
||||
mpaToHpaInjectionRequested = false;
|
||||
@ -489,8 +497,7 @@ void PayloadPcduHandler::checkAdcValues() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy();
|
||||
if (state >= States::ON_TRANS_HPA and not adcTransition) {
|
||||
if (((submode >> NormalSubmodeBits::HPA_ON) & 0b1) == 0b1) {
|
||||
if (allOnInjectRequested) {
|
||||
handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS);
|
||||
allOnInjectRequested = false;
|
||||
@ -677,6 +684,18 @@ void PayloadPcduHandler::handleFailureInjection(std::string output, Event event)
|
||||
droToX8InjectionRequested = false;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::pullAllGpiosLow(uint32_t delayBeforeSwitchingOffDro) {
|
||||
sif::info << "Pulling all PL PCDU GPIOs to low" << std::endl;
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_MPA);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_TX);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_X8);
|
||||
TaskFactory::delayTask(delayBeforeSwitchingOffDro);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_DRO);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT0);
|
||||
gpioIF->pullLow(gpioIds::PLPCDU_ENB_VBAT1);
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key,
|
||||
ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues) {
|
||||
@ -692,6 +711,8 @@ ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key,
|
||||
return params.writeJsonFile();
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* PayloadPcduHandler::getDataSetHandle(sid_t sid) { return &adcSet; }
|
||||
|
||||
#ifdef XIPHOS_Q7S
|
||||
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen,
|
||||
|
@ -76,6 +76,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
#endif
|
||||
|
||||
private:
|
||||
static constexpr bool NO_ADC_CHECKS = false;
|
||||
|
||||
enum class States : uint8_t {
|
||||
PL_PCDU_OFF,
|
||||
STACK_5V_SWITCHING,
|
||||
@ -84,20 +86,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
// Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
|
||||
// the ADC
|
||||
ON_TRANS_SSR,
|
||||
ON_TRANS_ADC_CLOSE_ZERO,
|
||||
// Enable Dielectric Resonant Oscillator and start monitoring voltages as
|
||||
// soon as DRO voltage reaches 6V
|
||||
ON_TRANS_DRO,
|
||||
// Switch on X8 compoennt and monitor voltages for 5 seconds
|
||||
ON_TRANS_X8,
|
||||
// Switch on TX component and monitor voltages for 5 seconds
|
||||
ON_TRANS_TX,
|
||||
// Switch on MPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_MPA,
|
||||
// Switch on HPA component and monitor voltages for 5 seconds
|
||||
ON_TRANS_HPA,
|
||||
// All components of the experiment are on
|
||||
PL_PCDU_ON,
|
||||
ON_TRANS_ADC_CLOSE_ZERO
|
||||
} state = States::PL_PCDU_OFF;
|
||||
|
||||
duallane::Submodes pwrSubmode = duallane::Submodes::A_SIDE;
|
||||
@ -106,7 +95,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
|
||||
enum class MonitoringMode { NONE, CLOSE_TO_ZERO, NEGATIVE } monMode = MonitoringMode::NONE;
|
||||
|
||||
enum class AdcStates { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcStates::OFF;
|
||||
enum class AdcState { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcState::OFF;
|
||||
|
||||
bool goToNormalMode = false;
|
||||
plpcdu::PlPcduAdcSet adcSet;
|
||||
@ -128,6 +117,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
bool mpaToHpaInjectionRequested = false;
|
||||
bool allOnInjectRequested = false;
|
||||
bool clearSetOnOffFlag = true;
|
||||
bool toNormalOneShot = true;
|
||||
|
||||
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
||||
uint8_t tempReadDivisor = 1;
|
||||
@ -168,6 +158,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
|
||||
void handleExtConvRead(const uint8_t* bufStart);
|
||||
void handlePrintout();
|
||||
void pullAllGpiosLow(uint32_t delayBeforeSwitchingOffDro);
|
||||
void checkAdcValues();
|
||||
void handleOutOfBoundsPrintout();
|
||||
void checkJsonFileInit();
|
||||
@ -178,6 +169,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
ReturnValue_t serializeFloat(uint32_t& param, float val);
|
||||
ReturnValue_t handleDoubleParamUpdate(std::string key, ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues);
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
};
|
||||
|
||||
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
||||
|
@ -19,11 +19,16 @@ using namespace returnvalue;
|
||||
|
||||
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
|
||||
SdCardMountedIF& sdcMan)
|
||||
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {}
|
||||
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {
|
||||
fsUnusableEventCd.timeOut();
|
||||
}
|
||||
|
||||
ScexDeviceHandler::~ScexDeviceHandler() {}
|
||||
|
||||
void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); }
|
||||
void ScexDeviceHandler::doStartUp() {
|
||||
filesystemChecks();
|
||||
setMode(MODE_ON);
|
||||
}
|
||||
|
||||
void ScexDeviceHandler::doShutDown() {
|
||||
reader.reset();
|
||||
@ -47,7 +52,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
bool tempCheck = false;
|
||||
if (commandDataLen == 1) {
|
||||
if (commandDataLen >= 1) {
|
||||
tempCheck = commandData[0];
|
||||
}
|
||||
if (commandActive) {
|
||||
@ -215,8 +220,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
}
|
||||
fileNameSet = true;
|
||||
} else {
|
||||
ofstream out(fileName,
|
||||
ofstream::binary | ofstream::app); // append
|
||||
if (!sdcMan.isSdCardUsable(std::nullopt)) {
|
||||
fsUnsableEvent();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
// Append to existing file.
|
||||
ofstream out(fileName, ofstream::binary | ofstream::app);
|
||||
if (out.bad()) {
|
||||
sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName
|
||||
<< std::endl;
|
||||
@ -280,18 +289,8 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
}
|
||||
|
||||
void ScexDeviceHandler::performOperationHook() {
|
||||
auto mntPrefix = sdcMan.getCurrentMountPrefix();
|
||||
if (mntPrefix != nullptr) {
|
||||
std::filesystem::path fullFilePath = mntPrefix;
|
||||
std::error_code e;
|
||||
fullFilePath /= "scex";
|
||||
bool fileExists = std::filesystem::exists(fullFilePath, e);
|
||||
if (not fileExists) {
|
||||
bool created = std::filesystem::create_directory(fullFilePath, e);
|
||||
if (not created) {
|
||||
sif::error << "Could not create SCEX directory: " << e << std::endl;
|
||||
}
|
||||
}
|
||||
if (getMode() != MODE_OFF) {
|
||||
filesystemChecks();
|
||||
}
|
||||
uint32_t remainingMillis = finishCountdown.getRemainingMillis();
|
||||
if (commandActive and finishCountdown.hasTimedOut()) {
|
||||
@ -319,6 +318,33 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
|
||||
return OK;
|
||||
}
|
||||
|
||||
void ScexDeviceHandler::filesystemChecks() {
|
||||
auto mntPrefix = sdcMan.getCurrentMountPrefix();
|
||||
if (mntPrefix == nullptr or !sdcMan.isSdCardUsable(std::nullopt)) {
|
||||
sif::warning << "SCEX: Filesystem currently unavailable" << std::endl;
|
||||
fsUnsableEvent();
|
||||
} else {
|
||||
std::filesystem::path fullFilePath = mntPrefix;
|
||||
std::error_code e;
|
||||
fullFilePath /= "scex";
|
||||
bool fileExists = std::filesystem::exists(fullFilePath, e);
|
||||
if (not fileExists) {
|
||||
bool created = std::filesystem::create_directory(fullFilePath, e);
|
||||
if (not created) {
|
||||
sif::error << "Could not create SCEX directory: " << e << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScexDeviceHandler::fsUnsableEvent() {
|
||||
if (fsUnusableEventCd.isBusy()) {
|
||||
return;
|
||||
}
|
||||
triggerEvent(scex::FS_UNUSABLE);
|
||||
fsUnusableEventCd.resetTimer();
|
||||
}
|
||||
|
||||
ReturnValue_t ScexDeviceHandler::generateNewScexFile(const char* cmdName) {
|
||||
char timeString[64]{};
|
||||
auto activeSd = sdcMan.getActiveSdCard();
|
||||
@ -328,7 +354,8 @@ ReturnValue_t ScexDeviceHandler::generateNewScexFile(const char* cmdName) {
|
||||
|
||||
std::ostringstream oss;
|
||||
auto prefix = sdcMan.getCurrentMountPrefix();
|
||||
if (prefix == nullptr) {
|
||||
if (prefix == nullptr or !sdcMan.isSdCardUsable(std::nullopt)) {
|
||||
fsUnsableEvent();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
timeval tv;
|
||||
|
@ -42,6 +42,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
||||
scex::Cmds currCmd = scex::Cmds::PING;
|
||||
SdCardMountedIF &sdcMan;
|
||||
Countdown finishCountdown = Countdown(LONG_CD);
|
||||
Countdown fsUnusableEventCd = Countdown(10000);
|
||||
|
||||
// DeviceHandlerBase private function implementation
|
||||
void doStartUp() override;
|
||||
@ -49,12 +50,15 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
||||
ScexHelper helper;
|
||||
ScexUartReader &reader;
|
||||
|
||||
void fsUnsableEvent();
|
||||
|
||||
void performOperationHook() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
void filesystemChecks();
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
|
||||
size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||
|
@ -20,6 +20,7 @@ static constexpr Event EXPERIMENT_TIMEDOUT = event::makeEvent(SUBSYSTEM_ID, 1, s
|
||||
//! FRAM, One Cell or All cells command finished. P1: Command ID
|
||||
static constexpr Event MULTI_PACKET_COMMAND_DONE =
|
||||
event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
|
||||
static constexpr Event FS_UNUSABLE = event::makeEvent(SUBSYSTEM_ID, 3, severity::LOW);
|
||||
|
||||
enum Cmds : DeviceCommandId_t {
|
||||
PING = 0b00111,
|
||||
|
@ -195,10 +195,21 @@ void EiveSystem::i2cRecoveryLogic() {
|
||||
// Try recovery.
|
||||
executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0);
|
||||
} else {
|
||||
if (waitingForI2cReboot) {
|
||||
return;
|
||||
}
|
||||
triggerEvent(core::I2C_REBOOT);
|
||||
// Some delay to ensure that the event is stored in the persistent TM store as well.
|
||||
TaskFactory::delayTask(500);
|
||||
// We already tried an I2C recovery but the bus is still broken.
|
||||
// Send full reboot request to core controller.
|
||||
sendFullRebootCommand();
|
||||
// Send reboot request to core controller.
|
||||
result = sendSelfRebootCommand();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "Sending a reboot command has failed" << std::endl;
|
||||
// If the previous operation failed, it should be re-attempted the next task cycle.
|
||||
return;
|
||||
}
|
||||
waitingForI2cReboot = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -285,25 +296,38 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() {
|
||||
}
|
||||
|
||||
void EiveSystem::pdecRecoveryLogic() {
|
||||
if (ptmeResetWasAttempted and ptmeResetWasAttemptedCd.hasTimedOut()) {
|
||||
ptmeResetWasAttempted = false;
|
||||
if (pdecResetWasAttempted and pdecResetWasAttemptedCd.hasTimedOut()) {
|
||||
pdecResetWasAttempted = false;
|
||||
}
|
||||
if (frameDirtyCheckCd.hasTimedOut()) {
|
||||
if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) {
|
||||
// If a PTME reset was already attempted and there is still an issue receiving TC frames,
|
||||
// reboot the system.
|
||||
if (ptmeResetWasAttempted) {
|
||||
if (pdecResetWasAttempted) {
|
||||
if (waitingForPdecReboot) {
|
||||
return;
|
||||
}
|
||||
triggerEvent(core::PDEC_REBOOT);
|
||||
// Some delay to ensure that the event is stored in the persistent TM store as well.
|
||||
TaskFactory::delayTask(500);
|
||||
// Send reboot command.
|
||||
sendFullRebootCommand();
|
||||
ReturnValue_t result = sendSelfRebootCommand();
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "Sending a reboot command has failed" << std::endl;
|
||||
// If the previous operation failed, it should be re-attempted the next task cycle.
|
||||
pdecResetWasAttemptedCd.resetTimer();
|
||||
return;
|
||||
}
|
||||
waitingForPdecReboot = true;
|
||||
return;
|
||||
} else {
|
||||
// Try one full PDEC reset.
|
||||
CommandMessage msg;
|
||||
store_address_t dummy{};
|
||||
ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy);
|
||||
commandQueue->sendMessage(pdecHandlerQueueId, &msg);
|
||||
ptmeResetWasAttemptedCd.resetTimer();
|
||||
ptmeResetWasAttempted = true;
|
||||
pdecResetWasAttemptedCd.resetTimer();
|
||||
pdecResetWasAttempted = true;
|
||||
}
|
||||
}
|
||||
frameDirtyErrorCounter = 0;
|
||||
@ -329,3 +353,17 @@ ReturnValue_t EiveSystem::handleCommandMessage(CommandMessage* message) {
|
||||
}
|
||||
return Subsystem::handleCommandMessage(message);
|
||||
}
|
||||
|
||||
ReturnValue_t EiveSystem::sendSelfRebootCommand() {
|
||||
CommandMessage msg;
|
||||
uint8_t data[1];
|
||||
// This option is used to target the same image.
|
||||
data[0] = true;
|
||||
store_address_t storeId;
|
||||
ReturnValue_t result = IPCStore->addData(&storeId, data, sizeof(data));
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
ActionMessage::setCommand(&msg, core::XSC_REBOOT_OBC, storeId);
|
||||
return commandQueue->sendMessage(coreCtrlQueueId, &msg);
|
||||
}
|
||||
|
@ -39,8 +39,10 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
||||
Countdown frameDirtyCheckCd = Countdown(10000);
|
||||
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that
|
||||
// only a full reboot will fix the issue.
|
||||
Countdown ptmeResetWasAttemptedCd = Countdown(120000);
|
||||
bool ptmeResetWasAttempted = false;
|
||||
Countdown pdecResetWasAttemptedCd = Countdown(120000);
|
||||
bool pdecResetWasAttempted = false;
|
||||
bool waitingForI2cReboot = false;
|
||||
bool waitingForPdecReboot = false;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
PowerSwitchIF* powerSwitcher = nullptr;
|
||||
@ -63,6 +65,7 @@ class EiveSystem : public Subsystem, public HasActionsIF {
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
|
||||
ReturnValue_t sendFullRebootCommand();
|
||||
ReturnValue_t sendSelfRebootCommand();
|
||||
|
||||
void pdecRecoveryLogic();
|
||||
|
||||
|
2
tmtc
2
tmtc
Submodule tmtc updated: cbcc06ede7...4b054b7628
Reference in New Issue
Block a user