Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel 17 (16) toggles after first switch to operate mode #948

Closed
siegmund42 opened this issue Feb 21, 2017 · 4 comments
Closed

Channel 17 (16) toggles after first switch to operate mode #948

siegmund42 opened this issue Feb 21, 2017 · 4 comments

Comments

@siegmund42
Copy link
Contributor

This has been reported quite accurate here: http://www.qlcplus.org/forum/viewtopic.php?f=33&t=10865#p46815

Seems like it is only related to some channels in combination with using an input profile with "generate extra toggle" enabled.
From debugging it seems like channel 17 (16 - if counting from 0) changes its value - and triggers slotInputValueChanged on the frame - which causes all the trouble. I was not able to find out why (especially) channel 17 (16) is doing this - and because of a lack of debugging experience in cpp I have no idea how to do that.

@mdmayfield
Copy link
Contributor

This is more complex than just channel 17 - when channels in the loopback universe are modified in Simple Desk prior to the first update of other channels, strange combinations of frames are enabled/disabled. Perhaps this is some kind of rounding error?

@mdmayfield
Copy link
Contributor

This is on the "back burner" and not a high priority, but recently I've seen a light or two flash on the first time going to Live mode after opening a workspace.

I think that means that this isn't a bug in the VC or frame enable widgets, but rather something deeper in the engine that is causing the very first DMX frame of certain channels to register >0 -- but only for one DMX frame, and only on the first time switching to Live mode after starting QLC or opening a project.

This behavior is deterministic, not random. Unfortunately it seems very hard to understand what causes it and why those particular channels are affected.

For example, channel 17 in universe 3 "flips" momentarily the first time going to Live mode... Unless channel 17's Simple Desk fader was touched before going to Live mode. In that case, a bizarre pattern of other channels "flip" when going to Live mode.

In any case, this only happens once per opening of a project. After the first time, going back and forth between Live and Edit modes does not show this behavior.

@mcallegari
Copy link
Owner

@mdmayfield there's indeed something wrong
I've added a debug message here: https://github.com/mcallegari/qlcplus/blob/master/plugins/loopback/src/loopback.cpp#L200

and it says: Data changed at 16 "0" "0"
Where 16 is i, "0" is chData[i] and "0" is data[i]
So basically between the if statement and the debug message someone changes the value of data (or chData)

@mcallegari
Copy link
Owner

mcallegari commented Apr 24, 2017

Alright, this seems to solve the issue. @janosvitok please review.
If you can build from sources, this is the code to be replaced:

void Loopback::writeUniverse(quint32 universe, quint32 output, const QByteArray &data)
{
    Q_UNUSED(universe);

    if (!m_outputMap.contains(output))
        return;

    QByteArray &chData = m_channelData[output];

    if (m_inputMap.contains(output))
    {
        quint32 inputUniverse = m_inputMap[output];

        for (int i = 0; i < data.size(); i++)
        {
            if (chData[i] != data[i])
            {
                chData[i] = data[i];
                //qDebug() << "Data changed at" << i << QString::number(chData[i]) << QString::number(data[i]);
                emit valueChanged(inputUniverse, output, i, chData[i]);
            }
        }
    }
}

mdmayfield pushed a commit to mdmayfield/qlcplus that referenced this issue Apr 24, 2017
…s are looped (fixes mcallegari#948)

I think there is still something wrong in how QByteArrays are used though.
They are all used by reference and if by any chance the reference of the original data changes,
there might be transitions with random data, if not a segfault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants