Heater Health IF #236
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit c0ff84bb9d81bc3444992fef38b74d260d54d5a0
|
||||
Subproject commit 02473a0cd7a71e2eac0479959ef576fd4b81e981
|
@ -47,10 +47,6 @@ ReturnValue_t HeaterHandler::performOperation(uint8_t operationCode) {
|
||||
for (const auto& heater : helper.heaters) {
|
||||
heater.first->performOperation(0);
|
||||
}
|
||||
// for (const auto& heater : heaterVec) {
|
||||
// sif::info << heater.switchState << ",";
|
||||
// }
|
||||
// sif::info << std::endl;
|
||||
} catch (const std::out_of_range& e) {
|
||||
sif::warning << "HeaterHandler::performOperation: "
|
||||
"Out of range error | "
|
||||
@ -110,7 +106,7 @@ void HeaterHandler::readCommandQueue() {
|
||||
|
||||
ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) {
|
||||
if (data == nullptr or size < 2) {
|
||||
if (data == nullptr or size < 3) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
if (actionId != SWITCH_HEATER) {
|
||||
@ -126,6 +122,15 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t
|
||||
health == HasHealthIF::NEEDS_RECOVERY) {
|
||||
return HasHealthIF::OBJECT_NOT_HEALTHY;
|
||||
}
|
||||
CmdSourceParam cmdSource = CmdSourceParam::EXTERNAL;
|
||||
uint8_t cmdSourceRaw = data[2];
|
||||
if(cmdSourceRaw > 1) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
cmdSource = static_cast<CmdSourceParam>(data[2]);
|
||||
if(health == HasHealthIF::EXTERNAL_CONTROL and cmdSource == CmdSourceParam::INTERNAL) {
|
||||
return HasHealthIF::IS_EXTERNALLY_CONTROLLED;
|
||||
}
|
||||
if (heater.active) {
|
||||
return COMMAND_ALREADY_WAITING;
|
||||
}
|
||||
@ -142,16 +147,18 @@ ReturnValue_t HeaterHandler::executeAction(ActionId_t actionId, MessageQueueId_t
|
||||
ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
|
||||
ReturnValue_t result;
|
||||
store_address_t storeAddress;
|
||||
uint8_t commandData[2] = {};
|
||||
uint8_t commandData[3] = {};
|
||||
|
||||
switch (onOff) {
|
||||
case PowerSwitchIF::SWITCH_ON:
|
||||
commandData[0] = switchNr;
|
||||
commandData[1] = SET_SWITCH_ON;
|
||||
commandData[2] = CmdSourceParam::INTERNAL;
|
||||
break;
|
||||
case PowerSwitchIF::SWITCH_OFF:
|
||||
commandData[0] = switchNr;
|
||||
commandData[1] = SET_SWITCH_OFF;
|
||||
commandData[2] = CmdSourceParam::INTERNAL;
|
||||
break;
|
||||
default:
|
||||
sif::error << "HeaterHandler::sendSwitchCommand: Invalid switch request" << std::endl;
|
||||
|
@ -46,6 +46,11 @@ class HeaterHandler : public ExecutableObjectIF,
|
||||
static const ReturnValue_t MAIN_SWITCH_SET_TIMEOUT = MAKE_RETURN_CODE(0xA4);
|
||||
static const ReturnValue_t COMMAND_ALREADY_WAITING = MAKE_RETURN_CODE(0xA5);
|
||||
|
||||
enum CmdSourceParam: uint8_t {
|
||||
INTERNAL = 0,
|
||||
EXTERNAL = 1
|
||||
};
|
||||
|
||||
/** Device command IDs */
|
||||
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
||||
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit eb4143e6b5144050abb6dfb965e74174d8bad063
|
||||
Subproject commit 8e20c2ab0879e5b483308d0feb4aeb5951ce00c9
|
Loading…
Reference in New Issue
Block a user