@@ -238,19 +238,25 @@ void ConfigRevoWidget::storeAndClearBoardRotation()
238238 if (!isBoardRotationStored) {
239239 UAVObjectUpdaterHelper updateHelper;
240240
241- // Store current board rotation
241+ // Store current board rotation and board level trim
242242 isBoardRotationStored = true ;
243243 AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance (getObjectManager ());
244244 Q_ASSERT (attitudeSettings);
245245 AttitudeSettings::DataFields data = attitudeSettings->getData ();
246- storedBoardRotation[AttitudeSettings::BOARDROTATION_YAW] = data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW];
247- storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL];
248- storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH];
246+ storedBoardRotation[AttitudeSettings::BOARDROTATION_YAW] = data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW];
247+ storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL] = data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL];
248+ storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH] = data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH];
249+ storedBoardLevelTrim[AttitudeSettings::BOARDLEVELTRIM_ROLL] = data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_ROLL];
250+ storedBoardLevelTrim[AttitudeSettings::BOARDLEVELTRIM_PITCH] = data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_PITCH];
249251
250- // Set board rotation to no rotation
251- data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW] = 0 ;
252- data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL] = 0 ;
253- data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH] = 0 ;
252+ // Set board rotation to zero
253+ data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW] = 0 ;
254+ data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL] = 0 ;
255+ data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH] = 0 ;
256+
257+ // Set board level trim to zero
258+ data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_ROLL] = 0 ;
259+ data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_PITCH] = 0 ;
254260
255261 attitudeSettings->setData (data, false );
256262 updateHelper.doObjectAndWait (attitudeSettings);
@@ -281,13 +287,15 @@ void ConfigRevoWidget::recallBoardRotation()
281287 // Recall current board rotation
282288 isBoardRotationStored = false ;
283289
284- // Restore the flight controller board rotation
290+ // Restore the flight controller board rotation and board level trim
285291 AttitudeSettings *attitudeSettings = AttitudeSettings::GetInstance (getObjectManager ());
286292 Q_ASSERT (attitudeSettings);
287293 AttitudeSettings::DataFields data = attitudeSettings->getData ();
288- data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW] = storedBoardRotation[AttitudeSettings::BOARDROTATION_YAW];
289- data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL] = storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL];
290- data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH];
294+ data.BoardRotation [AttitudeSettings::BOARDROTATION_YAW] = storedBoardRotation[AttitudeSettings::BOARDROTATION_YAW];
295+ data.BoardRotation [AttitudeSettings::BOARDROTATION_ROLL] = storedBoardRotation[AttitudeSettings::BOARDROTATION_ROLL];
296+ data.BoardRotation [AttitudeSettings::BOARDROTATION_PITCH] = storedBoardRotation[AttitudeSettings::BOARDROTATION_PITCH];
297+ data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_ROLL] = storedBoardLevelTrim[AttitudeSettings::BOARDLEVELTRIM_ROLL];
298+ data.BoardLevelTrim [AttitudeSettings::BOARDLEVELTRIM_PITCH] = storedBoardLevelTrim[AttitudeSettings::BOARDLEVELTRIM_PITCH];
291299
292300 attitudeSettings->setData (data, false );
293301 updateHelper.doObjectAndWait (attitudeSettings);
0 commit comments