phoddie / node-red-mcu

Node-RED for microcontrollers
120 stars 18 forks source link

Enable toStatus of DEBUG node. #15

Closed ralphwetzel closed 1 year ago

ralphwetzel commented 1 year ago

This small PR adds functionality to allow toStatus debugging of the Debug node.

phoddie commented 1 year ago

@ralphwetzel – The PR looks good. FWIW – I am trying not to carry references to config, because it allows for some code size optimizations in time. I would prefer to just copy the value of tostatus. I will update that after merging.

To merge, I do need to ask you to complete a Moddable CLA (which is basically the Google CLA). You can just email a signed copy of the Individual CLA to info@moddable.com. Thank you.

ralphwetzel commented 1 year ago

I've updated the node to follow your guidance & as well to mimic closer the NR template. That said, there's still a huge difference between the two implementations...

phoddie commented 1 year ago

I've updated the node to follow your guidance...

Cool. Thank you.

...& as well to mimic closer the NR template. That said, there's still a huge difference between the two implementations...

No doubt! I've been reading the Node-RED built-in nodes. It would be impractical to implement them in the same way for an MCU. I understand why the full Node-RED implementation is the way it is. But, for the MCU there will inevitably be constraints. Fortunately the MCU doesn't have to do all the same things as the full Node-RED either, so that helps.

ralphwetzel commented 1 year ago

Fortunately the MCU doesn't have to do all the same things as the full Node-RED either, so that helps.

To abstract things a bit - using the example of the debug node:

Transferring this principle to the topic of .tostatus, its functionality is mainly used to feedback (exemption: the status node). Rather than trying now to mimic the full behaviour of the NR node in MCU, raw data could be sent back to the NR runtime & received e.g. by the plugin. All the expensive processing necessary just for feedback could then be done there...

phoddie commented 1 year ago

@ralphwetzel – agreed.. Those are two good points. Another one is that the Node-RED editor allows incremental deploy – unchanged nodes keep running while changed are replaced. That feature debatable for the MCU and it actually has quite a high runtime cost (though acceptable on a fast computer!). My early work intended to support that, but I am ready to declare it unnecessary for the MCU and remove that code.

ralphwetzel commented 1 year ago

unchanged nodes keep running while changed are replaced.

As of now, I would prefer to just re-build the MCU app in total. Managing the diff between two build operations looks like a lot of overhead to me - for no real value add I can imagine.