PLOC SUPV Update to newer firmware #316

Merged
muellerr merged 99 commits from mueller/tas_ploc_supv_update into develop 2022-11-18 14:27:13 +01:00
3 changed files with 57 additions and 59 deletions
Showing only changes of commit c42eae9c17 - Show all commits

View File

@ -882,6 +882,37 @@ class RunAutoEmTests : public TcBase {
void initPacket(uint8_t test) { payloadStart[0] = test; }
};
/**
* @brief This class packages the space packet to enable or disable ADC channels.
*/
class SetAdcEnabledChannels : public TcBase {
public:
/**
* @brief Constructor
*
* @param ch Defines channels to be enabled or disabled.
*/
SetAdcEnabledChannels(TcParams params)
: TcBase(params, Apid::ADC_MON, static_cast<uint8_t>(tc::AdcMonId::SET_ENABLED_CHANNELS), 2) {
}
ReturnValue_t buildPacket(uint16_t ch) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(ch);
return calcAndSetCrc();
}
private:
void initPacket(uint16_t ch) {
size_t serializedSize = 0;
SerializeAdapter::serialize(&ch, &payloadStart, &serializedSize, sizeof(ch),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class packages the space packet change the state of a GPIO. This command is only
* required for ground testing.
@ -2000,37 +2031,6 @@ class DisableAutoTm : public TcBase {
static const uint8_t DISABLE = 0;
};
/**
* @brief This class packages the space packet to enable or disable ADC channels.
*/
class SetAdcEnabledChannels : public TcBase {
public:
/**
* @brief Constructor
*
* @param ch Defines channels to be enabled or disabled.
*/
SetAdcEnabledChannels(TcParams params)
: TcBase(params, Apid::ADC_MON, static_cast<uint8_t>(tc::AdcMonId::SET_ENABLED_CHANNELS), 2) {
}
ReturnValue_t buildPacket(uint16_t ch) {
auto res = checkSizeAndSerializeHeader();
if (res != returnvalue::OK) {
return res;
}
initPacket(ch);
return calcAndSetCrc();
}
private:
void initPacket(uint16_t ch) {
size_t serializedSize = 0;
SerializeAdapter::serialize(&ch, &payloadStart, &serializedSize, sizeof(ch),
SerializeIF::Endianness::BIG);
}
};
/**
* @brief This class creates the space packet to request the logging data from the supervisor
*/

View File

@ -299,6 +299,21 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
prepareEmptyCmd(Apid::BOOT_MAN, static_cast<uint8_t>(tc::BootManId::RESET_PL));
result = returnvalue::OK;
break;
}
case SET_ADC_ENABLED_CHANNELS: {
prepareSetAdcEnabledChannelsCmd(commandData);
result = returnvalue::OK;
break;
}
case SET_ADC_WINDOW_AND_STRIDE: {
prepareSetAdcWindowAndStrideCmd(commandData);
result = returnvalue::OK;
break;
}
case SET_ADC_THRESHOLD: {
prepareSetAdcThresholdCmd(commandData);
result = returnvalue::OK;
break;
}
// case ENABLE_NVMS: {
// result = prepareEnableNvmsCommand(commandData);
@ -342,22 +357,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
// result = returnvalue::OK;
// break;
// }
// case SET_ADC_ENABLED_CHANNELS: {
// prepareSetAdcEnabledChannelsCmd(commandData);
// result = returnvalue::OK;
// break;
// }
// case SET_ADC_WINDOW_AND_STRIDE: {
// prepareSetAdcWindowAndStrideCmd(commandData);
// result = returnvalue::OK;
// break;
// }
// case SET_ADC_THRESHOLD: {
// prepareSetAdcThresholdCmd(commandData);
// result = returnvalue::OK;
// break;
// }
// case ENABLE_AUTO_TM: {
// EnableAutoTm packet(spParams);
// result = packet.buildPacket();
@ -1452,17 +1451,16 @@ ReturnValue_t PlocSupervisorHandler::prepareSetAlertLimitCmd(const uint8_t* comm
return returnvalue::OK;
}
// ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData)
// {
// uint16_t ch = *(commandData) << 8 | *(commandData + 1);
// supv::SetAdcEnabledChannels packet(spParams);
// ReturnValue_t result = packet.buildPacket(ch);
// if (result != returnvalue::OK) {
// return result;
// }
// finishTcPrep(packet.getFullPacketLen());
// return returnvalue::OK;
// }
ReturnValue_t PlocSupervisorHandler::prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData) {
uint16_t ch = *(commandData) << 8 | *(commandData + 1);
supv::SetAdcEnabledChannels packet(spParams);
ReturnValue_t result = packet.buildPacket(ch);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(packet.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorHandler::prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData) {
uint8_t offset = 0;

View File

@ -281,7 +281,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
ReturnValue_t prepareLatchupConfigCmd(const uint8_t* commandData,
DeviceCommandId_t deviceCommand);
ReturnValue_t prepareSetAlertLimitCmd(const uint8_t* commandData);
// ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcEnabledChannelsCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcWindowAndStrideCmd(const uint8_t* commandData);
ReturnValue_t prepareSetAdcThresholdCmd(const uint8_t* commandData);
ReturnValue_t prepareRunAutoEmTest(const uint8_t* commandData);