edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

feat(color): Run widget 'background' function while in setup pages.

Open philmoz opened this issue 2 years ago • 29 comments

Fixes #4279

All setup pages inherit from the Page or TabsGroup (via PageTab) classes. These block the main view so no main view updates are processed while in the setup pages.

This PR adds a function to call just the 'background' function for all active widgets when using the setup pages. It does not call any of the UI objects 'checkEvents' functions so the only overhead is the processing time each widget 'background' call takes. So long as the widgets are well behaved, and there is not an excessive number of them it should not significantly affect performance.

However it needs extensive testing on a variety of radios especially with complex widget setups (which I don't use).

philmoz avatar Dec 09 '23 00:12 philmoz

Thanks Phil. I built and ran your PR with a script that has some load in background(). Works fine.

mha1 avatar Dec 09 '23 09:12 mha1

Please verify that your special functions are still enabled... i.e. with the default theme there will be a yellow filled square on the right side of the sf overview screen if a function is enabled.

pfeerick avatar Dec 11 '23 01:12 pfeerick

Have lost all Special functions (notable by no switch calls except in global functions) and background still does not work on the X12S. Loaded latest 2.10 nightly and all returned back (still with the ongoing sound problem). Back to 2.9.2!!

I don't have a X12S but built Companion based on https://github.com/EdgeTX/edgetx/pull/4393. Running my test widget script (https://github.com/EdgeTX/edgetx/files/13624506/bckgrnd.zip - see https://github.com/EdgeTX/edgetx/issues/4279#issuecomment-1848439948) works fine. Background calculation results (approximating Pi) and debug output confirms this PR is working fine.

image

image

mha1 avatar Dec 11 '23 09:12 mha1

@Kevltan your script is wrong. try this: main.lua.txt (remove the .txt)

mha1 avatar Dec 11 '23 15:12 mha1

What did you change??

Kevltan avatar Dec 11 '23 15:12 Kevltan

I don't understand what you're saying. Your main.lua doesn't work in the background because you don't call the part that is required to run in the background in the background function. I have changed your script, it should work now.

So try the version I uploaded. It's called main.lua.txt because github doesn't allow .lua files to be uploaded. Just click here https://github.com/EdgeTX/edgetx/files/13637615/main.lua.txt, download the file, then rename it from main.lua.txt to main.lua

Then copy main.lua to your widget script folder (WIDGETS/TD-RDT)

mha1 avatar Dec 11 '23 16:12 mha1

Ok thanks for that 😊👍Will try that🤞. Have looked at the change you made can see where I went wrong!!

Kevltan avatar Dec 11 '23 16:12 Kevltan

how does it fail?

mha1 avatar Dec 11 '23 16:12 mha1

My bad forgot about the *.text🤷‍♂️🤷‍♂️ Will load 2.10 PR#4395 and test👍

Kevltan avatar Dec 11 '23 16:12 Kevltan

I hope you are aware to flash this PR: https://github.com/EdgeTX/edgetx/suites/18891839239/artifacts/1102977052

mha1 avatar Dec 11 '23 16:12 mha1

Yes done all of that but still no joy PR#4395 and your lua edit. Have tried changing the backgroundProcessWidget(Me) to background(Me) this doesn't work. Having moved off the widget screen and into the telemetry screen I lose the value in FCAL, turns red after 30 seconds and "sensor lost" is announced. Your lua edit works (like this and will keep) but function background still doesn't (at least with my X12S)!

On Mon, 11 Dec 2023, 16:43 Michael, @.***> wrote:

I hope you are aware to flash this PR: https://github.com/EdgeTX/edgetx/suites/18891839239/artifacts/1102977052

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850457122, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAWYJAURZHXSO2JL6W4DYI4Z45AVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGQ2TOMJSGI . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 17:12 Kevltan

Do you have a receiver connected? FCAL will remain red if there is no live telemetry. Works fine on my NV14 FCAL is updating but red as long as there is no receiver connected

mha1 avatar Dec 11 '23 17:12 mha1

Yes, I do have receiver on. I move out of widget screen into telemetry screen and after 30 seconds I lose the FCAL and the value turns red. It is the only telemetry that doesn't have the "flashing" dot on it. I would try it on my TX16s but I am using an ACCESS Receiver.

On Mon, 11 Dec 2023, 17:39 Michael, @.***> wrote:

Do you have a receiver connected? FCAL will remain red if there is no live telemetry. Works fine on my NV14 FCAL is updating but red as long as there is no receiver connected

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850556680, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAWZDNRAC4ZN4ZIDRASDYI5ANPAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGU2TMNRYGA . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 17:12 Kevltan

Does the TD-RDT Widget run on your NV14?

On Mon, 11 Dec 2023, 17:55 Kev the Rev, @.***> wrote:

Yes, I do have receiver on. I move out of widget screen into telemetry screen and after 30 seconds I lose the FCAL and the value turns red. It is the only telemetry that doesn't have the "flashing" dot on it. I would try it on my TX16s but I am using an ACCESS Receiver.

On Mon, 11 Dec 2023, 17:39 Michael, @.***> wrote:

Do you have a receiver connected? FCAL will remain red if there is no live telemetry. Works fine on my NV14 FCAL is updating but red as long as there is no receiver connected

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850556680, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAWZDNRAC4ZN4ZIDRASDYI5ANPAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGU2TMNRYGA . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 18:12 Kevltan

yes it runs.

ok, strange. working different on my NV14.

mha1 avatar Dec 11 '23 18:12 mha1

keeps going for minutes now https://github.com/EdgeTX/edgetx/assets/5615068/577d2ffa-db45-4ef2-84f9-d8b4e252b7cc

mha1 avatar Dec 11 '23 18:12 mha1

Your getting the flashing dot and your running my widget - very strange!!!! Maybe I have too many sensors or something!!

On Mon, 11 Dec 2023, 18:10 Michael, @.***> wrote:

keeps going for minutes now https://github.com/EdgeTX/edgetx/assets/5615068/577d2ffa-db45-4ef2-84f9-d8b4e252b7cc

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850614674, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAW2K3WXD3XDJYJBQDRDYI5EAVAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGYYTINRXGQ . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 18:12 Kevltan

Going to try a clean firmware install of PR#4393 through STM32CubeProgrammer and see what happens!

On Mon, 11 Dec 2023, 18:22 Kev the Rev, @.***> wrote:

Your getting the flashing dot and your running my widget - very strange!!!! Maybe I have too many sensors or something!!

On Mon, 11 Dec 2023, 18:10 Michael, @.***> wrote:

keeps going for minutes now https://github.com/EdgeTX/edgetx/assets/5615068/577d2ffa-db45-4ef2-84f9-d8b4e252b7cc

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850614674, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAW2K3WXD3XDJYJBQDRDYI5EAVAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGYYTINRXGQ . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 18:12 Kevltan

WORKING YIPEE!!!!!

On Mon, 11 Dec 2023, 18:26 Kev the Rev, @.***> wrote:

Going to try a clean firmware install of PR#4393 through STM32CubeProgrammer and see what happens!

On Mon, 11 Dec 2023, 18:22 Kev the Rev, @.***> wrote:

Your getting the flashing dot and your running my widget - very strange!!!! Maybe I have too many sensors or something!!

On Mon, 11 Dec 2023, 18:10 Michael, @.***> wrote:

keeps going for minutes now https://github.com/EdgeTX/edgetx/assets/5615068/577d2ffa-db45-4ef2-84f9-d8b4e252b7cc

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850614674, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAW2K3WXD3XDJYJBQDRDYI5EAVAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGYYTINRXGQ . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 18:12 Kevltan

Now all I want please is someone to do a PR for 2.9.2 that does the same, because 2.10 does not work properly for the X12S (sound).

On Mon, 11 Dec 2023, 18:34 Kev the Rev, @.***> wrote:

WORKING YIPEE!!!!!

On Mon, 11 Dec 2023, 18:26 Kev the Rev, @.***> wrote:

Going to try a clean firmware install of PR#4393 through STM32CubeProgrammer and see what happens!

On Mon, 11 Dec 2023, 18:22 Kev the Rev, @.***> wrote:

Your getting the flashing dot and your running my widget - very strange!!!! Maybe I have too many sensors or something!!

On Mon, 11 Dec 2023, 18:10 Michael, @.***> wrote:

keeps going for minutes now https://github.com/EdgeTX/edgetx/assets/5615068/577d2ffa-db45-4ef2-84f9-d8b4e252b7cc

— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4393#issuecomment-1850614674, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANPFAW2K3WXD3XDJYJBQDRDYI5EAVAVCNFSM6AAAAABANK4X4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGYYTINRXGQ . You are receiving this because you were mentioned.Message ID: @.***>

Kevltan avatar Dec 11 '23 19:12 Kevltan

Tested on Yaapu in background which generates 8 virtual sensors with Ardupilot and ELRS, all continue to work just fine in setup=>telemetry screen, without this PR they would obviously stop working. And the feeling is that everything is more streamlined, faster even when browsing through the various pages of the widget, i've 5 telemetry screen. So TOP pull request, thanks!

Senza titolo

robustini avatar Dec 16 '23 17:12 robustini

Mine works fine too in both 2.10 and 2.9.2 builds using 9 sensors one of which is generated from a widget calculation which is then put into a telemetry field for reading in log files. 2.9.2 was built for me by Michael for testing at my own risk. FCAL is the widget generated telemetry field.

screen-2023-12-17-142829

Kevltan avatar Dec 17 '23 14:12 Kevltan

@philmoz I tried recompiling the firmware today from the main branch with your PR but it generates an annoying screen flicker on my X10S Express, could you check if it does this to you too? On December 16 it was ok.

robustini avatar Dec 19 '23 07:12 robustini

I tried recompiling the firmware today from the main branch with your PR but it generates an annoying screen flicker on my X10S Express, could you check if it does this to you too? On December 16 it was ok.

There's nothing in this PR that should affect screen display - can you post a video showing the issue.

philmoz avatar Dec 19 '23 07:12 philmoz

I tried recompiling the firmware today from the main branch with your PR but it generates an annoying screen flicker on my X10S Express, could you check if it does this to you too? On December 16 it was ok.

There's nothing in this PR that should affect screen display - can you post a video showing the issue.

I have not tried for now to recompile the firmware without your PR, so I do not rule out that it may also be in one of the latest commits the problem.

https://github.com/EdgeTX/edgetx/assets/3864712/a6a84164-9aa4-41e6-820e-3956214f42ff

robustini avatar Dec 19 '23 07:12 robustini

I have not tried for now to recompile the firmware without your PR, so I do not rule out that it may also be in one of the latest commits the problem.

I can't think of any reason why this PR would cause that to happen.

philmoz avatar Dec 19 '23 08:12 philmoz

I have not tried for now to recompile the firmware without your PR, so I do not rule out that it may also be in one of the latest commits the problem.

I can't think of any reason why this PR would cause that to happen.

Yes, the problem is elsewhere, i'm sorry, I report that.

robustini avatar Dec 19 '23 08:12 robustini

Works fine for me and no screen flicker on my X12S, tested live on my model heli on the ground with main blades off whilst flicking between pages. All data was retrieved flawlessy in log files. Think your problem is elsewhere as you intermated. Please let us know what the cause of this was in the end!?

Kevltan avatar Dec 19 '23 17:12 Kevltan

Works fine for me and no screen flicker on my X12S, tested live on my model heli on the ground with main blades off whilst flicking between pages. All data was retrieved flawlessy in log files. Think your problem is elsewhere as you intermated. Please let us know what the cause of this was in the end!?

https://github.com/EdgeTX/edgetx/pull/4433

robustini avatar Dec 19 '23 18:12 robustini

@philmoz @pfeerick what's the status on this PR?

mha1 avatar Feb 26 '24 18:02 mha1