Merge pull request #10546 from iNavFlight/delta-formatting
[inav.git] / src / main / io / osd / custom_elements.h
blob9c12ede6734e154c000e2937e438b421e22869e2
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "config/parameter_group.h"
22 #define OSD_CUSTOM_ELEMENT_TEXT_SIZE 16
23 #define CUSTOM_ELEMENTS_PARTS 3
24 #define MAX_CUSTOM_ELEMENTS 8
26 typedef enum {
27 CUSTOM_ELEMENT_TYPE_NONE = 0,
28 CUSTOM_ELEMENT_TYPE_TEXT = 1,
29 CUSTOM_ELEMENT_TYPE_ICON_STATIC = 2,
30 CUSTOM_ELEMENT_TYPE_ICON_GV = 3,
31 CUSTOM_ELEMENT_TYPE_ICON_LC = 4,
32 CUSTOM_ELEMENT_TYPE_GV_1 = 5,
33 CUSTOM_ELEMENT_TYPE_GV_2 = 6,
34 CUSTOM_ELEMENT_TYPE_GV_3 = 7,
35 CUSTOM_ELEMENT_TYPE_GV_4 = 8,
36 CUSTOM_ELEMENT_TYPE_GV_5 = 9,
37 CUSTOM_ELEMENT_TYPE_GV_FLOAT_1_1 = 10,
38 CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_1 = 11,
39 CUSTOM_ELEMENT_TYPE_GV_FLOAT_2_2 = 12,
40 CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_1 = 13,
41 CUSTOM_ELEMENT_TYPE_GV_FLOAT_3_2 = 14,
42 CUSTOM_ELEMENT_TYPE_GV_FLOAT_4_1 = 15,
43 CUSTOM_ELEMENT_TYPE_LC_1 = 16,
44 CUSTOM_ELEMENT_TYPE_LC_2 = 17,
45 CUSTOM_ELEMENT_TYPE_LC_3 = 18,
46 CUSTOM_ELEMENT_TYPE_LC_4 = 19,
47 CUSTOM_ELEMENT_TYPE_LC_5 = 20,
48 CUSTOM_ELEMENT_TYPE_LC_FLOAT_1_1 = 21,
49 CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_1 = 22,
50 CUSTOM_ELEMENT_TYPE_LC_FLOAT_2_2 = 23,
51 CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_1 = 24,
52 CUSTOM_ELEMENT_TYPE_LC_FLOAT_3_2 = 25,
53 CUSTOM_ELEMENT_TYPE_LC_FLOAT_4_1 = 26,
54 } osdCustomElementType_e;
56 typedef enum {
57 CUSTOM_ELEMENT_VISIBILITY_ALWAYS = 0,
58 CUSTOM_ELEMENT_VISIBILITY_GV = 1,
59 CUSTOM_ELEMENT_VISIBILITY_LOGIC_CON = 2,
60 } osdCustomElementTypeVisibility_e;
62 typedef struct {
63 osdCustomElementType_e type;
64 uint16_t value;
65 } osdCustomElementItem_t;
67 typedef struct {
68 osdCustomElementTypeVisibility_e type;
69 uint16_t value;
70 } osdCustomElementVisibility_t;
72 typedef struct {
73 osdCustomElementItem_t part[CUSTOM_ELEMENTS_PARTS];
74 osdCustomElementVisibility_t visibility;
75 char osdCustomElementText[OSD_CUSTOM_ELEMENT_TEXT_SIZE];
76 } osdCustomElement_t;
78 PG_DECLARE_ARRAY(osdCustomElement_t, MAX_CUSTOM_ELEMENTS, osdCustomElements);
80 void customElementDrawElement(char *buff, uint8_t customElementIndex);