-
-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable/Disable Logging to SD Card from LUA #5191
Comments
You can do this with LUA itself. Attached find a LUA function to enable/disable a defined SF SD Logs plus a little init routine that needs to be run once in order for the SD Logs enable/disable function to work. For demo purposes the LUA function is embedded in a little function script to show how it is used. Just rip out Ho does it work? ini |
will this work ... even if the transmitter does not have an SF for logs defined/set ? |
currently no but init can be extended with a few lines of code to automatically create an SF in case it doesn't find one. |
Here's the version that'll create a SF SD Logs in the first free SF slot with default 1.0s log period if the model setup doesn't have a SF SD Logs defined |
Cool. I will give it a try in my widget (currently using "radio made SF"). Thanks for the Hint/Input ! |
Gonna close this as resolved as like how #5191 (comment) is doing it is probably the only way this can really be reasonably be done, given this is a SF you need to define in the first place, and can be any line, any trigger, any state. So the API to do what you want can't be as 'simple' as a |
Could it be, that this is not working when called/used in a widget script ? If i execute your script manually it works ... but once "embedded" in a widget script it doesn't work anymore. Even using get/setCustomFunction does not seem to change anything: local test = model.getCustomFunction(SDlogsSFIndex) -- get SF at index i test.active = 1 model.setCustomFunction(SDlogsSFIndex, test) local test = model.getCustomFunction(SDlogsSFIndex) -- get SF at index i print("SFDEBG: CF Debug " .. test.switch ) returns the correct values ... but nothing is changed/visible at the SF Screen ... and logging is not on ... even though "test.active" says "1" SFDEBG: CF Debug 233 all values correct ... but logging still off ... and customfunction unchanged (interval set to 10 .... but should have changed to 30) |
I don't know but can't think of a reason why it wouldn't work in a widget. Please attach a minimal version of your widget demonstrating the problem. |
Is there an existing issue for this feature request?
Is your feature request related to a problem?
no
Describe the solution you'd like
add a LUA Function to enable/disable Logging to SD Card like:
sdlogging(true)
and
sdlogging(false)
optionally with an option to specify the interval.
I'd like to use this in a LUA Script ... to dynamically turn logging on for certain circumstances.
I'm sure this could be usefull for other LUA Scripts too
Describe alternatives you've considered
none
Additional context
i have tried to do it myself in the code ... but i have no knowhow with C++ ... i'm sure for a DEV it would be easy to do. I have managed to create a LUA Function that turns logging on or off by modifying initLoggingTimer() logsWrite() with a Boolean value ... but the status was not reflected on the UI.
The text was updated successfully, but these errors were encountered: