ploc supervisor wip

This commit is contained in:
Jakob.Meier
2021-07-22 08:06:04 +02:00
parent ea2260a61d
commit 995395d11e
7 changed files with 194 additions and 40 deletions

View File

@ -19,6 +19,7 @@ static const DeviceCommandId_t SET_BOOT_TIMEOUT = 6;
static const DeviceCommandId_t SET_MAX_RESTART_TRIES = 7;
static const DeviceCommandId_t RESET_MPSOC = 8;
static const DeviceCommandId_t SET_TIME_REF = 9;
static const DeviceCommandId_t DISABLE_PERIOIC_HK_TRANSMISSION = 10;
/** Reply IDs */
static const DeviceCommandId_t ACK_REPORT = 50;
@ -64,6 +65,7 @@ static const uint16_t APID_UPDATE_VERIFY = 0xB2;
static const uint16_t APID_WTD_ENABLE = 0xC0;
static const uint16_t APID_WTD_CONFIG_TIMEOUT = 0xC1;
static const uint16_t APID_SET_TIME_REF = 0xC2;
static const uint16_t APID_DISABLE_HK = 0xC3;
static const uint16_t APID_GET_HK_REPORT = 0xC6;
@ -289,6 +291,77 @@ private:
}
};
/**
* @brief This class can be used to generate the space packet to set the maximum boot tries.
*/
class SetRestartTries: public SpacePacket {
public:
/**
* @brief Constructor
*
* @param restartTries Maximum restart tries to set.
*/
SetRestartTries(uint8_t restartTries) :
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_SET_MAX_RESTART_TRIES, 1), restartTries(
restartTries) {
initPacket();
}
private:
uint8_t restartTries = 0;
/** Restart tries value (uint8_t) and crc (uint16_t) */
static const uint16_t DATA_FIELD_LENGTH = 3;
void initPacket() {
uint8_t* data_field_ptr = this->localData.fields.buffer;
*data_field_ptr = restartTries;
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
size_t serializedSize = 0;
uint8_t* crcPtr = data_field_ptr + 1;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPtr, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief With this class the space packet can be generated to disable to periodic transmission
* of housekeeping data. Normally, this will be disabled by default. However, adding this
* command can be useful for debugging.
*/
class DisablePeriodicHkTransmission: public SpacePacket {
public:
/**
* @brief Constructor
*/
DisablePeriodicHkTransmission() :
SpacePacket(DATA_FIELD_LENGTH - 1, true, APID_DISABLE_HK, 1) {
initPacket();
}
private:
uint8_t disableHk = 0;
/** Restart tries value (uint8_t) and crc (uint16_t) */
static const uint16_t DATA_FIELD_LENGTH = 3;
void initPacket() {
uint8_t* data_field_ptr = this->localData.fields.buffer;
*data_field_ptr = disableHk;
uint16_t crc = CRC::crc16ccitt(this->localData.byteStream,
sizeof(CCSDSPrimaryHeader) + DATA_FIELD_LENGTH - 2);
size_t serializedSize = 0;
uint8_t* crcPtr = data_field_ptr + 1;
SerializeAdapter::serialize<uint16_t>(&crc, &crcPtr, &serializedSize, sizeof(crc),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This dataset to store the housekeeping data of the supervisor.
*/