added heater 1

This commit is contained in:
Martin Zietz 2021-02-12 14:18:34 +01:00
commit c45e2a71d9
11 changed files with 468 additions and 17 deletions

View File

@ -500,3 +500,30 @@ GET out_en[0] = 1
* Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel)
* Remote File Path: /tmp/eive_obsw.elf
## Libgpiod
Detect all gpio device files:
````
gpiodetect
````
Get info about a specific gpio group:
````
gpioinfo <name of gpio group>
````
The following sets the gpio 18 from gpio group gpiochip7 to high level.
````
gpioset gpiochip7 18=1
````
Setting the gpio to low.
````
gpioset gpiochip7 18=0
````
Show options for setting gpios.
````
gpioset -h
````
To get the state of a gpio:
````
gpioget <gpiogroup> <offset>
````
Example to get state:
gpioget gpiochip7 14

View File

@ -105,9 +105,12 @@ void ObjectFactory::produce(){
gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater);
#else
/* Pin H2-11 on stack connector */
GpioConfig_t gpioConfigHeater0(std::string("gpiochip5"), 20,
GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18,
std::string("Heater0"), Gpio::OUT);
gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
GpioConfig_t gpioConfigHeater1(std::string("gpiochip7"), 14,
std::string("Heater1"), Gpio::OUT);
gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
#endif
new LinuxLibgpioIF(objects::GPIO_IF);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER,

View File

@ -12,10 +12,11 @@
// debugging.
#define OBSW_ENHANCED_PRINTOUT 1
#define TE0720 0
#define TE0720 0
#define PDU2_DEBUG 0
#define PDU1_DEBUG 0
#define P60DOCK_DEBUG 0
#define PDU1_DEBUG 0
#define PDU2_DEBUG 0
#include "OBSWVersion.h"

View File

@ -5,7 +5,14 @@
namespace gpioIds {
enum gpioId_t {
HEATER_0
HEATER_0,
HEATER_1,
HEATER_2,
HEATER_3,
HEATER_4,
HEATER_5,
HEATER_6,
HEATER_7,
};
}

View File

@ -3,7 +3,14 @@
namespace heaterSwitches {
enum switcherList: uint8_t {
PAYLOAD_CAMERA,
HEATER_0,
HEATER_1,
HEATER_2,
HEATER_3,
HEATER_4,
HEATER_5,
HEATER_6,
HEATER_7,
NUMBER_OF_SWITCHES
};
}

View File

@ -33,7 +33,7 @@ public:
*/
GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF,
CookieIF * comCookie, uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress,
uint16_t hkTableSize, LocalPoolDataSetBase* hkTableDataset);
uint16_t hkTableReplySize, LocalPoolDataSetBase* hkTableDataset);
virtual ~GomspaceDeviceHandler();
protected:

View File

@ -305,9 +305,12 @@ bool HeaterHandler::allSwitchesOff() {
gpioId_t HeaterHandler::getGpioIdFromSwitchNr(int switchNr) {
gpioId_t gpioId = 0xFFFF;
switch(switchNr) {
case heaterSwitches::PAYLOAD_CAMERA:
case heaterSwitches::HEATER_0:
gpioId = gpioIds::HEATER_0;
break;
case heaterSwitches::HEATER_1:
gpioId = gpioIds::HEATER_1;
break;
default:
sif::error << "HeaterHandler::getGpioIdFromSwitchNr: Unknown heater switch number"
<< std::endl;

View File

@ -1,15 +1,388 @@
#include "P60DockHandler.h"
#include "OBSWConfig.h"
P60DockHandler::P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) :
GomspaceDeviceHandler(objectId, comIF, comCookie, P60Dock::MAX_CONFIGTABLE_ADDRESS,
P60Dock::MAX_HKTABLE_ADDRESS, P60Dock::HK_TABLE_SIZE, &p60dockHkTableDataset), p60dockHkTableDataset(
P60Dock::MAX_HKTABLE_ADDRESS, P60Dock::HK_TABLE_REPLY_SIZE, &p60dockHkTableDataset), p60dockHkTableDataset(
this) {
}
P60DockHandler::~P60DockHandler() {
}
ReturnValue_t P60DockHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) {
*id = GOMSPACE::REQUEST_HK_TABLE;
return buildCommandFromCommand(*id, NULL, 0);
}
void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet);
/**
* Hk table will be sent to the commander if hk table request was not triggered by the
* P60DockHandler itself.
*/
handleDeviceTM(&p60dockHkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && P60DOCK_DEBUG == 1
p60dockHkTableDataset.read();
float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1;
sif::info << "P60 Dock: Temperature 1: " << temperatureC << " °C" << std::endl;
temperatureC = p60dockHkTableDataset.temperature2.value * 0.1;
sif::info << "P60 Dock: Temperature 2: " << temperatureC << " °C" << std::endl;
sif::info << "P60 Dock: Watchdog Timer seconds left before reboot: "
<< p60dockHkTableDataset.wdtGndLeft << " seconds" << std::endl;
sif::info << "P60 Dock: CSP 1, pings left before reboot: "
<< (int) p60dockHkTableDataset.wdtCspLeft1.value << std::endl;
sif::info << "P60 Dock: CSP 2, pings left before reboot: "
<< (int) p60dockHkTableDataset.wdtCspLeft1.value << std::endl;
p60dockHkTableDataset.commit();
#endif
}
void P60DockHandler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0;
p60dockHkTableDataset.read();
/**
* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address.
*/
dataOffset += 12;
p60dockHkTableDataset.currentAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentX3IdleVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentX3IdleVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentPdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStackVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.currentGS5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageX3IdleVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageX3IdleVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltagePdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStackVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.voltageGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.outputEnableStateAcuVcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu1Vcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateX3IdleVcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu2Vcc = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateAcuVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu1Vbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateX3IdleVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStatePdu2Vbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStackVbat = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStack3V3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateStack5V = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateGS3V3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.outputEnableStateGS5V = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.temperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.temperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.bootcause = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.bootCount = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.uptime = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.resetcause = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.battMode = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.heaterOn = *(packet + dataOffset);
/* + 13 because here begins a new gomspace csp data field */
dataOffset += 13;
p60dockHkTableDataset.converter5VStatus = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.latchupsAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsAcuVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu1Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsX3IdleVcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu2Vcc = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsAcuVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu1Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsX3IdleVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsPdu2Vbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStackVbat = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStack3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsStack5V = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.latchupsGS3V3 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.vbatVoltageValue = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.vccCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryVoltage = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryTemperature1 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryTemperature2 = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.device0 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device1 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device2 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device3 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device4 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device5 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device6 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device7 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device0Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device1Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device2Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device3Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device4Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device5Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device6Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.device7Status = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.dearmStatus = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.wdtCntGnd = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntI2c = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCan = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCsp1 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCntCsp2 = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtGndLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtI2cLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
dataOffset += 6;
p60dockHkTableDataset.wdtCanLeft = *(packet + dataOffset) << 24 | *(packet + dataOffset + 1) << 16 | *(packet + dataOffset + 2) << 8 | *(packet + dataOffset + 3);
/* +16 because here begins a new gomspace csp packet */
dataOffset += 16;
p60dockHkTableDataset.wdtCspLeft1 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.wdtCspLeft2 = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.batteryChargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.batteryDischargeCurrent = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;
p60dockHkTableDataset.ant6Depl = *(packet + dataOffset);
dataOffset += 3;
p60dockHkTableDataset.ar6Depl = *(packet + dataOffset);
p60dockHkTableDataset.commit();
}
ReturnValue_t P60DockHandler::initializeLocalDataPool(
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_ACU_VCC, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU1_VCC, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_X3_IDLE_VCC, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU2_VCC, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_ACU_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU1_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_X3_IDLE_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_PDU2_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_3V3, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_STACK_5V, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_GS3V3, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CURRENT_GS5V, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_ACU_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU1_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_X3_IDLE_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU2_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_ACU_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU1_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_X3_IDLE_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_PDU2_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_3V3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_STACK_5V, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_GS3V3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VOLTAGE_GS5V, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_ACU_VCC, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU1_VCC, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VCC, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU2_VCC, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_ACU_VBAT, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU1_VBAT, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_PDU2_VBAT, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_VBAT, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_3V3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_STACK_5V, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_GS3V3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_OUTPUTENABLE_GS5V, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_TEMPERATURE_1, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_TEMPERATURE_2, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BOOT_CAUSE, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BOOT_CNT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_UPTIME, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_RESETCAUSE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_HEATER_ON, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_CONV_5V_ENABLE_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_ACU_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU1_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU2_VCC, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_ACU_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU1_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_PDU2_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_VBAT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_3V3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_STACK_5V, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_GS3V3, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_LATCHUP_GS5V, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VBAT_VALUE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_VCC_CURRENT_VALUE, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_CURRENT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_VOLTAGE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_TEMPERATURE_1, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATTERY_TEMPERATURE_2, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_0, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_4, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_5, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_6, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_7, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_0_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_1_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_2_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_3_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_4_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_5_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_6_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEVICE_7_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_DEARM_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_GND, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_I2C, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CAN, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CSP_1, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CNT_CSP_2, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_GND_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_I2C_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CAN_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CSP_LEFT_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_WDT_CSP_LEFT_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_CHARGE_CURRENT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_BATT_DISCHARGE_CURRENT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_ANT6_DEPL, new PoolEntry<int8_t>( { 0 }));
localDataPoolMap.emplace(P60System::P60DOCK_AR6_DEPL, new PoolEntry<int8_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -14,11 +14,26 @@ public:
P60DockHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie);
virtual ~P60DockHandler();
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
protected:
/**
* @brief As soon as the device is in MODE_NORMAL, this function is executed periodically.
*/
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) override;
private:
P60Dock::HkTableDataset p60dockHkTableDataset;
/**
* @brief Function extracts the hk table information from the received csp packet and stores
* the values in the p60dockHkTableDataset.
*/
void parseHkTableReply(const uint8_t *packet);
};
#endif /* MISSION_DEVICES_P60DOCKHANDLER_H_ */

View File

@ -20,6 +20,10 @@ ReturnValue_t PDU2Handler::buildNormalDeviceCommand(
void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) {
parseHkTableReply(packet);
/**
* Hk table will be sent to the commander if hk table request was not triggered by the
* PDU2Handler itself.
*/
handleDeviceTM(&pdu2HkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && PDU2_DEBUG == 1
@ -63,8 +67,10 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac
void PDU2Handler::parseHkTableReply(const uint8_t *packet) {
uint16_t dataOffset = 0;
pdu2HkTableDataset.read();
/* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address. */
/**
* Fist 10 bytes contain the gomspace header. Each variable is preceded by the 16-bit table
* address.
*/
dataOffset += 12;
pdu2HkTableDataset.currentOutQ7S = *(packet + dataOffset) << 8 | *(packet + dataOffset + 1);
dataOffset += 4;

View File

@ -369,6 +369,12 @@ namespace P60Dock {
static const uint8_t HK_TABLE_DATA_SET_ID = 0x3;
static const uint8_t HK_TABLE_ENTRIES = 100;
/**
* Requesting the full housekeeping table from the P60 dock will generate a reply comprising
* 402 bytes of data.
*/
static const uint16_t HK_TABLE_REPLY_SIZE = 407;
/**
* @brief This class defines a dataset for the hk table of the P60 Dock.
*/
@ -401,7 +407,7 @@ namespace P60Dock {
P60System::P60DOCK_CURRENT_X3_IDLE_VBAT, this);
lp_var_t<int16_t> currentPdu2Vbat = lp_var_t<int16_t>(sid.objectId,
P60System::P60DOCK_CURRENT_PDU2_VBAT, this);
lp_var_t<int16_t> currentStackVbata = lp_var_t<int16_t>(sid.objectId,
lp_var_t<int16_t> currentStackVbat = lp_var_t<int16_t>(sid.objectId,
P60System::P60DOCK_CURRENT_STACK_VBAT, this);
lp_var_t<int16_t> currentStack3V3 = lp_var_t<int16_t>(sid.objectId,
P60System::P60DOCK_CURRENT_STACK_3V3, this);
@ -429,7 +435,7 @@ namespace P60Dock {
P60System::P60DOCK_VOLTAGE_X3_IDLE_VBAT, this);
lp_var_t<uint16_t> voltagePdu2Vbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_VOLTAGE_PDU2_VBAT, this);
lp_var_t<uint16_t> voltageStackVbata = lp_var_t<uint16_t>(sid.objectId,
lp_var_t<uint16_t> voltageStackVbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_VOLTAGE_STACK_VBAT, this);
lp_var_t<uint16_t> voltageStack3V3 = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_VOLTAGE_STACK_3V3, this);
@ -457,7 +463,7 @@ namespace P60Dock {
P60System::P60DOCK_OUTPUTENABLE_X3_IDLE_VBAT, this);
lp_var_t<uint8_t> outputEnableStatePdu2Vbat = lp_var_t<uint8_t>(sid.objectId,
P60System::P60DOCK_OUTPUTENABLE_PDU2_VBAT, this);
lp_var_t<uint8_t> outputEnableStateStackVbata = lp_var_t<uint8_t>(sid.objectId,
lp_var_t<uint8_t> outputEnableStateStackVbat = lp_var_t<uint8_t>(sid.objectId,
P60System::P60DOCK_OUTPUTENABLE_STACK_VBAT, this);
lp_var_t<uint8_t> outputEnableStateStack3V3 = lp_var_t<uint8_t>(sid.objectId,
P60System::P60DOCK_OUTPUTENABLE_STACK_3V3, this);
@ -506,7 +512,7 @@ namespace P60Dock {
P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, this);
lp_var_t<uint16_t> latchupsPdu2Vbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_PDU2_VBAT, this);
lp_var_t<uint16_t> latchupsStackVbata = lp_var_t<uint16_t>(sid.objectId,
lp_var_t<uint16_t> latchupsStackVbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_STACK_VBAT, this);
lp_var_t<uint16_t> latchupsStack3V3 = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_STACK_3V3, this);
@ -567,6 +573,8 @@ namespace P60Dock {
lp_var_t<uint8_t> dearmStatus = lp_var_t<uint8_t>(sid.objectId,
P60System::P60DOCK_DEARM_STATUS, this);
/** Number of reboots due to gnd, i2c, csp watchdog timeout */
lp_var_t<uint32_t> wdtCntGnd = lp_var_t<uint32_t>(sid.objectId,
P60System::P60DOCK_WDT_CNT_GND, this);
lp_var_t<uint32_t> wdtCntI2c = lp_var_t<uint32_t>(sid.objectId,
@ -577,6 +585,7 @@ namespace P60Dock {
P60System::P60DOCK_WDT_CNT_CSP_1, this);
lp_var_t<uint32_t> wdtCntCsp2 = lp_var_t<uint32_t>(sid.objectId,
P60System::P60DOCK_WDT_CNT_CSP_2, this);
lp_var_t<uint32_t> wdtGndLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::P60DOCK_WDT_GND_LEFT, this);
lp_var_t<uint32_t> wdtI2cLeft = lp_var_t<uint32_t>(sid.objectId,
@ -589,7 +598,7 @@ namespace P60Dock {
P60System::P60DOCK_WDT_CSP_LEFT_2, this);
lp_var_t<int16_t> batteryChargeCurrent = lp_var_t<int16_t>(sid.objectId,
P60System::P60DOCK_BATT_CHARGE_CURRENT, this);
lp_var_t<int16_t> batteryDishargeCurrent = lp_var_t<int16_t>(sid.objectId,
lp_var_t<int16_t> batteryDischargeCurrent = lp_var_t<int16_t>(sid.objectId,
P60System::P60DOCK_BATT_DISCHARGE_CURRENT, this);
lp_var_t<int8_t> ant6Depl = lp_var_t<int8_t>(sid.objectId,
P60System::P60DOCK_ANT6_DEPL, this);