1
0
Fork 0
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:
Evgeny Sychov 2016-06-08 01:18:33 -07:00
parent a1a71d68ac
commit a38a2da74f
4 changed files with 9 additions and 54 deletions

View file

@ -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);

View file

@ -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 = &currentProfile->pidProfile.P_f[pid_term];
diff = 0.1;
break;
case 1:
ptr = &currentProfile->pidProfile.I_f[pid_term];
diff = 0.01;
break;
case 2:
ptr = &currentProfile->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) {

View file

@ -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

View file

@ -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