francotiveron / Choreo

Choreo User Interface
0 stars 1 forks source link

Color change for fault severity #72

Open francotiveron opened 2 years ago

francotiveron commented 2 years ago

Im my mind this can be done by adding a 3rd column to the fault matrix in twincat. I can assign a 1, 2 or 3 to that column which would indicate rather fault should be yellow, orange or red

francotiveron commented 2 years ago

@pkelm1 I suggest a different approach, quicker to implement and with better performance. At the moment the error mapping is transparent (for example twincat error 17744 becomes choreo error 17744).

This is not necessary so I suggest to remap as follows:

// FaultCodeMapperFC
// Current
IF Error_State THEN
    CASE Error_Value OF
        17744: FaultCodeMapperFC := 17744; //Position Error
        16992: FaultCodeMapperFC := 16992; //Enable Error
        ELSE FaultCodeMapperFC := 16#FFFF; //Unknown Fault
    END_CASE
ELSE
    FaultCodeMapperFC := 0;
END_IF

// Becomes
IF Error_State THEN
    CASE Error_Value OF
        17744: FaultCodeMapperFC := 2#0100_0000_0000_0001; //Position Error (Color code 01 -> Yellow, Error code -> 1)
        16992: FaultCodeMapperFC := 2#1100_0000_0000_0010; //Enable Error (Color code 11 -> Red, Error code -> 2)
        ELSE FaultCodeMapperFC := 16#FFFF; //Unknown Fault (Color code 11 -> Red, Error Code 0x3FFF)
    END_CASE
ELSE
    FaultCodeMapperFC := 0;
END_IF
AxesErrors: ARRAY [0..15] OF AxisErrorDUT := [
        (
            FaultCode:=17744,
            Description:='Following Error'
        ),
        (
            FaultCode:=16992,
            Description:='Enable Fault'
        ),

//Becomes

AxesErrors: ARRAY [0..15] OF AxisErrorDUT := [
        (
            FaultCode:=2#0100_0000_0000_0001,
            Description:='Following Error'
        ),
        (
            FaultCode:=2#1100_0000_0000_0010,
            Description:='Enable Fault'
        ),

What do you think?

pkelm1 commented 2 years ago

This works for me, I might have to talk through the actual implementation again once it is time to make the changes since I haven't done it in awhile but I understand what you are going for

francotiveron commented 2 years ago

The dot assumes the new colors according to the mapping proposed. In this first implementation the background color does not assume the yellow and orange colors but only red as before when colorcode is red (error), and no color for the other color codes (same as ok before). This is because the display would result a little confused. But this is my opinion,. If you want the yellow and orange color to also fill the background as the dot, please raise a new issue.

image