ETP 519 Update Sensor/State packet

Wikis > ETP 519 Update Sensor/State packet

1.1 To add/modify a state packet on DRONA firmware for WiRa_Board option


2.1 Drona:, version: 816ee47


3.1 The state packet requests are from WiRa, then the states will be sent back to WiRa. Currently, the state packets are STATE, SENSOR, GPS, and GAINS. Note that The GPS packet is unimplemented since GPS had not been interfaced then. For more details about the gains system, please check the ETP-520.
3.2 Every state packet request has its own command ID. The created ID should be put in SDCommands.h. For example, there are SDGetGainsCmdID, SDGetSensorsCmdID, SDGetGPSCmdID, and SDGetStateCmdID.
3.3 The function SDP_Process_Command() processes the commands and remember to update the variable PacketState to STATE_PACKET for each command.
3.4 SDP_Continue() determines what kind of the packets should be built. The build packet function should be called here. (e.g. SDP_Build_Sensor_Packet()).
3.5 Update the WHICH_PACKET enum which is defined in SDProtocol.c. Each state packet has its own number in the enum. That will be used for 3.4.
3.6 The packet structures are defined in SDProtocol.c (e.g. SDStatePacket, SDSensorPacket, and SDGPSPacket). The structure must follow the protocol. For more details about the SPI frame structure (protocol), please check the readme file ( under Selfi-Drone-Flight-Control (the codebase) directory.
3.6.1 Note that for all the state packet requests, the “Response” field in the packet header must be set to 1.
3.7 To build the state packets, please refer to functions “SDP_Build_xxx_Packet()”. You just need to fill the values you want in the structure fields.
3.8 Note that for the client APP, the command sets should be consistent with those defined in DRONA.