Sequences to perform when software crashes / is closed

Davide Marzona

recently I implemented my own protocol to comunicate with a DC power supply in C++. I tested it by simulating the other modules and connecting only the power supply. In certain cases, someĀ  other module had exeprienced some errors and the whole software crashed. I noticed that in these cases, if the power suppply has been enabled, there's no funciotnality that is able to turn it off, I have to manually connetct to it and disable the output.
My question is if there is some way to define some sequencences in module/interface code that shall be performed when software crashes or simply is closed by the user. My idea is that as like ev-cli creates module init and ready functions, if there is some way to create a function like close where the methods needed to safelly close the module are collected.

Thank you,
D. Marzona

Join { to automatically receive all group messages.