Monitor variables in a table

I'm an embedded programmer and work extensively on the STM32 MCUs. They have a tool called Cubemonitor for live monitoring variables within the executable and is based on Node-red. I'm trying to figure out how to monitor arrays and variables from my program in a tabular format. They do have a chart-based output and that works, however, for a large # of variables the chart is very clunky and any data is barely legible. A tabular format would be far more readable.

Please note that I have zero experience with javascript and nodered and I'm hoping someone here can help me since I'm not getting anywhere on the ST community site.

The first image is what the variables window looks like. This is the list of variables that I need to monitor. The second image is that of the table but I have no clue as to how to add these variables to this table.

First thing to do is to see what output that first node gives you. Add a debug node to its output and see what it produces. I would guess that it is either an JavaScript object or an array.. Based on that, we can work out how to feed it into the ui table node.

Ok I added that and this is what it seems to produce on node status(?)

OK, so each variable produces a separate msg. What is not clear to me is what x and y mean and why there are 2 sets of values for each output?

Next step would be to simplify that output. Ultimately, what you are looking to end up with is a msg.payload that contains an ARRAY of OBJECTS. Where each object represents a row in your table and the object's properties are the column names:

[
   {
      "col1": val1, 
      "col2": val2,
      ...
   },
   ... next row ...
]

So first you want each of those output messages to have a payload that looks like the row data. Then you need to either join all of the "rows" together with a join node or pass the object to the front-end and do the work there.

Though I suppose you might be looking to have the variables as the columns? In that case, you would need to work out the right format for the data along the same principles.

Yep, that is not clear to me as well. For instance, M2.runstate is either 0 or 1.

I believe there is some post-processing allowable inside the nodes. Let me tinker with that a little more.

No, I'd prefer them to be in rows and there should be a single column to show values.

Even if I do figure out how to join all the rows, I'm still not seeing the right values here.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.