RW handler tweaks
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-09-23 16:03:09 +02:00
parent 8693075061
commit 8fc144b595
2 changed files with 11 additions and 19 deletions

View File

@ -766,14 +766,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0,
// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS);
// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0,
// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS);
// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0,
// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS);
auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS,
"Enable reaction wheel 1", gpio::OUT, gpio::LOW); "Enable reaction wheel 1", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);

View File

@ -144,47 +144,47 @@ void RwHandler::fillCommandAndReplyMap() {
ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
uint8_t replyByte = *start;
switch (*(start)) { switch (replyByte) {
case (static_cast<uint8_t>(RwDefinitions::GET_LAST_RESET_STATUS)): { case (RwDefinitions::GET_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RESET_STATUS; *foundLen = RwDefinitions::SIZE_GET_RESET_STATUS;
*foundId = RwDefinitions::GET_LAST_RESET_STATUS; *foundId = RwDefinitions::GET_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::CLEAR_LAST_RESET_STATUS)): { case (RwDefinitions::CLEAR_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS; *foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS;
*foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS; *foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_RW_STATUS)): { case (RwDefinitions::GET_RW_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RW_STATUS; *foundLen = RwDefinitions::SIZE_GET_RW_STATUS;
*foundId = RwDefinitions::GET_RW_STATUS; *foundId = RwDefinitions::GET_RW_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::INIT_RW_CONTROLLER)): { case (RwDefinitions::INIT_RW_CONTROLLER): {
*foundLen = RwDefinitions::SIZE_INIT_RW; *foundLen = RwDefinitions::SIZE_INIT_RW;
*foundId = RwDefinitions::INIT_RW_CONTROLLER; *foundId = RwDefinitions::INIT_RW_CONTROLLER;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::SET_SPEED)): { case (RwDefinitions::SET_SPEED): {
*foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY; *foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY;
*foundId = RwDefinitions::SET_SPEED; *foundId = RwDefinitions::SET_SPEED;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TEMPERATURE)): { case (RwDefinitions::GET_TEMPERATURE): {
*foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY; *foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY;
*foundId = RwDefinitions::GET_TEMPERATURE; *foundId = RwDefinitions::GET_TEMPERATURE;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TM)): { case (RwDefinitions::GET_TM): {
*foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY; *foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY;
*foundId = RwDefinitions::GET_TM; *foundId = RwDefinitions::GET_TM;
break; break;
} }
default: { default: {
sif::debug << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" <<
std::endl;
return RETURN_FAILED; return RETURN_FAILED;
break;
} }
} }