Lua script enhancement to write back Dronecan Message on CAN-2 Port of Cube Orange Plus

This is in continuation to the topic

Able to decode CAN frames sent by Tattu 18S batteries on CAN-1 Port of Cube-Orange-Plus using enhanced can_logger.lua as attached in the screen-shot below.

Have currently stored the battery information in a local buffer. How to convert this to dronecan Battery message and write back to CAN-Port using the same lua script.

Is it possible to write back to CAN-2 port and set it to dronecan so that it can be read by different BATTERY_STATUS. Currently CAN-1 Port is set to scripting to read raw CAN messages from Tattu batteries.

Any pointers would be highly appreciated.

Attached lua script

CanParserTattuBatteryWorkingAsExpected.lua (4.7 KB)

Able to Monitor Tattu 18S batteries by parsing their GeneralBatteryInfo via a CAN hub and converting it into ESCTelemetryData for Battery Monitoring. This post and code here was used.

In the larger interest would like to refine the lua script and make it is a generic driver to support multiple batteries and upload for github review, Request to point at quick-and-easy-start guide to write drivers for Battery Monitoring.

Thank you.