collin80 / SavvyCAN

QT based cross platform canbus tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mask isn't working on Graphing Window

EMSoe opened this issue · comments

Hi Collin!

I've tried to use the "mask" function in graphing wondow to clear out the sawtooth signal that is bothering me in the graph that is attached.

image

I know that the sawtooth is coming from bits 2 and 3, so I used 0xF3 as it woud the mask b11110011. But nothign changes between using 0xF3, 0xFF or 0x FFFFFFFF in the mask box.

I'm currently using the V213 (built Mar 23 2023).

Maybe I misunderstand the functioning of the mask tool. Please clear me this doubt.

It looks like the usages of the mask parameter have been commented out in the code that creates/appends graphs.

The change was made as a part of 4fd437a and b0902c8 around the same time.

You could try uncommenting the //& params.mask; part at the end of these two lines:

tempVal = Utility::processIntegerSignal(frame.payload(), params.startBit, params.numBits, params.intelFormat, params.isSigned); //& params.mask;

tempVal = Utility::processIntegerSignal(frameCache[k].payload(), sBit, bits, intelFormat, isSigned); //& params.mask;

This would theoretically apply the mask but may create other issues. When a mask value is not provided in the settings window params.mask will be 0, resulting in all values being masked out. Perhaps this is what the commits linked above were trying to address.

A better fix may be to only apply the mask when it's set to a non-zero value. Something along the lines of:

        tempVal = Utility::processIntegerSignal(frame.payload(), params.startBit, params.numBits, params.intelFormat, params.isSigned);
        if (params.mask)
        {
            tempVal &= params.mask;
        }

I pushed a branch with those changes to my fork of the project for reference:
master...dontgetfoundout:SavvyCAN:apply-graph-mask

I'm travelling at the moment and don't have access to hardware to properly validate the changes though.