Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 03:42 30 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Code is erasing array....

     Page 2 of 2    
Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 07:30pm 09 Jan 2016
Copy link to clipboard 
Print this post

Why would you need to reset day of week?

DOW$ is just a list of day names for the DayOfWeek function to refer to, and 'second run you are going beyond parameters for day and confusing the cpu' - I don't follow that at all....

Perhaps you could elaborate, as I don't quite follow what you mean by that. ...wouldn't be the first time.

Oh, and welcome to the forums. BTW. Edited by Grogster 2016-01-11
Smoke makes things work. When the smoke gets out, it stops!
 
skylight
Newbie

Joined: 10/01/2016
Location: United Kingdom
Posts: 23
Posted: 12:16am 10 Jan 2016
Copy link to clipboard 
Print this post

Hi New to the forum and using micromites.
I wonder if frwainscott was referring to the pointer for the array DOW$ may be incrementing beyond 6 which is Saturday and would need resetting?
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 03:58am 10 Jan 2016
Copy link to clipboard 
Print this post

Oh, I see. I don't think so. If you try to point to an area of an array that does not exist, MMBASIC throws an error: 'Error: Array index out of bounds.'

The forumla for calculating the day of the week reference in the DayOfWeek function, has been well tested by myself and others, and that seems to always work OK.

I have not had any issues with THAT side of things since I removed the length reference when diming the array.

Thanks for your comments, and welcome to the forums.
Smoke makes things work. When the smoke gets out, it stops!
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 09:06am 10 Jan 2016
Copy link to clipboard 
Print this post

  skylight said   Hi New to the forum and using micromites.
I wonder if frwainscott was referring to the pointer for the array DOW$ may be incrementing beyond 6 which is Saturday and would need resetting?

The calculation for the value of the index to this variable, is (.....) MOD 7. The MOD 7 limits the possible values to the range of 0 to 6 which is exactly what is needed.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 11:29pm 10 Jan 2016
Copy link to clipboard 
Print this post

Thanks for that, Bob - I learn't something with that comment, as I don't really understand that formula at all - it's pretty intense mathematics - I just use it!
Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9063
Posted: 12:02am 18 Jan 2016
Copy link to clipboard 
Print this post

UPDATE:

I have introduced a new routine to clear the GUI which seems to be working. It is a variation of disco4now's code, but instead of tracking each control, it just waits till it detects no control being touched, and THEN it deletes the controls. This is called at the start of each NEW screen of controls via the CLEARSCR sub:


SUB CLEARSCR
Timer=0
Do:Loop Until Touch(UP)=1 'Wait until no touch control being touched.
X=Timer
If DEBUG then Print "Delete GUI in " + STR$(X) + " ms."
GUI delete all
CLS
End SUB


This seems to be working fine for the moment(no corruption), and saves me having to to keep track of individual controls.

Geoff has advised me via email, that deleting GUI controls while they are still active is a big no-no, and this was what was happening when I look at the debug delays in the new routine - it takes a few tens of ms before the touch is released(depending on how fast you are tapping buttons etc), and deleting controls as part of the new screen, when the old button is still "Down" - not a good thing.

disco4now already hinted as much in his posting on this thread, and it would seem he was indeed quite right.

Oh well - I am learning new stuff, as GUI controls are totally new territory for me!
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024