mirror of
https://github.com/marqs85/ossc.git
synced 2025-08-08 07:25:02 +00:00
minor optimizations
This commit is contained in:
@@ -547,17 +547,14 @@ void program_mode()
|
|||||||
int load_profile() {
|
int load_profile() {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
input_profiles[profile_link ? cm.avinput : AV_TESTPAT] = profile_sel;
|
|
||||||
retval = read_userdata(profile_sel);
|
retval = read_userdata(profile_sel);
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
// Change the input if the new profile demands a different one.
|
// Change the input if the new profile demands it.
|
||||||
// Also prevent the change of input from inducing a profile load.
|
if (tc.link_av != AV_LAST)
|
||||||
if (tc.link_av != AV_LAST && tc.link_av != cm.avinput) {
|
|
||||||
target_input = tc.link_av;
|
target_input = tc.link_av;
|
||||||
input_profiles[profile_link ? target_input : AV_TESTPAT]
|
|
||||||
= profile_sel;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Update profile link (also prevents the change of input from inducing a profile load).
|
||||||
|
input_profiles[profile_link ? target_input : AV_TESTPAT] = profile_sel;
|
||||||
write_userdata(INIT_CONFIG_SLOT);
|
write_userdata(INIT_CONFIG_SLOT);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@@ -778,7 +775,7 @@ int main()
|
|||||||
|
|
||||||
alt_u32 input_vec;
|
alt_u32 input_vec;
|
||||||
|
|
||||||
int init_stat;
|
int init_stat, man_input_change;
|
||||||
|
|
||||||
init_stat = init_hw();
|
init_stat = init_hw();
|
||||||
|
|
||||||
@@ -810,7 +807,16 @@ int main()
|
|||||||
if ((remote_rpt == 0) || ((remote_rpt > 1) && (remote_rpt < 6)) || (remote_rpt == remote_rpt_prev))
|
if ((remote_rpt == 0) || ((remote_rpt > 1) && (remote_rpt < 6)) || (remote_rpt == remote_rpt_prev))
|
||||||
remote_code = 0;
|
remote_code = 0;
|
||||||
|
|
||||||
parse_control();
|
remote_rpt_prev = remote_rpt;
|
||||||
|
|
||||||
|
if (btn_code_prev == 0) {
|
||||||
|
btn_code_prev = btn_code;
|
||||||
|
} else {
|
||||||
|
btn_code_prev = btn_code;
|
||||||
|
btn_code = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
man_input_change = parse_control();
|
||||||
|
|
||||||
if (menu_active)
|
if (menu_active)
|
||||||
display_menu(0);
|
display_menu(0);
|
||||||
@@ -880,7 +886,7 @@ int main()
|
|||||||
if (!menu_active)
|
if (!menu_active)
|
||||||
lcd_write_status();
|
lcd_write_status();
|
||||||
// record last input if it was selected manually
|
// record last input if it was selected manually
|
||||||
if ((def_input == AV_LAST) && (remote_code || (btn_code & PB0_BIT)))
|
if ((def_input == AV_LAST) && man_input_change)
|
||||||
write_userdata(INIT_CONFIG_SLOT);
|
write_userdata(INIT_CONFIG_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,8 +942,6 @@ int main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
btn_code_prev = btn_code;
|
|
||||||
remote_rpt_prev = remote_rpt;
|
|
||||||
usleep(300); // Avoid executing mainloop multiple times per vsync
|
usleep(300); // Avoid executing mainloop multiple times per vsync
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||||
//
|
//
|
||||||
// This file is part of Open Source Scan Converter project.
|
// This file is part of Open Source Scan Converter project.
|
||||||
//
|
//
|
||||||
@@ -103,11 +103,12 @@ void setup_rc()
|
|||||||
write_userdata(INIT_CONFIG_SLOT);
|
write_userdata(INIT_CONFIG_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_control()
|
int parse_control()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
alt_u32 btn_vec;
|
alt_u32 btn_vec;
|
||||||
alt_u8 pt_only = 0;
|
alt_u8 pt_only = 0;
|
||||||
|
avinput_t man_target_input = AV_LAST;
|
||||||
|
|
||||||
// one for each video_group
|
// one for each video_group
|
||||||
alt_u8* pmcfg_ptr[] = { &pt_only, &tc.pm_240p, &tc.pm_384p, &tc.pm_480i, &tc.pm_480p, &tc.pm_480p, &tc.pm_1080i };
|
alt_u8* pmcfg_ptr[] = { &pt_only, &tc.pm_240p, &tc.pm_384p, &tc.pm_480i, &tc.pm_480p, &tc.pm_480p, &tc.pm_1080i };
|
||||||
@@ -116,7 +117,7 @@ void parse_control()
|
|||||||
if (remote_code)
|
if (remote_code)
|
||||||
printf("RCODE: 0x%.4lx, %d\n", remote_code, remote_rpt);
|
printf("RCODE: 0x%.4lx, %d\n", remote_code, remote_rpt);
|
||||||
|
|
||||||
if (btn_code_prev == 0 && btn_code != 0)
|
if (btn_code)
|
||||||
printf("BCODE: 0x%.2lx\n", btn_code>>16);
|
printf("BCODE: 0x%.2lx\n", btn_code>>16);
|
||||||
|
|
||||||
for (i = RC_BTN1; i < REMOTE_MAX_KEYS; i++) {
|
for (i = RC_BTN1; i < REMOTE_MAX_KEYS; i++) {
|
||||||
@@ -127,15 +128,15 @@ void parse_control()
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case RC_BTN1: target_input = AV1_RGBs; break;
|
case RC_BTN1: man_target_input = AV1_RGBs; break;
|
||||||
case RC_BTN4: target_input = AV1_RGsB; break;
|
case RC_BTN4: man_target_input = AV1_RGsB; break;
|
||||||
case RC_BTN7: target_input = AV1_YPBPR; break;
|
case RC_BTN7: man_target_input = AV1_YPBPR; break;
|
||||||
case RC_BTN2: target_input = AV2_YPBPR; break;
|
case RC_BTN2: man_target_input = AV2_YPBPR; break;
|
||||||
case RC_BTN5: target_input = AV2_RGsB; break;
|
case RC_BTN5: man_target_input = AV2_RGsB; break;
|
||||||
case RC_BTN3: target_input = AV3_RGBHV; break;
|
case RC_BTN3: man_target_input = AV3_RGBHV; break;
|
||||||
case RC_BTN6: target_input = AV3_RGBs; break;
|
case RC_BTN6: man_target_input = AV3_RGBs; break;
|
||||||
case RC_BTN9: target_input = AV3_RGsB; break;
|
case RC_BTN9: man_target_input = AV3_RGsB; break;
|
||||||
case RC_BTN0: target_input = AV3_YPBPR; break;
|
case RC_BTN0: man_target_input = AV3_YPBPR; break;
|
||||||
case RC_MENU:
|
case RC_MENU:
|
||||||
menu_active = !menu_active;
|
menu_active = !menu_active;
|
||||||
|
|
||||||
@@ -226,10 +227,15 @@ void parse_control()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button_Check:
|
Button_Check:
|
||||||
if (btn_code_prev == 0) {
|
if (btn_code & PB0_BIT)
|
||||||
if (btn_code & PB0_BIT)
|
man_target_input = (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)
|
||||||
if (btn_code & PB1_BIT)
|
tc.sl_mode = tc.sl_mode < SL_MODE_MAX ? tc.sl_mode + 1 : 0;
|
||||||
tc.sl_mode = tc.sl_mode < SL_MODE_MAX ? tc.sl_mode + 1 : 0;
|
|
||||||
|
if (man_target_input != AV_LAST) {
|
||||||
|
target_input = man_target_input;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||||
//
|
//
|
||||||
// This file is part of Open Source Scan Converter project.
|
// This file is part of Open Source Scan Converter project.
|
||||||
//
|
//
|
||||||
@@ -60,6 +60,6 @@ typedef enum {
|
|||||||
#define REMOTE_MAX_KEYS (RC_PROF_HOTKEY-RC_BTN1+1)
|
#define REMOTE_MAX_KEYS (RC_PROF_HOTKEY-RC_BTN1+1)
|
||||||
|
|
||||||
void setup_rc();
|
void setup_rc();
|
||||||
void parse_control();
|
int parse_control();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||||
//
|
//
|
||||||
// This file is part of Open Source Scan Converter project.
|
// This file is part of Open Source Scan Converter project.
|
||||||
//
|
//
|
||||||
@@ -57,7 +57,7 @@ int write_userdata(alt_u8 entry)
|
|||||||
case UDE_INITCFG:
|
case UDE_INITCFG:
|
||||||
((ude_initcfg*)databuf)->data_len = sizeof(ude_initcfg) - offsetof(ude_initcfg, last_profile);
|
((ude_initcfg*)databuf)->data_len = sizeof(ude_initcfg) - offsetof(ude_initcfg, last_profile);
|
||||||
memcpy(((ude_initcfg*)databuf)->last_profile, input_profiles, sizeof(input_profiles));
|
memcpy(((ude_initcfg*)databuf)->last_profile, input_profiles, sizeof(input_profiles));
|
||||||
((ude_initcfg*)databuf)->last_input = cm.avinput;
|
((ude_initcfg*)databuf)->last_input = target_input;
|
||||||
((ude_initcfg*)databuf)->def_input = def_input;
|
((ude_initcfg*)databuf)->def_input = def_input;
|
||||||
((ude_initcfg*)databuf)->profile_link = profile_link;
|
((ude_initcfg*)databuf)->profile_link = profile_link;
|
||||||
memcpy(((ude_initcfg*)databuf)->keys, rc_keymap, sizeof(rc_keymap));
|
memcpy(((ude_initcfg*)databuf)->keys, rc_keymap, sizeof(rc_keymap));
|
||||||
|
Reference in New Issue
Block a user