From 3d8c29f2414eb7fa92e87d31058d1b90a6871e62 Mon Sep 17 00:00:00 2001 From: max_10 Date: Fri, 3 May 2019 21:39:42 +0200 Subject: [PATCH] activate unicable pin, thx DboxOldie Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c8e42e2b613a56d49b8788695747cb38cdf3f7be Author: max_10 Date: 2019-05-03 (Fri, 03 May 2019) Origin message was: ------------------ - activate unicable pin, thx DboxOldie ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 2 ++ data/locale/english.locale | 2 ++ src/gui/scan_setup.cpp | 8 +++++++- src/system/locals.h | 2 ++ src/system/locals_intern.h | 2 ++ src/zapit/src/femanager.cpp | 2 +- src/zapit/src/frontend.cpp | 17 ++++++++++++----- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 057df86e6..a33ad2b4e 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -2748,6 +2748,8 @@ tunersetup.mode Betriebsmodus tunersetup.power 5V-Versorgung bei DVB-T/T2 Kanälen tunersetup.terr Terrestrisch (DVB-T/T2) unicable.lnb Unicable Eingang +unicable.pin Unicable PIN +unicable.pin_hint PIN (1 - 255) für Benutzer Frequenz\n0 bedeutet inaktiv / aus unicable.qrg Unicable Frequenz unicable.scr Unicable SCR unit.decimal , diff --git a/data/locale/english.locale b/data/locale/english.locale index 3dc983441..48f09fa4a 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -2748,6 +2748,8 @@ tunersetup.mode Operation mode tunersetup.power 5V supply on DVB-T/T2 channels tunersetup.terr Terrestrial (DVB-T/T2) unicable.lnb Unicable Input +unicable.pin Unicable PIN +unicable.pin_hint PIN (1 - 255) for user frequency\n0 means inactive / off unicable.qrg Unicable Frequency unicable.scr Unicable SCR unit.decimal . diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index db1c2240d..9822f79aa 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -1105,9 +1105,13 @@ int CScanSetup::showUnicableSetup() frontend_config_t &fe_config = fe->getConfig(); int unicable_scr = fe_config.uni_scr; int unicable_qrg = fe_config.uni_qrg; + int unicable_pin = fe_config.uni_pin; CMenuOptionNumberChooser *uniscr = new CMenuOptionNumberChooser(LOCALE_UNICABLE_SCR, &unicable_scr, true, 0, dmode == DISEQC_UNICABLE ? 7 : 31); CIntInput *uniqrg = new CIntInput(LOCALE_UNICABLE_QRG, &unicable_qrg, 4, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); + CMenuOptionNumberChooser *unipin = new CMenuOptionNumberChooser(LOCALE_UNICABLE_PIN, &unicable_pin, true, 0, 255, NULL, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF); + unipin->setNumericInput(true); + unipin->setHint("", LOCALE_UNICABLE_PIN_HINT); CMenuWidget *uni_setup = new CMenuWidget(LOCALE_SATSETUP_UNI_SETTINGS, NEUTRINO_ICON_SETTINGS, width); uni_setup->addIntroItems(); @@ -1115,12 +1119,14 @@ int CScanSetup::showUnicableSetup() uni_setup->addItem(uniscr); CMenuForwarder *mf = new CMenuDForwarder(LOCALE_UNICABLE_QRG, true, uniqrg->getValue(), uniqrg); uni_setup->addItem(mf); + uni_setup->addItem(unipin); res = uni_setup->exec(NULL, ""); delete uni_setup; if (res) { fe_config.uni_scr = unicable_scr; fe_config.uni_qrg = unicable_qrg; - printf("%s: scr: %d qrg: %d\n", __func__, unicable_scr, unicable_qrg); + fe_config.uni_pin = unicable_pin; + printf("%s: scr: %d qrg: %d pin: %d\n", __func__, unicable_scr, unicable_qrg, unicable_pin); } return res; } diff --git a/src/system/locals.h b/src/system/locals.h index d141e4e60..cc99fa4ca 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -2775,6 +2775,8 @@ typedef enum LOCALE_TUNERSETUP_POWER, LOCALE_TUNERSETUP_TERR, LOCALE_UNICABLE_LNB, + LOCALE_UNICABLE_PIN, + LOCALE_UNICABLE_PIN_HINT, LOCALE_UNICABLE_QRG, LOCALE_UNICABLE_SCR, LOCALE_UNIT_DECIMAL, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index e397e60ad..364aa8f6c 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -2775,6 +2775,8 @@ const char * locale_real_names[] = "tunersetup.power", "tunersetup.terr", "unicable.lnb", + "unicable.pin", + "unicable.pin_hint", "unicable.qrg", "unicable.scr", "unit.decimal", diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index d73f27c37..c6bd9fe3f 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -250,7 +250,7 @@ bool CFEManager::loadSettings() fe_config.highVoltage = getConfigValue(fe, "highVoltage", 0); fe_config.uni_scr = getConfigValue(fe, "uni_scr", 0); fe_config.uni_qrg = getConfigValue(fe, "uni_qrg", 0); - fe_config.uni_pin = getConfigValue(fe, "uni_pin", -1); + fe_config.uni_pin = getConfigValue(fe, "uni_pin", 0); fe_config.diseqc_order = getConfigValue(fe, "diseqc_order", UNCOMMITED_FIRST); fe_config.use_usals = getConfigValue(fe, "use_usals", 0); fe_config.rotor_swap = getConfigValue(fe, "rotor_swap", 0); diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index 0f2379c83..0a44d5272 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -1705,7 +1705,7 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int WARN("ooops. t > 1024? (%d)", t); return 0; } - if (pin >= 0 && pin < 0x100) { + if (pin > 0 && pin < 0x100) { cmd.msg[2] = 0x5c; cmd.msg[5] = config.uni_pin; cmd.msg_len = 6; @@ -1716,7 +1716,7 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int if (!slave && info.type == FE_QPSK) { cmd.msg[3] = (config.uni_scr << 5); /* adress */ if (bank < 2) { /* bank = 0/1 => tune, bank = 2 => standby */ - cmd.msg[3] |= (t >> 8) | /* highest 3 bits of t */ + cmd.msg[3] |= (t >> 8) | /* highest 2 bits of t */ (bank << 4) | /* input 0/1 */ (horizontal << 3) | /* horizontal == 0x08 */ (high_band) << 2; /* high_band == 0x04 */ @@ -1733,20 +1733,27 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int uint32_t CFrontend::sendEN50607TuningCommand(const uint32_t frequency, const int high_band, const int horizontal, const int bank) { uint32_t bpf = config.uni_qrg; + int pin = config.uni_pin; struct dvb_diseqc_master_cmd cmd = { {0x70, 0x00, 0x00, 0x00, 0x00, 0x00}, 4 }; + if (pin > 0 && pin < 0x100) { + cmd.msg[0] = 0x71; + cmd.msg[4] = config.uni_pin; + cmd.msg_len = 5; + } + unsigned int t = frequency / 1000 - 100; if (t < 0x800 && config.uni_scr >= 0 && config.uni_scr < 32) { uint32_t ret = bpf * 1000; - INFO("[unicable-JESS] 18V=%d TONE=%d, freq=%d qrg=%d scr=%d bank=%d ret=%d", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, config.uni_scr, bank, ret); + INFO("[unicable-JESS] 18V=%d TONE=%d, freq=%d qrg=%d scr=%d bank=%d pin=%d ret=%d", currentVoltage == SEC_VOLTAGE_18, currentToneMode == SEC_TONE_ON, frequency, bpf, config.uni_scr, bank, pin, ret); if (!slave && info.type == FE_QPSK) { cmd.msg[1] = ((config.uni_scr & 0x1F) << 3) | /* user band adress ( 0 to 31) */ /* max. possible tuning word = 0x7FF */ ((t >> 8) & 0x07); /* highest 3 bits of t (MSB) */ cmd.msg[2] = t & 0xFF; /* tuning word (LSB) */ - cmd.msg[3] = (0 << 4) | /* no uncommited switch */ + cmd.msg[3] = (0 << 4) | /* no commited switch */ /* I really don't know if the combines of option and position bits are right here, because I can'test it, assuming here 4 sat positions */ ((bank & 0x03) << 2) | /* input 0/1/2/3 */ @@ -1755,7 +1762,7 @@ uint32_t CFrontend::sendEN50607TuningCommand(const uint32_t frequency, const int fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_18); usleep(20 * 1000); /* en50494 says: >4ms and < 22 ms */ sendDiseqcCommand(&cmd, 80); /* en50494 says: >2ms and < 60 ms */ - fop(ioctl, FE_SET_VOLTAGE, SEC_VOLTAGE_13); + fop(ioctl, FE_SET_VOLTAGE, unicable_lowvolt); } return ret; }