From: Peter BaĊĦista Date: Tue, 17 Jan 2023 07:48:43 +0000 (+0100) Subject: Add configurable delays after Unicable operations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b70f3b3f12b4398cfdf18fb311e9e57abcf86260;p=thirdparty%2Ftvheadend.git Add configurable delays after Unicable operations Allow user to adjust the length of time delays after the Unicable device is powered up and after a DiSEqC command is sent to it --- diff --git a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c index 6a6d675ff..9ea7f783e 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c @@ -144,6 +144,22 @@ const idclass_t linuxdvb_en50494_class = .ic_caption = N_("en50494"), .ic_get_title = linuxdvb_en50494_class_get_title, .ic_properties = (const property_t[]) { + { + .type = PT_U32, + .id = "powerup_time", + .name = N_("Power up time (ms) (10-500)"), + .desc = N_("Time (in milliseconds) for the Unicable device to power up."), + .off = offsetof(linuxdvb_en50494_t, le_powerup_time), + .def.u32 = 15, + }, + { + .type = PT_U32, + .id = "cmd_time", + .name = N_("Command time (ms) (10-300)"), + .desc = N_("Time (in milliseconds) for a command to complete."), + .off = offsetof(linuxdvb_en50494_t, le_cmd_time), + .def.u32 = 50 + }, { .type = PT_U16, .id = "id", @@ -186,6 +202,22 @@ const idclass_t linuxdvb_en50607_class = .ic_caption = N_("en50607"), .ic_get_title = linuxdvb_en50607_class_get_title, .ic_properties = (const property_t[]) { + { + .type = PT_U32, + .id = "powerup_time", + .name = N_("Power up time (ms) (10-500)"), + .desc = N_("Time (in milliseconds) for the Unicable device to power up."), + .off = offsetof(linuxdvb_en50494_t, le_powerup_time), + .def.u32 = 15, + }, + { + .type = PT_U32, + .id = "cmd_time", + .name = N_("Command time (ms) (10-300)"), + .desc = N_("Time (in milliseconds) for a command to complete."), + .off = offsetof(linuxdvb_en50494_t, le_cmd_time), + .def.u32 = 50 + }, { .type = PT_U16, .id = "id", @@ -345,7 +377,10 @@ linuxdvb_en50494_tune tvherror(LS_EN50494, "error setting lnb voltage to 18V"); break; } - tvh_safe_usleep(15000); /* standard: 4ms < x < 22ms */ + + /* linuxdvb_diseqc_set_volt() function already sleeps for 15ms */ + tvhtrace(LS_EN50494, "after power up: sleep %d ms", le->le_powerup_time); + tvh_safe_usleep(MINMAX(le->le_powerup_time, 10, 500) * 1000); /* standard: 4ms < x < 22ms */ /* send tune command (with/without pin) */ tvhdebug(LS_EN50494, @@ -379,7 +414,9 @@ linuxdvb_en50494_tune tvherror(LS_EN50494, "error send tune command"); break; } - tvh_safe_usleep(50000); /* standard: 2ms < x < 60ms */ + + tvhtrace(LS_EN50494, "after command: sleep %d ms", le->le_cmd_time); + tvh_safe_usleep(MINMAX(le->le_cmd_time, 10, 300) * 1000); /* standard: 2ms < x < 60ms */ /* return to 13V */ ret = linuxdvb_diseqc_set_volt(lsp, 0); @@ -447,6 +484,10 @@ linuxdvb_en50494_create0 le->le_pin = LINUXDVB_EN50494_NOPIN; le->ld_freq = linuxdvb_en50494_freq; le->ld_match = linuxdvb_en50494_match; + if (le->le_powerup_time == 0) + le->le_powerup_time = 15; + if (le->le_cmd_time == 0) + le->le_cmd_time = 50; ld = linuxdvb_diseqc_create0((linuxdvb_diseqc_t *)le, NULL, diff --git a/src/input/mpegts/linuxdvb/linuxdvb_private.h b/src/input/mpegts/linuxdvb/linuxdvb_private.h index 77c927d03..baaf03313 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_private.h +++ b/src/input/mpegts/linuxdvb/linuxdvb_private.h @@ -351,6 +351,10 @@ struct linuxdvb_en50494 { linuxdvb_diseqc_t; + /* wait times */ + uint32_t le_powerup_time; /* time to wait for power up in milliseconds */ + uint32_t le_cmd_time; /* time to wait for command to complete in milliseconds */ + /* en50494 configuration */ uint16_t le_id; /* user band ID (0-7 for EN50494, 0-31 for EN50607) */ uint16_t le_frequency; /* user band frequency in MHz */