Merge branch 'v2.1.0-dev' into update-ptme-code-2
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.2.0-dev This commit looks good

This commit is contained in:
Robin Müller 2023-05-27 17:03:58 +02:00
commit f3cc406495
10 changed files with 42 additions and 24 deletions

View File

@ -61,6 +61,8 @@ TODO: New firmware package version.
- Transmitter state is not taken into account anymore for writing into the PTME. The PTME should - Transmitter state is not taken into account anymore for writing into the PTME. The PTME should
be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any be perfectly capable of generating a valid CADU, even when the transmitter is not ON for any
reason. reason.
- OFF mode is ignores in TM store for determining whether a store will be written. The modes will
only be used to cancel a transfer.
## Added ## Added
@ -69,6 +71,7 @@ TODO: New firmware package version.
- BPX battery handler is added for EM by default. - BPX battery handler is added for EM by default.
- ACU dummy HK sets - ACU dummy HK sets
- IMTQ HK sets - IMTQ HK sets
- IMTQ dummy now handles power switch
## Fixed ## Fixed
@ -92,6 +95,7 @@ TODO: New firmware package version.
- HK TM store: The HK store dump success event was triggered for cancelled HK dumps. - HK TM store: The HK store dump success event was triggered for cancelled HK dumps.
- When a PUS parsing error occured while parsing a TM store file, the dump completion procedure - When a PUS parsing error occured while parsing a TM store file, the dump completion procedure
was always executed. was always executed.
- Some smaller logic fixes in the TM store base class
# [v2.0.5] 2023-05-11 # [v2.0.5] 2023-05-11

View File

@ -98,7 +98,7 @@ set(OBSW_ADD_THERMAL_TEMP_INSERTER
${OBSW_Q7S_EM} ${OBSW_Q7S_EM}
CACHE STRING "Add thermal sensor temperature inserter") CACHE STRING "Add thermal sensor temperature inserter")
set(OBSW_ADD_ACS_BOARD set(OBSW_ADD_ACS_BOARD
1 ${INIT_VAL}
CACHE STRING "Add ACS board module") CACHE STRING "Add ACS board module")
set(OBSW_ADD_GPS_CTRL set(OBSW_ADD_GPS_CTRL
${INIT_VAL} ${INIT_VAL}

View File

@ -98,7 +98,7 @@ void ObjectFactory::produce(void* args) {
// and will cause xsc_boot_copy commands to always boot to 0 0 // and will cause xsc_boot_copy commands to always boot to 0 0
// createRadSensorComponent(gpioComIF); // createRadSensorComponent(gpioComIF);
// Still initialize chip select to avoid SPI bus issues. // Still initialize chip select to avoid SPI bus issues.
createRadSensorChipSelect(gpioComIF); // createRadSensorChipSelect(gpioComIF);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true, createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true,

View File

@ -3,11 +3,12 @@
#include <mission/acs/imtqHelpers.h> #include <mission/acs/imtqHelpers.h>
ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, ImtqDummy::ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
bool enableHkSets) power::Switch_t pwrSwitcher, bool enableHkSets)
: DeviceHandlerBase(objectId, comif, comCookie), : DeviceHandlerBase(objectId, comif, comCookie),
setNoTorque(this), setNoTorque(this),
setWithTorque(this), setWithTorque(this),
enableHkSets(enableHkSets) {} enableHkSets(enableHkSets),
switcher(pwrSwitcher) {}
ImtqDummy::~ImtqDummy() = default; ImtqDummy::~ImtqDummy() = default;
@ -15,6 +16,15 @@ void ImtqDummy::doStartUp() { setMode(MODE_NORMAL); }
void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); } void ImtqDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
ReturnValue_t ImtqDummy::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) {
if (switcher != power::NO_SWITCH) {
*numberOfSwitches = 1;
*switches = &switcher;
return returnvalue::OK;
}
return DeviceHandlerBase::NO_SWITCH;
}
ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } ReturnValue_t ImtqDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }
ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { ReturnValue_t ImtqDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {

View File

@ -13,10 +13,12 @@ class ImtqDummy : public DeviceHandlerBase {
static const uint8_t SIMPLE_COMMAND_DATA = 1; static const uint8_t SIMPLE_COMMAND_DATA = 1;
static const uint8_t PERIODIC_REPLY_DATA = 2; static const uint8_t PERIODIC_REPLY_DATA = 2;
ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie, bool enableHkSets); ImtqDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie,
power::Switch_t pwrSwitcher, bool enableHkSets);
~ImtqDummy() override; ~ImtqDummy() override;
protected: protected:
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
imtq::HkDatasetNoTorque setNoTorque; imtq::HkDatasetNoTorque setNoTorque;
imtq::HkDatasetWithTorque setWithTorque; imtq::HkDatasetWithTorque setWithTorque;
bool enableHkSets; bool enableHkSets;
@ -38,6 +40,8 @@ class ImtqDummy : public DeviceHandlerBase {
PoolEntry<float> mtmRawWithTorque = PoolEntry<float>(3); PoolEntry<float> mtmRawWithTorque = PoolEntry<float>(3);
PoolEntry<uint8_t> actStatusWithTorque = PoolEntry<uint8_t>(1); PoolEntry<uint8_t> actStatusWithTorque = PoolEntry<uint8_t>(1);
power::Switch_t switcher = power::NO_SWITCH;
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;

View File

@ -75,9 +75,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio
} }
auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY); auto* imtqAssy = new ImtqAssembly(objects::IMTQ_ASSY);
imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM); imtqAssy->connectModeTreeParent(satsystem::acs::ACS_SUBSYSTEM);
auto* imtqDummy = auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy,
new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); power::Switches::PDU1_CH3_MGT_5V, enableHkSets);
imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->enableThermalModule(ThermalStateCfg());
imtqDummy->setPowerSwitcher(&pwrSwitcher);
imtqDummy->connectModeTreeParent(*imtqAssy); imtqDummy->connectModeTreeParent(*imtqAssy);
if (cfg.addOnlyAcuDummy) { if (cfg.addOnlyAcuDummy) {
new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets); new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy, enableHkSets);

View File

@ -131,25 +131,22 @@ ReturnValue_t TmStoreTaskBase::performDump(PersistentTmStoreWithTmQueue& store,
dumpContext.ptmeBusyCounter = 0; dumpContext.ptmeBusyCounter = 0;
tmSinkBusyCd.resetTimer(); tmSinkBusyCd.resetTimer();
ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped); ReturnValue_t result = store.getNextDumpPacket(tmReader, fileHasSwapped);
if (result != returnvalue::OK) { if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
} else if (fileHasSwapped and result == PersistentTmStore::DUMP_DONE) {
// This can happen if a file is corrupted and the next file swap completes the dump. // This can happen if a file is corrupted and the next file swap completes the dump.
dumpDoneHandler(); dumpDoneHandler();
return returnvalue::OK; return returnvalue::OK;
} else if (result != returnvalue::OK) {
sif::error << "PersistentTmStore: Getting next dump packet failed" << std::endl;
return result;
} }
dumpedLen = tmReader.getFullPacketLen(); dumpedLen = tmReader.getFullPacketLen();
// Only write to VC if mode is on, but always confirm the dump. result = channel.write(tmReader.getFullData(), dumpedLen);
// If the mode is OFF, it is assumed the PTME is not usable and is not allowed to be written if (result == DirectTmSinkIF::IS_BUSY) {
// (e.g. to confirm a reset or the transmitter is off anyway). sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl;
if (mode == MODE_ON) { } else if (result != returnvalue::OK) {
result = channel.write(tmReader.getFullData(), dumpedLen); sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl;
if (result == DirectTmSinkIF::IS_BUSY) {
sif::warning << "PersistentTmStore: Unexpected VC channel busy" << std::endl;
} else if (result != returnvalue::OK) {
sif::warning << "PersistentTmStore: Unexpected VC channel write failure" << std::endl;
}
} }
result = store.confirmDump(tmReader, fileHasSwapped); result = store.confirmDump(tmReader, fileHasSwapped);
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK)) { if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK)) {
dumpPerformed = true; dumpPerformed = true;

View File

@ -18,9 +18,7 @@ uint8_t VirtualChannel::getVcid() const { return vcId; }
const char* VirtualChannel::getName() const { return vcName.c_str(); } const char* VirtualChannel::getName() const { return vcName.c_str(); }
bool VirtualChannel::isBusy() const { bool VirtualChannel::isBusy() const { return ptme.isBusy(vcId); }
return ptme.isBusy(vcId);
}
void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); } void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); }

View File

@ -268,6 +268,8 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switch heaterIdx) {
triggerEvent(GPIO_PULL_HIGH_FAILED, result); triggerEvent(GPIO_PULL_HIGH_FAILED, result);
} else { } else {
triggerEvent(HEATER_WENT_ON, heaterIdx, 0); triggerEvent(HEATER_WENT_ON, heaterIdx, 0);
EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO,
MODE_ON, MODE_OFF);
{ {
MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
heater.switchState = ON; heater.switchState = ON;
@ -324,6 +326,8 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switch heaterIdx) {
heater.switchState = OFF; heater.switchState = OFF;
} }
triggerEvent(HEATER_WENT_OFF, heaterIdx, 0); triggerEvent(HEATER_WENT_OFF, heaterIdx, 0);
EventManagerIF::triggerEvent(helper.heaters[heaterIdx].first->getObjectId(), MODE_INFO,
MODE_OFF, MODE_ON);
// When all switches are off, also main line switch will be turned off // When all switches are off, also main line switch will be turned off
if (allSwitchesOff()) { if (allSwitchesOff()) {
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);

View File

@ -256,6 +256,7 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi
if (state == State::IDLE or dumpParams.pendingPacketDump) { if (state == State::IDLE or dumpParams.pendingPacketDump) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
fileHasSwapped = false;
reader.setReadOnlyData(fileBuf.data() + dumpParams.currentSize, reader.setReadOnlyData(fileBuf.data() + dumpParams.currentSize,
fileBuf.size() - dumpParams.currentSize); fileBuf.size() - dumpParams.currentSize);
// CRC check to fully ensure this is a valid TM // CRC check to fully ensure this is a valid TM
@ -270,7 +271,6 @@ ReturnValue_t PersistentTmStore::getNextDumpPacket(PusTmReader& reader, bool& fi
fileHasSwapped = true; fileHasSwapped = true;
return loadNextDumpFile(); return loadNextDumpFile();
} }
fileHasSwapped = false;
dumpParams.pendingPacketDump = true; dumpParams.pendingPacketDump = true;
return returnvalue::OK; return returnvalue::OK;
} }