+ }
+ case eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO:
+ {
+ eSecCommand::pair &compare = m_sec_sequence.current()->compare;
+ int idx = compare.voltage;
+ if ( idx == 0 || idx == 1 )
+ {
+ int idle = readInputpower();
+ int diff = abs(idle-m_idleInputpower[idx]);
+ if ( diff > 0)
+ {
+ eDebug("measure idle(%d) was not okay.. (%d - %d = %d) retry", idx, m_idleInputpower[idx], idle, diff);
+ setSecSequencePos(compare.steps);
+ break;
+ }
+ }
+ ++m_sec_sequence.current();
+ break;
+ }
+ case eSecCommand::MEASURE_RUNNING_INPUTPOWER:
+ m_runningInputpower = readInputpower();
+ eDebug("[SEC] runningInputpower is %d", m_runningInputpower);
+ ++m_sec_sequence.current();
+ break;
+ case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
+ {
+ int idleInputpower = m_idleInputpower[ (m_curVoltage&1) ? 0 : 1];
+ eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
+ const char *txt = cmd.direction ? "running" : "stopped";
+ eDebug("[SEC] waiting for rotor %s %d, idle %d, delta %d",
+ txt,
+ m_runningInputpower,
+ idleInputpower,
+ cmd.deltaA);
+ if ( (cmd.direction && abs(m_runningInputpower - idleInputpower) >= cmd.deltaA)
+ || (!cmd.direction && abs(m_runningInputpower - idleInputpower) <= cmd.deltaA) )
+ {
+ ++cmd.okcount;
+ eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
+ if ( cmd.okcount > 6 )
+ {
+ m_sec->setRotorMoving(cmd.direction);
+ eDebug("[SEC] rotor is %s", txt);
+ if (setSecSequencePos(cmd.steps))
+ break;
+ }
+ }
+ else
+ {
+ eDebug("[SEC] rotor not %s... reset counter.. increase timeout", txt);
+ --m_timeoutCount;
+ if (!m_timeoutCount && m_retryCount > 0)
+ --m_retryCount;
+ cmd.okcount=0;
+ }
+ ++m_sec_sequence.current();
+ break;
+ }
+ case eSecCommand::IF_ROTORPOS_VALID_GOTO:
+ if (m_data[5] != -1 && m_data[6] != -1)
+ setSecSequencePos(m_sec_sequence.current()->steps);
+ else
+ ++m_sec_sequence.current();
+ break;
+ case eSecCommand::INVALIDATE_CURRENT_ROTORPARMS:
+ m_data[5] = m_data[6] = -1;
+ eDebug("[SEC] invalidate current rotorparams");
+ ++m_sec_sequence.current();
+ break;
+ case eSecCommand::UPDATE_CURRENT_ROTORPARAMS:
+ m_data[5] = m_data[3];
+ m_data[6] = m_data[4];
+ eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]);
+ ++m_sec_sequence.current();
+ break;
+ case eSecCommand::SET_ROTOR_DISEQC_RETRYS:
+ m_retryCount = m_sec_sequence.current()++->val;
+ eDebug("[SEC] set rotor retries %d", m_retryCount);
+ break;
+ case eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO:
+ if (!m_retryCount)
+ {
+ eDebug("[SEC] no more rotor retrys");
+ setSecSequencePos(m_sec_sequence.current()->steps);
+ }
+ else
+ ++m_sec_sequence.current();
+ break;
+ case eSecCommand::SET_POWER_LIMITING_MODE:
+ {
+ int fd = m_fe ?
+ ::open("/dev/i2c/1", O_RDWR) :
+ ::open("/dev/i2c/0", O_RDWR);
+
+ unsigned char data[2];
+ ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
+ if(::read(fd, data, 1) != 1)
+ eDebug("[SEC] error read lnbp (%m)");
+ if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic )
+ {
+ data[0] |= 0x80; // enable static current limiting
+ eDebug("[SEC] set static current limiting");
+ }
+ else
+ {
+ data[0] &= ~0x80; // enable dynamic current limiting
+ eDebug("[SEC] set dynamic current limiting");
+ }
+ if(::write(fd, data, 1) != 1)
+ eDebug("[SEC] error write lnbp (%m)");
+ ::close(fd);
+ ++m_sec_sequence.current();
+ break;
+ }