As I have already written, with your method only the simulation works correctly for me, not in the processor.
The other settings of pot_panel1 are not accessible in the property panel at all, but only in the macro. Some of the variables there have different names.
Only when I inserted the macro did both simulation and processor run correctly.
I also tried your suggestion with the GetAverageInt at the beginning, but changed it because of the processor problem. I will check it again to see if it is more elegant.
I had written this program in Bascom and just ported it to Flowcode.
For me, Flowcode seems as if the processor attachted on the pot and not vice versa.

Translated with www.DeepL.com/Translator (free version)