From 13a6a45d3046d14cfc6b25af5408acc6873f5786 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 10:22:02 +0200 Subject: [PATCH 01/12] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 646cf1a1..8655f0c9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 646cf1a14e0fa61d5e91e26a46017be557bad642 +Subproject commit 8655f0c9e6158c460e1f8bc02e73a9310e33b18f From e781da1be4e9e22fc7b5766d162dd485261e5f99 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 11:01:33 +0200 Subject: [PATCH 02/12] simplify power set ID handling --- mission/devices/PCDUHandler.cpp | 8 +-- .../devicedefinitions/GomspaceDefinitions.h | 50 ++++++++----------- tmtc | 2 +- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 8dc78137..39a09d5a 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -52,7 +52,7 @@ ReturnValue_t PCDUHandler::initialize() { return returnvalue::FAILED; } result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - static_cast(P60System::SetIds::PDU_2_CORE), this->getObjectId(), + static_cast(P60System::SetIds::CORE), this->getObjectId(), commandQueue->getId(), true); if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " @@ -68,7 +68,7 @@ ReturnValue_t PCDUHandler::initialize() { return returnvalue::FAILED; } result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - static_cast(P60System::SetIds::PDU_1_CORE), this->getObjectId(), + static_cast(P60System::SetIds::CORE), this->getObjectId(), commandQueue->getId(), true); if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " @@ -110,11 +110,11 @@ void PCDUHandler::readCommandQueue() { MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); } void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { - if (sid == sid_t(objects::PDU2_HANDLER, static_cast(P60System::SetIds::PDU_2_CORE))) { + if (sid == sid_t(objects::PDU2_HANDLER, static_cast(P60System::SetIds::CORE))) { updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset); updatePdu2SwitchStates(); } else if (sid == - sid_t(objects::PDU1_HANDLER, static_cast(P60System::SetIds::PDU_1_CORE))) { + sid_t(objects::PDU1_HANDLER, static_cast(P60System::SetIds::CORE))) { updateHkTableDataset(storeId, &pdu1CoreHk, &timeStampPdu1HkDataset); updatePdu1SwitchStates(); } else { diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 5d435375..325a2a0c 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -103,17 +103,9 @@ namespace P60System { enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 }; enum class SetIds : uint32_t { - PDU_1_CORE = 1, - PDU_1_AUX = 2, - PDU_2_CORE = 3, - PDU_2_AUX = 4, - P60_CORE = 5, - P60_AUX = 6, - ACU_CORE = 7, - ACU_AUX = 8, - - PDU_1_CONFIG = 9, - PDU_2_CONFIG = 10 + CORE = 1, + AUX = 2, + CONFIG = 3 }; } // namespace P60System @@ -217,10 +209,10 @@ static const uint8_t HK_TABLE_ENTRIES = 100; class CoreHkSet : public StaticLocalDataSet<16> { public: CoreHkSet(HasLocalDataPoolIF* owner) - : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::P60_CORE)) {} + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::CORE)) {} CoreHkSet(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::P60_CORE))) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::CORE))) {} /** Measured output currents */ lp_vec_t currents = @@ -254,10 +246,10 @@ class CoreHkSet : public StaticLocalDataSet<16> { class HkTableDataset : public StaticLocalDataSet<32> { public: HkTableDataset(HasLocalDataPoolIF* owner) - : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::P60_AUX)) {} + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::AUX)) {} HkTableDataset(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::P60_AUX))) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::AUX))) {} /** Number of detected latchups on each output channel */ lp_vec_t latchups = @@ -545,25 +537,25 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_CHANNEL8 = 0x50; class Pdu1CoreHk : public ::PDU::PduCoreHk { public: Pdu1CoreHk(HasLocalDataPoolIF* owner) - : PduCoreHk(owner, static_cast(::P60System::SetIds::PDU_1_CORE)) {} + : PduCoreHk(owner, static_cast(::P60System::SetIds::CORE)) {} Pdu1CoreHk(object_id_t objectId) - : PduCoreHk(objectId, static_cast(::P60System::SetIds::PDU_1_CORE)) {} + : PduCoreHk(objectId, static_cast(::P60System::SetIds::CORE)) {} }; class Pdu1AuxHk : public ::PDU::PduAuxHk { public: Pdu1AuxHk(HasLocalDataPoolIF* owner) - : PduAuxHk(owner, static_cast(::P60System::SetIds::PDU_1_AUX)) {} + : PduAuxHk(owner, static_cast(::P60System::SetIds::AUX)) {} Pdu1AuxHk(object_id_t objectId) - : PduAuxHk(objectId, static_cast(::P60System::SetIds::PDU_1_AUX)) {} + : PduAuxHk(objectId, static_cast(::P60System::SetIds::AUX)) {} }; class Pdu1Config : public ::PDU::PduConfig { public: Pdu1Config(HasLocalDataPoolIF* owner) - : PduConfig(owner, static_cast(::P60System::SetIds::PDU_1_CONFIG)) {} + : PduConfig(owner, static_cast(::P60System::SetIds::CONFIG)) {} }; } // namespace PDU1 @@ -600,25 +592,25 @@ static const uint16_t CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA = 0x50; class Pdu2CoreHk : public ::PDU::PduCoreHk { public: Pdu2CoreHk(HasLocalDataPoolIF* owner) - : PduCoreHk(owner, static_cast(::P60System::SetIds::PDU_2_CORE)) {} + : PduCoreHk(owner, static_cast(::P60System::SetIds::CORE)) {} Pdu2CoreHk(object_id_t objectId) - : PduCoreHk(objectId, static_cast(::P60System::SetIds::PDU_2_CORE)) {} + : PduCoreHk(objectId, static_cast(::P60System::SetIds::CORE)) {} }; class Pdu2AuxHk : public ::PDU::PduAuxHk { public: Pdu2AuxHk(HasLocalDataPoolIF* owner) - : PduAuxHk(owner, static_cast(::P60System::SetIds::PDU_2_AUX)) {} + : PduAuxHk(owner, static_cast(::P60System::SetIds::AUX)) {} Pdu2AuxHk(object_id_t objectId) - : PduAuxHk(objectId, static_cast(::P60System::SetIds::PDU_2_AUX)) {} + : PduAuxHk(objectId, static_cast(::P60System::SetIds::AUX)) {} }; class Pdu2Config : public ::PDU::PduConfig { public: Pdu2Config(HasLocalDataPoolIF* owner) - : PduConfig(owner, static_cast(::P60System::SetIds::PDU_2_CONFIG)) {} + : PduConfig(owner, static_cast(::P60System::SetIds::CONFIG)) {} }; } // namespace PDU2 @@ -661,10 +653,10 @@ static const size_t MAX_REPLY_SIZE = HK_TABLE_SIZE; class CoreHk : public StaticLocalDataSet<14> { public: CoreHk(HasLocalDataPoolIF* owner) - : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::ACU_CORE)) {} + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::CORE)) {} CoreHk(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::ACU_CORE))) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::CORE))) {} lp_var_t mpptMode = lp_var_t(sid.objectId, pool::ACU_MPPT_MODE, this); @@ -694,10 +686,10 @@ class CoreHk : public StaticLocalDataSet<14> { class AuxHk : public StaticLocalDataSet<12> { public: AuxHk(HasLocalDataPoolIF* owner) - : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::ACU_AUX)) {} + : StaticLocalDataSet(owner, static_cast(::P60System::SetIds::AUX)) {} AuxHk(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::ACU_AUX))) {} + : StaticLocalDataSet(sid_t(objectId, static_cast(::P60System::SetIds::AUX))) {} lp_vec_t dacEnables = lp_vec_t(sid.objectId, pool::ACU_DAC_ENABLES, this); diff --git a/tmtc b/tmtc index 8655f0c9..9171f23d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 8655f0c9e6158c460e1f8bc02e73a9310e33b18f +Subproject commit 9171f23d9373fcba6b75d2f75d1b4764180bb7b5 From b01217cf16ef0cfab0c634dfce4a16b474e09802 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 11:08:38 +0200 Subject: [PATCH 03/12] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 9171f23d..80a57cdc 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9171f23d9373fcba6b75d2f75d1b4764180bb7b5 +Subproject commit 80a57cdc70f8d88365ed6e77b075b2f7cae483d9 From a0f8872ad7abbd116484c25e716e40bdd7359b19 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 11:41:27 +0200 Subject: [PATCH 04/12] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 80a57cdc..0ddb9587 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 80a57cdc70f8d88365ed6e77b075b2f7cae483d9 +Subproject commit 0ddb9587ba48ff9108fb5da9ef39b646960d6022 From c3b2e3ef0f39a4a2b62da76f2cc7517ee4249bc3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 14:08:26 +0200 Subject: [PATCH 05/12] rw fix and higher timeout for tctrl locks --- mission/controller/ThermalController.cpp | 60 ++++++++++++------------ mission/controller/ThermalController.h | 1 + mission/devices/RwHandler.cpp | 4 +- tmtc | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 10c74fca..608b68b7 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -235,7 +235,7 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode void ThermalController::copySensors() { { - PoolReadGuard pg0(&max31865Set0); + PoolReadGuard pg0(&max31865Set0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg0.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_heatspreader.value = max31865Set0.temperatureCelcius.value; sensorTemperatures.sensor_ploc_heatspreader.setValid( @@ -247,7 +247,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg1(&max31865Set1); + PoolReadGuard pg1(&max31865Set1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg1.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_ploc_missionboard.value = max31865Set1.temperatureCelcius.value; sensorTemperatures.sensor_ploc_missionboard.setValid( @@ -259,7 +259,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg2(&max31865Set2); + PoolReadGuard pg2(&max31865Set2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg2.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_4k_camera.value = max31865Set2.temperatureCelcius.value; sensorTemperatures.sensor_4k_camera.setValid(max31865Set2.temperatureCelcius.isValid()); @@ -270,7 +270,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg3(&max31865Set3); + PoolReadGuard pg3(&max31865Set3, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg3.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_dac_heatspreader.value = max31865Set3.temperatureCelcius.value; sensorTemperatures.sensor_dac_heatspreader.setValid( @@ -282,7 +282,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg4(&max31865Set4); + PoolReadGuard pg4(&max31865Set4, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg4.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_startracker.value = max31865Set4.temperatureCelcius.value; sensorTemperatures.sensor_startracker.setValid(max31865Set4.temperatureCelcius.isValid()); @@ -293,7 +293,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg5(&max31865Set5); + PoolReadGuard pg5(&max31865Set5, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg5.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_rw1.value = max31865Set5.temperatureCelcius.value; sensorTemperatures.sensor_rw1.setValid(max31865Set5.temperatureCelcius.isValid()); @@ -304,7 +304,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg6(&max31865Set6); + PoolReadGuard pg6(&max31865Set6, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg6.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_dro.value = max31865Set6.temperatureCelcius.value; sensorTemperatures.sensor_dro.setValid(max31865Set6.temperatureCelcius.isValid()); @@ -315,7 +315,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg7(&max31865Set7); + PoolReadGuard pg7(&max31865Set7, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg7.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_scex.value = max31865Set7.temperatureCelcius.value; sensorTemperatures.sensor_scex.setValid(max31865Set7.temperatureCelcius.isValid()); @@ -326,7 +326,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg8(&max31865Set8); + PoolReadGuard pg8(&max31865Set8, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg8.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_x8.value = max31865Set8.temperatureCelcius.value; sensorTemperatures.sensor_x8.setValid(max31865Set8.temperatureCelcius.isValid()); @@ -337,7 +337,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg9(&max31865Set9); + PoolReadGuard pg9(&max31865Set9, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg9.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_hpa.value = max31865Set9.temperatureCelcius.value; sensorTemperatures.sensor_hpa.setValid(max31865Set9.temperatureCelcius.isValid()); @@ -348,7 +348,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg10(&max31865Set10); + PoolReadGuard pg10(&max31865Set10, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg10.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tx_modul.value = max31865Set10.temperatureCelcius.value; sensorTemperatures.sensor_tx_modul.setValid(max31865Set10.temperatureCelcius.isValid()); @@ -359,7 +359,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg11(&max31865Set11); + PoolReadGuard pg11(&max31865Set11, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg11.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_mpa.value = max31865Set11.temperatureCelcius.value; sensorTemperatures.sensor_mpa.setValid(max31865Set11.temperatureCelcius.isValid()); @@ -370,7 +370,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg12(&max31865Set12); + PoolReadGuard pg12(&max31865Set12, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg12.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_acu.value = max31865Set12.temperatureCelcius.value; sensorTemperatures.sensor_acu.setValid(max31865Set12.temperatureCelcius.isValid()); @@ -381,7 +381,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg13(&max31865Set13); + PoolReadGuard pg13(&max31865Set13, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg13.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_plpcdu_heatspreader.value = max31865Set13.temperatureCelcius.value; sensorTemperatures.sensor_plpcdu_heatspreader.setValid( @@ -393,7 +393,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg14(&max31865Set14); + PoolReadGuard pg14(&max31865Set14, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg14.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tcs_board.value = max31865Set14.temperatureCelcius.value; sensorTemperatures.sensor_tcs_board.setValid(max31865Set14.temperatureCelcius.isValid()); @@ -404,7 +404,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg15(&max31865Set15); + PoolReadGuard pg15(&max31865Set15, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg15.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_magnettorquer.value = max31865Set15.temperatureCelcius.value; sensorTemperatures.sensor_magnettorquer.setValid(max31865Set15.temperatureCelcius.isValid()); @@ -415,7 +415,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg111(&tmp1075Set1); + PoolReadGuard pg111(&tmp1075Set1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg111.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tmp1075_1.value = tmp1075Set1.temperatureCelcius.value; sensorTemperatures.sensor_tmp1075_1.setValid(tmp1075Set1.temperatureCelcius.isValid()); @@ -426,7 +426,7 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg112(&tmp1075Set2); + PoolReadGuard pg112(&tmp1075Set2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg112.getReadResult() == returnvalue::OK) { sensorTemperatures.sensor_tmp1075_2.value = tmp1075Set2.temperatureCelcius.value; sensorTemperatures.sensor_tmp1075_2.setValid(tmp1075Set2.temperatureCelcius.isValid()); @@ -439,7 +439,7 @@ void ThermalController::copySensors() { void ThermalController::copySus() { { - PoolReadGuard pg0(&susSet0); + PoolReadGuard pg0(&susSet0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg0.getReadResult() == returnvalue::OK) { susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.value = susSet0.temperatureCelcius.value; susTemperatures.sus_0_n_loc_xfyfzm_pt_xf.setValid(susSet0.temperatureCelcius.isValid()); @@ -450,7 +450,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg1(&susSet1); + PoolReadGuard pg1(&susSet1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg1.getReadResult() == returnvalue::OK) { susTemperatures.sus_6_r_loc_xfybzm_pt_xf.value = susSet1.temperatureCelcius.value; susTemperatures.sus_6_r_loc_xfybzm_pt_xf.setValid(susSet1.temperatureCelcius.isValid()); @@ -461,7 +461,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg2(&susSet2); + PoolReadGuard pg2(&susSet2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg2.getReadResult() == returnvalue::OK) { susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.value = susSet2.temperatureCelcius.value; susTemperatures.sus_1_n_loc_xbyfzm_pt_xb.setValid(susSet2.temperatureCelcius.isValid()); @@ -472,7 +472,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg3(&susSet3); + PoolReadGuard pg3(&susSet3, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg3.getReadResult() == returnvalue::OK) { susTemperatures.sus_7_r_loc_xbybzm_pt_xb.value = susSet3.temperatureCelcius.value; susTemperatures.sus_7_r_loc_xbybzm_pt_xb.setValid(susSet3.temperatureCelcius.isValid()); @@ -483,7 +483,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg4(&susSet4); + PoolReadGuard pg4(&susSet4, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg4.getReadResult() == returnvalue::OK) { susTemperatures.sus_2_n_loc_xfybzb_pt_yb.value = susSet4.temperatureCelcius.value; susTemperatures.sus_2_n_loc_xfybzb_pt_yb.setValid(susSet4.temperatureCelcius.isValid()); @@ -494,7 +494,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg5(&susSet5); + PoolReadGuard pg5(&susSet5, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg5.getReadResult() == returnvalue::OK) { susTemperatures.sus_8_r_loc_xbybzb_pt_yb.value = susSet5.temperatureCelcius.value; susTemperatures.sus_8_r_loc_xbybzb_pt_yb.setValid(susSet5.temperatureCelcius.isValid()); @@ -505,7 +505,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg6(&susSet6); + PoolReadGuard pg6(&susSet6, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg6.getReadResult() == returnvalue::OK) { susTemperatures.sus_3_n_loc_xfybzf_pt_yf.value = susSet6.temperatureCelcius.value; susTemperatures.sus_3_n_loc_xfybzf_pt_yf.setValid(susSet6.temperatureCelcius.isValid()); @@ -516,7 +516,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg7(&susSet7); + PoolReadGuard pg7(&susSet7, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg7.getReadResult() == returnvalue::OK) { susTemperatures.sus_9_r_loc_xbybzb_pt_yf.value = susSet7.temperatureCelcius.value; susTemperatures.sus_9_r_loc_xbybzb_pt_yf.setValid(susSet7.temperatureCelcius.isValid()); @@ -527,7 +527,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg8(&susSet8); + PoolReadGuard pg8(&susSet8, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg8.getReadResult() == returnvalue::OK) { susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.value = susSet8.temperatureCelcius.value; susTemperatures.sus_4_n_loc_xmyfzf_pt_zf.setValid(susSet8.temperatureCelcius.isValid()); @@ -538,7 +538,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg9(&susSet9); + PoolReadGuard pg9(&susSet9, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg9.getReadResult() == returnvalue::OK) { susTemperatures.sus_10_n_loc_xmybzf_pt_zf.value = susSet9.temperatureCelcius.value; susTemperatures.sus_10_n_loc_xmybzf_pt_zf.setValid(susSet9.temperatureCelcius.isValid()); @@ -549,7 +549,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg10(&susSet10); + PoolReadGuard pg10(&susSet10, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg10.getReadResult() == returnvalue::OK) { susTemperatures.sus_5_n_loc_xfymzb_pt_zb.value = susSet10.temperatureCelcius.value; susTemperatures.sus_5_n_loc_xfymzb_pt_zb.setValid(susSet10.temperatureCelcius.isValid()); @@ -560,7 +560,7 @@ void ThermalController::copySus() { } { - PoolReadGuard pg11(&susSet11); + PoolReadGuard pg11(&susSet11, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); if (pg11.getReadResult() == returnvalue::OK) { susTemperatures.sus_11_r_loc_xbymzb_pt_zb.value = susSet11.temperatureCelcius.value; susTemperatures.sus_11_r_loc_xbymzb_pt_zb.setValid(susSet11.temperatureCelcius.isValid()); diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 29661d5e..7ca517cb 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -75,6 +75,7 @@ class ThermalController : public ExtendedControllerBase { // Initial delay to make sure all pool variables have been initialized their owners Countdown initialCountdown = Countdown(DELAY); + static constexpr dur_millis_t MUTEX_TIMEOUT = 50; void copySensors(); void copySus(); void copyDevices(); diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index b7e26123..732bb9fe 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -304,9 +304,9 @@ ReturnValue_t RwHandler::checkSpeedAndRampTime(const uint8_t* commandData, size_ return INVALID_SPEED; } - uint16_t rampTime = *(commandData + 4) << 8 | *(commandData + 5); + uint16_t rampTime = (*(commandData + 4) << 8) | *(commandData + 5); - if (rampTime < 10 || rampTime > 10000) { + if (rampTime < 10 || rampTime > 20000) { sif::error << "RwHandler::checkSpeedAndRampTime: Command has invalid ramp time" << std::endl; return INVALID_RAMP_TIME; } diff --git a/tmtc b/tmtc index 0ddb9587..7957ed84 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 0ddb9587ba48ff9108fb5da9ef39b646960d6022 +Subproject commit 7957ed844e6b2d143cf780d3cc5a3ba485a06e70 From 83362f7a0072f2afb948ffc4cb2672941f0d4aa9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 17:51:20 +0200 Subject: [PATCH 06/12] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 7957ed84..b2bab4c9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 7957ed844e6b2d143cf780d3cc5a3ba485a06e70 +Subproject commit b2bab4c964848d6f78a6f44525166dcf24cc46b6 From 371a11684ae71b25e704a77a8c8d2959aef33da1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 19 Oct 2022 10:46:57 +0200 Subject: [PATCH 07/12] cleanr PL PCDU data on off cmd --- mission/devices/PCDUHandler.cpp | 11 +++++------ mission/devices/PayloadPcduHandler.cpp | 6 ++++++ mission/devices/PayloadPcduHandler.h | 1 + .../devices/devicedefinitions/GomspaceDefinitions.h | 6 +----- tmtc | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 39a09d5a..91881db5 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -52,8 +52,8 @@ ReturnValue_t PCDUHandler::initialize() { return returnvalue::FAILED; } result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - static_cast(P60System::SetIds::CORE), this->getObjectId(), - commandQueue->getId(), true); + static_cast(P60System::SetIds::CORE), this->getObjectId(), commandQueue->getId(), + true); if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU2Handler" << std::endl; @@ -68,8 +68,8 @@ ReturnValue_t PCDUHandler::initialize() { return returnvalue::FAILED; } result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( - static_cast(P60System::SetIds::CORE), this->getObjectId(), - commandQueue->getId(), true); + static_cast(P60System::SetIds::CORE), this->getObjectId(), commandQueue->getId(), + true); if (result != returnvalue::OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " << "PDU1Handler" << std::endl; @@ -113,8 +113,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* if (sid == sid_t(objects::PDU2_HANDLER, static_cast(P60System::SetIds::CORE))) { updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset); updatePdu2SwitchStates(); - } else if (sid == - sid_t(objects::PDU1_HANDLER, static_cast(P60System::SetIds::CORE))) { + } else if (sid == sid_t(objects::PDU1_HANDLER, static_cast(P60System::SetIds::CORE))) { updateHkTableDataset(storeId, &pdu1CoreHk, &timeStampPdu1HkDataset); updatePdu1SwitchStates(); } else { diff --git a/mission/devices/PayloadPcduHandler.cpp b/mission/devices/PayloadPcduHandler.cpp index 56822bd5..d9e41c7f 100644 --- a/mission/devices/PayloadPcduHandler.cpp +++ b/mission/devices/PayloadPcduHandler.cpp @@ -33,6 +33,7 @@ void PayloadPcduHandler::doStartUp() { if (pwrStateMachine.getState() == power::States::IDLE) { pwrStateMachine.start(MODE_ON, pwrSubmode); } + clearSetOnOffFlag = true; auto opCode = pwrStateMachine.fsm(); if (opCode == power::OpCodes::TO_NOT_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) { pwrStateMachine.reset(); @@ -50,6 +51,11 @@ void PayloadPcduHandler::doShutDown() { if (pwrStateMachine.getState() == power::States::IDLE) { pwrStateMachine.start(MODE_OFF, 0); } + if (clearSetOnOffFlag) { + std::memset(adcSet.processed.value, 0, adcSet.processed.getSerializedSize()); + clearSetOnOffFlag = false; + } + auto opCode = pwrStateMachine.fsm(); if (opCode == power::OpCodes::TO_OFF_DONE or opCode == power::OpCodes::TIMEOUT_OCCURED) { pwrStateMachine.reset(); diff --git a/mission/devices/PayloadPcduHandler.h b/mission/devices/PayloadPcduHandler.h index 6a9334ca..2f89c837 100644 --- a/mission/devices/PayloadPcduHandler.h +++ b/mission/devices/PayloadPcduHandler.h @@ -124,6 +124,7 @@ class PayloadPcduHandler : public DeviceHandlerBase { bool txToMpaInjectionRequested = false; bool mpaToHpaInjectionRequested = false; bool allOnInjectRequested = false; + bool clearSetOnOffFlag = true; PeriodicOperationDivider opDivider = PeriodicOperationDivider(5); uint8_t tempReadDivisor = 1; diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index 325a2a0c..d2ffdc25 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -102,11 +102,7 @@ namespace P60System { enum class BatteryModes : uint8_t { CRITICAL = 1, SAFE = 2, NORMAL = 3, FULL = 4 }; -enum class SetIds : uint32_t { - CORE = 1, - AUX = 2, - CONFIG = 3 -}; +enum class SetIds : uint32_t { CORE = 1, AUX = 2, CONFIG = 3 }; } // namespace P60System diff --git a/tmtc b/tmtc index b2bab4c9..9493cdaa 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit b2bab4c964848d6f78a6f44525166dcf24cc46b6 +Subproject commit 9493cdaabf3cef636dcab2c98768215b0e58636b From def93d3e59c07fb7e68d8417f63918a7bd16c898 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 20 Oct 2022 17:09:38 +0200 Subject: [PATCH 08/12] bump deps --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 692be9df..73454c62 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 692be9df8d06beb3bfc83aad77cefd727d8f7c35 +Subproject commit 73454c629c042de8efe7aa4fa6dcbf1e184b0961 diff --git a/tmtc b/tmtc index 9493cdaa..1dfc2fca 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 9493cdaabf3cef636dcab2c98768215b0e58636b +Subproject commit 1dfc2fca2f58f8d226fab01c87eb529ba7ec8376 From 5abbaeddb06c461a2c3a425d5a5fbba3cb55da6a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 20 Oct 2022 17:16:37 +0200 Subject: [PATCH 09/12] update EM obj factory --- bsp_q7s/em/emObjectFactory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index b8e83862..d80d0af7 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -43,13 +43,14 @@ void ObjectFactory::produce(void* args) { // createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV); // createRtdComponents(q7s::SPI_DEFAULT_DEV, gpioComIF, pwrSwitcher, spiMainComIF); // createTmpComponents(); + // createSolarArrayDeploymentComponents(); createRadSensorComponent(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); #endif createHeaterComponents(gpioComIF, pwrSwitcher, healthTable); - createSolarArrayDeploymentComponents(); + createPayloadComponents(gpioComIF); #if OBSW_ADD_MGT == 1 @@ -71,6 +72,9 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_TEST_CODE == 1 createTestComponents(gpioComIF); #endif /* OBSW_ADD_TEST_CODE == 1 */ +#if OBSW_ADD_SCEX_DEVICE == 1 + createScexComponents(q7s::UART_SCEX_DEV, pwrSwitcher, *SdCardManager::instance(), true, std::nullopt); +#endif createMiscComponents(); createAcsController(); From da177f117093e489897eabcb229bef613177d847 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 20 Oct 2022 17:25:27 +0200 Subject: [PATCH 10/12] create SA deployment dummy --- dummies/CMakeLists.txt | 1 + dummies/SaDeploymentDummy.cpp | 10 ++++++++++ dummies/SaDeploymentDummy.h | 19 +++++++++++++++++++ dummies/helpers.cpp | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 dummies/SaDeploymentDummy.cpp create mode 100644 dummies/SaDeploymentDummy.h diff --git a/dummies/CMakeLists.txt b/dummies/CMakeLists.txt index 4cb05289..677120fb 100644 --- a/dummies/CMakeLists.txt +++ b/dummies/CMakeLists.txt @@ -12,6 +12,7 @@ target_sources( AcuDummy.cpp PduDummy.cpp P60DockDummy.cpp + SaDeploymentDummy.cpp GyroAdisDummy.cpp GyroL3GD20Dummy.cpp MgmLIS3MDLDummy.cpp diff --git a/dummies/SaDeploymentDummy.cpp b/dummies/SaDeploymentDummy.cpp new file mode 100644 index 00000000..8ea80545 --- /dev/null +++ b/dummies/SaDeploymentDummy.cpp @@ -0,0 +1,10 @@ +#include "SaDeploymentDummy.h" + +SaDeplDummy::SaDeplDummy(object_id_t objectId): SystemObject(objectId) { +} + +SaDeplDummy::~SaDeplDummy() = default; + +ReturnValue_t SaDeplDummy::performOperation(uint8_t opCode) { + return returnvalue::OK; +} diff --git a/dummies/SaDeploymentDummy.h b/dummies/SaDeploymentDummy.h new file mode 100644 index 00000000..a0b5ccdf --- /dev/null +++ b/dummies/SaDeploymentDummy.h @@ -0,0 +1,19 @@ + +#ifndef DUMMIES_SADEPLOYMENT_H_ +#define DUMMIES_SADEPLOYMENT_H_ + +#include "SaDeploymentDummy.h" +#include + +class SaDeplDummy : public SystemObject, public ExecutableObjectIF { + public: + + SaDeplDummy(object_id_t objectId); + virtual ~SaDeplDummy(); + + ReturnValue_t performOperation(uint8_t opCode) override; + + protected: +}; + +#endif /* DUMMIES_SADEPLOYMENT_H_ */ diff --git a/dummies/helpers.cpp b/dummies/helpers.cpp index 8eb73250..2b18cffd 100644 --- a/dummies/helpers.cpp +++ b/dummies/helpers.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -35,6 +36,7 @@ void dummy::createDummies(DummyCfg cfg) { new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy); new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy); new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy); + new SaDeplDummy(objects::SOLAR_ARRAY_DEPL_HANDLER); new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy); new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); From 6effbaa85ed7c317f3fea5b89c5a53ba31f655a3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 20 Oct 2022 18:03:37 +0200 Subject: [PATCH 11/12] EM installer updates --- CMakeLists.txt | 2 +- q7s-env-em.sh | 2 +- scripts/install-obsw-yocto.sh | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6a73014..43336bdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ set(OBSW_ADD_ACS_CTRL ${INIT_VAL} CACHE STRING "Add ACS controller") set(OBSW_ADD_RTD_DEVICES - 1 + ${INIT_VAL} CACHE STRING "Add RTD devices") set(OBSW_ADD_RAD_SENSORS ${INIT_VAL} diff --git a/q7s-env-em.sh b/q7s-env-em.sh index e8be1467..86737627 100755 --- a/q7s-env-em.sh +++ b/q7s-env-em.sh @@ -19,5 +19,5 @@ if [[ -d "eive-obsw" ]]; then export PATH=$PATH:"$(pwd)/eive-obsw/scripts" cd "eive-obsw" fi -export CONSOLE_PREFIX="[Q7S ENV]" +export CONSOLE_PREFIX="[Q7S ENV EM]" /bin/bash diff --git a/scripts/install-obsw-yocto.sh b/scripts/install-obsw-yocto.sh index c7880d2f..d9d94818 100755 --- a/scripts/install-obsw-yocto.sh +++ b/scripts/install-obsw-yocto.sh @@ -2,13 +2,10 @@ # This is a helper script to install the compiles EIVE OBSW files # into the yocto repository to re-generate the mission root filesystem build_dir=cmake-build-release-q7s -em_install="0" -if [ ! -z ${1} ]; then - if [[ "${1}" == "em" ]]; then - echo "-I- Installing EM binaries" - em_install="1" - build_dir=cmake-build-release-q7s-em - fi +if [ ! -z ${1} && "${1}" == "em" ] || [[ ${EIVE_Q7S_EM} == "1" ]]; then + echo "-I- Installing EM binaries" + em_install="1" + build_dir=cmake-build-release-q7s-em fi init_dir=$(pwd) From f29b578caed987a69eef89de5a0845f5667cf05c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 20 Oct 2022 18:14:26 +0200 Subject: [PATCH 12/12] do not install watchdog in yocto install script --- scripts/install-obsw-yocto.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/install-obsw-yocto.sh b/scripts/install-obsw-yocto.sh index d9d94818..a7e3f20a 100755 --- a/scripts/install-obsw-yocto.sh +++ b/scripts/install-obsw-yocto.sh @@ -81,17 +81,17 @@ else echo "-I- Installed EIVE OBSW into yocto repository successfully" fi -if [ ! -f ${build_dir}/${watchdog_bin_name} ]; then - echo "-W- No EIVE Watchdog found to intall to yocto" -else - cp_cmd="cp $(pwd)/${build_dir}/${watchdog_bin_name} ${yocto_root}/${yocto_watchdog_path}/${watchdog_target_name}" - echo "-I- Executing: ${cp_cmd}" - eval ${cp_cmd} - cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${yocto_watchdog_path}" - echo "-I- Executing: ${cp_ver_cmd}" - eval ${cp_ver_cmd} - echo "-I- Installed EIVE watchdog into yocto repository successfully" -fi +#if [ ! -f ${build_dir}/${watchdog_bin_name} ]; then +# echo "-W- No EIVE Watchdog found to intall to yocto" +#else +# cp_cmd="cp $(pwd)/${build_dir}/${watchdog_bin_name} ${yocto_root}/${yocto_watchdog_path}/${watchdog_target_name}" +# echo "-I- Executing: ${cp_cmd}" +# eval ${cp_cmd} +# cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${yocto_watchdog_path}" +# echo "-I- Executing: ${cp_ver_cmd}" +# eval ${cp_ver_cmd} +# echo "-I- Installed EIVE watchdog into yocto repository successfully" +#fi if [ -f $(pwd)/${obsw_version_filename} ]; then rm $(pwd)/${obsw_version_filename}