Merge branch 'meier/ReactionWheelHandler' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into meier/ReactionWheelHandler

This commit is contained in:
Jakob Meier 2021-06-25 15:47:39 +02:00
commit 93f5ce2892
4 changed files with 20 additions and 7 deletions

View File

@ -20,6 +20,7 @@ debugging. */
#define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 1
#define OBSW_ADD_TEST_PST 1
#define OBSW_ADD_GPS 0
#define TEST_LIBGPIOD 0
#define TEST_RADIATION_SENSOR_HANDLER 0
@ -43,6 +44,7 @@ debugging. */
#define DEBUG_SUS 1
#define DEBUG_RTD 1
#define IMTQ_DEBUG 1
#define RW_DEBUG 1
// Leave at one as the BSP is linux. Used by the ADIS16507 device handler
#define OBSW_ADIS16507_LINUX_COM_IF 1

View File

@ -432,50 +432,61 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) {
ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs();
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#if OBSW_ADD_GPS == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
#endif
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
#if OBSW_ADD_GPS == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
#endif
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
#if OBSW_ADD_GPS == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
#endif
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
#if OBSW_ADD_GPS == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
#endif
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
#if OBSW_ADD_GPS == 1
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GPS1_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
#endif
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "UART PST initialization failed" << std::endl;

View File

@ -208,7 +208,7 @@ ReturnValue_t RwHandler::checkSpeedAndRampTime(const uint8_t* commandData, size_
return INVALID_SPEED;
}
uint16_t rampTime = *commandData << 8 | *(commandData + 1);
uint16_t rampTime = *(commandData + 4) << 8 | *(commandData + 5);
if (rampTime < 10 || rampTime > 10000) {
sif::error << "RwHandler::checkSpeedAndRampTime: Command has invalid ramp time"
@ -238,8 +238,8 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDa
commandBuffer[3] = *(commandData + 1);
commandBuffer[4] = *commandData;
/** Ramp time (ms) */
commandBuffer[5] = *(commandData + 1);
commandBuffer[6] = *commandData;
commandBuffer[5] = *(commandData + 5);
commandBuffer[6] = *(commandData + 4);
uint16_t crc = CRC::crc16ccitt(commandBuffer, 7, 0xFFFF);
commandBuffer[7] = static_cast<uint8_t>(crc & 0xFF);
@ -251,10 +251,10 @@ void RwHandler::prepareSetSpeedCmd(const uint8_t * commandData, size_t commandDa
void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
uint8_t offset = 2;
statusSet.currSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 1 | *(packet + offset);
| *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
statusSet.referenceSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 1 | *(packet + offset);
| *(packet + offset + 1) << 8 | *(packet + offset);
offset += 4;
statusSet.state = *(packet + offset);
offset += 1;
@ -275,7 +275,7 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
void RwHandler::handleTemperatureReply(const uint8_t* packet) {
uint8_t offset = 2;
temperatureSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16
| *(packet + offset + 1) << 1 | *(packet + offset);
| *(packet + offset + 1) << 8 | *(packet + offset);
#if OBSW_VERBOSE_LEVEL >= 1 && RW_DEBUG == 1
sif::info << "RwHandler::handleTemperatureReply: Temperature: "
<< temperatureSet.temperatureCelcius << " °C" << std::endl;

2
tmtc

@ -1 +1 @@
Subproject commit 899cd942ce7136f371e93d270a6c6c149c0698cb
Subproject commit 19b76d961c61966a0093d3768f62d99196e1c9b2