kzuidberg - 2021-05-19

Good morning,

I searched in this forum for my issue but couldn't find it exactly. Sorry if it was already discussed earlier.

To build some sort of recipe structure which can survive a power down, I declared an array of structs in retained memory.

The compiler however gives a warning on that:

'TwinCAT XAE': Retain variable 'PGVL.recipes' not added to retain handler because of local data type 'ARRAY [0..23] OF ST_RECIPE'

First question: Is this a codesys error or something Beckhoff specific? Then I have to rest my case here.

I thought I solved it by removing a time_t variable from one of the structs but now the type seems to be the problem.
Unfortunately the help on retain variable doesn't indicate limitation on nested structures.

Can someone help me out? Thanks in advance.

For completeness I include the involved code.

VAR_GLOBAL RETAIN
recipes: ARRAY[0..23] OF ST_RECIPE;

// Remember recipe selection between shutdowns
recipe_active_index: INT;

canary: BOOL; // If this is false, the variables were not retained and should be re-initialized.

END_VAR

TYPE ST_RECIPE :
STRUCT
name: STRING(32);
points: ARRAY[0..31] OF ST_RECIPE_POINT;
END_STRUCT
END_TYPE

TYPE ST_RECIPE_POINT :
STRUCT
tPreheat: REAL; (was time_t type)
tPostheat: REAL;
nPosX: DINT;
nPosY: DINT;

END_STRUCT
END_TYPE

 

Last edit: kzuidberg 2021-05-19