Timer Stalling
Posted
#1
(In Topic #981)
Trainee
Gambas 3.12.2
Synology Server DS-713+ running V7 OS
While moving picture screens loaded in array memory @ 10fps to Picture Box from a timer, in a select entry I call "if exist( filename )", to a external synology server, the animation timer stops updating while the existance is checked, missing frames.
also…
Information loaded into a 3D array holding [20, 500000, 10] is searched the timer updating the Picture Box stalls till the search is complete (about 3 seconds or 30 frames). (Created a complete external gambas program to do the search to get arround the problem).
Is there a way to keep the animation timer updating the PictureBox without fail while the forms in the program runs tasks for setting up the next event while playing a mp3 in MediaView or Music.Load uninterupted.
Posted
Guru

/comp/gb/task - Gambas Documentation
You can use a Task to run the method at a low priority so it does not effect the timer updates.
a Task runs as a separate process/program , within the Task code you can set Application.Priority (0 = normal, 20 = lowest, -20 highest but only superuser can set negative value)
Easiest way to run a Task is to set it up in the New statement,
see below for a simple (hand typed untested) example of using Task.class and passing a couple of arguments to it.
Maybe it will help you
Code (gambas)
- ' Gambas class file (name = MyTask.class)
- Inherits Task
- ' We can get and store the values for each task instance in the _new() method.
- ' the _new() method is run when you use hNewtask = New MyTask(Arg1,l Arg2)
- $Value1 = Value1
- $Value2 = Value2
- ' After the _new method completes the Main() method is automatically run
- ' do some code with $Value1 and $Value2
- Print "This result here is sent to the parent handler"
Then to use the above Task (say i called it MyTask.class)
Code (gambas)
- ' (if you want multiple tasks running at once do not use a single global $hMyTask variable, try a local one)
- ' This event is triggered when the task Prints something
- ' Each Print from the task is passed as a String in sData
But saying that , you may just be asking too much from a Pi
I think the best solution is a low priority task
Posted
Trainee
The round trip if checking for a file at a location on the Synology server seems to be the delay. A exist for a file on MY RPI 4 with a 128gb M.2 is almost instant, no dropped frames but the over all DB size for MP3+G files is small (only a few thousand entry's).
I have tried checking for existance with other Form's with the main program but things stop till the existance result is checked. I wrote another program that runs independently of the program running the animation and that works for searching for a entrys in the database that match. To shell out to a program works also as long as Wait to Result is NOT used and the shell'd program ports its result to a file that can be checked for and then evaluate the answer. Checking for the result file name on the RPI and loading the text in is almost instant.
I have found ways around the problem, I'm just looking for a better way.
The hopes that a timer set at 100ms would update every 100ms no matter what is going on elsewere in the program doesn't seem to work.
Thanks though….
Posted
Trainee
Been Programming the Karaoke Program for YEARS now.
Loaded the Program into RPI 4 Bullseye with Gambas 3.18.0 and made code changes and saved. NOW the Gambas 3.12.2 programming environment won't load the program for editing, I get a error box…
Cannot open project file :
<tt>Type mismatch: wanted Integer, got String instead
Project.ReadProject.3285 Project.Open.714 FWelcome.btnOpen_Click.144 CCoolButton.Panel_MouseUp.147</tt>
I have NOT found a way to get RPI 4 Buster, Gambas 3.12.2 to upgrade to 3.18.0. Also the compiled program from 3.18.0 will NOT run on the Buster OS.
Years of writing the program, 7500+ lines of code…. :evil:
I do have a backup before the 3.18.0 modification SPLAT!!!
YUCK! Been HERE before with a earlier update incompatablility.
I like to write programs BUT this problem is NOT fun. :!:
Posted
Guru

/install/raspbian - Gambas Documentation
instructions for raspbian buster and bullseye
Best way would be to use an ubuntu raspbian os . then upgrading to latest gambas is easy.
buster is super old now, i'd upgrade the raspbian on it. https://www.raspberrypi.com/software/operating-systems/
newer raspbian = newer gambas.
Maybe my gambas upgrader bash script can help?
Bruce Steers / gambas3-compile-and-install · GitLab
1 guest and 0 members have just viewed this.




