acu hk tabel local pool, wip

This commit is contained in:
Jakob Meier 2021-02-12 14:31:43 +01:00
parent f26d104b42
commit 5ede7fabd5
3 changed files with 123 additions and 2 deletions

View File

@ -9,6 +9,114 @@ ACUHandler::ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCo
ACUHandler::~ACUHandler() {
}
ReturnValue_t ACUHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) {
*id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0);
}
void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
}
void ACUHandler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0;
acuHkTableDataset.read();
dataOffset += 12;
acuHkTableDataset.currentInChannel0 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
acuHkTableDataset.currentInChannel1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
acuHkTableDataset.currentInChannel2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
acuHkTableDataset.currentInChannel3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
acuHkTableDataset.currentInChannel4 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
acuHkTableDataset.currentInChannel5 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;<
acuHkTableDataset.commit();
}
ReturnValue_t ACUHandler::initializeLocalDataPool(
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL0, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL1, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL2, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL3, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL4, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL5, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL0, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL2, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL4, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_CURRENT_IN_CHANNEL5, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_TEMPERATURE_1, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_TEMPERATURE_2, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_TEMPERATURE_3, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_MPPT_MODE, new PoolEntry<uin8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL0, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL2, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL4, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_VBOOST_CHANNEL5, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL0, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL2, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL4, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_POWER_CHANNEL5, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_EN_0, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_EN_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_EN_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_0, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_2, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_4, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DAC_RAW_5, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_BOOTCAUSE, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_BOOTCNT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_UPTIME, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_RESET_CAUSE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_MPPT_TIME, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_MPPT_PERIOD, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_0, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_4, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_5, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_6, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_7, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_0_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_1_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_2_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_3_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_4_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_5_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_6_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_DEVICE_7_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_WDT_CNT_GND, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::ACU_WDT_GND_LEFT, new PoolEntry<uint32_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -12,13 +12,28 @@ class ACUHandler: public GomspaceDeviceHandler {
public:
ACUHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie);
virtual ~ACUHandler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
protected:
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override;
/**
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
private:
ACU::HkTableDataset acuHkTableDataset;
/**
* @brief Function extracts the hk table information from the received csp packet and stores
* the values in the acuHkTableDataset.
*/
void parseHkTableReply(const uint8_t *packet);
};
#endif /* MISSION_DEVICES_ACUHANDLER_H_ */

View File

@ -1153,8 +1153,6 @@ namespace ACU {
lp_var_t<uint32_t> bootCause = lp_var_t<uint32_t>(sid.objectId,
P60System::ACU_BOOTCAUSE, this);
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_t>(sid.objectId,
P60System::ACU_BOOTCAUSE, this);
lp_var_t<uint32_t> bootcnt = lp_var_t<uint32_t>(sid.objectId,
P60System::ACU_BOOTCNT, this);
lp_var_t<uint32_t> uptime = lp_var_t<uint32_t>(sid.objectId,