TheEagle wrote in Wed Jul 20, 2022 6:19 pm:Make a wrapper around the function like this:
- Code: Select all
globals.controls._startEngine = globals.controls.startEngine;
globals.controls.startEngine = func(v = 1, which...) {
debug.dump(v);
globals.controls._startEngine(v, which);
};
Hello TheEagle,
I am not sure to understand
Which one is to have original role and wrapper role ? (globals.controls._startEngine is the original function and globals.controls.startEngine the wrapper ?)
I should have been more specific about the problem I'm having:
So to make things clear:
on the Airbus (at least on the 330) the MCDU screen is refreshed every 0.125 seconds
There is a timer that refreshes the canvas (the MCDU screen in Models/Instruments/MCDU/MCDU.nas):
var MCDU_update = maketimer(0.125, func {
canvas_MCDU_base.update();
});
canvas_MCDU_base.update() calls MCDU_1.update() which itself calls me.updateCommon() which refreshes the screen. (all theese func are in the same Nasal File (the MCDU screen in Models/Instruments/MCDU/MCDU.nas)
To refresh the screen on the physical MCDU (the one I am building) I would like to detect the execution of the me.updateCommon function which is in a Nasal file specific to the airbus, but without having to modify the files of the airbus otherwise each time the airbus is going to be updated I will lose the modification
The idea would be to update a specific property in the tree structure of the interface to update when the function is executed and this property would be propagated via generic protocols to the hardware interface
Because otherwise, even if I don't have the choice to modify the original function, as much as I put the new property directly in the code of the function, I just have to put a setValue at the end of its code.
But maybe I misunderstood your example.
Best regards