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(); param.print();
int test = 0; 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) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1 sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl; << " does not exist" << std::endl;
} }
std::string test2; 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) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1 sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
<< " does not exist" << std::endl; << " does not exist" << std::endl;

View File

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

View File

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

View File

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

View File

@ -82,11 +82,11 @@
10902;SWITCH_ALREADY_ON;LOW;;/home/rmueller/EIVE/eive-obsw/mission/devices/HeaterHandler.h 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 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 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 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/linux/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/linux/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/linux/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/linux/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 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 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 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 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 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 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 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 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 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 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 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 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 * @details
* Generated on: 2022-02-03 17:30:40 * Generated on: 2022-02-25 17:28:47
*/ */
#include "translateEvents.h" #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_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE"; const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT"; 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 *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED"; const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_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_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_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_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) { const char * translateEvents(Event event) {
switch( (event & 0xffff) ) { switch( (event & 0xffff) ) {
@ -361,7 +374,11 @@ const char * translateEvents(Event event) {
case(11504): case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING; return SUPV_CRC_FAILURE_EVENT_STRING;
case(11600): case(11600):
return SANITIZATION_FAILED_STRING; return ALLOC_FAILURE_STRING;
case(11601):
return REBOOT_SW_STRING;
case(11603):
return REBOOT_HW_STRING;
case(11700): case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING; return UPDATE_FILE_NOT_EXISTS_STRING;
case(11701): case(11701):
@ -428,6 +445,28 @@ const char * translateEvents(Event event) {
return STR_HELPER_SENDING_PACKET_FAILED_STRING; return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case(12019): case(12019):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING; 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: default:
return "UNKNOWN_EVENT"; 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 * @details
* Generated on: 2022-02-03 17:30:40 * Generated on: 2022-02-25 17:28:47
*/ */
#include "translateEvents.h" #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_ACK_FAILURE_STRING = "SUPV_ACK_FAILURE";
const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE"; const char *SUPV_EXE_FAILURE_STRING = "SUPV_EXE_FAILURE";
const char *SUPV_CRC_FAILURE_EVENT_STRING = "SUPV_CRC_FAILURE_EVENT"; 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 *UPDATE_FILE_NOT_EXISTS_STRING = "UPDATE_FILE_NOT_EXISTS";
const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED"; const char *ACTION_COMMANDING_FAILED_STRING = "ACTION_COMMANDING_FAILED";
const char *UPDATE_AVAILABLE_FAILED_STRING = "UPDATE_AVAILABLE_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_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_SENDING_PACKET_FAILED_STRING = "STR_HELPER_SENDING_PACKET_FAILED";
const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG_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) { const char * translateEvents(Event event) {
switch( (event & 0xffff) ) { switch( (event & 0xffff) ) {
@ -361,7 +374,11 @@ const char *translateEvents(Event event) {
case(11504): case(11504):
return SUPV_CRC_FAILURE_EVENT_STRING; return SUPV_CRC_FAILURE_EVENT_STRING;
case(11600): case(11600):
return SANITIZATION_FAILED_STRING; return ALLOC_FAILURE_STRING;
case(11601):
return REBOOT_SW_STRING;
case(11603):
return REBOOT_HW_STRING;
case(11700): case(11700):
return UPDATE_FILE_NOT_EXISTS_STRING; return UPDATE_FILE_NOT_EXISTS_STRING;
case(11701): case(11701):
@ -428,6 +445,28 @@ const char *translateEvents(Event event) {
return STR_HELPER_SENDING_PACKET_FAILED_STRING; return STR_HELPER_SENDING_PACKET_FAILED_STRING;
case(12019): case(12019):
return STR_HELPER_REQUESTING_MSG_FAILED_STRING; 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: default:
return "UNKNOWN_EVENT"; return "UNKNOWN_EVENT";
} }

View File

@ -241,6 +241,7 @@ void PayloadPcduHandler::transitionBackToOff() {
void PayloadPcduHandler::checkAdcValues() { void PayloadPcduHandler::checkAdcValues() {
using namespace plpcdu; using namespace plpcdu;
checkJsonFileInit();
adcSet.processed[U_BAT_DIV_6] = adcSet.processed[U_BAT_DIV_6] =
static_cast<float>(adcSet.channels[0]) * VOLTAGE_DIV / MAX122X_BIT * MAX122X_VREF; static_cast<float>(adcSet.channels[0]) * VOLTAGE_DIV / MAX122X_BIT * MAX122X_VREF;
adcSet.processed[U_NEG_V_FB] = 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() { void PayloadPcduHandler::stateMachineToNormal() {
using namespace plpcdu;
if (adcState == AdcStates::BOOT_DELAY) { if (adcState == AdcStates::BOOT_DELAY) {
if (adcCountdown.hasTimedOut()) { if (adcCountdown.hasTimedOut()) {
adcState = AdcStates::SEND_SETUP; adcState = AdcStates::SEND_SETUP;
@ -280,42 +293,53 @@ void PayloadPcduHandler::stateMachineToNormal() {
if (adcState == AdcStates::SEND_SETUP) { if (adcState == AdcStates::SEND_SETUP) {
if (adcCmdExecuted) { if (adcCmdExecuted) {
adcState = AdcStates::NORMAL; adcState = AdcStates::NORMAL;
setMode(MODE_NORMAL, plpcdu::NORMAL_ADC_ONLY); setMode(MODE_NORMAL, NORMAL_ADC_ONLY);
adcCmdExecuted = false; adcCmdExecuted = false;
} }
} }
if (submode == plpcdu::NORMAL_ALL_ON) { if (submode == plpcdu::NORMAL_ALL_ON) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) { if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (not commandExecuted) { 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(); countdown.resetTimer();
commandExecuted = true; commandExecuted = true;
// TODO: For now, skip ADC check
transitionOk = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_DRO; state = States::ON_TRANS_DRO;
// Now start monitoring for negative voltages instead // Now start monitoring for negative voltages instead
monMode = MonitoringMode::NEGATIVE; monMode = MonitoringMode::NEGATIVE;
countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if (state == States::ON_TRANS_DRO) { if (state == States::ON_TRANS_DRO) {
if (not commandExecuted) { 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); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_DRO);
commandExecuted = true; commandExecuted = true;
} }
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_X8; state = States::ON_TRANS_X8;
countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if (state == States::ON_TRANS_X8) { if (state == States::ON_TRANS_X8) {
if (not commandExecuted) { 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 // Switch on X8
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_X8);
commandExecuted = true; commandExecuted = true;
@ -323,13 +347,16 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_TX; state = States::ON_TRANS_TX;
countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if (state == States::ON_TRANS_TX) { if (state == States::ON_TRANS_TX) {
if (not commandExecuted) { 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 // Switch on TX
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_TX);
commandExecuted = true; commandExecuted = true;
@ -337,13 +364,16 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_MPA; state = States::ON_TRANS_MPA;
countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }
} }
if (state == States::ON_TRANS_MPA) { if (state == States::ON_TRANS_MPA) {
if (not commandExecuted) { 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 // Switch on MPA
gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA); gpioIF->pullHigh(gpioIds::PLPCDU_ENB_MPA);
commandExecuted = true; commandExecuted = true;
@ -351,7 +381,6 @@ void PayloadPcduHandler::stateMachineToNormal() {
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::ON_TRANS_HPA; state = States::ON_TRANS_HPA;
countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;
} }

View File

@ -109,12 +109,14 @@ class PayloadPcduHandler : public DeviceHandlerBase {
bool commandExecuted = false; bool commandExecuted = false;
bool adcCmdExecuted = false; bool adcCmdExecuted = false;
bool periodicPrintout = false; bool periodicPrintout = false;
bool jsonFileInitComplete = false;
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5); PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t tempReadDivisor = 1; uint8_t tempReadDivisor = 1;
Countdown countdown = Countdown(5000); Countdown countdown = Countdown(5000);
Countdown adcCountdown = Countdown(50); Countdown adcCountdown = Countdown(50);
GpioIF* gpioIF; GpioIF* gpioIF;
SdCardMountedIF* sdcMan; 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<uint16_t> channelValues = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
PoolEntry<float> processedValues = PoolEntry<float> processedValues =
@ -140,6 +142,7 @@ class PayloadPcduHandler : public DeviceHandlerBase {
void handleExtConvRead(const uint8_t* bufStart); void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout(); void handlePrintout();
void checkAdcValues(); void checkAdcValues();
void checkJsonFileInit();
void stateMachineToNormal(); 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_U_UPPER_BOUND = 11.0;
static constexpr float HPA_I_UPPER_BOUND = 3000.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 SSR_TO_DRO_WAIT_TIME = 5.0;
static constexpr float DRO_TO_X8_WAIT_TIME = 905.0; static constexpr float DRO_TO_X8_WAIT_TIME = 905.0;
static constexpr float X8_TO_TX_WAIT_TIME = 5.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); lp_var_t<float> tempC = lp_var_t<float>(sid.objectId, TEMP, this);
}; };
class PlPcduParameter : public SystemObject, public NVMParameterBase { class PlPcduParameter : public NVMParameterBase {
public: public:
static constexpr char SSR_TO_DRO_WAIT_TIME_K[] = "ssrToDroWait"; static constexpr char SSR_TO_DRO_WAIT_TIME_K[] = "ssrToDroWait";
static constexpr char DRO_TO_X8_WAIT_TIME_K[] = "droToX8Wait"; 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 TX_TO_MPA_WAIT_TIME_K[] = "txToMpaWait";
static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait"; static constexpr char MPA_TO_HPA_WAIT_TIME_K[] = "mpaToHpaWait";
PlPcduParameter(object_id_t objectId) PlPcduParameter()
: SystemObject(objectId), NVMParameterBase(""), mountPrefix("") { : NVMParameterBase(""), mountPrefix("") {
// Initialize with default values // Initialize with default values
insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME); insertValue(SSR_TO_DRO_WAIT_TIME_K, SSR_TO_DRO_WAIT_TIME);
insertValue(DRO_TO_X8_WAIT_TIME_K, DRO_TO_X8_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); ReturnValue_t setValue(std::string key, T value);
template <typename T> 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 printKeys() const;
void print() const; void print() const;
@ -67,11 +67,11 @@ inline ReturnValue_t NVMParameterBase::setValue(std::string key, T value) {
} }
template <typename T> 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)) { if (!json.contains(key)) {
return KEY_NOT_EXISTS; return KEY_NOT_EXISTS;
} }
*value = json[key]; value = json[key];
return RETURN_OK; return RETURN_OK;
} }

View File

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