IMTQ dipole actuation command, wip

This commit is contained in:
Jakob Meier 2021-03-19 15:33:43 +01:00
parent 9a55eb5508
commit 97c5d01d2e
2 changed files with 34 additions and 10 deletions

View File

@ -47,9 +47,16 @@ ReturnValue_t IMTQHandler::buildCommandFromCommand(
return RETURN_OK; return RETURN_OK;
} }
case(IMTQ::START_ACTUATION_DIPOLE): { case(IMTQ::START_ACTUATION_DIPOLE): {
/* IMTQ expects low byte first */
commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE; commandBuffer[0] = IMTQ::CC::START_ACTUATION_DIPOLE;
commandBuffer[1] = *(commandData + 1); commandBuffer[1] = *(commandData + 1);
commandBuffer[2] = *(commandData + 2); commandBuffer[2] = *(commandData);
commandBuffer[3] = *(commandData + 3);
commandBuffer[4] = *(commandData + 2);
commandBuffer[5] = *(commandData + 5);
commandBuffer[6] = *(commandData + 4);
commandBuffer[7] = *(commandData + 7);
commandBuffer[8] = *(commandData + 6);
rawPacket = commandBuffer; rawPacket = commandBuffer;
return RETURN_OK; return RETURN_OK;
} }

View File

@ -84,6 +84,9 @@ public:
/** /**
* @brief This class can be used to ease the generation of an action message commanding the * @brief This class can be used to ease the generation of an action message commanding the
* IMTQHandler to configure the magnettorquer with the desired dipoles. * IMTQHandler to configure the magnettorquer with the desired dipoles.
*
* @details Deserialize the packet, write the deserialized data to the ipc store and store the
* the ipc store address in the action message.
*/ */
class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> { class CommandDipolePacket : public SerialLinkedListAdapter<SerializeIF> {
public: public:
@ -93,16 +96,30 @@ public:
} }
private: private:
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole);
void setLinks() { /**
setStart(&cspPort); * @brief Constructor
cspPort.setNext(&querySize); *
querySize.setNext(&magic); * @param xDipole The dipole of the x coil in 10^-4*Am^2
* @param yDipole The dipole of the y coil in 10^-4*Am^2
* @param zDipole The dipole of the z coil in 10^-4*Am^2
* @param duration The duration in milliseconds the dipole will be generated by the coils.
* When set to 0, the dipole will be generated until a new dipole actuation
* command is sent.
*/
CommandDipolePacket(uint16_t xDipole, uint16_t yDipole, uint16_t zDipole) :
xDipole(xDipole), yDipole(yDipole), zDipole(zDipole), duration(duration) {
} }
SerializeElement<uint8_t> cspPort = GOMSPACE::P60_PORT_GNDWDT_RESET; void setLinks() {
SerializeElement<uint16_t> querySize = 1; setStart(&xDipole);
/* Sending 0x78 to port 9 of a gomspace device resets the ground watchdog */ xDipole.setNext(&yDipole);
SerializeElement<uint8_t> magic = 0x78; yDipole.setNext(&zDipole);
zDipole.setNext(&duration);
}
SerializeElement<uint16_t> xDipole;
SerializeElement<uint16_t> yDipole;
SerializeElement<uint16_t> zDipole;
SerializeElement<uint16_t> duration;
}; };
} }