mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Delay osd initialization, remove floating point pids from osd
This commit is contained in:
parent
a1a71d68ac
commit
a38a2da74f
4 changed files with 9 additions and 54 deletions
|
@ -57,6 +57,7 @@ void max7456_init(uint8_t system) {
|
|||
//Minimum spi clock period for max7456 is 100ns (10Mhz)
|
||||
spiSetDivisor(MAX7456_SPI_INSTANCE, SPI_9MHZ_CLOCK_DIVIDER);
|
||||
|
||||
delay(1000);
|
||||
// force soft reset on Max7456
|
||||
ENABLE_MAX7456;
|
||||
max7456_send(VM0_reg, max7456_reset);
|
||||
|
|
|
@ -179,22 +179,13 @@ void print_vtx_freq(uint16_t pos, uint8_t col) {
|
|||
void print_pid(uint16_t pos, uint8_t col, int pid_term) {
|
||||
switch(col) {
|
||||
case 0:
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
sprintf(string_buffer, "%d", (int)(currentProfile->pidProfile.P_f[pid_term] * 10.0));
|
||||
else
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.P8[pid_term]);
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.P8[pid_term]);
|
||||
break;
|
||||
case 1:
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
sprintf(string_buffer, "%d", (int)(currentProfile->pidProfile.I_f[pid_term] * 100.0));
|
||||
else
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.I8[pid_term]);
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.I8[pid_term]);
|
||||
break;
|
||||
case 2:
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
sprintf(string_buffer, "%d", (int)(currentProfile->pidProfile.D_f[pid_term] * 1000.0));
|
||||
else
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.D8[pid_term]);
|
||||
sprintf(string_buffer, "%d", currentProfile->pidProfile.D8[pid_term]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -274,53 +265,16 @@ void update_int_pid(bool inc, uint8_t col, int pid_term) {
|
|||
}
|
||||
}
|
||||
|
||||
void update_float_pid(bool inc, uint8_t col, int pid_term) {
|
||||
void* ptr;
|
||||
float diff;
|
||||
|
||||
switch(col) {
|
||||
case 0:
|
||||
ptr = ¤tProfile->pidProfile.P_f[pid_term];
|
||||
diff = 0.1;
|
||||
break;
|
||||
case 1:
|
||||
ptr = ¤tProfile->pidProfile.I_f[pid_term];
|
||||
diff = 0.01;
|
||||
break;
|
||||
case 2:
|
||||
ptr = ¤tProfile->pidProfile.D_f[pid_term];
|
||||
diff = 0.001;
|
||||
break;
|
||||
}
|
||||
|
||||
if (inc) {
|
||||
if (*(float*)ptr < 100.0)
|
||||
*(float*)ptr += diff;
|
||||
} else {
|
||||
if (*(float*)ptr > 0.0)
|
||||
*(float*)ptr -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
void update_roll_pid(bool inc, uint8_t col) {
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
update_float_pid(inc, col, ROLL);
|
||||
else
|
||||
update_int_pid(inc, col, ROLL);
|
||||
update_int_pid(inc, col, ROLL);
|
||||
}
|
||||
|
||||
void update_pitch_pid(bool inc, uint8_t col) {
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
update_float_pid(inc, col, PITCH);
|
||||
else
|
||||
update_int_pid(inc, col, PITCH);
|
||||
update_int_pid(inc, col, PITCH);
|
||||
}
|
||||
|
||||
void update_yaw_pid(bool inc, uint8_t col) {
|
||||
if (IS_PID_CONTROLLER_FP_BASED(currentProfile->pidProfile.pidController))
|
||||
update_float_pid(inc, col, YAW);
|
||||
else
|
||||
update_int_pid(inc, col, YAW);
|
||||
update_int_pid(inc, col, YAW);
|
||||
}
|
||||
|
||||
void update_roll_rate(bool inc, uint8_t col) {
|
||||
|
|
|
@ -499,7 +499,7 @@ static const lookupTableEntry_t lookupTables[] = {
|
|||
{ lookupTableBaroHardware, sizeof(lookupTableBaroHardware) / sizeof(char *) },
|
||||
{ lookupTableMagHardware, sizeof(lookupTableMagHardware) / sizeof(char *) },
|
||||
{ lookupTableDebug, sizeof(lookupTableDebug) / sizeof(char *) },
|
||||
{ lookupTableSuperExpoYaw, sizeof(lookupTableSuperExpoYaw) / sizeof(char *) }
|
||||
{ lookupTableSuperExpoYaw, sizeof(lookupTableSuperExpoYaw) / sizeof(char *) },
|
||||
#ifdef OSD
|
||||
{ lookupTableOsdType, sizeof(lookupTableOsdType) / sizeof(char *) },
|
||||
#endif
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
||||
#define TELEMETRY
|
||||
#define SERIAL_RX
|
||||
#define GTUNE
|
||||
//#define GTUNE
|
||||
#define USE_CLI
|
||||
#define OSD
|
||||
#define LED0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue