small changes to NVM JSON api, regenerate events

This commit is contained in:
Robin Müller 2022-02-25 17:29:06 +01:00
parent 006e9e2229
commit 3f3bbfcde4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
13 changed files with 461 additions and 327 deletions

View File

@ -142,13 +142,13 @@ void Q7STestTask::testDummyParams() {
param.print();
int test = 0;
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, &test);
result = param.getValue<int>(DummyParameter::DUMMY_KEY_PARAM_1, test);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl;
}
std::string test2;
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, &test2);
result = param.getValue<std::string>(DummyParameter::DUMMY_KEY_PARAM_2, test2);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl;

View File

@ -1517,69 +1517,69 @@ ReturnValue_t StarTrackerHandler::prepareUploadCentroidCommand(const uint8_t* co
<< " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::id, &req.id);
result = j.getValue(StarTracker::UploadCentroidKeys::id, req.id);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::id << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::pixx, &req.pixx);
result = j.getValue(StarTracker::UploadCentroidKeys::pixx, req.pixx);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::pixx << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::pixy, &req.pixy);
result = j.getValue(StarTracker::UploadCentroidKeys::pixy, req.pixy);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::pixy << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::x_uncorrected, &req.x_uncorrected);
result = j.getValue(StarTracker::UploadCentroidKeys::x_uncorrected, req.x_uncorrected);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::x_uncorrected << " does not exist"
<< std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::y_uncorrected, &req.y_uncorrected);
result = j.getValue(StarTracker::UploadCentroidKeys::y_uncorrected, req.y_uncorrected);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::y_uncorrected << " does not exist"
<< std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::x_corrected, &req.x_corrected);
result = j.getValue(StarTracker::UploadCentroidKeys::x_corrected, req.x_corrected);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::x_corrected << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::y_corrected, &req.y_corrected);
result = j.getValue(StarTracker::UploadCentroidKeys::y_corrected, req.y_corrected);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::y_corrected << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::magnitude, &req.magnitude);
result = j.getValue(StarTracker::UploadCentroidKeys::magnitude, req.magnitude);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::magnitude << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::cxa, &req.cxa);
result = j.getValue(StarTracker::UploadCentroidKeys::cxa, req.cxa);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::cxa << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::cya, &req.cya);
result = j.getValue(StarTracker::UploadCentroidKeys::cya, req.cya);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::cya << " does not exist" << std::endl;
return result;
}
result = j.getValue(StarTracker::UploadCentroidKeys::quality, &req.quality);
result = j.getValue(StarTracker::UploadCentroidKeys::quality, req.quality);
if (result != RETURN_OK) {
sif::warning << "StarTrackerHandler::prepareUploadCentroidCommand: The key "
<< StarTracker::UploadCentroidKeys::quality << " does not exist" << std::endl;

View File

@ -1,3 +1,4 @@
#include <fsfw/ipc/MutexGuard.h>
#include "SdCardManager.h"
#include <unistd.h>
@ -15,7 +16,9 @@
SdCardManager* SdCardManager::factoryInstance = nullptr;
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {}
SdCardManager::SdCardManager() : SystemObject(objects::SDC_MANAGER), cmdExecutor(256) {
mutex = MutexFactory::instance()->createMutex();
}
SdCardManager::~SdCardManager() {}
@ -162,6 +165,7 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
ReturnValue_t SdCardManager::getSdCardActiveStatus(SdStatePair& active) {
using namespace std;
MutexGuard mg(mutex);
if (not filesystem::exists(SD_STATE_FILE)) {
return STATUS_FILE_NEXISTS;
}
@ -366,6 +370,7 @@ ReturnValue_t SdCardManager::updateSdCardStateFile() {
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
return CommandExecutor::COMMAND_PENDING;
}
MutexGuard mg(mutex);
// Use q7hw utility and pipe the command output into the state file
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
@ -440,6 +445,7 @@ void SdCardManager::setPrintCommandOutput(bool print) { this->printCmdOutput = p
bool SdCardManager::isSdCardMounted(sd::SdCard sdCard) {
SdCardManager::SdStatePair active;
ReturnValue_t result = this->getSdCardActiveStatus(active);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::debug << "SdCardManager::isSdCardMounted: Failed to get SD card active state";
return false;

View File

@ -28,6 +28,8 @@ class SdCardManager: public SystemObject, public SdCardMountedIF {
friend class SdCardAccess;
public:
using mountInitCb = ReturnValue_t (*) (void *args);
enum class Operations { SWITCHING_ON, SWITCHING_OFF, MOUNTING, UNMOUNTING, IDLE };
enum class OpStatus { IDLE, TIMEOUT, ONGOING, SUCCESS, FAIL };
@ -89,7 +91,7 @@ class SdCardManager: public SystemObject, public SdCardMountedIF {
* @param sdCard
* @return
*/
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const;
ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const override;
/**
* Switch on the specified SD card.
@ -184,7 +186,7 @@ class SdCardManager: public SystemObject, public SdCardMountedIF {
void setPrintCommandOutput(bool print);
/**
* @brief Checks if an SD card is mounted
* @brief Checks if an SD card is mounted.
*
* @param sdCard The SD card to check
*
@ -197,6 +199,7 @@ class SdCardManager: public SystemObject, public SdCardMountedIF {
Operations currentOp = Operations::IDLE;
bool blocking = false;
bool printCmdOutput = true;
MutexIF* mutex = nullptr;
SdCardManager();

View File

@ -82,11 +82,11 @@
10902;SWITCH_ALREADY_ON;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
10903;SWITCH_ALREADY_OFF;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
10904;MAIN_SWITCH_TIMEOUT;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;/home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;/home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
11002;DEPLOYMENT_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h
11000;MAIN_SWITCH_ON_TIMEOUT;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
11001;MAIN_SWITCH_OFF_TIMEOUT;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
11002;DEPLOYMENT_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
11003;DEPL_SA1_GPIO_SWTICH_ON_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
11004;DEPL_SA2_GPIO_SWTICH_ON_FAILED;HIGH;;/home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
11101;MEMORY_READ_RPT_CRC_FAILURE;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
11102;ACK_FAILURE;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
11103;EXE_FAILURE;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
@ -104,7 +104,9 @@
11502;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11503;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11504;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
11600;SANITIZATION_FAILED;LOW;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/memory/SdCardManager.h
11600;ALLOC_FAILURE;MEDIUM;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
11601;REBOOT_SW;MEDIUM; Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;/home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
11603;REBOOT_HW;MEDIUM;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
11700;UPDATE_FILE_NOT_EXISTS;LOW;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
11701;ACTION_COMMANDING_FAILED;LOW;Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
11702;UPDATE_AVAILABLE_FAILED;LOW;Supervisor handler replied action message indicating a command execution failure of the update available command;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
@ -138,3 +140,14 @@
12017;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
12018;STR_HELPER_SENDING_PACKET_FAILED;LOW;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
12019;STR_HELPER_REQUESTING_MSG_FAILED;LOW;;/home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
12101;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12102;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12103;I_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12104;U_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12105;I_X8_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12106;U_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12107;I_TX_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12108;U_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12109;I_MPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12110;U_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
12111;I_HPA_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;/home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h

1 2200 STORE_SEND_WRITE_FAILED LOW /home/rmueller/EIVE/eive-obsw/fsfw/src/fsfw/tmstorage/TmStoreBackendIF.h
82 10902 SWITCH_ALREADY_ON LOW /home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
83 10903 SWITCH_ALREADY_OFF LOW /home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
84 10904 MAIN_SWITCH_TIMEOUT LOW /home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h
85 11000 MAIN_SWITCH_ON_TIMEOUT LOW /home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h /home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
86 11001 MAIN_SWITCH_OFF_TIMEOUT LOW /home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h /home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
87 11002 DEPLOYMENT_FAILED HIGH /home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h /home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
88 11003 DEPL_SA1_GPIO_SWTICH_ON_FAILED HIGH /home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h /home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
89 11004 DEPL_SA2_GPIO_SWTICH_ON_FAILED HIGH /home/rmueller/EIVE/eive-obsw/linux/devices/SolarArrayDeploymentHandler.h /home/rmueller/EIVE/eive-obsw/mission/devices/SolarArrayDeploymentHandler.h
90 11101 MEMORY_READ_RPT_CRC_FAILURE LOW /home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
91 11102 ACK_FAILURE LOW /home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
92 11103 EXE_FAILURE LOW /home/rmueller/EIVE/eive-obsw/mission/devices/PlocMPSoCHandler.h
104 11502 SUPV_ACK_FAILURE LOW PLOC supervisor received acknowledgment failure report /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
105 11503 SUPV_EXE_FAILURE LOW PLOC received execution failure report /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
106 11504 SUPV_CRC_FAILURE_EVENT LOW PLOC supervisor reply has invalid crc /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocSupervisorHandler.h
107 11600 SANITIZATION_FAILED ALLOC_FAILURE LOW MEDIUM /home/rmueller/EIVE/eive-obsw/bsp_q7s/memory/SdCardManager.h /home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
108 11601 REBOOT_SW MEDIUM Software reboot occured. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy /home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
109 11603 REBOOT_HW MEDIUM /home/rmueller/EIVE/eive-obsw/bsp_q7s/core/CoreController.h
110 11700 UPDATE_FILE_NOT_EXISTS LOW /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
111 11701 ACTION_COMMANDING_FAILED LOW Failed to send command to supervisor handler P1: Return value of CommandActionHelper::commandAction P2: Action ID of command to send /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
112 11702 UPDATE_AVAILABLE_FAILED LOW Supervisor handler replied action message indicating a command execution failure of the update available command /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/PlocUpdater.h
140 12017 STR_HELPER_FILE_NOT_EXISTS LOW Specified file does not exist P1: Internal state of str helper /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
141 12018 STR_HELPER_SENDING_PACKET_FAILED LOW /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
142 12019 STR_HELPER_REQUESTING_MSG_FAILED LOW /home/rmueller/EIVE/eive-obsw/bsp_q7s/devices/startracker/StrHelper.h
143 12101 NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
144 12102 U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
145 12103 I_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
146 12104 U_X8_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
147 12105 I_X8_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
148 12106 U_TX_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
149 12107 I_TX_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
150 12108 U_MPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
151 12109 I_MPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
152 12110 U_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h
153 12111 I_HPA_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value /home/rmueller/EIVE/eive-obsw/mission/devices/PayloadPcduHandler.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 140 translations.
* @brief Auto-generated event translation file. Contains 153 translations.
* @details
* Generated on: 2022-02-03 17:30:40
* Generated on: 2022-02-25 17:28:47
*/
#include "translateEvents.h"
@ -111,7 +111,9 @@ const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_FAILED";
@ -145,6 +147,17 @@ const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
const char * translateEvents(Event event) {
switch( (event & 0xffff) ) {
@ -361,7 +374,11 @@ const char * translateEvents(Event event) {
case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING;
case(11600):
return SANITIZATION_FAILED_STRING;
return ALLOC_FAILURE_STRING;
case(11601):
return REBOOT_SW_STRING;
case(11603):
return REBOOT_HW_STRING;
case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING;
case(11701):
@ -428,6 +445,28 @@ const char * translateEvents(Event event) {
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case(12019):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
case(12101):
return NEG_V_OUT_OF_BOUNDS_STRING;
case(12102):
return U_DRO_OUT_OF_BOUNDS_STRING;
case(12103):
return I_DRO_OUT_OF_BOUNDS_STRING;
case(12104):
return U_X8_OUT_OF_BOUNDS_STRING;
case(12105):
return I_X8_OUT_OF_BOUNDS_STRING;
case(12106):
return U_TX_OUT_OF_BOUNDS_STRING;
case(12107):
return I_TX_OUT_OF_BOUNDS_STRING;
case(12108):
return U_MPA_OUT_OF_BOUNDS_STRING;
case(12109):
return I_MPA_OUT_OF_BOUNDS_STRING;
case(12110):
return U_HPA_OUT_OF_BOUNDS_STRING;
case(12111):
return I_HPA_OUT_OF_BOUNDS_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 140 translations.
* @brief Auto-generated event translation file. Contains 153 translations.
* @details
* Generated on: 2022-02-03 17:30:40
* Generated on: 2022-02-25 17:28:47
*/
#include "translateEvents.h"
@ -111,7 +111,9 @@ const char *SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING = "SUPV_MEMORY_READ_RPT_CRC_
const char *SUPV_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT";
const char *SANITIZATION_FAILED_STRING = "SANITIZATION_FAILED";
const char *ALLOC_FAILURE_STRING = "ALLOC_FAILURE";
const char *REBOOT_SW_STRING = "REBOOT_SW";
const char *REBOOT_HW_STRING = "REBOOT_HW";
const char *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_FAILED";
@ -145,289 +147,326 @@ const char *POSITION_MISMATCH_STRING = "POSITION_MISMATCH";
const char *STR_HELPER_FILE_NOT_EXISTS_STRING = "STR_HELPER_FILE_NOT_EXISTS";
const char *STR_HELPER_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_FAILED";
const char *NEG_V_OUT_OF_BOUNDS_STRING = "NEG_V_OUT_OF_BOUNDS";
const char *U_DRO_OUT_OF_BOUNDS_STRING = "U_DRO_OUT_OF_BOUNDS";
const char *I_DRO_OUT_OF_BOUNDS_STRING = "I_DRO_OUT_OF_BOUNDS";
const char *U_X8_OUT_OF_BOUNDS_STRING = "U_X8_OUT_OF_BOUNDS";
const char *I_X8_OUT_OF_BOUNDS_STRING = "I_X8_OUT_OF_BOUNDS";
const char *U_TX_OUT_OF_BOUNDS_STRING = "U_TX_OUT_OF_BOUNDS";
const char *I_TX_OUT_OF_BOUNDS_STRING = "I_TX_OUT_OF_BOUNDS";
const char *U_MPA_OUT_OF_BOUNDS_STRING = "U_MPA_OUT_OF_BOUNDS";
const char *I_MPA_OUT_OF_BOUNDS_STRING = "I_MPA_OUT_OF_BOUNDS";
const char *U_HPA_OUT_OF_BOUNDS_STRING = "U_HPA_OUT_OF_BOUNDS";
const char *I_HPA_OUT_OF_BOUNDS_STRING = "I_HPA_OUT_OF_BOUNDS";
const char *translateEvents(Event event) {
switch ((event & 0xffff)) {
case (2200):
const char * translateEvents(Event event) {
switch( (event & 0xffff) ) {
case(2200):
return STORE_SEND_WRITE_FAILED_STRING;
case (2201):
case(2201):
return STORE_WRITE_FAILED_STRING;
case (2202):
case(2202):
return STORE_SEND_READ_FAILED_STRING;
case (2203):
case(2203):
return STORE_READ_FAILED_STRING;
case (2204):
case(2204):
return UNEXPECTED_MSG_STRING;
case (2205):
case(2205):
return STORING_FAILED_STRING;
case (2206):
case(2206):
return TM_DUMP_FAILED_STRING;
case (2207):
case(2207):
return STORE_INIT_FAILED_STRING;
case (2208):
case(2208):
return STORE_INIT_EMPTY_STRING;
case (2209):
case(2209):
return STORE_CONTENT_CORRUPTED_STRING;
case (2210):
case(2210):
return STORE_INITIALIZE_STRING;
case (2211):
case(2211):
return INIT_DONE_STRING;
case (2212):
case(2212):
return DUMP_FINISHED_STRING;
case (2213):
case(2213):
return DELETION_FINISHED_STRING;
case (2214):
case(2214):
return DELETION_FAILED_STRING;
case (2215):
case(2215):
return AUTO_CATALOGS_SENDING_FAILED_STRING;
case (2600):
case(2600):
return GET_DATA_FAILED_STRING;
case (2601):
case(2601):
return STORE_DATA_FAILED_STRING;
case (2800):
case(2800):
return DEVICE_BUILDING_COMMAND_FAILED_STRING;
case (2801):
case(2801):
return DEVICE_SENDING_COMMAND_FAILED_STRING;
case (2802):
case(2802):
return DEVICE_REQUESTING_REPLY_FAILED_STRING;
case (2803):
case(2803):
return DEVICE_READING_REPLY_FAILED_STRING;
case (2804):
case(2804):
return DEVICE_INTERPRETING_REPLY_FAILED_STRING;
case (2805):
case(2805):
return DEVICE_MISSED_REPLY_STRING;
case (2806):
case(2806):
return DEVICE_UNKNOWN_REPLY_STRING;
case (2807):
case(2807):
return DEVICE_UNREQUESTED_REPLY_STRING;
case (2808):
case(2808):
return INVALID_DEVICE_COMMAND_STRING;
case (2809):
case(2809):
return MONITORING_LIMIT_EXCEEDED_STRING;
case (2810):
case(2810):
return MONITORING_AMBIGUOUS_STRING;
case (2811):
case(2811):
return DEVICE_WANTS_HARD_REBOOT_STRING;
case (4201):
case(4201):
return FUSE_CURRENT_HIGH_STRING;
case (4202):
case(4202):
return FUSE_WENT_OFF_STRING;
case (4204):
case(4204):
return POWER_ABOVE_HIGH_LIMIT_STRING;
case (4205):
case(4205):
return POWER_BELOW_LOW_LIMIT_STRING;
case (4300):
case(4300):
return SWITCH_WENT_OFF_STRING;
case (5000):
case(5000):
return HEATER_ON_STRING;
case (5001):
case(5001):
return HEATER_OFF_STRING;
case (5002):
case(5002):
return HEATER_TIMEOUT_STRING;
case (5003):
case(5003):
return HEATER_STAYED_ON_STRING;
case (5004):
case(5004):
return HEATER_STAYED_OFF_STRING;
case (5200):
case(5200):
return TEMP_SENSOR_HIGH_STRING;
case (5201):
case(5201):
return TEMP_SENSOR_LOW_STRING;
case (5202):
case(5202):
return TEMP_SENSOR_GRADIENT_STRING;
case (5901):
case(5901):
return COMPONENT_TEMP_LOW_STRING;
case (5902):
case(5902):
return COMPONENT_TEMP_HIGH_STRING;
case (5903):
case(5903):
return COMPONENT_TEMP_OOL_LOW_STRING;
case (5904):
case(5904):
return COMPONENT_TEMP_OOL_HIGH_STRING;
case (5905):
case(5905):
return TEMP_NOT_IN_OP_RANGE_STRING;
case (7101):
case(7101):
return FDIR_CHANGED_STATE_STRING;
case (7102):
case(7102):
return FDIR_STARTS_RECOVERY_STRING;
case (7103):
case(7103):
return FDIR_TURNS_OFF_DEVICE_STRING;
case (7201):
case(7201):
return MONITOR_CHANGED_STATE_STRING;
case (7202):
case(7202):
return VALUE_BELOW_LOW_LIMIT_STRING;
case (7203):
case(7203):
return VALUE_ABOVE_HIGH_LIMIT_STRING;
case (7204):
case(7204):
return VALUE_OUT_OF_RANGE_STRING;
case (7400):
case(7400):
return CHANGING_MODE_STRING;
case (7401):
case(7401):
return MODE_INFO_STRING;
case (7402):
case(7402):
return FALLBACK_FAILED_STRING;
case (7403):
case(7403):
return MODE_TRANSITION_FAILED_STRING;
case (7404):
case(7404):
return CANT_KEEP_MODE_STRING;
case (7405):
case(7405):
return OBJECT_IN_INVALID_MODE_STRING;
case (7406):
case(7406):
return FORCING_MODE_STRING;
case (7407):
case(7407):
return MODE_CMD_REJECTED_STRING;
case (7506):
case(7506):
return HEALTH_INFO_STRING;
case (7507):
case(7507):
return CHILD_CHANGED_HEALTH_STRING;
case (7508):
case(7508):
return CHILD_PROBLEMS_STRING;
case (7509):
case(7509):
return OVERWRITING_HEALTH_STRING;
case (7510):
case(7510):
return TRYING_RECOVERY_STRING;
case (7511):
case(7511):
return RECOVERY_STEP_STRING;
case (7512):
case(7512):
return RECOVERY_DONE_STRING;
case (7900):
case(7900):
return RF_AVAILABLE_STRING;
case (7901):
case(7901):
return RF_LOST_STRING;
case (7902):
case(7902):
return BIT_LOCK_STRING;
case (7903):
case(7903):
return BIT_LOCK_LOST_STRING;
case (7905):
case(7905):
return FRAME_PROCESSING_FAILED_STRING;
case (8900):
case(8900):
return CLOCK_SET_STRING;
case (8901):
case(8901):
return CLOCK_SET_FAILURE_STRING;
case (9700):
case(9700):
return TEST_STRING;
case (10600):
case(10600):
return CHANGE_OF_SETUP_PARAMETER_STRING;
case (10900):
case(10900):
return GPIO_PULL_HIGH_FAILED_STRING;
case (10901):
case(10901):
return GPIO_PULL_LOW_FAILED_STRING;
case (10902):
case(10902):
return SWITCH_ALREADY_ON_STRING;
case (10903):
case(10903):
return SWITCH_ALREADY_OFF_STRING;
case (10904):
case(10904):
return MAIN_SWITCH_TIMEOUT_STRING;
case (11000):
case(11000):
return MAIN_SWITCH_ON_TIMEOUT_STRING;
case (11001):
case(11001):
return MAIN_SWITCH_OFF_TIMEOUT_STRING;
case (11002):
case(11002):
return DEPLOYMENT_FAILED_STRING;
case (11003):
case(11003):
return DEPL_SA1_GPIO_SWTICH_ON_FAILED_STRING;
case (11004):
case(11004):
return DEPL_SA2_GPIO_SWTICH_ON_FAILED_STRING;
case (11101):
case(11101):
return MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11102):
case(11102):
return ACK_FAILURE_STRING;
case (11103):
case(11103):
return EXE_FAILURE_STRING;
case (11104):
case(11104):
return CRC_FAILURE_EVENT_STRING;
case (11201):
case(11201):
return SELF_TEST_I2C_FAILURE_STRING;
case (11202):
case(11202):
return SELF_TEST_SPI_FAILURE_STRING;
case (11203):
case(11203):
return SELF_TEST_ADC_FAILURE_STRING;
case (11204):
case(11204):
return SELF_TEST_PWM_FAILURE_STRING;
case (11205):
case(11205):
return SELF_TEST_TC_FAILURE_STRING;
case (11206):
case(11206):
return SELF_TEST_MTM_RANGE_FAILURE_STRING;
case (11207):
case(11207):
return SELF_TEST_COIL_CURRENT_FAILURE_STRING;
case (11208):
case(11208):
return INVALID_ERROR_BYTE_STRING;
case (11301):
case(11301):
return ERROR_STATE_STRING;
case (11501):
case(11501):
return SUPV_MEMORY_READ_RPT_CRC_FAILURE_STRING;
case (11502):
case(11502):
return SUPV_ACK_FAILURE_STRING;
case (11503):
case(11503):
return SUPV_EXE_FAILURE_STRING;
case (11504):
case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING;
case (11600):
return SANITIZATION_FAILED_STRING;
case (11700):
case(11600):
return ALLOC_FAILURE_STRING;
case(11601):
return REBOOT_SW_STRING;
case(11603):
return REBOOT_HW_STRING;
case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING;
case (11701):
case(11701):
return ACTION_COMMANDING_FAILED_STRING;
case (11702):
case(11702):
return UPDATE_AVAILABLE_FAILED_STRING;
case (11703):
case(11703):
return UPDATE_TRANSFER_FAILED_STRING;
case (11704):
case(11704):
return UPDATE_VERIFY_FAILED_STRING;
case (11705):
case(11705):
return UPDATE_FINISHED_STRING;
case (11800):
case(11800):
return SEND_MRAM_DUMP_FAILED_STRING;
case (11801):
case(11801):
return MRAM_DUMP_FAILED_STRING;
case (11802):
case(11802):
return MRAM_DUMP_FINISHED_STRING;
case (11901):
case(11901):
return INVALID_TC_FRAME_STRING;
case (11902):
case(11902):
return INVALID_FAR_STRING;
case (11903):
case(11903):
return CARRIER_LOCK_STRING;
case (11904):
case(11904):
return BIT_LOCK_PDEC_STRING;
case (12000):
case(12000):
return IMAGE_UPLOAD_FAILED_STRING;
case (12001):
case(12001):
return IMAGE_DOWNLOAD_FAILED_STRING;
case (12002):
case(12002):
return IMAGE_UPLOAD_SUCCESSFUL_STRING;
case (12003):
case(12003):
return IMAGE_DOWNLOAD_SUCCESSFUL_STRING;
case (12004):
case(12004):
return FLASH_WRITE_SUCCESSFUL_STRING;
case (12005):
case(12005):
return FLASH_READ_SUCCESSFUL_STRING;
case (12006):
case(12006):
return FLASH_WRITE_FAILED_STRING;
case (12007):
case(12007):
return FLASH_READ_FAILED_STRING;
case (12008):
case(12008):
return FPGA_DOWNLOAD_SUCCESSFUL_STRING;
case (12009):
case(12009):
return FPGA_DOWNLOAD_FAILED_STRING;
case (12010):
case(12010):
return FPGA_UPLOAD_SUCCESSFUL_STRING;
case (12011):
case(12011):
return FPGA_UPLOAD_FAILED_STRING;
case (12012):
case(12012):
return STR_HELPER_READING_REPLY_FAILED_STRING;
case (12013):
case(12013):
return STR_HELPER_COM_ERROR_STRING;
case (12014):
case(12014):
return STR_HELPER_NO_REPLY_STRING;
case (12015):
case(12015):
return STR_HELPER_DEC_ERROR_STRING;
case (12016):
case(12016):
return POSITION_MISMATCH_STRING;
case (12017):
case(12017):
return STR_HELPER_FILE_NOT_EXISTS_STRING;
case (12018):
case(12018):
return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case (12019):
case(12019):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING;
case(12101):
return NEG_V_OUT_OF_BOUNDS_STRING;
case(12102):
return U_DRO_OUT_OF_BOUNDS_STRING;
case(12103):
return I_DRO_OUT_OF_BOUNDS_STRING;
case(12104):
return U_X8_OUT_OF_BOUNDS_STRING;
case(12105):
return I_X8_OUT_OF_BOUNDS_STRING;
case(12106):
return U_TX_OUT_OF_BOUNDS_STRING;
case(12107):
return I_TX_OUT_OF_BOUNDS_STRING;
case(12108):
return U_MPA_OUT_OF_BOUNDS_STRING;
case(12109):
return I_MPA_OUT_OF_BOUNDS_STRING;
case(12110):
return U_HPA_OUT_OF_BOUNDS_STRING;
case(12111):
return I_HPA_OUT_OF_BOUNDS_STRING;
default:
return "UNKNOWN_EVENT";
}

View File

@ -3,6 +3,6 @@
#include "fsfw/events/Event.h"
const char* translateEvents(Event event);
const char * translateEvents(Event event);
#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */

View File

@ -241,6 +241,7 @@ void PayloadPcduHandler::transitionBackToOff() {
void PayloadPcduHandler::checkAdcValues() {
using namespace plpcdu;
checkJsonFileInit();
adcSet.processed[U_BAT_DIV_6] =
static_cast<float>(adcSet.channels[0]) * VOLTAGE_DIV / MAX122X_BIT * MAX122X_VREF;
adcSet.processed[U_NEG_V_FB] =
@ -270,7 +271,19 @@ void PayloadPcduHandler::checkAdcValues() {
}
}
void PayloadPcduHandler::checkJsonFileInit() {
if(not jsonFileInitComplete) {
sd::SdCard prefSd;
sdcMan->getPreferredSdCard(prefSd);
if(sdcMan->isSdCardMounted(prefSd)) {
params.initialize(sdcMan->getCurrentMountPrefix(prefSd));
}
jsonFileInitComplete = true;
}
}
void PayloadPcduHandler::stateMachineToNormal() {
using namespace plpcdu;
if (adcState == AdcStates::BOOT_DELAY) {
if (adcCountdown.hasTimedOut()) {
adcState = AdcStates::SEND_SETUP;
@ -280,42 +293,53 @@ void PayloadPcduHandler::stateMachineToNormal() {
if (adcState == AdcStates::SEND_SETUP) {
if (adcCmdExecuted) {
adcState = AdcStates::NORMAL;
setMode(MODE_NORMAL, plpcdu::NORMAL_ADC_ONLY);
setMode(MODE_NORMAL, NORMAL_ADC_ONLY);
adcCmdExecuted = false;
}
}
if (submode == plpcdu::NORMAL_ALL_ON) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (not commandExecuted) {
float waitTime = SSR_TO_DRO_WAIT_TIME;
params.getValue(PlPcduParameter::SSR_TO_DRO_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
commandExecuted = true;
// TODO: For now, skip ADC check
transitionOk = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_DRO;
// Now start monitoring for negative voltages instead
monMode = MonitoringMode::NEGATIVE;
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_DRO) {
if (not commandExecuted) {
// Switch on DRO and start monitoring for negative voltagea
float waitTime = DRO_TO_X8_WAIT_TIME;
params.getValue(PlPcduParameter::DRO_TO_X8_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on DRO and start monitoring for negative voltages
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
commandExecuted = true;
}
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_X8;
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_X8) {
if (not commandExecuted) {
float waitTime = X8_TO_TX_WAIT_TIME;
params.getValue(PlPcduParameter::X8_TO_TX_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on X8
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
commandExecuted = true;
@ -323,13 +347,16 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_TX;
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_TX) {
if (not commandExecuted) {
float waitTime = TX_TO_MPA_WAIT_TIME;
params.getValue(PlPcduParameter::TX_TO_MPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on TX
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
commandExecuted = true;
@ -337,13 +364,16 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_MPA;
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}
}
if (state == States::ON_TRANS_MPA) {
if (not commandExecuted) {
float waitTime = MPA_TO_HPA_WAIT_TIME;
params.getValue(PlPcduParameter::MPA_TO_HPA_WAIT_TIME_K, waitTime);
countdown.setTimeout(std::round(waitTime * 1000));
countdown.resetTimer();
// Switch on MPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
commandExecuted = true;
@ -351,7 +381,6 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_HPA;
countdown.resetTimer();
commandExecuted = false;
transitionOk = false;
}

View File

@ -109,12 +109,14 @@ class PayloadPcduHandler : public DeviceHandlerBase {
bool commandExecuted = false;
bool adcCmdExecuted = false;
bool periodicPrintout = false;
bool jsonFileInitComplete = false;
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t tempReadDivisor = 1;
Countdown countdown = Countdown(5000);
Countdown adcCountdown = Countdown(50);
GpioIF* gpioIF;
SdCardMountedIF* sdcMan;
plpcdu::PlPcduParameter params;
PoolEntry<uint16_t> channelValues = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
PoolEntry<float> processedValues =
@ -140,6 +142,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout();
void checkAdcValues();
void checkJsonFileInit();
void stateMachineToNormal();
};

View File

@ -107,6 +107,7 @@ static constexpr float HPA_U_LOWER_BOUND = 9.6;
static constexpr float HPA_U_UPPER_BOUND = 11.0;
static constexpr float HPA_I_UPPER_BOUND = 3000.0;
// Wait time in floating point seconds
static constexpr float SSR_TO_DRO_WAIT_TIME = 5.0;
static constexpr float DRO_TO_X8_WAIT_TIME = 905.0;
static constexpr float X8_TO_TX_WAIT_TIME = 5.0;
@ -128,7 +129,7 @@ class PlPcduAdcSet : public StaticLocalDataSet<DATASET_ENTRIES> {
lp_var_t<float> tempC = lp_var_t<float>(sid.objectId, TEMP, this);
};
class PlPcduParameter : public SystemObject, public NVMParameterBase {
class PlPcduParameter : public NVMParameterBase {
public:
static constexpr char SSR_TO_DRO_WAIT_TIME_K[] = "ssrToDroWait";
static constexpr char DRO_TO_X8_WAIT_TIME_K[] = "droToX8Wait";
@ -136,8 +137,8 @@ class PlPcduParameter : public SystemObject, public NVMParameterBase {
static constexpr char TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait";
static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait";
PlPcduParameter(object_id_t objectId)
: SystemObject(objectId), NVMParameterBase(""), mountPrefix("") {
PlPcduParameter()
: NVMParameterBase(""), mountPrefix("") {
// Initialize with default values
insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME);
insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_WAIT_TIME);

View File

@ -34,7 +34,7 @@ class NVMParameterBase : public HasReturnvaluesIF {
ReturnValue_t setValue(std::string key, T value);
template <typename T>
ReturnValue_t getValue(std::string key, T* value) const;
ReturnValue_t getValue(std::string key, T& value) const;
void printKeys() const;
void print() const;
@ -67,11 +67,11 @@ inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) {
}
template <typename T>
inline ReturnValue_t NVMParameterBase::getValue(std::string key, T* value) const {
inline ReturnValue_t NVMParameterBase::getValue(std::string key, T& value) const {
if (!json.contains(key)) {
return KEY_NOT_EXISTS;
}
*value = json[key];
value = json[key];
return RETURN_OK;
}

View File

@ -10,6 +10,7 @@ public:
virtual~SdCardMountedIF() {};
virtual std::string getCurrentMountPrefix(sd::SdCard prefSdCardPtr = sd::SdCard::NONE) = 0;
virtual bool isSdCardMounted(sd::SdCard sdCard) = 0;
virtual ReturnValue_t getPreferredSdCard(sd::SdCard& sdCard) const = 0;
private:
};