Compare commits

..

55 Commits

Author SHA1 Message Date
b2d9582a46 Merge pull request 'prep v6.3.0' (#769) from prep_v6.3.0 into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #769
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-08-03 13:17:53 +02:00
155bf9eed0 prep v6.3.0
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-main Build queued...
2023-08-03 13:15:57 +02:00
15618a4c18 Merge pull request 'Fix Calculation of Fused Rotation Rate during Eclipse' (#768) from fused-rot-rate-fix into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #768
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
2023-08-03 13:11:04 +02:00
d07568bbe1 Merge branch 'main' into fused-rot-rate-fix
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build queued...
2023-08-03 13:10:15 +02:00
1267097368 Merge pull request 'PL PCDU tweaks' (#766) from pl-pcdu-tweaks into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #766
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-08-03 13:07:10 +02:00
e746c151d3 tweaks
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build started...
2023-08-03 13:03:10 +02:00
5958560d00 cleanup
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 11:34:29 +02:00
e258193713 changelog 2023-08-03 11:32:16 +02:00
8f0b0f47c9 not sure if we need it here but doesnot matter 2023-08-03 11:32:08 +02:00
97f40232d7 changelog typo
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 10:16:51 +02:00
7c3329abb2 this is more correct
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 10:16:11 +02:00
acc50ca7aa fused rotation rate calculation during eclipse can be disabled
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 10:09:43 +02:00
6f8ad08e9b changelog
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 10:06:10 +02:00
1f02c0ef57 set set to 0 for OFF cmd
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 10:05:10 +02:00
093f7f3a31 re-introduce proper bounds checking
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 09:59:08 +02:00
a0e4f0a438 Merge branch 'main' into pl-pcdu-tweaks
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-03 09:23:54 +02:00
81311770e8 this might be the fix
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 16:26:57 +02:00
2132f6bb1f Merge pull request 'SCEX filesystem usage fixes' (#765) from scex-fs-usage-improvements into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #765
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-08-02 15:31:48 +02:00
d2c0c1709e that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 15:29:13 +02:00
b23ae2e152 logiically it works..
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 14:17:32 +02:00
eae63a8dc9 add PL PCDU for EM
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 14:08:10 +02:00
a88725070b more robust code
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2023-08-02 13:40:37 +02:00
39c299e55d Merge remote-tracking branch 'origin/main' into scex-fs-usage-improvements
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 13:13:55 +02:00
0bbcfb34e8 tweaks for pin handling
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2023-08-02 11:14:35 +02:00
7f3c71f4dc Merge pull request 'Bugfixes for Detumble Mode' (#764) from acs-detumble-bugfixes into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #764
Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
2023-08-02 10:43:59 +02:00
03e0cb4ca4 Merge branch 'main' into acs-detumble-bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 10:28:58 +02:00
5f82b05d3e how many changelog commits will it be
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 10:27:14 +02:00
004c60030b changelog
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 10:24:24 +02:00
c08024bd0b changelog
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 10:23:02 +02:00
6bdafe62ad thank god we never needed this before 2023-08-02 10:22:15 +02:00
7fe676fed9 add event function CALL
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 09:44:22 +02:00
2fda3e127e changelog
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 09:42:24 +02:00
beb79d2fb4 that should do the job
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 09:41:54 +02:00
f0bbc1d090 added filesystem down event
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 09:39:42 +02:00
c120ce8617 remove newline 2023-08-02 09:29:55 +02:00
58c19e90eb changelog fix 2023-08-02 09:29:28 +02:00
833166cc78 Merge remote-tracking branch 'origin/main' into scex-fs-usage-improvements 2023-08-02 09:29:04 +02:00
0ea0322e45 Merge pull request 'EIVE system changes for reboot handling' (#763) from pdec-reboot-target-self-image into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #763
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-08-02 09:27:26 +02:00
949ac8942d small corrections
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build queued...
2023-08-02 09:25:01 +02:00
6d18e21edf removed stray return
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build queued...
2023-08-02 09:23:00 +02:00
d9a010f6bd changelog
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
2023-08-02 09:21:53 +02:00
971fd5b4a3 improve SCEX FS usage code 2023-08-02 09:20:36 +02:00
4b4dd35b55 this is the cleanest solution
Some checks are pending
EIVE/eive-obsw/pipeline/pr-main Build started...
2023-08-02 09:19:43 +02:00
988da377b1 pause the tasks waiting for a reboot
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-02 09:00:45 +02:00
77ffc62236 changelog
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-01 16:41:37 +02:00
bea918e861 added fused rotation calculation to detumble and write detumble strat to dataset
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-01 16:37:42 +02:00
8105e5f689 more robust code
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-01 09:36:08 +02:00
b27694321f update changelog
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-08-01 09:29:34 +02:00
a884176773 improvements for reboot FDIR
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
2023-08-01 09:26:06 +02:00
1f61f7d2e8 Merge pull request 'Small SCEX fix' (#761) from small-scex-fix into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #761
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
2023-08-01 09:08:25 +02:00
85dc977796 changelog
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-07-27 10:12:06 +02:00
5615f51ae7 Merge remote-tracking branch 'origin/main' into small-scex-fix
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
2023-07-27 10:11:12 +02:00
9219d2bc8c small fix 2023-07-27 10:10:54 +02:00
85a12f071f Merge pull request 'CHANGELOG: HK generation is countdown based' (#760) from fsfw-changelog into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #760
2023-07-26 15:00:58 +02:00
1ae2f692ba HK generation is countdown based
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-main This commit looks good
2023-07-26 14:32:13 +02:00
28 changed files with 304 additions and 138 deletions

View File

@ -16,6 +16,38 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [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 # [v6.2.0] 2023-07-26
- `eive-tmtc`: v5.3.1 - `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. 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 - 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. 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 ## Added

View File

@ -10,7 +10,7 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
set(OBSW_VERSION_MAJOR 6) set(OBSW_VERSION_MAJOR 6)
set(OBSW_VERSION_MINOR 2) set(OBSW_VERSION_MINOR 3)
set(OBSW_VERSION_REVISION 0) set(OBSW_VERSION_REVISION 0)
# set(CMAKE_VERBOSE TRUE) # set(CMAKE_VERBOSE TRUE)
@ -144,7 +144,7 @@ set(OBSW_ADD_RAD_SENSORS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Rad Sensor module") CACHE STRING "Add Rad Sensor module")
set(OBSW_ADD_PL_PCDU set(OBSW_ADD_PL_PCDU
${INIT_VAL} 1
CACHE STRING "Add Payload PCDU modukle") CACHE STRING "Add Payload PCDU modukle")
set(OBSW_ADD_SYRLINKS set(OBSW_ADD_SYRLINKS
1 1

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 301 translations. * @brief Auto-generated event translation file. Contains 302 translations.
* @details * @details
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; 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 *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED"; const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED"; const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
return EXPERIMENT_TIMEDOUT_STRING; return EXPERIMENT_TIMEDOUT_STRING;
case (13802): case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING; return MULTI_PACKET_COMMAND_DONE_STRING;
case (13803):
return FS_UNUSABLE_STRING;
case (13901): case (13901):
return SET_CONFIGFILEVALUE_FAILED_STRING; return SET_CONFIGFILEVALUE_FAILED_STRING;
case (13902): case (13902):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 171 translations. * Contains 171 translations.
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -94,6 +94,9 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
dummyCfg.addAcsBoardDummies = false; dummyCfg.addAcsBoardDummies = false;
#endif #endif
#if OBSW_ADD_PL_PCDU == 0
dummyCfg.addPlPcduDummy = true;
#endif
PowerSwitchIF* pwrSwitcher = nullptr; PowerSwitchIF* pwrSwitcher = nullptr;
#if OBSW_ADD_GOMSPACE_PCDU == 0 #if OBSW_ADD_GOMSPACE_PCDU == 0
@ -107,6 +110,8 @@ void ObjectFactory::produce(void* args) {
new CoreController(objects::CORE_CONTROLLER, enableHkSets); new CoreController(objects::CORE_CONTROLLER, enableHkSets);
auto* stackHandler = new Stack5VHandler(*pwrSwitcher);
// Initialize chip select to avoid SPI bus issues. // Initialize chip select to avoid SPI bus issues.
createRadSensorChipSelect(gpioComIF); createRadSensorChipSelect(gpioComIF);
@ -146,6 +151,9 @@ void ObjectFactory::produce(void* args) {
createStrComponents(pwrSwitcher); createStrComponents(pwrSwitcher);
#endif /* OBSW_ADD_STAR_TRACKER == 1 */ #endif /* OBSW_ADD_STAR_TRACKER == 1 */
#if OBSW_ADD_PL_PCDU == 1
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
#endif
createPayloadComponents(gpioComIF, *pwrSwitcher); createPayloadComponents(gpioComIF, *pwrSwitcher);
#if OBSW_ADD_CCSDS_IP_CORES == 1 #if OBSW_ADD_CCSDS_IP_CORES == 1

View File

@ -81,7 +81,9 @@ void ObjectFactory::produce(void* args) {
createTmpComponents(tmpDevsToAdd); createTmpComponents(tmpDevsToAdd);
#endif #endif
createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF); createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
#if OBSW_ADD_PL_PCDU == 1
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher, *stackHandler);
#endif
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher); createSyrlinksComponents(pwrSwitcher);
#endif /* OBSW_ADD_SYRLINKS == 1 */ #endif /* OBSW_ADD_SYRLINKS == 1 */

View File

@ -902,8 +902,6 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie, new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_MAIN_COM_IF, spiCookie,
gpioComIF, SdCardManager::instance(), stackHandler, false); gpioComIF, SdCardManager::instance(), stackHandler, false);
spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler); spiCookie->setCallbackMode(PayloadPcduHandler::extConvAsTwoCallback, plPcduHandler);
// plPcduHandler->enablePeriodicPrintout(true, 5);
// static_cast<void>(plPcduHandler);
#if OBSW_TEST_PL_PCDU == 1 #if OBSW_TEST_PL_PCDU == 1
plPcduHandler->setStartUpImmediately(); plPcduHandler->setStartUpImmediately();
#endif #endif

View File

@ -248,9 +248,11 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy); auto* scexDummy = new ScexDummy(objects::SCEX, objects::DUMMY_COM_IF, comCookieDummy);
scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM); scexDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
} }
if (cfg.addPlPcduDummy) {
auto* plPcduDummy = auto* plPcduDummy =
new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);
plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM); plPcduDummy->connectModeTreeParent(satsystem::payload::SUBSYSTEM);
}
if (cfg.addPlocDummies) { if (cfg.addPlocDummies) {
auto* plocMpsocDummy = auto* plocMpsocDummy =
new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PlocMpsocDummy(objects::PLOC_MPSOC_HANDLER, objects::DUMMY_COM_IF, comCookieDummy);

View File

@ -30,6 +30,7 @@ struct DummyCfg {
bool addStrDummy = true; bool addStrDummy = true;
bool addTmpDummies = true; bool addTmpDummies = true;
bool addRadSensorDummy = true; bool addRadSensorDummy = true;
bool addPlPcduDummy = false;
Tmp1075Cfg tmp1075Cfg; Tmp1075Cfg tmp1075Cfg;
bool addCamSwitcherDummy = false; bool addCamSwitcherDummy = false;
bool addScexDummy = false; bool addScexDummy = false;

View File

@ -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 13800;0x35e8;MISSING_PACKET;LOW;No description;mission/payload/scexHelpers.h
13801;0x35e9;EXPERIMENT_TIMEDOUT;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 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 13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
13902;0x364e;GET_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 13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
255 13800 0x35e8 MISSING_PACKET LOW No description mission/payload/scexHelpers.h
256 13801 0x35e9 EXPERIMENT_TIMEDOUT LOW No description mission/payload/scexHelpers.h
257 13802 0x35ea MULTI_PACKET_COMMAND_DONE INFO No description mission/payload/scexHelpers.h
258 13803 0x35eb FS_UNUSABLE LOW No description mission/payload/scexHelpers.h
259 13901 0x364d SET_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h
260 13902 0x364e GET_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h
261 13903 0x364f INSERT_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h

View File

@ -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 13800;0x35e8;MISSING_PACKET;LOW;No description;mission/payload/scexHelpers.h
13801;0x35e9;EXPERIMENT_TIMEDOUT;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 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 13901;0x364d;SET_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h
13902;0x364e;GET_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 13903;0x364f;INSERT_CONFIGFILEVALUE_FAILED;MEDIUM;No description;mission/utility/GlobalConfigHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
255 13800 0x35e8 MISSING_PACKET LOW No description mission/payload/scexHelpers.h
256 13801 0x35e9 EXPERIMENT_TIMEDOUT LOW No description mission/payload/scexHelpers.h
257 13802 0x35ea MULTI_PACKET_COMMAND_DONE INFO No description mission/payload/scexHelpers.h
258 13803 0x35eb FS_UNUSABLE LOW No description mission/payload/scexHelpers.h
259 13901 0x364d SET_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h
260 13902 0x364e GET_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h
261 13903 0x364f INSERT_CONFIGFILEVALUE_FAILED MEDIUM No description mission/utility/GlobalConfigHandler.h

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 301 translations. * @brief Auto-generated event translation file. Contains 302 translations.
* @details * @details
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; 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 *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED"; const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED"; const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
return EXPERIMENT_TIMEDOUT_STRING; return EXPERIMENT_TIMEDOUT_STRING;
case (13802): case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING; return MULTI_PACKET_COMMAND_DONE_STRING;
case (13803):
return FS_UNUSABLE_STRING;
case (13901): case (13901):
return SET_CONFIGFILEVALUE_FAILED_STRING; return SET_CONFIGFILEVALUE_FAILED_STRING;
case (13902): case (13902):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 175 translations. * Contains 175 translations.
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -1,7 +1,7 @@
/** /**
* @brief Auto-generated event translation file. Contains 301 translations. * @brief Auto-generated event translation file. Contains 302 translations.
* @details * @details
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateEvents.h" #include "translateEvents.h"
@ -261,6 +261,7 @@ const char *TX_OFF_STRING = "TX_OFF";
const char *MISSING_PACKET_STRING = "MISSING_PACKET"; const char *MISSING_PACKET_STRING = "MISSING_PACKET";
const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT"; const char *EXPERIMENT_TIMEDOUT_STRING = "EXPERIMENT_TIMEDOUT";
const char *MULTI_PACKET_COMMAND_DONE_STRING = "MULTI_PACKET_COMMAND_DONE"; 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 *SET_CONFIGFILEVALUE_FAILED_STRING = "SET_CONFIGFILEVALUE_FAILED";
const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED"; const char *GET_CONFIGFILEVALUE_FAILED_STRING = "GET_CONFIGFILEVALUE_FAILED";
const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED"; const char *INSERT_CONFIGFILEVALUE_FAILED_STRING = "INSERT_CONFIGFILEVALUE_FAILED";
@ -821,6 +822,8 @@ const char *translateEvents(Event event) {
return EXPERIMENT_TIMEDOUT_STRING; return EXPERIMENT_TIMEDOUT_STRING;
case (13802): case (13802):
return MULTI_PACKET_COMMAND_DONE_STRING; return MULTI_PACKET_COMMAND_DONE_STRING;
case (13803):
return FS_UNUSABLE_STRING;
case (13901): case (13901):
return SET_CONFIGFILEVALUE_FAILED_STRING; return SET_CONFIGFILEVALUE_FAILED_STRING;
case (13902): case (13902):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 175 translations. * Contains 175 translations.
* Generated on: 2023-07-26 12:51:20 * Generated on: 2023-08-02 09:40:31
*/ */
#include "translateObjects.h" #include "translateObjects.h"

View File

@ -273,6 +273,8 @@ void AcsController::performDetumble() {
sensorProcessing.process(now, &sensorValues, &mgmDataProcessed, &susDataProcessed, sensorProcessing.process(now, &sensorValues, &mgmDataProcessed, &susDataProcessed,
&gyrDataProcessed, &gpsDataProcessed, &acsParameters); &gyrDataProcessed, &gpsDataProcessed, &acsParameters);
fusedRotationEstimation.estimateFusedRotationRateSafe(&susDataProcessed, &mgmDataProcessed,
&gyrDataProcessed, &fusedRotRateData);
ReturnValue_t result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed, ReturnValue_t result = navigation.useMekf(&sensorValues, &gyrDataProcessed, &mgmDataProcessed,
&susDataProcessed, &mekfData, &acsParameters); &susDataProcessed, &mekfData, &acsParameters);
if (result != MultiplicativeKalmanFilter::MEKF_RUNNING && if (result != MultiplicativeKalmanFilter::MEKF_RUNNING &&
@ -321,18 +323,18 @@ void AcsController::performDetumble() {
if (acsParameters.safeModeControllerParameters.useMekf) { if (acsParameters.safeModeControllerParameters.useMekf) {
if (mekfData.satRotRateMekf.isValid() and if (mekfData.satRotRateMekf.isValid() and
VectorOperations<double>::norm(mekfData.satRotRateMekf.value, 3) < VectorOperations<double>::norm(mekfData.satRotRateMekf.value, 3) <
acsParameters.detumbleParameter.omegaDetumbleStart) { acsParameters.detumbleParameter.omegaDetumbleEnd) {
detumbleCounter++; detumbleCounter++;
} }
} else if (acsParameters.safeModeControllerParameters.useGyr) { } else if (acsParameters.safeModeControllerParameters.useGyr) {
if (gyrDataProcessed.gyrVecTot.isValid() and if (gyrDataProcessed.gyrVecTot.isValid() and
VectorOperations<double>::norm(gyrDataProcessed.gyrVecTot.value, 3) < VectorOperations<double>::norm(gyrDataProcessed.gyrVecTot.value, 3) <
acsParameters.detumbleParameter.omegaDetumbleStart) { acsParameters.detumbleParameter.omegaDetumbleEnd) {
detumbleCounter++; detumbleCounter++;
} }
} else if (fusedRotRateData.rotRateTotal.isValid() and } else if (fusedRotRateData.rotRateTotal.isValid() and
VectorOperations<double>::norm(fusedRotRateData.rotRateTotal.value, 3) < VectorOperations<double>::norm(fusedRotRateData.rotRateTotal.value, 3) <
acsParameters.detumbleParameter.omegaDetumbleStart) { acsParameters.detumbleParameter.omegaDetumbleEnd) {
detumbleCounter++; detumbleCounter++;
} else if (detumbleCounter > 0) { } else if (detumbleCounter > 0) {
detumbleCounter -= 1; detumbleCounter -= 1;
@ -345,7 +347,7 @@ void AcsController::performDetumble() {
startTransition(mode, acs::SafeSubmode::DEFAULT); startTransition(mode, acs::SafeSubmode::DEFAULT);
} }
disableCtrlValData(); updateCtrlValData(safeCtrlStrat);
updateActuatorCmdData(cmdDipoleMtqs); updateActuatorCmdData(cmdDipoleMtqs);
commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2], commandActuators(cmdDipoleMtqs[0], cmdDipoleMtqs[1], cmdDipoleMtqs[2],
acsParameters.magnetorquerParameter.torqueDuration); 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) { void AcsController::updateCtrlValData(double errAng, uint8_t safeModeStrat) {
PoolReadGuard pg(&ctrlValData); PoolReadGuard pg(&ctrlValData);
if (pg.getReadResult() == returnvalue::OK) { 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, ReturnValue_t AcsController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) { LocalDataPoolManager &poolManager) {
// MGM Raw // MGM Raw

View File

@ -117,10 +117,10 @@ class AcsController : public ExtendedControllerBase, public ReceivesParameterMes
void updateActuatorCmdData(const int16_t* mtqTargetDipole); void updateActuatorCmdData(const int16_t* mtqTargetDipole);
void updateActuatorCmdData(const double* rwTargetTorque, const int32_t* rwTargetSpeed, void updateActuatorCmdData(const double* rwTargetTorque, const int32_t* rwTargetSpeed,
const int16_t* mtqTargetDipole); const int16_t* mtqTargetDipole);
void updateCtrlValData(uint8_t safeModeStrat);
void updateCtrlValData(double errAng, uint8_t safeModeStrat); void updateCtrlValData(double errAng, uint8_t safeModeStrat);
void updateCtrlValData(const double* tgtQuat, const double* errQuat, double errAng, void updateCtrlValData(const double* tgtQuat, const double* errQuat, double errAng,
const double* tgtRotRate); const double* tgtRotRate);
void disableCtrlValData();
/* ACS Sensor Values */ /* ACS Sensor Values */
ACS::SensorValues sensorValues; ACS::SensorValues sensorValues;

View File

@ -26,6 +26,9 @@ ReturnValue_t AcsParameters::getParameter(uint8_t domainId, uint8_t parameterId,
case 0x1: case 0x1:
parameterWrapper->set(onBoardParams.mekfViolationTimer); parameterWrapper->set(onBoardParams.mekfViolationTimer);
break; break;
case 0x2:
parameterWrapper->set(onBoardParams.fusedRateSafeDuringEclipse);
break;
default: default:
return INVALID_IDENTIFIER_ID; return INVALID_IDENTIFIER_ID;
} }

View File

@ -19,6 +19,7 @@ class AcsParameters : public HasParametersIF {
struct OnBoardParams { struct OnBoardParams {
double sampleTime = 0.4; // [s] double sampleTime = 0.4; // [s]
uint16_t mekfViolationTimer = 750; uint16_t mekfViolationTimer = 750;
uint8_t fusedRateSafeDuringEclipse = true;
} onBoardParams; } onBoardParams;
struct InertiaEIVE { struct InertiaEIVE {

View File

@ -18,10 +18,18 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
std::memcpy(fusedRotRateData->rotRateTotal.value, ZERO_VEC, 3 * sizeof(double)); std::memcpy(fusedRotRateData->rotRateTotal.value, ZERO_VEC, 3 * sizeof(double));
fusedRotRateData->setValidity(false, true); fusedRotRateData->setValidity(false, true);
} }
// store for calculation of angular acceleration
if (gyrDataProcessed->gyrVecTot.isValid()) {
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
}
return; return;
} }
if (not susDataProcessed->susVecTot.isValid()) { if (not susDataProcessed->susVecTot.isValid()) {
estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData); estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData);
// store for calculation of angular acceleration
if (gyrDataProcessed->gyrVecTot.isValid()) {
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
}
return; return;
} }
@ -42,6 +50,10 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
fusedRotRateParallel, 3); fusedRotRateParallel, 3);
} else { } else {
estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData); estimateFusedRotationRateEclipse(gyrDataProcessed, fusedRotRateData);
// store for calculation of angular acceleration
if (gyrDataProcessed->gyrVecTot.isValid()) {
std::memcpy(rotRateOldB, gyrDataProcessed->gyrVecTot.value, 3 * sizeof(double));
}
return; return;
} }
@ -58,11 +70,6 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
double fusedRotRateTotal[3] = {0, 0, 0}; double fusedRotRateTotal[3] = {0, 0, 0};
VectorOperations<double>::add(fusedRotRateParallel, fusedRotRateOrthogonal, fusedRotRateTotal); 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); PoolReadGuard pg(fusedRotRateData);
std::memcpy(fusedRotRateData->rotRateOrthogonal.value, fusedRotRateOrthogonal, std::memcpy(fusedRotRateData->rotRateOrthogonal.value, fusedRotRateOrthogonal,
@ -71,11 +78,17 @@ void FusedRotationEstimation::estimateFusedRotationRateSafe(
std::memcpy(fusedRotRateData->rotRateTotal.value, fusedRotRateTotal, 3 * sizeof(double)); std::memcpy(fusedRotRateData->rotRateTotal.value, fusedRotRateTotal, 3 * sizeof(double));
fusedRotRateData->setValidity(true, true); 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( void FusedRotationEstimation::estimateFusedRotationRateEclipse(
acsctrl::GyrDataProcessed *gyrDataProcessed, acsctrl::FusedRotRateData *fusedRotRateData) { 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) { VectorOperations<double>::norm(fusedRotRateData->rotRateTotal.value, 3) == 0) {
{ {
PoolReadGuard pg(fusedRotRateData); PoolReadGuard pg(fusedRotRateData);

View File

@ -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 <mission/payload/PayloadPcduHandler.h>
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "fsfw/thermal/tcsDefinitions.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
#include <fsfw_hal/linux/UnixFileGuard.h> #include <fsfw_hal/linux/UnixFileGuard.h>
@ -64,6 +66,16 @@ void PayloadPcduHandler::doShutDown() {
return; return;
} }
state = States::PL_PCDU_OFF; 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 // No need to set mode _MODE_POWER_DOWN, power switching was already handled
setMode(MODE_OFF); setMode(MODE_OFF);
} }
@ -73,14 +85,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
stateMachineToNormal(modeFrom, subModeFrom); stateMachineToNormal(modeFrom, subModeFrom);
return; return;
} else if (getMode() == _MODE_TO_ON and modeFrom == MODE_NORMAL) { } else if (getMode() == _MODE_TO_ON and modeFrom == MODE_NORMAL) {
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA); pullAllGpiosLow(200);
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);
state = States::STACK_5V_CORRECT; state = States::STACK_5V_CORRECT;
} }
DeviceHandlerBase::doTransition(modeFrom, subModeFrom); 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) { ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_t subModeFrom) {
using namespace plpcdu; using namespace plpcdu;
bool doFinish = true; bool doFinish = true;
if (toNormalOneShot) {
PoolReadGuard pg(&adcSet);
adcSet.setReportingEnabled(true);
toNormalOneShot = false;
}
if (((getSubmode() >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) { if (((getSubmode() >> SOLID_STATE_RELAYS_ADC_ON) & 0b1) == 1) {
if (state == States::PL_PCDU_OFF) { if (state == States::PL_PCDU_OFF) {
sif::error << "PayloadPcduHandler::stateMachineToNormal: Unexpected state 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; state = States::ON_TRANS_ADC_CLOSE_ZERO;
adcCountdown.setTimeout(50); adcCountdown.setTimeout(50);
adcCountdown.resetTimer(); adcCountdown.resetTimer();
adcState = AdcStates::BOOT_DELAY; adcState = AdcState::BOOT_DELAY;
doFinish = false; doFinish = false;
// If the values are not close to zero, we should not allow transition // If the values are not close to zero, we should not allow transition
monMode = MonitoringMode::CLOSE_TO_ZERO; monMode = MonitoringMode::CLOSE_TO_ZERO;
} }
} }
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) { if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (adcState == AdcStates::BOOT_DELAY) { if (adcState == AdcState::BOOT_DELAY) {
doFinish = false; doFinish = false;
if (adcCountdown.hasTimedOut()) { if (adcCountdown.hasTimedOut()) {
adcState = AdcStates::SEND_SETUP; adcState = AdcState::SEND_SETUP;
adcCmdExecuted = false; adcCmdExecuted = false;
} }
} }
if (adcState == AdcStates::SEND_SETUP) { if (adcState == AdcState::SEND_SETUP) {
if (adcCmdExecuted) { if (adcCmdExecuted) {
adcState = AdcStates::NORMAL; adcState = AdcState::NORMAL;
doFinish = true; doFinish = true;
adcCountdown.setTimeout(100); adcCountdown.setTimeout(100);
adcCountdown.resetTimer(); adcCountdown.resetTimer();
@ -167,6 +177,7 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
switchHandler(MPA_ON, gpioIds::PLPCDU_ENB_MPA, "MPA"); switchHandler(MPA_ON, gpioIds::PLPCDU_ENB_MPA, "MPA");
switchHandler(HPA_ON, gpioIds::PLPCDU_ENB_HPA, "HPA"); switchHandler(HPA_ON, gpioIds::PLPCDU_ENB_HPA, "HPA");
if (doFinish) { if (doFinish) {
toNormalOneShot = true;
setMode(MODE_NORMAL); setMode(MODE_NORMAL);
} }
return returnvalue::OK; return returnvalue::OK;
@ -174,11 +185,11 @@ ReturnValue_t PayloadPcduHandler::stateMachineToNormal(Mode_t modeFrom, Submode_
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
switch (adcState) { switch (adcState) {
case (AdcStates::SEND_SETUP): { case (AdcState::SEND_SETUP): {
*id = plpcdu::SETUP_CMD; *id = plpcdu::SETUP_CMD;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
case (AdcStates::NORMAL): { case (AdcState::NORMAL): {
*id = plpcdu::READ_WITH_TEMP_EXT; *id = plpcdu::READ_WITH_TEMP_EXT;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
@ -190,7 +201,7 @@ ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
} }
ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
if (adcState == AdcStates::SEND_SETUP) { if (adcState == AdcState::SEND_SETUP) {
*id = plpcdu::SETUP_CMD; *id = plpcdu::SETUP_CMD;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
@ -211,9 +222,9 @@ void PayloadPcduHandler::updateSwitchGpio(gpioId_t id, gpio::Levels level) {
} }
void PayloadPcduHandler::fillCommandAndReplyMap() { void PayloadPcduHandler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(plpcdu::READ_CMD, 2, &adcSet); insertInCommandAndReplyMap(plpcdu::READ_CMD, 2);
insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1, &adcSet); insertInCommandAndReplyMap(plpcdu::READ_TEMP_EXT, 1);
insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP_EXT, 1, &adcSet); insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP_EXT, 1);
insertInCommandAndReplyMap(plpcdu::SETUP_CMD, 1); insertInCommandAndReplyMap(plpcdu::SETUP_CMD, 1);
} }
@ -277,6 +288,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
break; break;
} }
case (READ_CMD): { case (READ_CMD): {
{
PoolReadGuard pg(&adcSet); PoolReadGuard pg(&adcSet);
if (pg.getReadResult() != returnvalue::OK) { if (pg.getReadResult() != returnvalue::OK) {
return pg.getReadResult(); return pg.getReadResult();
@ -284,10 +296,12 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
handleExtConvRead(packet); handleExtConvRead(packet);
checkAdcValues(); checkAdcValues();
adcSet.setValidity(true, true); adcSet.setValidity(true, true);
}
handlePrintout(); handlePrintout();
break; break;
} }
case (READ_WITH_TEMP_EXT): { case (READ_WITH_TEMP_EXT): {
{
PoolReadGuard pg(&adcSet); PoolReadGuard pg(&adcSet);
if (pg.getReadResult() != returnvalue::OK) { if (pg.getReadResult() != returnvalue::OK) {
return pg.getReadResult(); return pg.getReadResult();
@ -298,6 +312,7 @@ ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]); max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 1]);
checkAdcValues(); checkAdcValues();
adcSet.setValidity(true, true); adcSet.setValidity(true, true);
}
handlePrintout(); handlePrintout();
break; break;
} }
@ -367,16 +382,9 @@ void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir) { void PayloadPcduHandler::quickTransitionBackToOff(bool startTransitionToOff, bool notifyFdir) {
States currentState = state; States currentState = state;
gpioIF->pullLow(gpioIds::PLPCDU_ENB_HPA); pullAllGpiosLow(200);
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);
state = States::STACK_5V_SWITCHING; state = States::STACK_5V_SWITCHING;
adcState = AdcStates::OFF; adcState = AdcState::OFF;
if (startTransitionToOff) { if (startTransitionToOff) {
startTransition(MODE_OFF, 0); 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; adcSet.processed[U_DRO_DIV_6] = static_cast<float>(adcSet.channels[11]) * SCALE_VOLTAGE;
float lowerBound = 0.0; float lowerBound = 0.0;
float upperBound = 0.0; float upperBound = 0.0;
bool adcTransition = false; bool adcTransition = adcState == AdcState::NORMAL and adcCountdown.isBusy();
adcTransition = state == States::ON_TRANS_DRO and adcCountdown.isBusy(); if (NO_ADC_CHECKS or adcTransition) {
// Now check against voltage and current limits, depending on state return;
if (state >= States::ON_TRANS_DRO and not adcTransition) { }
// Now check against voltage and current limits.
uint8_t submode = getSubmode();
if (((submode >> NormalSubmodeBits::DRO_ON) & 0b1) == 0b1) {
if (ssrToDroInjectionRequested) { if (ssrToDroInjectionRequested) {
handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS); handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS);
ssrToDroInjectionRequested = false; ssrToDroInjectionRequested = false;
@ -435,8 +446,7 @@ void PayloadPcduHandler::checkAdcValues() {
return; return;
} }
} }
adcTransition = state == States::ON_TRANS_X8 and adcCountdown.isBusy(); if (((submode >> NormalSubmodeBits::X8_ON) & 0b1) == 0b1) {
if (state >= States::ON_TRANS_X8 and not adcTransition) {
if (droToX8InjectionRequested) { if (droToX8InjectionRequested) {
handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS); handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS);
droToX8InjectionRequested = false; droToX8InjectionRequested = false;
@ -453,8 +463,7 @@ void PayloadPcduHandler::checkAdcValues() {
return; return;
} }
} }
adcTransition = state == States::ON_TRANS_TX and adcCountdown.isBusy(); if (((submode >> NormalSubmodeBits::TX_ON) & 0b1) == 0b1) {
if (state >= States::ON_TRANS_TX and not adcTransition) {
if (txToMpaInjectionRequested) { if (txToMpaInjectionRequested) {
handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS); handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS);
txToMpaInjectionRequested = false; txToMpaInjectionRequested = false;
@ -471,8 +480,7 @@ void PayloadPcduHandler::checkAdcValues() {
return; return;
} }
} }
adcTransition = state == States::ON_TRANS_MPA and adcCountdown.isBusy(); if (((submode >> NormalSubmodeBits::MPA_ON) & 0b1) == 0b1) {
if (state >= States::ON_TRANS_MPA and not adcTransition) {
if (mpaToHpaInjectionRequested) { if (mpaToHpaInjectionRequested) {
handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS); handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS);
mpaToHpaInjectionRequested = false; mpaToHpaInjectionRequested = false;
@ -489,8 +497,7 @@ void PayloadPcduHandler::checkAdcValues() {
return; return;
} }
} }
adcTransition = state == States::ON_TRANS_HPA and adcCountdown.isBusy(); if (((submode >> NormalSubmodeBits::HPA_ON) & 0b1) == 0b1) {
if (state >= States::ON_TRANS_HPA and not adcTransition) {
if (allOnInjectRequested) { if (allOnInjectRequested) {
handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS); handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS);
allOnInjectRequested = false; allOnInjectRequested = false;
@ -677,6 +684,18 @@ void PayloadPcduHandler::handleFailureInjection(std::string output, Event event)
droToX8InjectionRequested = false; 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, ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key,
ParameterWrapper* parameterWrapper, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues) { const ParameterWrapper* newValues) {
@ -692,6 +711,8 @@ ReturnValue_t PayloadPcduHandler::handleDoubleParamUpdate(std::string key,
return params.writeJsonFile(); return params.writeJsonFile();
} }
LocalPoolDataSetBase* PayloadPcduHandler::getDataSetHandle(sid_t sid) { return &adcSet; }
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie, ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
const uint8_t* sendData, size_t sendLen, const uint8_t* sendData, size_t sendLen,

View File

@ -76,6 +76,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
#endif #endif
private: private:
static constexpr bool NO_ADC_CHECKS = false;
enum class States : uint8_t { enum class States : uint8_t {
PL_PCDU_OFF, PL_PCDU_OFF,
STACK_5V_SWITCHING, 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 // Solid State Relay, enable battery voltages VBAT0 and VBAT1. This will also switch on
// the ADC // the ADC
ON_TRANS_SSR, ON_TRANS_SSR,
ON_TRANS_ADC_CLOSE_ZERO, 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,
} state = States::PL_PCDU_OFF; } state = States::PL_PCDU_OFF;
duallane::Submodes pwrSubmode = duallane::Submodes::A_SIDE; 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 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; bool goToNormalMode = false;
plpcdu::PlPcduAdcSet adcSet; plpcdu::PlPcduAdcSet adcSet;
@ -128,6 +117,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
bool mpaToHpaInjectionRequested = false; bool mpaToHpaInjectionRequested = false;
bool allOnInjectRequested = false; bool allOnInjectRequested = false;
bool clearSetOnOffFlag = true; bool clearSetOnOffFlag = true;
bool toNormalOneShot = true;
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5); PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t tempReadDivisor = 1; uint8_t tempReadDivisor = 1;
@ -168,6 +158,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void handleExtConvRead(const uint8_t* bufStart); void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout(); void handlePrintout();
void pullAllGpiosLow(uint32_t delayBeforeSwitchingOffDro);
void checkAdcValues(); void checkAdcValues();
void handleOutOfBoundsPrintout(); void handleOutOfBoundsPrintout();
void checkJsonFileInit(); void checkJsonFileInit();
@ -178,6 +169,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
ReturnValue_t serializeFloat(uint32_t& param, float val); ReturnValue_t serializeFloat(uint32_t& param, float val);
ReturnValue_t handleDoubleParamUpdate(std::string key, ParameterWrapper* parameterWrapper, ReturnValue_t handleDoubleParamUpdate(std::string key, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues); const ParameterWrapper* newValues);
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
}; };
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */ #endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */

View File

@ -19,11 +19,16 @@ using namespace returnvalue;
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie, ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
SdCardMountedIF& sdcMan) SdCardMountedIF& sdcMan)
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {} : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), sdcMan(sdcMan), reader(reader) {
fsUnusableEventCd.timeOut();
}
ScexDeviceHandler::~ScexDeviceHandler() {} ScexDeviceHandler::~ScexDeviceHandler() {}
void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); } void ScexDeviceHandler::doStartUp() {
filesystemChecks();
setMode(MODE_ON);
}
void ScexDeviceHandler::doShutDown() { void ScexDeviceHandler::doShutDown() {
reader.reset(); reader.reset();
@ -47,7 +52,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
} }
bool tempCheck = false; bool tempCheck = false;
if (commandDataLen == 1) { if (commandDataLen >= 1) {
tempCheck = commandData[0]; tempCheck = commandData[0];
} }
if (commandActive) { if (commandActive) {
@ -215,8 +220,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
} }
fileNameSet = true; fileNameSet = true;
} else { } else {
ofstream out(fileName, if (!sdcMan.isSdCardUsable(std::nullopt)) {
ofstream::binary | ofstream::app); // append fsUnsableEvent();
return returnvalue::FAILED;
}
// Append to existing file.
ofstream out(fileName, ofstream::binary | ofstream::app);
if (out.bad()) { if (out.bad()) {
sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName sif::error << "ScexDeviceHandler::handleValidReply: Could not open file " << fileName
<< std::endl; << std::endl;
@ -280,18 +289,8 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
} }
void ScexDeviceHandler::performOperationHook() { void ScexDeviceHandler::performOperationHook() {
auto mntPrefix = sdcMan.getCurrentMountPrefix(); if (getMode() != MODE_OFF) {
if (mntPrefix != nullptr) { filesystemChecks();
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;
}
}
} }
uint32_t remainingMillis = finishCountdown.getRemainingMillis(); uint32_t remainingMillis = finishCountdown.getRemainingMillis();
if (commandActive and finishCountdown.hasTimedOut()) { if (commandActive and finishCountdown.hasTimedOut()) {
@ -319,6 +318,33 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
return OK; 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) { ReturnValue_t ScexDeviceHandler::generateNewScexFile(const char* cmdName) {
char timeString[64]{}; char timeString[64]{};
auto activeSd = sdcMan.getActiveSdCard(); auto activeSd = sdcMan.getActiveSdCard();
@ -328,7 +354,8 @@ ReturnValue_t ScexDeviceHandler::generateNewScexFile(const char* cmdName) {
std::ostringstream oss; std::ostringstream oss;
auto prefix = sdcMan.getCurrentMountPrefix(); auto prefix = sdcMan.getCurrentMountPrefix();
if (prefix == nullptr) { if (prefix == nullptr or !sdcMan.isSdCardUsable(std::nullopt)) {
fsUnsableEvent();
return returnvalue::FAILED; return returnvalue::FAILED;
} }
timeval tv; timeval tv;

View File

@ -42,6 +42,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
scex::Cmds currCmd = scex::Cmds::PING; scex::Cmds currCmd = scex::Cmds::PING;
SdCardMountedIF &sdcMan; SdCardMountedIF &sdcMan;
Countdown finishCountdown = Countdown(LONG_CD); Countdown finishCountdown = Countdown(LONG_CD);
Countdown fsUnusableEventCd = Countdown(10000);
// DeviceHandlerBase private function implementation // DeviceHandlerBase private function implementation
void doStartUp() override; void doStartUp() override;
@ -49,12 +50,15 @@ class ScexDeviceHandler : public DeviceHandlerBase {
ScexHelper helper; ScexHelper helper;
ScexUartReader &reader; ScexUartReader &reader;
void fsUnsableEvent();
void performOperationHook() override; void performOperationHook() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override; size_t commandDataLen) override;
void fillCommandAndReplyMap() override; void fillCommandAndReplyMap() override;
void filesystemChecks();
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
size_t *foundLen) override; size_t *foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;

View File

@ -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 //! FRAM, One Cell or All cells command finished. P1: Command ID
static constexpr Event MULTI_PACKET_COMMAND_DONE = static constexpr Event MULTI_PACKET_COMMAND_DONE =
event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO); event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
static constexpr Event FS_UNUSABLE = event::makeEvent(SUBSYSTEM_ID, 3, severity::LOW);
enum Cmds : DeviceCommandId_t { enum Cmds : DeviceCommandId_t {
PING = 0b00111, PING = 0b00111,

View File

@ -195,10 +195,21 @@ void EiveSystem::i2cRecoveryLogic() {
// Try recovery. // Try recovery.
executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0); executeAction(EXECUTE_I2C_REBOOT, MessageQueueIF::NO_QUEUE, nullptr, 0);
} else { } else {
if (waitingForI2cReboot) {
return;
}
triggerEvent(core::I2C_REBOOT); 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. // We already tried an I2C recovery but the bus is still broken.
// Send full reboot request to core controller. // Send reboot request to core controller.
sendFullRebootCommand(); 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; return;
} }
} }
@ -285,25 +296,38 @@ ReturnValue_t EiveSystem::sendFullRebootCommand() {
} }
void EiveSystem::pdecRecoveryLogic() { void EiveSystem::pdecRecoveryLogic() {
if (ptmeResetWasAttempted and ptmeResetWasAttemptedCd.hasTimedOut()) { if (pdecResetWasAttempted and pdecResetWasAttemptedCd.hasTimedOut()) {
ptmeResetWasAttempted = false; pdecResetWasAttempted = false;
} }
if (frameDirtyCheckCd.hasTimedOut()) { if (frameDirtyCheckCd.hasTimedOut()) {
if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) { if (frameDirtyErrorCounter >= FRAME_DIRTY_COM_REBOOT_LIMIT) {
// If a PTME reset was already attempted and there is still an issue receiving TC frames, // If a PTME reset was already attempted and there is still an issue receiving TC frames,
// reboot the system. // reboot the system.
if (ptmeResetWasAttempted) { if (pdecResetWasAttempted) {
if (waitingForPdecReboot) {
return;
}
triggerEvent(core::PDEC_REBOOT); 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. // 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 { } else {
// Try one full PDEC reset. // Try one full PDEC reset.
CommandMessage msg; CommandMessage msg;
store_address_t dummy{}; store_address_t dummy{};
ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy); ActionMessage::setCommand(&msg, pdec::RESET_PDEC_WITH_REINIITALIZATION, dummy);
commandQueue->sendMessage(pdecHandlerQueueId, &msg); commandQueue->sendMessage(pdecHandlerQueueId, &msg);
ptmeResetWasAttemptedCd.resetTimer(); pdecResetWasAttemptedCd.resetTimer();
ptmeResetWasAttempted = true; pdecResetWasAttempted = true;
} }
} }
frameDirtyErrorCounter = 0; frameDirtyErrorCounter = 0;
@ -329,3 +353,17 @@ ReturnValue_t EiveSystem::handleCommandMessage(CommandMessage* message) {
} }
return Subsystem::handleCommandMessage(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);
}

View File

@ -39,8 +39,10 @@ class EiveSystem : public Subsystem, public HasActionsIF {
Countdown frameDirtyCheckCd = Countdown(10000); Countdown frameDirtyCheckCd = Countdown(10000);
// If the PDEC reset was already attempted in the last 2 minutes, there is a high chance that // 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. // only a full reboot will fix the issue.
Countdown ptmeResetWasAttemptedCd = Countdown(120000); Countdown pdecResetWasAttemptedCd = Countdown(120000);
bool ptmeResetWasAttempted = false; bool pdecResetWasAttempted = false;
bool waitingForI2cReboot = false;
bool waitingForPdecReboot = false;
ActionHelper actionHelper; ActionHelper actionHelper;
PowerSwitchIF* powerSwitcher = nullptr; PowerSwitchIF* powerSwitcher = nullptr;
@ -63,6 +65,7 @@ class EiveSystem : public Subsystem, public HasActionsIF {
ReturnValue_t handleCommandMessage(CommandMessage* message) override; ReturnValue_t handleCommandMessage(CommandMessage* message) override;
ReturnValue_t sendFullRebootCommand(); ReturnValue_t sendFullRebootCommand();
ReturnValue_t sendSelfRebootCommand();
void pdecRecoveryLogic(); void pdecRecoveryLogic();

2
tmtc

Submodule tmtc updated: cbcc06ede7...4b054b7628