v1.9.0 #175

Merged
muellerr merged 623 commits from develop into main 2022-03-08 10:32:41 +01:00
7 changed files with 71 additions and 5 deletions
Showing only changes of commit 2ed0bdf132 - Show all commits

View File

@ -639,7 +639,7 @@ class HistogramSet:
public: public:
// Size of dataset // Size of dataset
static const size_t SIZE = 154; static const size_t SIZE = 156;
HistogramSet(HasLocalDataPoolIF* owner): HistogramSet(HasLocalDataPoolIF* owner):
StaticLocalDataSet(owner, HISTOGRAM_SET_ID) { StaticLocalDataSet(owner, HISTOGRAM_SET_ID) {

View File

@ -1411,8 +1411,7 @@ ReturnValue_t StarTrackerHandler::handleHistogramTm() {
if(status != StarTracker::STATUS_OK) { if(status != StarTracker::STATUS_OK) {
sif::warning << "StarTrackerHandler::handleHistogramTm: Reply error: " sif::warning << "StarTrackerHandler::handleHistogramTm: Reply error: "
<< static_cast<unsigned int>(status) << std::endl; << static_cast<unsigned int>(status) << std::endl;
result = HISTOGRAM_REQ_FAILED; return HISTOGRAM_REQ_FAILED;
return result;
} }
result = histogramSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT); result = histogramSet.read(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) { if (result != RETURN_OK) {
@ -1425,6 +1424,10 @@ ReturnValue_t StarTrackerHandler::handleHistogramTm() {
sif::warning << "StarTrackerHandler::handleHistogramTm: Deserialization failed" sif::warning << "StarTrackerHandler::handleHistogramTm: Deserialization failed"
<< std::endl; << std::endl;
} }
result = histogramSet.commit(TIMEOUT_TYPE, MUTEX_TIMEOUT);
if (result != RETURN_OK) {
return result;
}
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_STARTRACKER == 1
histogramSet.printSet(); histogramSet.printSet();
#endif #endif

View File

@ -266,3 +266,44 @@ ReturnValue_t ACUHandler::initializeLocalDataPool(
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t ACUHandler::deviceSpecificCommand(DeviceCommandId_t cmd) {
switch(cmd) {
case PRINT_CHANNEL_STATS: {
printChannelStats();
return RETURN_OK;
}
default: {
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
}
}
void ACUHandler::printChannelStats() {
PoolReadGuard pg(&acuHkTableDataset);
sif::info << "ACU Info: Stats, Current [mA], Voltage [mV]" << std::endl;
sif::info << std::setw(30) << std::left << "Ch0" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel0.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel0.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch1" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel1.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel1.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch2" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel2.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel2.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch3" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel3.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel3.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch4" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel4.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel4.value << ", "
<< std::setw(4) << std::endl;
sif::info << std::setw(30) << std::left << "Ch5" << std::dec << "| " <<
static_cast<unsigned int>(acuHkTableDataset.currentInChannel5.value) << ", " <<
std::setw(4) << std::right << acuHkTableDataset.voltageInChannel5.value << ", "
<< std::setw(4) << std::endl;
}

View File

@ -3,6 +3,7 @@
#include "GomspaceDeviceHandler.h" #include "GomspaceDeviceHandler.h"
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h> #include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
#include "fsfw/datapool/PoolReadGuard.h"
/** /**
* @brief Handler for the ACU from Gomspace. Monitors and controls the battery charging via * @brief Handler for the ACU from Gomspace. Monitors and controls the battery charging via
@ -25,8 +26,12 @@ protected:
*/ */
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
virtual ReturnValue_t deviceSpecificCommand(DeviceCommandId_t cmd) override;
private: private:
static const DeviceCommandId_t PRINT_CHANNEL_STATS = 51;
ACU::HkTableDataset acuHkTableDataset; ACU::HkTableDataset acuHkTableDataset;
/** /**
@ -34,6 +39,11 @@ private:
* the values in the acuHkTableDataset. * the values in the acuHkTableDataset.
*/ */
void parseHkTableReply(const uint8_t *packet); void parseHkTableReply(const uint8_t *packet);
/**
* @brief Prints channel statistics (current and voltage) to console
*/
void printChannelStats();
}; };
#endif /* MISSION_DEVICES_ACUHANDLER_H_ */ #endif /* MISSION_DEVICES_ACUHANDLER_H_ */

View File

@ -87,7 +87,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(
break; break;
} }
default: default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return deviceSpecificCommand(deviceCommand);
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -398,6 +398,10 @@ LocalPoolDataSetBase* GomspaceDeviceHandler::getDataSetHandle(sid_t sid) {
} }
} }
ReturnValue_t GomspaceDeviceHandler::deviceSpecificCommand(DeviceCommandId_t cmd) {
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
void GomspaceDeviceHandler::setModeNormal() { void GomspaceDeviceHandler::setModeNormal() {
mode = MODE_NORMAL; mode = MODE_NORMAL;
} }

View File

@ -105,6 +105,11 @@ protected:
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
/**
* @brief Can be used by gomspace devices to implement device specific commands.
*/
virtual ReturnValue_t deviceSpecificCommand(DeviceCommandId_t cmd);
private: private:
/** /**

View File

@ -25,7 +25,10 @@ static const uint8_t REBOOT_PORT = 4;
static const uint8_t PARAM_PORT = 7; static const uint8_t PARAM_PORT = 7;
static const uint8_t P60_PORT_GNDWDT_RESET = 9; static const uint8_t P60_PORT_GNDWDT_RESET = 9;
/* Device commands are derived from the rparam.h of the gomspace lib */ /**
* Device commands are derived from the rparam.h of the gomspace lib..
* IDs above 50 are reserved for device specific commands.
*/
static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t PING = 1; //!< [EXPORT] : [COMMAND]
static const DeviceCommandId_t NONE = 2; // Set when no command is pending static const DeviceCommandId_t NONE = 2; // Set when no command is pending
static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND] static const DeviceCommandId_t REBOOT = 4; //!< [EXPORT] : [COMMAND]