added debug printouts
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
7d5b4325e2
commit
fea0b2bfe9
@ -1,4 +1,7 @@
|
|||||||
#include "BpxBatteryHandler.h"
|
#include "BpxBatteryHandler.h"
|
||||||
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
|
|
||||||
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
|
||||||
: DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {}
|
: DeviceHandlerBase(objectId, comIF, comCookie), hkSet(this), cfgSet(this) {}
|
||||||
@ -30,6 +33,10 @@ ReturnValue_t BpxBatteryHandler::buildNormalDeviceCommand(DeviceCommandId_t* id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t BpxBatteryHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t BpxBatteryHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
|
if(state == States::CHECK_COM) {
|
||||||
|
*id = BpxBattery::PING;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +54,7 @@ ReturnValue_t BpxBatteryHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (BpxBattery::PING): {
|
case (BpxBattery::PING): {
|
||||||
if (commandDataLen == 1) {
|
if (commandDataLen == 1 and commandData != nullptr) {
|
||||||
sentPingByte = commandData[0];
|
sentPingByte = commandData[0];
|
||||||
} else {
|
} else {
|
||||||
sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
|
sentPingByte = BpxBattery::DEFAULT_PING_SENT_BYTE;
|
||||||
@ -172,10 +179,24 @@ ReturnValue_t BpxBatteryHandler::scanForReply(const uint8_t* start, size_t remai
|
|||||||
ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case (BpxBattery::GET_HK): {
|
case (BpxBattery::GET_HK): {
|
||||||
|
PoolReadGuard rg(&hkSet);
|
||||||
ReturnValue_t result = hkSet.parseRawHk(packet, 21);
|
ReturnValue_t result = hkSet.parseRawHk(packet, 21);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#if OBSW_DEBUG_BPX_BATT == 1
|
||||||
|
sif::info << "BPX Battery HK output:" << std::endl;
|
||||||
|
sif::info << "Charge current [mA]: " << hkSet.chargeCurrent << std::endl;
|
||||||
|
sif::info << "Discharge current [mA]; " << hkSet.dischargeCurrent << std::endl;
|
||||||
|
sif::info << "Heater current [mA]: " << hkSet.heaterCurrent << std::endl;
|
||||||
|
sif::info << "Battery voltage [mV]: " << hkSet.battVoltage << std::endl;
|
||||||
|
sif::info << "Battery Temperature 1 [C]: " << hkSet.battTemp1 << std::endl;
|
||||||
|
sif::info << "Battery Temperature 2 [C]: " << hkSet.battTemp2 << std::endl;
|
||||||
|
sif::info << "Battery Temperature 3 [C]: " << hkSet.battTemp3 << std::endl;
|
||||||
|
sif::info << "Battery Temperature 4 [C]: " << hkSet.battTemp4 << std::endl;
|
||||||
|
sif::info << "Battery Reboot Counter: " << hkSet.rebootCounter << std::endl;
|
||||||
|
sif::info << "Battery Boot Cause: " << hkSet.bootcause << std::endl;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (BpxBattery::PING): {
|
case (BpxBattery::PING): {
|
||||||
@ -197,6 +218,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (BpxBattery::CONFIG_GET): {
|
case (BpxBattery::CONFIG_GET): {
|
||||||
|
PoolReadGuard rg(&cfgSet);
|
||||||
ReturnValue_t result = cfgSet.parseRawHk(packet, 3);
|
ReturnValue_t result = cfgSet.parseRawHk(packet, 3);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user