Move default input field from profiles to initconfig

This makes things consistent. Without this change, the default
input would be dictated by the profile associated with AV1.
This commit is contained in:
Ari Sundholm 2017-11-11 00:23:51 +02:00
parent d638b6a650
commit 04c9137e29
5 changed files with 10 additions and 7 deletions

View File

@ -68,7 +68,7 @@ alt_u8 target_type;
alt_u8 stable_frames;
alt_u8 update_cur_vm;
alt_u8 vm_sel, vm_edit, profile_sel, input_profiles[3], lt_sel;
alt_u8 vm_sel, vm_edit, profile_sel, input_profiles[3], lt_sel, def_input;
alt_u16 tc_h_samplerate, tc_h_synclen, tc_h_bporch, tc_h_active, tc_v_synclen, tc_v_bporch, tc_v_active;
char row1[LCD_ROW_LEN+1], row2[LCD_ROW_LEN+1], menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
@ -785,8 +785,8 @@ int main()
while (1) {}
}
if (tc.def_input < AV_LAST)
target_mode = tc.def_input;
if (def_input < AV_LAST)
target_mode = def_input;
// Mainloop
while(1) {
@ -901,7 +901,7 @@ int main()
strncpy(row2, " NO SYNC", LCD_ROW_LEN+1);
if (!menu_active)
lcd_write_status();
if (av_init && (tc.def_input == AV_LAST))
if (av_init && (def_input == AV_LAST))
write_userdata(INIT_CONFIG_SLOT);
av_init = 1;
}

View File

@ -83,7 +83,6 @@ typedef struct {
alt_u8 audio_dw_sampl;
alt_u8 audio_swap_lr;
#endif
alt_u8 def_input;
color_setup_t col;
} __attribute__((packed)) avconfig_t;

View File

@ -41,7 +41,7 @@ extern mode_data_t video_modes[];
extern alt_u16 tc_h_samplerate, tc_h_synclen, tc_h_bporch, tc_h_active, tc_v_synclen, tc_v_bporch, tc_v_active;
extern alt_u32 remote_code;
extern alt_u16 rc_keymap[REMOTE_MAX_KEYS];
extern alt_u8 vm_sel, profile_sel, lt_sel;
extern alt_u8 vm_sel, profile_sel, lt_sel, def_input;
alt_u8 menu_active;
@ -134,7 +134,7 @@ MENU(menu_output, P99_PROTECT({ \
{ LNG("256x240 aspect","256x240アスペクト"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.ar_256col, OPT_WRAP, SETTING_ITEM(ar_256col_desc) } } },
{ LNG("TX mode","TXモード"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.tx_mode, OPT_WRAP, SETTING_ITEM(tx_mode_desc) } } },
{ "HDMI ITC", OPT_AVCONFIG_SELECTION, { .sel = { &tc.hdmi_itc, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
{ LNG("Initial input","ショキニュウリョク"), OPT_AVCONFIG_SELECTION, { .sel = { &tc.def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } },
{ LNG("Initial input","ショキニュウリョク"), OPT_AVCONFIG_SELECTION, { .sel = { &def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } },
}))
MENU(menu_postproc, P99_PROTECT({ \

View File

@ -32,6 +32,7 @@ extern avinput_t target_mode;
extern alt_u8 update_cur_vm;
extern alt_u8 input_profiles[3];
extern alt_u8 profile_sel;
extern alt_u8 def_input;
int write_userdata(alt_u8 entry)
{
@ -57,6 +58,7 @@ int write_userdata(alt_u8 entry)
((ude_initcfg*)databuf)->data_len = sizeof(ude_initcfg) - offsetof(ude_initcfg, last_profile);
memcpy(((ude_initcfg*)databuf)->last_profile, input_profiles, sizeof(input_profiles));
((ude_initcfg*)databuf)->last_input = cm.avinput;
((ude_initcfg*)databuf)->def_input = def_input;
memcpy(((ude_initcfg*)databuf)->keys, rc_keymap, sizeof(rc_keymap));
retval = write_flash_page(databuf, sizeof(ude_initcfg), (USERDATA_OFFSET+entry*SECTORSIZE)/PAGESIZE);
if (retval != 0)
@ -138,6 +140,7 @@ int read_userdata(alt_u8 entry)
input_profiles[i] = ((ude_initcfg*)databuf)->last_profile[i];
if (((ude_initcfg*)databuf)->last_input < AV_LAST)
target_mode = ((ude_initcfg*)databuf)->last_input;
def_input = ((ude_initcfg*)databuf)->def_input;
profile_sel = input_profiles[0]; // Arbitrary default
memcpy(rc_keymap, ((ude_initcfg*)databuf)->keys, sizeof(rc_keymap));
printf("RC data read (%u bytes)\n", sizeof(rc_keymap));

View File

@ -48,6 +48,7 @@ typedef struct {
alt_u16 data_len;
alt_u8 last_profile[3];
avinput_t last_input;
avinput_t def_input;
alt_u16 keys[REMOTE_MAX_KEYS];
} __attribute__((packed, __may_alias__)) ude_initcfg;