-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathmodel.h
More file actions
95 lines (88 loc) · 2.37 KB
/
model.h
File metadata and controls
95 lines (88 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#define NUM_TRIM_ELEMS 6
#define NUM_BOX_ELEMS 8
#define NUM_BAR_ELEMS 8
#define NUM_TOGGLE_ELEMS 4
#ifndef _MODEL_H_
#define _MODEL_H_
#include "mixer.h"
#include "timer.h"
#include "rtc.h"
#include "telemetry.h"
#include "datalog.h"
#include "pagecfg.h"
#if HAS_EXTENDED_AUDIO
#include "music.h"
#endif
/* INI file consts */
#define MODEL_NAME "name"
#define MODEL_ICON "icon"
#define MODEL_TYPE "type"
#define MODEL_TEMPLATE "template"
#define UNKNOWN_ICON ("media/noicon" IMG_EXT)
//This cannot be computed, and must be manually updated
#define NUM_PROTO_OPTS 6
#define VIRT_NAME_LEN 10
struct Model {
u32 fixed_id;
enum ModelType type;
enum Protocols protocol;
s16 proto_opts[NUM_PROTO_OPTS];
u8 num_channels;
u8 num_ppmin;
u16 ppmin_centerpw;
u16 ppmin_deltapw;
u8 train_sw;
enum TxPower tx_power;
enum SwashType swash_type;
u8 swash_invert;
u8 swashmix[3];
char name[24];
char icon[24];
char virtname[NUM_VIRT_CHANNELS][VIRT_NAME_LEN];
u8 templates[NUM_CHANNELS];
u8 safety[NUM_SOURCES+1];
u8 telem_alarm[TELEM_NUM_ALARMS];
s32 telem_alarm_val[TELEM_NUM_ALARMS];
u8 telem_alarm_th[TELEM_NUM_ALARMS];
u8 telem_flags;
MixerMode mixer_mode;
s8 ppm_map[MAX_PPM_IN_CHANNELS];
u8 padding_1[2];
#if HAS_PERMANENT_TIMER
u32 permanent_timer;
#endif
#if HAS_VIDEO
u8 videosrc;
u8 videoch;
s8 video_contrast;
s8 video_brightness;
#endif
struct Trim trims[NUM_TRIMS];
struct Mixer mixers[NUM_MIXERS];
struct Limit limits[NUM_OUT_CHANNELS];
struct Timer timer[NUM_TIMERS];
struct PageCfg2 pagecfg2;
#if HAS_DATALOG
struct datalog datalog;
#endif
#if HAS_EXTENDED_AUDIO
struct Voice voice;
#endif // HAS_EXTENDED_AUDIO
#if HAS_EXTENDED_TELEMETRY
s32 ground_level;
#endif
};
extern struct Model Model;
extern const char * const RADIO_TX_POWER_VAL[TXPOWER_LAST];
u8 CONFIG_ReadModel(u8 model_num);
u8 CONFIG_WriteModel(u8 model_num);
u8 CONFIG_GetCurrentModel();
const char *CONFIG_GetIcon(enum ModelType type);
const char *CONFIG_GetCurrentIcon();
enum ModelType CONFIG_ParseModelType(const char *value);
void CONFIG_ParseIconName(char *name, const char *value);
void CONFIG_ResetModel();
u8 CONFIG_ReadTemplateByIndex(u8 template_num);
u8 CONFIG_ReadTemplate(const char *filename);
u8 CONFIG_ReadLayout(const char *filename);
#endif /*_MODEL_H_*/