ETP 520 Update gains system

Wikis > ETP 520 Update gains system

1.1 To update the Gain control system in DRONA firmware (set gain and get gain)


2.1 Drona:, version: 816ee47


3.1 The gain system for DRONA can be summarized in the following table:


3.2 At the timing of writing, the gain update system has been implemented only the get gain function: SDP_Build_Gains_Packet(). Note that the parameter SDGetGainsCmd* cmd is necessary for the function call because the gain type is determined by the request (please see 3.3)
3.3 There are three gain types: roll, pitch, and yaw. To response the get gain request from WiRa, we need to update the field in the gains packet (SDGainsPacket defined in SDPackets.h). The GainMask defined in the request command (SDGetGainsCmd) is to specify the gain type.
3.4 Read 9 gains from PIDPitch, PIDRoll, or PIDYaw, and write the 9 gains into the SPI Tx buffer (WRTXPacket). These were done by FC_PID_Get_Gains().
3.5 SDP_Process_Set_Gains_Command () is defined for setting gains, but hasn’t be implemented yet at the time of writing. To implement the set gain function, please refer to DFP_Process_set_Gains_Command() in DFProtocol.c. The API for setting gains provided by flight control is FC_PID_Set_xxx_yyy (please see the table above).