added debug printouts
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-02-02 17:53:07 +01:00
parent 7d5b4325e2
commit fea0b2bfe9
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -1,4 +1,7 @@
#include "BpxBatteryHandler.h"
#include "OBSWConfig.h"
#include <fsfw/datapool/PoolReadGuard.h>
BpxBatteryHandler::BpxBatteryHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
: 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) {
if(state == States::CHECK_COM) {
*id = BpxBattery::PING;
return buildCommandFromCommand(*id, nullptr, 0);
}
return HasReturnvaluesIF::RETURN_OK;
}
@ -47,7 +54,7 @@ ReturnValue_t BpxBatteryHandler::buildCommandFromCommand(DeviceCommandId_t devic
size_t commandDataLen) {
switch (deviceCommand) {
case (BpxBattery::PING): {
if (commandDataLen == 1) {
if (commandDataLen == 1 and commandData != nullptr) {
sentPingByte = commandData[0];
} else {
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) {
switch (id) {
case (BpxBattery::GET_HK): {
PoolReadGuard rg(&hkSet);
ReturnValue_t result = hkSet.parseRawHk(packet, 21);
if (result != HasReturnvaluesIF::RETURN_OK) {
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;
}
case (BpxBattery::PING): {
@ -197,6 +218,7 @@ ReturnValue_t BpxBatteryHandler::interpretDeviceReply(DeviceCommandId_t id, cons
break;
}
case (BpxBattery::CONFIG_GET): {
PoolReadGuard rg(&cfgSet);
ReturnValue_t result = cfgSet.parseRawHk(packet, 3);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;