mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
display craft name, current mesurement on OSD
This commit is contained in:
parent
9a38d8a9e1
commit
69955d7b07
4 changed files with 34 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
@ -753,6 +754,28 @@ void updateOsd(void)
|
||||||
sprintf(line+1, "%d.%1d", vbat / 10, vbat % 10);
|
sprintf(line+1, "%d.%1d", vbat / 10, vbat % 10);
|
||||||
max7456_write_string(line, masterConfig.osdProfile.item_pos[OSD_MAIN_BATT_VOLTAGE]);
|
max7456_write_string(line, masterConfig.osdProfile.item_pos[OSD_MAIN_BATT_VOLTAGE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (masterConfig.osdProfile.item_pos[OSD_CURRENT_DRAW] != -1) {
|
||||||
|
line[0] = SYM_AMP;
|
||||||
|
sprintf(line+1, "%d.%02d", amperage / 100, amperage % 100);
|
||||||
|
max7456_write_string(line, masterConfig.osdProfile.item_pos[OSD_CURRENT_DRAW]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (masterConfig.osdProfile.item_pos[OSD_MAH_DRAWN] != -1) {
|
||||||
|
line[0] = SYM_MAH;
|
||||||
|
sprintf(line+1, "%d", mAhDrawn);
|
||||||
|
max7456_write_string(line, masterConfig.osdProfile.item_pos[OSD_MAH_DRAWN]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (masterConfig.osdProfile.item_pos[OSD_CRAFT_NAME] != -1) {
|
||||||
|
for (uint8_t i = 0; i < MAX_NAME_LENGTH; i++) {
|
||||||
|
line[i] = toupper((unsigned char)masterConfig.name[i]);
|
||||||
|
if (masterConfig.name[i] == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
max7456_write_string(line, masterConfig.osdProfile.item_pos[OSD_CRAFT_NAME]);
|
||||||
|
}
|
||||||
|
|
||||||
if (masterConfig.osdProfile.item_pos[OSD_RSSI_VALUE] != -1) {
|
if (masterConfig.osdProfile.item_pos[OSD_RSSI_VALUE] != -1) {
|
||||||
line[0] = SYM_RSSI;
|
line[0] = SYM_RSSI;
|
||||||
sprintf(line+1, "%d", rssi / 10);
|
sprintf(line+1, "%d", rssi / 10);
|
||||||
|
@ -823,6 +846,9 @@ void resetOsdConfig(void)
|
||||||
masterConfig.osdProfile.item_pos[OSD_DISARMED] = -109;
|
masterConfig.osdProfile.item_pos[OSD_DISARMED] = -109;
|
||||||
masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON] = -1;
|
masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON] = -1;
|
||||||
masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS] = -1;
|
masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS] = -1;
|
||||||
|
masterConfig.osdProfile.item_pos[OSD_CURRENT_DRAW] = -23;
|
||||||
|
masterConfig.osdProfile.item_pos[OSD_MAH_DRAWN] = -18;
|
||||||
|
masterConfig.osdProfile.item_pos[OSD_CRAFT_NAME] = -77;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,6 +50,9 @@ typedef enum {
|
||||||
OSD_DISARMED,
|
OSD_DISARMED,
|
||||||
OSD_ARTIFICIAL_HORIZON,
|
OSD_ARTIFICIAL_HORIZON,
|
||||||
OSD_HORIZON_SIDEBARS,
|
OSD_HORIZON_SIDEBARS,
|
||||||
|
OSD_CURRENT_DRAW,
|
||||||
|
OSD_MAH_DRAWN,
|
||||||
|
OSD_CRAFT_NAME,
|
||||||
OSD_MAX_ITEMS, // MUST BE LAST
|
OSD_MAX_ITEMS, // MUST BE LAST
|
||||||
} osd_items_t;
|
} osd_items_t;
|
||||||
|
|
||||||
|
|
|
@ -893,6 +893,9 @@ const clivalue_t valueTable[] = {
|
||||||
{ "osd_disarmed_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_DISARMED], .config.minmax = { -480, 480 } },
|
{ "osd_disarmed_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_DISARMED], .config.minmax = { -480, 480 } },
|
||||||
{ "osd_artificial_horizon", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON], .config.minmax = { -1, 0 } },
|
{ "osd_artificial_horizon", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_ARTIFICIAL_HORIZON], .config.minmax = { -1, 0 } },
|
||||||
{ "osd_horizon_sidebars", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS], .config.minmax = { -1, 0 } },
|
{ "osd_horizon_sidebars", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_HORIZON_SIDEBARS], .config.minmax = { -1, 0 } },
|
||||||
|
{ "osd_current_draw_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_CURRENT_DRAW], .config.minmax = { -480, 480 } },
|
||||||
|
{ "osd_mah_drawn_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_MAH_DRAWN], .config.minmax = { -480, 480 } },
|
||||||
|
{ "osd_craft_name_pos", VAR_INT16 | MASTER_VALUE, &masterConfig.osdProfile.item_pos[OSD_CRAFT_NAME], .config.minmax = { -480, 480 } },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,8 @@
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define ADC_INSTANCE ADC1
|
#define ADC_INSTANCE ADC1
|
||||||
#define VBAT_ADC_PIN PA0
|
#define VBAT_ADC_PIN PA0
|
||||||
|
#define CURRENT_METER_ADC_PIN PA3
|
||||||
|
#define RSSI_ADC_PIN PA2
|
||||||
|
|
||||||
//#define USE_QUAD_MIXER_ONLY
|
//#define USE_QUAD_MIXER_ONLY
|
||||||
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue