Skip to content

Commit f7c1b21

Browse files
authored
Merge pull request #591 from howard0su/timer
Hide permanent timer under knob
2 parents 834528a + 82ce2f4 commit f7c1b21

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/config/model.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ static const char * const TIMER_TYPE_VAL[TIMER_LAST] = {
162162
};
163163
static const char TIMER_TIME[] = "time";
164164
static const char TIMER_RESETSRC[] = "resetsrc";
165+
#if HAS_PERMANENT_TIMER
165166
static const char PERMANENT_TIMER[] = "permanent_timer";
167+
#endif
166168
static const char TIMER_VAL[] = "val";
167169

168170
/* Section: Safety */
@@ -526,10 +528,12 @@ struct struct_map {const char *str; u16 offset; u16 defval;};
526528
#define OFFSETS(s,v) (((long)(&s.v) - (long)(&s)) | ((sizeof(s.v)+3) << 13))
527529
#define OFFSET_SRC(s,v) (((long)(&s.v) - (long)(&s)) | (2 << 13))
528530
#define OFFSET_BUT(s,v) (((long)(&s.v) - (long)(&s)) | (6 << 13))
531+
#if HAS_PERMANENT_TIMER
529532
static const struct struct_map _secnone[] =
530533
{
531534
{PERMANENT_TIMER, OFFSET(Model, permanent_timer), 0},
532535
};
536+
#endif
533537
static const struct struct_map _secradio[] = {
534538
{RADIO_NUM_CHANNELS, OFFSET(Model, num_channels), 0},
535539
{RADIO_FIXED_ID, OFFSET(Model, fixed_id), 0},
@@ -628,8 +632,10 @@ int assign_int(void* ptr, const struct struct_map *map, int map_size)
628632
CONFIG_ParseIconName(m->icon, value);
629633
return 1;
630634
}
635+
#if HAS_PERMANENT_TIMER
631636
if(assign_int(&Model, _secnone, MAPSIZE(_secnone)))
632637
return 1;
638+
#endif
633639
if (MATCH_KEY(MODEL_TYPE)) {
634640
for (i = 0; i < NUM_STR_ELEMS(MODEL_TYPE_VAL); i++) {
635641
if (MATCH_VALUE(MODEL_TYPE_VAL[i])) {
@@ -1193,7 +1199,9 @@ u8 CONFIG_WriteModel(u8 model_num) {
11931199
}
11941200
CONFIG_EnableLanguage(0);
11951201
fprintf(fh, "%s=%s\n", MODEL_NAME, m->name);
1202+
#if HAS_PERMANENT_TIMER
11961203
write_int(fh, m, _secnone, MAPSIZE(_secnone));
1204+
#endif
11971205
fprintf(fh, "%s=%s\n", MODEL_MIXERMODE, STDMIXER_ModeName(m->mixer_mode));
11981206
if(m->icon[0] != 0)
11991207
fprintf(fh, "%s=%s\n", MODEL_ICON, m->icon + 9);

src/config/model.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ struct Model {
5353
MixerMode mixer_mode;
5454
s8 ppm_map[MAX_PPM_IN_CHANNELS];
5555
u8 padding_1[2];
56+
#if HAS_PERMANENT_TIMER
5657
u32 permanent_timer;
58+
#endif
5759
#if HAS_VIDEO
5860
u8 videosrc;
5961
u8 videoch;

0 commit comments

Comments
 (0)