Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:34 11 Nov 2025 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 : CLS not working as expected

Author Message
carlm
Newbie

Joined: 31/05/2018
Location: Australia
Posts: 10
Posted: 07:21am 19 Jun 2018
Copy link to clipboard 
Print this post

Hi all, I have an issue with a piece(s) of my MM Edit code.

I have attached a chunk of my code for a Micromite backpack.

As you can see i have utilised CLS to clear the screen.
I have commented out my 4 of Drawbutton lines.
Subsequently the buttons are not created.
Problem is that other buttons still appear on my display in runtime.

These buttons are buttons that are created by DrawButtons in other parts of my code. I only want my 4 of buttons here and none else.

My CLS does not seem to work as I would like. I am not sure - the other buttons that appear may be global buttons or the like.

Can anyone help?
Thanks in Advance.

Sub StandbyControl
Local Float btn
CLS
FONT 1, 2
Text 160,15, StandbyTitleA, CM, , , rgb(blue), rgb(black)

'DrawButton bTempLitrePulse , 0, 8, 10, 170, 30, rgb(yellow), "1 L P"
'DrawButton bNavtoWarning, 0, 8, 160, 110, 35, rgb(yellow), "Warn"
'DrawButton bNavtoEmpty, 0, 8, 200, 110, 35, rgb(yellow), "Empty"
'DrawButton bDosesReset, 0, 8, 200, 110, 35, rgb(yellow), "Refill"


Text 4, 55, "Next Dose in:", LM, , , rgb(cyan), rgb(black)
Text 255, 55, "Lt" , LM, , , rgb(cyan), rgb(black)
Text 4, 90, "Since Refill:", LM, , , rgb(cyan), rgb(black)
Text 4, 125, "Warning SP: ", LM, , , rgb(cyan), rgb(black)
Text 4, 160, "Empty SP: ", LM, , , rgb(cyan), rgb(black)

'Text 220,65, " ", LM, , , rgb(cyan), rgb(black)
'Text 220,90, " ", LM, , , rgb(cyan), rgb(black)
''Text 220,125, " ", LM, , , rgb(cyan), rgb(black)
'Text 220,160, " ", LM, , , rgb(cyan), rgb(black)

Text 227, 55, STR$(iLitresPerDose - iPulseCountSinceLastDose) , CM, , , rgb(cyan), rgb(black)
Text 220, 90, STR$(iDosesSinceRefill), LM, , , rgb(cyan), rgb(black)
Text 220, 125, STR$(iDoseCountWarning), LM, , , rgb(cyan), rgb(black)
Text 220, 160, STR$(iDoseCountEmpty), LM, , , rgb(cyan), rgb(black)

Timer = 0
Do
WATCHDOG 20000
CheckButtonPress(1, NumberOfButtons)
'DoseControl
if key_Pulse(bTempLitrePulse) = 1 then
iPulseCountSinceLastDose = iPulseCountSinceLastDose + 1
'iTemp = iLitresPerDose - iPulseCountSinceLastDose
DoseControl
endif

if key_Pulse(bDosesReset) = 1 then
iDosesSinceRefill = 0
Text 220, 90, " ", LM, , , rgb(cyan), rgb(black)
Text 220, 90, STR$(iDosesSinceRefill), LM, , , rgb(cyan), rgb(black)
Text 220, 125, STR$(iDoseCountWarning), LM, , , rgb(cyan), rgb(black)
Text 220, 160, STR$(iDoseCountEmpty), LM, , , rgb(cyan), rgb(black)
endif

'IF TIMER > 30000 THEN ScreenSaver
LOOP
END SUB

 
AussieWombat
Newbie

Joined: 04/05/2018
Location: Australia
Posts: 21
Posted: 08:32am 19 Jun 2018
Copy link to clipboard 
Print this post

Hi carlm,

Welcome to the forum.

Maybe, but not sure , whether the command

GUI HIDE ALL
then
GUI SHOW (#ref first button),(2nd button), etc


might work, when you only want those 4 gui elements on screen.

Page 26 of Micromite Plus Manual 5.1 (edit: Might not relate to Micromite Backpack )

AussieWombatEdited by AussieWombat 2018-06-20
 
carlm
Newbie

Joined: 31/05/2018
Location: Australia
Posts: 10
Posted: 11:34pm 20 Jun 2018
Copy link to clipboard 
Print this post

Hi,
Thanks for that.
I will definitely give that a go.
Carl
 
Azure

Guru

Joined: 09/11/2017
Location: Australia
Posts: 446
Posted: 11:44pm 20 Jun 2018
Copy link to clipboard 
Print this post

That extract you posted is a subroutine.

If your main code or any interrupt driven code updates the screen then that other code will be updating the screen after the CLS command in your subroutine is executed.

You will need to check your program flow by looking at what else gets displayed and find the code which displays it to see when it is updating your screen.

One thing you might be able to do is add a flag to indicate what state your program is in and have the other code check if it is ok to display things or not based on the flag.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9751
Posted: 11:45pm 20 Jun 2018
Copy link to clipboard 
Print this post

Welcome to the forums AussieWombat and carlm.

If you are using the Backpack(28-pin chip), that only has basic touch-screen support, so won't acknowledge any of the GUI commands, and it will throw an error along the lines of 'Unknown command'.

GUI commands are specifically for use with the MM+ series of chips.
Explore-64, Explore-100 and matherp's MMX.

Are you using a Micromite Backpack(28-pin DIL chip) or a Micromite Plus Backpack(64-pin QFP SMD chip)?
Smoke makes things work. When the smoke gets out, it stops!
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1116
Posted: 01:00am 21 Jun 2018
Copy link to clipboard 
Print this post

Carl,

As said by Grogster above, you are a bit limited with the MM2 if you want to do
a multi page, multi menu type display. This easily achieved by using an MM+ and the GUI commands.

If you end up going this way, please have a look at this thread - it is just an example and not necessarily the only or best way to do this but it may give you some ideas.

panky

... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025