From 04c9137e29a36a210225756d9c2721649ae4c374 Mon Sep 17 00:00:00 2001 From: Ari Sundholm Date: Sat, 11 Nov 2017 00:23:51 +0200 Subject: [PATCH] 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. --- software/sys_controller/ossc/av_controller.c | 8 ++++---- software/sys_controller/ossc/avconfig.h | 1 - software/sys_controller/ossc/menu.c | 4 ++-- software/sys_controller/ossc/userdata.c | 3 +++ software/sys_controller/ossc/userdata.h | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/software/sys_controller/ossc/av_controller.c b/software/sys_controller/ossc/av_controller.c index af5c469..07fdbf9 100644 --- a/software/sys_controller/ossc/av_controller.c +++ b/software/sys_controller/ossc/av_controller.c @@ -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; } diff --git a/software/sys_controller/ossc/avconfig.h b/software/sys_controller/ossc/avconfig.h index a032793..1b68504 100644 --- a/software/sys_controller/ossc/avconfig.h +++ b/software/sys_controller/ossc/avconfig.h @@ -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; diff --git a/software/sys_controller/ossc/menu.c b/software/sys_controller/ossc/menu.c index cc0b86c..e8904b7 100644 --- a/software/sys_controller/ossc/menu.c +++ b/software/sys_controller/ossc/menu.c @@ -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({ \ diff --git a/software/sys_controller/ossc/userdata.c b/software/sys_controller/ossc/userdata.c index 3c2bf28..1a11901 100644 --- a/software/sys_controller/ossc/userdata.c +++ b/software/sys_controller/ossc/userdata.c @@ -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)); diff --git a/software/sys_controller/ossc/userdata.h b/software/sys_controller/ossc/userdata.h index 507c57e..d86d2a2 100644 --- a/software/sys_controller/ossc/userdata.h +++ b/software/sys_controller/ossc/userdata.h @@ -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;