mirror of
https://github.com/marqs85/ossc.git
synced 2025-02-28 11:29:12 +00:00
allow profile link (to each logical input) via a menu option
This commit is contained in:
parent
8caa4c1952
commit
bee64c6fbc
File diff suppressed because it is too large
Load Diff
@ -68,14 +68,13 @@ 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, def_input;
|
||||
alt_u8 vm_sel, vm_edit, profile_sel, input_profiles[AV_LAST], lt_sel, def_input, profile_link;
|
||||
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];
|
||||
|
||||
extern alt_u8 menu_active;
|
||||
avinput_t target_mode;
|
||||
phyinput_t phy_input_sel;
|
||||
avinput_t target_input;
|
||||
|
||||
alt_u8 pcm1862_active;
|
||||
|
||||
@ -541,7 +540,7 @@ void program_mode()
|
||||
int load_profile() {
|
||||
int retval;
|
||||
|
||||
input_profiles[phy_input_sel] = profile_sel;
|
||||
input_profiles[profile_link ? cm.avinput : AV_TESTPAT] = profile_sel;
|
||||
retval = read_userdata(profile_sel);
|
||||
if (retval == 0)
|
||||
write_userdata(INIT_CONFIG_SLOT);
|
||||
@ -551,7 +550,7 @@ int load_profile() {
|
||||
int save_profile() {
|
||||
int retval;
|
||||
|
||||
input_profiles[phy_input_sel] = profile_sel;
|
||||
input_profiles[profile_link ? cm.avinput : AV_TESTPAT] = profile_sel;
|
||||
retval = write_userdata(profile_sel);
|
||||
if (retval == 0)
|
||||
write_userdata(INIT_CONFIG_SLOT);
|
||||
@ -754,12 +753,11 @@ void enable_outputs()
|
||||
|
||||
int main()
|
||||
{
|
||||
tvp_input_t target_input = 0;
|
||||
tvp_input_t target_tvp = 0;
|
||||
ths_input_t target_ths = 0;
|
||||
pcm_input_t target_pcm = 0;
|
||||
video_format target_format = 0;
|
||||
|
||||
alt_u8 av_init = 0;
|
||||
status_t status;
|
||||
|
||||
alt_u32 input_vec;
|
||||
@ -785,9 +783,6 @@ int main()
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
if (def_input < AV_LAST)
|
||||
target_mode = def_input;
|
||||
|
||||
// Mainloop
|
||||
while(1) {
|
||||
// Read remote control and PCB button status
|
||||
@ -804,89 +799,85 @@ int main()
|
||||
if (menu_active)
|
||||
display_menu(0);
|
||||
|
||||
if (target_mode == cm.avinput)
|
||||
target_mode = AV_KEEP;
|
||||
if (target_input != cm.avinput) {
|
||||
|
||||
switch (target_mode) {
|
||||
case AV1_RGBs:
|
||||
target_input = TVP_INPUT1;
|
||||
target_format = FORMAT_RGBS;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV1_RGsB:
|
||||
target_input = TVP_INPUT1;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV1_YPBPR:
|
||||
target_input = TVP_INPUT1;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV2_YPBPR:
|
||||
target_input = TVP_INPUT1;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_A;
|
||||
target_pcm = PCM_INPUT3;
|
||||
break;
|
||||
case AV2_RGsB:
|
||||
target_input = TVP_INPUT1;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_A;
|
||||
target_pcm = PCM_INPUT3;
|
||||
break;
|
||||
case AV3_RGBHV:
|
||||
target_input = TVP_INPUT3;
|
||||
target_format = FORMAT_RGBHV;
|
||||
target_typemask = VIDEO_PC;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_RGBs:
|
||||
target_input = TVP_INPUT3;
|
||||
target_format = FORMAT_RGBS;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_RGsB:
|
||||
target_input = TVP_INPUT3;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_YPBPR:
|
||||
target_input = TVP_INPUT3;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (target_input) {
|
||||
case AV1_RGBs:
|
||||
target_tvp = TVP_INPUT1;
|
||||
target_format = FORMAT_RGBS;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV1_RGsB:
|
||||
target_tvp = TVP_INPUT1;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV1_YPBPR:
|
||||
target_tvp = TVP_INPUT1;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_B;
|
||||
target_pcm = PCM_INPUT4;
|
||||
break;
|
||||
case AV2_YPBPR:
|
||||
target_tvp = TVP_INPUT1;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_A;
|
||||
target_pcm = PCM_INPUT3;
|
||||
break;
|
||||
case AV2_RGsB:
|
||||
target_tvp = TVP_INPUT1;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_INPUT_A;
|
||||
target_pcm = PCM_INPUT3;
|
||||
break;
|
||||
case AV3_RGBHV:
|
||||
target_tvp = TVP_INPUT3;
|
||||
target_format = FORMAT_RGBHV;
|
||||
target_typemask = VIDEO_PC;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_RGBs:
|
||||
target_tvp = TVP_INPUT3;
|
||||
target_format = FORMAT_RGBS;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_RGsB:
|
||||
target_tvp = TVP_INPUT3;
|
||||
target_format = FORMAT_RGsB;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
case AV3_YPBPR:
|
||||
target_tvp = TVP_INPUT3;
|
||||
target_format = FORMAT_YPbPr;
|
||||
target_typemask = VIDEO_LDTV|VIDEO_SDTV|VIDEO_EDTV|VIDEO_HDTV;
|
||||
target_ths = THS_STANDBY;
|
||||
target_pcm = PCM_INPUT2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (target_mode != AV_KEEP) {
|
||||
printf("### SWITCH MODE TO %s ###\n", avinput_str[target_mode]);
|
||||
|
||||
phy_input_sel = avinput_to_phyinput[target_mode];
|
||||
printf("### SWITCH MODE TO %s ###\n", avinput_str[target_input]);
|
||||
|
||||
// The input changed, so load the appropriate profile
|
||||
if (profile_sel != input_profiles[phy_input_sel]) {
|
||||
profile_sel = input_profiles[phy_input_sel];
|
||||
if (profile_link && (profile_sel != input_profiles[target_input])) {
|
||||
profile_sel = input_profiles[target_input];
|
||||
read_userdata(profile_sel);
|
||||
}
|
||||
|
||||
cm.avinput = target_mode;
|
||||
cm.avinput = target_input;
|
||||
cm.sync_active = 0;
|
||||
ths_source_sel(target_ths, (cm.cc.video_lpf > 1) ? (VIDEO_LPF_MAX-cm.cc.video_lpf) : THS_LPF_BYPASS);
|
||||
tvp_disable_output();
|
||||
@ -895,18 +886,18 @@ int main()
|
||||
if (pcm1862_active)
|
||||
pcm_source_sel(target_pcm);
|
||||
#endif
|
||||
tvp_source_sel(target_input, target_format);
|
||||
tvp_source_sel(target_tvp, target_format);
|
||||
cm.clkcnt = 0; //TODO: proper invalidate
|
||||
strncpy(row1, avinput_str[cm.avinput], LCD_ROW_LEN+1);
|
||||
strncpy(row2, " NO SYNC", LCD_ROW_LEN+1);
|
||||
if (!menu_active)
|
||||
lcd_write_status();
|
||||
if (av_init && (def_input == AV_LAST))
|
||||
// record last input if it was selected manually
|
||||
if ((def_input == AV_LAST) && (remote_code || (btn_code & PB0_BIT)))
|
||||
write_userdata(INIT_CONFIG_SLOT);
|
||||
av_init = 1;
|
||||
}
|
||||
|
||||
// Check here to enable regardless of av_init
|
||||
// Check here to enable regardless of input
|
||||
if (tc.tx_mode != cm.cc.tx_mode) {
|
||||
HDMITX_SetAVIInfoFrame(HDMI_Unkown, 0, 0, 0, 0);
|
||||
TX_enable(tc.tx_mode);
|
||||
@ -920,8 +911,8 @@ int main()
|
||||
cm.cc.hdmi_itc = tc.hdmi_itc;
|
||||
}
|
||||
|
||||
if (av_init) {
|
||||
status = get_status(target_input, target_format);
|
||||
if (cm.avinput != AV_TESTPAT) {
|
||||
status = get_status(target_tvp, target_format);
|
||||
|
||||
switch (status) {
|
||||
case ACTIVITY_CHANGE:
|
||||
@ -960,7 +951,6 @@ int main()
|
||||
|
||||
btn_code_prev = btn_code;
|
||||
remote_rpt_prev = remote_rpt;
|
||||
target_mode = AV_KEEP;
|
||||
usleep(300); // Avoid executing mainloop multiple times per vsync
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@ -62,7 +62,7 @@
|
||||
static const char *avinput_str[] = { "Test pattern", "AV1: RGBS", "AV1: RGsB", "AV1: YPbPr", "AV2: YPbPr", "AV2: RGsB", "AV3: RGBHV", "AV3: RGBS", "AV3: RGsB", "AV3: YPbPr", "Last used" };
|
||||
|
||||
typedef enum {
|
||||
AV_KEEP = 0,
|
||||
AV_TESTPAT = 0,
|
||||
AV1_RGBs = 1,
|
||||
AV1_RGsB = 2,
|
||||
AV1_YPBPR = 3,
|
||||
@ -75,27 +75,6 @@ typedef enum {
|
||||
AV_LAST = 10
|
||||
} avinput_t;
|
||||
|
||||
typedef enum {
|
||||
PHY_AV1 = 0,
|
||||
PHY_AV2 = 1,
|
||||
PHY_AV3 = 2,
|
||||
PHY_INVALID = 3
|
||||
} phyinput_t;
|
||||
|
||||
static phyinput_t avinput_to_phyinput[] = {
|
||||
[AV_KEEP] = PHY_INVALID,
|
||||
[AV1_RGBs] = PHY_AV1,
|
||||
[AV1_RGsB] = PHY_AV1,
|
||||
[AV1_YPBPR] = PHY_AV1,
|
||||
[AV2_YPBPR] = PHY_AV2,
|
||||
[AV2_RGsB] = PHY_AV2,
|
||||
[AV3_RGBHV] = PHY_AV3,
|
||||
[AV3_RGBs] = PHY_AV3,
|
||||
[AV3_RGsB] = PHY_AV3,
|
||||
[AV3_YPBPR] = PHY_AV3,
|
||||
[AV_LAST] = PHY_INVALID
|
||||
};
|
||||
|
||||
// In reverse order of importance
|
||||
typedef enum {
|
||||
NO_CHANGE = 0,
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@ -40,7 +40,7 @@ extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
extern const mode_data_t video_modes[];
|
||||
extern avmode_t cm;
|
||||
extern avconfig_t tc;
|
||||
extern avinput_t target_mode;
|
||||
extern avinput_t target_input;
|
||||
extern alt_u8 menu_active;
|
||||
extern alt_u16 sys_ctrl;
|
||||
extern alt_u8 profile_sel;
|
||||
@ -127,15 +127,15 @@ void parse_control()
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case RC_BTN1: target_mode = AV1_RGBs; break;
|
||||
case RC_BTN4: target_mode = AV1_RGsB; break;
|
||||
case RC_BTN7: target_mode = AV1_YPBPR; break;
|
||||
case RC_BTN2: target_mode = AV2_YPBPR; break;
|
||||
case RC_BTN5: target_mode = AV2_RGsB; break;
|
||||
case RC_BTN3: target_mode = AV3_RGBHV; break;
|
||||
case RC_BTN6: target_mode = AV3_RGBs; break;
|
||||
case RC_BTN9: target_mode = AV3_RGsB; break;
|
||||
case RC_BTN0: target_mode = AV3_YPBPR; break;
|
||||
case RC_BTN1: target_input = AV1_RGBs; break;
|
||||
case RC_BTN4: target_input = AV1_RGsB; break;
|
||||
case RC_BTN7: target_input = AV1_YPBPR; break;
|
||||
case RC_BTN2: target_input = AV2_YPBPR; break;
|
||||
case RC_BTN5: target_input = AV2_RGsB; break;
|
||||
case RC_BTN3: target_input = AV3_RGBHV; break;
|
||||
case RC_BTN6: target_input = AV3_RGBs; break;
|
||||
case RC_BTN9: target_input = AV3_RGsB; break;
|
||||
case RC_BTN0: target_input = AV3_YPBPR; break;
|
||||
case RC_MENU:
|
||||
menu_active = !menu_active;
|
||||
|
||||
@ -228,7 +228,7 @@ void parse_control()
|
||||
Button_Check:
|
||||
if (btn_code_prev == 0) {
|
||||
if (btn_code & PB0_BIT)
|
||||
target_mode = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1);
|
||||
target_input = (cm.avinput == AV3_YPBPR) ? AV1_RGBs : (cm.avinput+1);
|
||||
if (btn_code & PB1_BIT)
|
||||
tc.sl_mode = tc.sl_mode < SL_MODE_MAX ? tc.sl_mode + 1 : 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@ -24,7 +24,7 @@
|
||||
#include "sysconfig.h"
|
||||
|
||||
#define FW_VER_MAJOR 0
|
||||
#define FW_VER_MINOR 79
|
||||
#define FW_VER_MINOR 80
|
||||
|
||||
#ifdef ENABLE_AUDIO
|
||||
#define FW_SUFFIX1 "a"
|
||||
|
@ -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, def_input;
|
||||
extern alt_u8 vm_sel, profile_sel, lt_sel, def_input, profile_link;
|
||||
|
||||
alt_u8 menu_active;
|
||||
|
||||
@ -134,7 +134,6 @@ 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 = { &def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } },
|
||||
}))
|
||||
|
||||
MENU(menu_postproc, P99_PROTECT({ \
|
||||
@ -164,6 +163,15 @@ MENU(menu_audio, P99_PROTECT({ \
|
||||
#define AUDIO_MENU
|
||||
#endif
|
||||
|
||||
MENU(menu_settings, P99_PROTECT({ \
|
||||
{ LNG("<Load profile >","<プロファイルロード >"), OPT_FUNC_CALL, { .fun = { load_profile, &profile_arg_info } } },
|
||||
{ LNG("<Save profile >","<プロファイルセーブ >"), OPT_FUNC_CALL, { .fun = { save_profile, &profile_arg_info } } },
|
||||
{ LNG("<Reset settings>","<セッテイオショキカ >"), OPT_FUNC_CALL, { .fun = { set_default_avconfig, NULL } } },
|
||||
{ LNG("Initial input","ショキニュウリョク"), OPT_AVCONFIG_SELECTION, { .sel = { &def_input, OPT_WRAP, SETTING_ITEM(avinput_str) } } },
|
||||
{ "Link input/prof", OPT_AVCONFIG_SELECTION, { .sel = { &profile_link, OPT_WRAP, SETTING_ITEM(off_on_desc) } } },
|
||||
{ LNG("<Fw. update >","<ファームウェアアップデート>"), OPT_FUNC_CALL, { .fun = { fw_update, NULL } } },
|
||||
}))
|
||||
|
||||
|
||||
MENU(menu_main, P99_PROTECT({ \
|
||||
{ LNG("Video in proc >","タイオウエイゾウ >"), OPT_SUBMENU, { .sub = { &menu_vinputproc, NULL, NULL } } },
|
||||
@ -173,10 +181,7 @@ MENU(menu_main, P99_PROTECT({ \
|
||||
{ LNG("Post-proc. >","アトショリ >"), OPT_SUBMENU, { .sub = { &menu_postproc, NULL, NULL } } },
|
||||
{ LNG("Compatibility >","ゴカンセイ >"), OPT_SUBMENU, { .sub = { &menu_compatibility, NULL, NULL } } },
|
||||
AUDIO_MENU
|
||||
{ LNG("<Load profile >","<プロファイルロード >"), OPT_FUNC_CALL, { .fun = { load_profile, &profile_arg_info } } },
|
||||
{ LNG("<Save profile >","<プロファイルセーブ >"), OPT_FUNC_CALL, { .fun = { save_profile, &profile_arg_info } } },
|
||||
{ LNG("<Reset settings>","<セッテイオショキカ >"), OPT_FUNC_CALL, { .fun = { set_default_avconfig, NULL } } },
|
||||
{ LNG("<Fw. update >","<ファームウェアアップデート>"), OPT_FUNC_CALL, { .fun = { fw_update, NULL } } },
|
||||
{ "Settings opt >", OPT_SUBMENU, { .sub = { &menu_settings, NULL, NULL } } },
|
||||
}))
|
||||
|
||||
// Max 3 levels currently
|
||||
@ -190,7 +195,7 @@ void display_menu(alt_u8 forcedisp)
|
||||
menuitem_type type;
|
||||
alt_u8 *val, val_wrap, val_min, val_max;
|
||||
alt_u16 *val_u16;
|
||||
int i, retval = 0;
|
||||
int i, func_called = 0, retval = 0;
|
||||
|
||||
for (i=RC_OK; i < RC_INFO; i++) {
|
||||
if (remote_code == rc_keymap[i]) {
|
||||
@ -235,6 +240,7 @@ void display_menu(alt_u8 forcedisp)
|
||||
break;
|
||||
case OPT_FUNC_CALL:
|
||||
retval = navi[navlvl].m->items[navi[navlvl].mp].fun.f();
|
||||
func_called = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -312,7 +318,7 @@ void display_menu(alt_u8 forcedisp)
|
||||
menu_row2[0] = 0;
|
||||
break;
|
||||
case OPT_FUNC_CALL:
|
||||
if (code == OPT_SELECT)
|
||||
if (func_called)
|
||||
sniprintf(menu_row2, LCD_ROW_LEN+1, "%s", (retval==0) ? "Done" : "Failed");
|
||||
else if (navi[navlvl].m->items[navi[navlvl].mp].fun.arg_info)
|
||||
navi[navlvl].m->items[navi[navlvl].mp].fun.arg_info->df(*navi[navlvl].m->items[navi[navlvl].mp].fun.arg_info->data);
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@ -28,11 +28,11 @@ extern alt_u16 rc_keymap[REMOTE_MAX_KEYS];
|
||||
extern avmode_t cm;
|
||||
extern avconfig_t tc;
|
||||
extern mode_data_t video_modes[];
|
||||
extern avinput_t target_mode;
|
||||
extern avinput_t target_input;
|
||||
extern alt_u8 update_cur_vm;
|
||||
extern alt_u8 input_profiles[3];
|
||||
extern alt_u8 input_profiles[AV_LAST];
|
||||
extern alt_u8 profile_sel;
|
||||
extern alt_u8 def_input;
|
||||
extern alt_u8 def_input, profile_link;
|
||||
|
||||
int write_userdata(alt_u8 entry)
|
||||
{
|
||||
@ -59,6 +59,7 @@ int write_userdata(alt_u8 entry)
|
||||
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;
|
||||
((ude_initcfg*)databuf)->profile_link = profile_link;
|
||||
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)
|
||||
@ -135,13 +136,16 @@ int read_userdata(alt_u8 entry)
|
||||
switch (((ude_hdr*)databuf)->type) {
|
||||
case UDE_INITCFG:
|
||||
if (((ude_initcfg*)databuf)->data_len == sizeof(ude_initcfg) - offsetof(ude_initcfg, last_profile)) {
|
||||
for (alt_u8 i = 0; i < sizeof(input_profiles)/sizeof(*input_profiles); ++i)
|
||||
for (i = 0; i < sizeof(input_profiles)/sizeof(*input_profiles); ++i)
|
||||
if (((ude_initcfg*)databuf)->last_profile[i] <= MAX_PROFILE)
|
||||
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
|
||||
if (def_input < AV_LAST)
|
||||
target_input = def_input;
|
||||
else if (((ude_initcfg*)databuf)->last_input < AV_LAST)
|
||||
target_input = ((ude_initcfg*)databuf)->last_input;
|
||||
profile_link = ((ude_initcfg*)databuf)->profile_link;
|
||||
profile_sel = input_profiles[AV_TESTPAT]; // Global profile
|
||||
memcpy(rc_keymap, ((ude_initcfg*)databuf)->keys, sizeof(rc_keymap));
|
||||
printf("RC data read (%u bytes)\n", sizeof(rc_keymap));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@ -46,7 +46,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
ude_hdr hdr;
|
||||
alt_u16 data_len;
|
||||
alt_u8 last_profile[3];
|
||||
alt_u8 last_profile[AV_LAST];
|
||||
alt_u8 profile_link;
|
||||
avinput_t last_input;
|
||||
avinput_t def_input;
|
||||
alt_u16 keys[REMOTE_MAX_KEYS];
|
||||
|
Loading…
x
Reference in New Issue
Block a user