@@ -58,6 +58,8 @@ static uint8_t tmpPidProfileIndex;
58
58
static uint8_t pidProfileIndex ;
59
59
static char pidProfileIndexString [] = " p" ;
60
60
static uint8_t buttered_pids ;
61
+ static uint8_t i_decay ;
62
+ static uint8_t r_weight ;
61
63
static uint8_t tempPid [3 ][3 ];
62
64
static uint16_t tempPidF [3 ];
63
65
@@ -119,6 +121,8 @@ static long cmsx_PidRead(void)
119
121
120
122
const pidProfile_t * pidProfile = pidProfiles (pidProfileIndex );
121
123
buttered_pids = pidProfile -> buttered_pids ;
124
+ i_decay = pidProfile -> i_decay ;
125
+ r_weight = pidProfile -> r_weight ;
122
126
for (uint8_t i = 0 ; i < 3 ; i ++ ) {
123
127
tempPid [i ][0 ] = pidProfile -> pid [i ].P ;
124
128
tempPid [i ][1 ] = pidProfile -> pid [i ].I ;
@@ -149,6 +153,8 @@ static long cmsx_PidWriteback(const OSD_Entry *self)
149
153
pidProfile -> pid [i ].D = tempPid [i ][2 ];
150
154
pidProfile -> pid [i ].F = tempPidF [i ];
151
155
}
156
+ pidProfile -> i_decay = i_decay ;
157
+ pidProfile -> r_weight = r_weight ;
152
158
pidInitConfig (currentPidProfile );
153
159
154
160
return 0 ;
@@ -174,6 +180,9 @@ static OSD_Entry cmsx_menuPidEntries[] =
174
180
{ "YAW D" , OME_UINT8 , NULL , & (OSD_UINT8_t ){ & tempPid [PID_YAW ][2 ], 0 , 200 , 1 }, 0 },
175
181
{ "YAW F" , OME_UINT16 , NULL , & (OSD_UINT16_t ){ & tempPidF [PID_YAW ], 0 , 2000 , 1 }, 0 },
176
182
183
+ { "I_DECAY" , OME_UINT8 , NULL , & (OSD_UINT8_t ){ & i_decay , 1 , 10 , 1 }, 0 },
184
+ { "R_WEIGHT" , OME_UINT8 , NULL , & (OSD_UINT8_t ){ & r_weight , 1 , 200 , 1 }, 0 },
185
+
177
186
{ "BACK" , OME_Back , NULL , NULL , 0 },
178
187
{ "SAVE&EXIT" , OME_OSD_Exit , cmsMenuExit , (void * )CMS_EXIT_SAVE , 0 },
179
188
{ NULL , OME_END , NULL , NULL , 0 }
@@ -337,7 +346,7 @@ static uint16_t gyroConfig_gyro_soft_notch_hz_2;
337
346
static uint16_t gyroConfig_gyro_soft_notch_cutoff_2 ;
338
347
#ifndef USE_GYRO_IMUF9001
339
348
static uint16_t gyroConfig_gyro_filter_q ;
340
- static uint16_t gyroConfig_gyro_filter_r ;
349
+ static uint16_t gyroConfig_gyro_filter_w ;
341
350
#endif
342
351
343
352
static long cmsx_menuGyro_onEnter (void )
@@ -351,7 +360,7 @@ static long cmsx_menuGyro_onEnter(void)
351
360
352
361
#ifndef USE_GYRO_IMUF9001
353
362
gyroConfig_gyro_filter_q = gyroConfig ()-> gyro_filter_q ;
354
- gyroConfig_gyro_filter_r = gyroConfig ()-> gyro_filter_r ;
363
+ gyroConfig_gyro_filter_w = gyroConfig ()-> gyro_filter_w ;
355
364
#endif
356
365
return 0 ;
357
366
}
@@ -369,7 +378,7 @@ static long cmsx_menuGyro_onExit(const OSD_Entry *self)
369
378
370
379
#ifndef USE_GYRO_IMUF9001
371
380
gyroConfigMutable ()-> gyro_filter_q = gyroConfig_gyro_filter_q ;
372
- gyroConfigMutable ()-> gyro_filter_r = gyroConfig_gyro_filter_r ;
381
+ gyroConfigMutable ()-> gyro_filter_w = gyroConfig_gyro_filter_w ;
373
382
#endif
374
383
return 0 ;
375
384
}
@@ -388,7 +397,7 @@ static OSD_Entry cmsx_menuFilterGlobalEntries[] =
388
397
{ "GYRO NF2C" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_gyro_soft_notch_cutoff_2 , 0 , 500 , 1 }, 0 },
389
398
#ifndef USE_GYRO_IMUF9001
390
399
{ "KALMAN Q" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_gyro_filter_q , 0 , 16000 , 1 }, 0 },
391
- { "KALMAN R " , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_gyro_filter_r , 0 , 16000 , 1 }, 0 },
400
+ { "KALMAN W " , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_gyro_filter_w , 3 , 64 , 1 }, 0 },
392
401
#endif
393
402
{ "BACK" , OME_Back , NULL , NULL , 0 },
394
403
{ NULL , OME_END , NULL , NULL , 0 }
@@ -418,6 +427,7 @@ static uint16_t gyroConfig_imuf_w;
418
427
static uint16_t gyroConfig_imuf_pitch_lpf_cutoff_hz ;
419
428
static uint16_t gyroConfig_imuf_roll_lpf_cutoff_hz ;
420
429
static uint16_t gyroConfig_imuf_yaw_lpf_cutoff_hz ;
430
+ static uint16_t gyroConfig_imuf_acc_lpf_cutoff_hz ;
421
431
#endif
422
432
423
433
#if defined(USE_GYRO_IMUF9001 )
@@ -430,6 +440,7 @@ static long cmsx_menuImuf_onEnter(void)
430
440
gyroConfig_imuf_pitch_lpf_cutoff_hz = gyroConfig ()-> imuf_pitch_lpf_cutoff_hz ;
431
441
gyroConfig_imuf_roll_lpf_cutoff_hz = gyroConfig ()-> imuf_roll_lpf_cutoff_hz ;
432
442
gyroConfig_imuf_yaw_lpf_cutoff_hz = gyroConfig ()-> imuf_yaw_lpf_cutoff_hz ;
443
+ gyroConfig_imuf_acc_lpf_cutoff_hz = gyroConfig ()-> imuf_acc_lpf_cutoff_hz ;
433
444
434
445
return 0 ;
435
446
}
@@ -447,6 +458,7 @@ static long cmsx_menuImuf_onExit(const OSD_Entry *self)
447
458
gyroConfigMutable ()-> imuf_roll_lpf_cutoff_hz = gyroConfig_imuf_roll_lpf_cutoff_hz ;
448
459
gyroConfigMutable ()-> imuf_pitch_lpf_cutoff_hz = gyroConfig_imuf_pitch_lpf_cutoff_hz ;
449
460
gyroConfigMutable ()-> imuf_yaw_lpf_cutoff_hz = gyroConfig_imuf_yaw_lpf_cutoff_hz ;
461
+ gyroConfigMutable ()-> imuf_acc_lpf_cutoff_hz = gyroConfig_imuf_acc_lpf_cutoff_hz ;
450
462
return 0 ;
451
463
}
452
464
#endif
@@ -463,8 +475,9 @@ static OSD_Entry cmsx_menuImufEntries[] =
463
475
{ "ROLL LPF" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_imuf_roll_lpf_cutoff_hz , 0 , 450 , 1 }, 0 },
464
476
{ "PITCH LPF" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_imuf_pitch_lpf_cutoff_hz , 0 , 450 , 1 }, 0 },
465
477
{ "YAW LPF" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_imuf_yaw_lpf_cutoff_hz , 0 , 450 , 1 }, 0 },
478
+ { "IMUF ACC" , OME_UINT16 , NULL , & (OSD_UINT16_t ) { & gyroConfig_imuf_acc_lpf_cutoff_hz , 0 , 450 , 1 }, 0 },
466
479
467
- { "BACK" , OME_Back , NULL , NULL , 0 },
480
+ { "BACK" , OME_Back , NULL , NULL , 0 },
468
481
{ "SAVE&REBOOT" , OME_OSD_Exit , cmsMenuExit , (void * )CMS_EXIT_SAVEREBOOT , 0 },
469
482
{ NULL , OME_END , NULL , NULL , 0 }
470
483
};
0 commit comments