Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:56 06 Jul 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 : GUI Pages-Tabbed.

     Page 1 of 2    
Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:45am 06 Aug 2016
Copy link to clipboard 
Print this post

Hi All,

I've only played a little with the MM+ GUI, scaling down Geoff's Pump demo.
It's pretty small on a 2.8" screen, but I can see a good application, where the other screens would be too big.

What I'm thinking of is a Tabbed approach to the multiple pages, a bit like Browser tabs.

Wondering what people think about the best approach to achieving this is.
General starting points & suggestions I suppose.

Thinking out loud....

Cheers

Phil.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 05:16pm 06 Aug 2016
Copy link to clipboard 
Print this post

Yep..! It works like a champ...



I did this on a small "tabbed" screen setup



I does seem to get crowded kinda fast, but doable...



When things get to small, the "fat finger" starts getting into trouble...
Must be time for a bigger panel..!!




 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 05:33pm 06 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said   Yep..! It works like a champ...

I did this on a small "tabbed" screen setup
[/quote]

So are the Tab Buttons defined on each page?
Or are they separate controls with no page defined.

I could think of maybe 3 different ways to approach this, but don't quite know which is best, (or what won't work for that matter.

The other though that comes to mind is 4 pages;

1 that just contains the Tabs at the top, while the 3 other contain the lower elements.

[Quote]When things get to small, the "fat finger" starts getting into trouble...
Must be time for a bigger panel..!!


Old Palm Pilot pen helping me out here....
All the big screens still in their boxes....

Cheers

Phil.
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 06:15pm 06 Aug 2016
Copy link to clipboard 
Print this post

Humm... I did look up the code... From 8/22/15... It's not "up to date" with latest GUI firmware, but could work as a starting point fot the "tab" objects...


' LTC2983 Test Program for MM+470 on the GC microboard 2

Option explicit

' Assign Object Values

Const status_button=1
Const data_button=2
Const setup_button=3

Const cht1_led=4
Const cht2_led=5
Const cht3_led=6
Const cht4_led=7
Const egt1_led=8
Const egt2_led=9
Const egt3_led=10
Const egt4_led=11

Const temps_stat_frame=12
Const cht_stat_box=13
Const egt_stat_box=14

Const cht_data_frame=15
Const cht1_data_box=16
Const cht2_data_box=17
Const cht3_data_box=18
Const cht4_data_box=19

Const egt_data_frame=20
Const egt1_data_box=21
Const egt2_data_box=22
Const egt3_data_box=23
Const egt4_data_box=24

Const cht_thermo_type_frame=25
Const cht_jtype_button=26
Const cht_ktype_button=27

Const egt_thermo_type_frame=28
Const egt_jtype_button=29
Const egt_ktype_button=30

Const rpm_count_frame=31
Const rpm_dev2_button=32
Const rpm_even_button=33
Const rpm_mul2_button=34
Const rpm_mul4_button=35
Const rpm_dis_button=36

Const function_enable_frame=37
Const bt_radio_checkbox=38
Const rs485_checkbox=39

Const next_button=40
Const done_button=41

Dim screen_state=status_button ' current screen #, set to 1
Dim old_screen_state,touch_state,old_touch_state ' last screen #, returned object # touched
Font #5,1 ' mid sized bold

CLS

' Create "TAB" buttons

GUI button next_button,"Next",0,0,MM.FontWidth*7,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button done_button,"Done",127,0,MM.FontWidth*5,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI hide next_button, done_button

GUI button status_button,"Status",0,0,MM.FontWidth*7,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button data_button,"Data",127,0,MM.FontWidth*5,MM.FontHeight*2,RGB(yellow),RGB(gray)
GUI button setup_button,"Setup",220,0,MM.FontWidth*6,MM.FontHeight*2,RGB(yellow),RGB(gray)

' Create "Status Screen"

GUI frame temps_stat_frame,"Temps",0,75,320,125,RGB(yellow)
GUI displaybox cht_stat_box,7,100,MM.FontWidth*19,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht_stat_box)="CHT 1 2 3 4"
GUI led cht1_led,139,104,20,RGB(green)
GUI led cht2_led,188,104,20,RGB(red)
GUI led cht3_led,237,104,20,RGB(yellow)
GUI led cht4_led,285,104,20,RGB(yellow)

GUI displaybox egt_stat_box,7,150,MM.FontWidth*19,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt_stat_box)="EGT 1 2 3 4"
GUI led egt1_led,139,154,20,RGB(green)
GUI led egt2_led,188,154,20,RGB(green)
GUI led egt3_led,237,154,20,RGB(green)
GUI led egt4_led,285,154,20,RGB(green)

GUI hide temps_stat_frame,cht_stat_box,egt_stat_box
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide egt1_led,egt2_led,egt3_led,egt4_led

' Create "Data" Screen

GUI frame cht_data_frame," CHT ",0,75,110,159,RGB(yellow)
GUI displaybox cht1_data_box,15,90,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht1_data_box)="xxx"
GUI displaybox cht2_data_box,15,125,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht2_data_box)="xxx"
GUI displaybox cht3_data_box,15,160,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht3_data_box)="xxx"
GUI displaybox cht4_data_box,15,195,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(cht4_data_box)="xxx"

GUI frame egt_data_frame," EGT ",115,75,110,159,RGB(yellow)
GUI displaybox egt1_data_box,130,90,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt1_data_box)="xxxx"
GUI displaybox egt2_data_box,130,125,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt2_data_box)="xxxx"
GUI displaybox egt3_data_box,130,160,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt3_data_box)="xxxx"
GUI displaybox egt4_data_box,130,195,MM.FontWidth*5,MM.FontHeight+5,RGB(red),RGB(black)
CtrlVal(egt4_data_box)="xxxx"

GUI hide cht_data_frame,egt_data_frame
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box

' Create "Settup" Screen

GUI frame cht_thermo_type_frame,"CHT",0,75,80,70,RGB(yellow)
GUI radio cht_jtype_button,"J",15,85,25,RGB(green)
GUI radio cht_ktype_button,"K",15,115,25,RGB(green)
CtrlVal(cht_jtype_button)=1

GUI frame egt_thermo_type_frame,"EGT",0,165,80,70,RGB(yellow)
GUI radio egt_jtype_button,"J",15,175,25,RGB(green)
GUI radio egt_ktype_button,"K",15,205,25,RGB(green)
CtrlVal(egt_jtype_button)=1

GUI frame rpm_count_frame,"RPM",185,75,115,160,RGB(yellow)
GUI radio rpm_dev2_button,"\2",200,105,25,RGB(green)
GUI radio rpm_even_button,"EV",200,135,25,RGB(green)
GUI radio rpm_mul2_button,"x2",200,165,25,RGB(green)
GUI radio rpm_mul4_button,"x4",200,175,25,RGB(green)
GUI radio rpm_dis_button,"DS",200,205,25,RGB(green)
CtrlVal(rpm_dis_button)=1

GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame

GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button,rpm_mul4_button,rpm_dis_button
GUI hide rpm_count_frame


'End

' set some values...

CtrlVal(cht1_led)=1
CtrlVal(cht2_led)=1
CtrlVal(cht3_led)=1
CtrlVal(cht4_led)=1
CtrlVal(egt2_led)=1

GUI interrupt TouchDown,TouchUp
'SetTick 1000,blink

' ----------- Main

Do
If screen_state<>old_screen_state Then redraw
If touch_state<>old_touch_state Then
Print "Touch "; touch_state; " Screen "; screen_state
Print "EGT Setup ";
If CtrlVal(egt_jtype_button) Then Print "J ";
If CtrlVal(egt_ktype_button) Then Print "K ";
Print " CHT Setup ";
If CtrlVal(cht_jtype_button) Then Print "J ";
If CtrlVal(cht_ktype_button) Then Print "K ";
old_touch_state=touch_state
Print ""
EndIf
Loop

' -------- Sub's

Sub blink
If CtrlVal(cht1_led) Then
CtrlVal(cht1_led)=0
CtrlVal(egt1_led)=1
Else
CtrlVal(cht1_led)=1
CtrlVal(egt1_led)=0
EndIf
End Sub

Sub TouchDown
'touch_state=Touch(ref)
'If touch_state>=1 And touch_state<=3 Then screen_state=touch_state
'Print touch_state screen_state
'If screen_state<>old_screen_state Then redraw
End Sub

Sub TouchUp
touch_state=Touch(lastref)
If touch_state>=1 And touch_state<=3 Then screen_state=touch_state
'Print touch_state screen_state
'If screen_state<>old_screen_state Then redraw
End Sub

Sub redraw
Select Case screen_state ' find out which control was touched
Case status_button ' restore status screen
GUI hide status_button
RBox 0,0,MM.FontWidth*7,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 10,12,"Status",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=data_button Then ' hide data screen objects
GUI restore data_button
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
GUI hide cht_data_frame,egt_data_frame
EndIf
If old_screen_state=setup_button Then ' hide setup screen objects
GUI restore setup_button
GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame
GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
GUI hide rpm_count_frame
EndIf
GUI restore temps_stat_frame,cht_stat_box,egt_stat_box
GUI restore cht1_led,cht2_led,cht3_led,cht4_led
GUI restore egt1_led,egt2_led,egt3_led,egt4_led
Case data_button ' restore data screen
GUI hide data_button
RBox 127,0,MM.FontWidth*5,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 137,12,"Data",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=status_button Then ' hide status screen objects
GUI restore status_button
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide egt1_led,egt2_led,egt3_led,egt4_led
GUI hide cht_stat_box,egt_stat_box
GUI hide temps_stat_frame
EndIf
If old_screen_state=setup_button Then ' hide setup screen objects
GUI restore setup_button
GUI hide cht_jtype_button,cht_ktype_button
GUI hide cht_thermo_type_frame
GUI hide egt_jtype_button,egt_ktype_button
GUI hide egt_thermo_type_frame
GUI hide rpm_dev2_button,rpm_even_button
GUI hide rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
GUI hide rpm_count_frame
EndIf
GUI restore cht_data_frame
GUI restore cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI restore egt_data_frame
GUI restore egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
Case setup_button ' restore setup screen
GUI hide setup_button
RBox 220,0,MM.FontWidth*6,MM.FontHeight*2,3,RGB(yellow),RGB(yellow)
Text 230,12,"Setup",L,5,1,RGB(black),RGB(yellow)
If old_screen_state=data_button Then ' hide data screen objects
GUI restore data_button
GUI hide cht1_data_box,cht2_data_box,cht3_data_box,cht4_data_box
GUI hide cht_data_frame
GUI hide egt1_data_box,egt2_data_box,egt3_data_box,egt4_data_box
GUI hide egt_data_frame
EndIf
If old_screen_state=status_button Then ' hide status screen objects
GUI restore status_button
GUI hide cht1_led,cht2_led,cht3_led,cht4_led
GUI hide cht_stat_box
GUI hide egt1_led,egt2_led,egt3_led,egt4_led
GUI hide egt_stat_box
GUI hide temps_stat_frame
EndIf
GUI restore cht_thermo_type_frame
GUI restore cht_jtype_button,cht_ktype_button
GUI restore egt_thermo_type_frame
GUI restore egt_jtype_button,egt_ktype_button
GUI restore rpm_count_frame,rpm_dev2_button,rpm_even_button
GUI restore rpm_mul2_button ',rpm_mul4_button ',rpm_dis_button
End Select
old_screen_state=screen_state ' update old
End Sub

End


Use the basic tabbed framework and "touch action" sections, Insert your objects for the main sections of the screen and see how your screens work...

Post them back here so we can take a look..!
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 12:06am 07 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said  
Use the basic tabbed framework and "touch action" sections, Insert your objects for the main sections of the screen and see how your screens work...

Post them back here so we can take a look..!


Just gave it a try on my CG board the same as yours.

Crashed at line 77;
[Code][77] GUI displaybox cht_stat_box,7,100,MM.FontWidth*19,MM.FontHeight+5,RGB(red),RGB(black)
Error: 456 is invalid (valid is 16 to 320)
[/code]

Presume that means I need to add the font you used in line 60.
Mid Sized Bold.

Phil.

Edit:-

What Firmware Version is the above running on Zonker?
Looks like the latest version differs a fair bit in terms of syntax.

Notice this with the GUI LED commands.Edited by Phil23 2016-08-08
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 04:26pm 12 Aug 2016
Copy link to clipboard 
Print this post

Hi @Zonker & others,

Have had a few looks at your code & gone off on my own tangent.
I Presume Multiple Screens weren't available when you developed your code;
Lot's of GUI Hide & Restore happening.

I decided to use pages, & have one for the Tab Headers & four others for the body of the page below.

Currently using the GUI SWITCH, as it can be dimmed.
Tried with the BUTTON, but could not get a suitable visual change without trying to vary it's Colour; Might still revisit it yet....

Anyone have comments or suggestions before I go any further?

Haven't declared anything yet, or setup constants for the references.

Cheers

Phil

[Code]
Cls
Font 4
TabHgt=60

GUI Interrupt TouchDown

'Heading Buttons
GUI SETUP 9
GUI Switch 1, "Button1", MM.HRes/4*0,0,MM.Hres/4-2,TabHgt, RGB(Cyan),RGB(Gray)
CtrlVal(1)=0
GUI Switch 2, "Button2",MM.HRes/4*1,0,MM.Hres/4-2,TabHgt, RGB(White)
CtrlVal(2)=1
GUI Switch 3, "Button3",MM.HRes/4*2,0,MM.Hres/4-2,TabHgt, RGB(White)
CtrlVal(3)=1
GUI Switch 4, "Button4",MM.HRes/4*3,0,MM.Hres/4-2,TabHgt, RGB(White)
CtrlVal(4)=1

'Page #1
GUI SETUP 1
GUI Displaybox 5, 0,TabHgt+1,MM.HRes/2,TabHgt
CtrlVal(5)="First Tab"

'Page #2
GUI SETUP 2
GUI Displaybox 6, 0,TabHgt+1,MM.HRes/2,TabHgt
CtrlVal(6)="Second Tab"

'Page #3
GUI SETUP 3
GUI Displaybox 7, 0,TabHgt+1,MM.HRes/2,TabHgt
CtrlVal(7)="Third Tab"

'Page #4
GUI SETUP 4
GUI Displaybox 8, 0,TabHgt+1,MM.HRes/2,TabHgt
CtrlVal(8)="Fourth Tab"

Page 1,9

Do
'Code Here
Loop

Sub TouchDown

Print "TouchDown"

Select Case Touch(REF) ' find out the control touched
Case 1
Print CtrlVal(1),"Button 1 Pressed"
TabAct=1
Page 1,9
Case 2
Print CtrlVal(2),"Button 2 Pressed"
TabAct=2
Page 2,9
Case 3
Print CtrlVal(3),"Button 3 Pressed"
TabAct=3
Page 3,9
Case 4
Print CtrlVal(4),"Button 4 Pressed"
TabAct=4
Page 4,9
End Select

Select Case TabAct
Case 1
CtrlVal(1)=0
CtrlVal(2)=1
CtrlVal(3)=1
CtrlVal(4)=1
Case 2
CtrlVal(1)=1
CtrlVal(2)=0
CtrlVal(3)=1
CtrlVal(4)=1
Case 3
CtrlVal(1)=1
CtrlVal(2)=1
CtrlVal(3)=0
CtrlVal(4)=1
Case 4
CtrlVal(1)=1
CtrlVal(2)=1
CtrlVal(3)=1
CtrlVal(4)=0
End Select


End Sub
[/code]Edited by Phil23 2016-08-14
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 04:40am 13 Aug 2016
Copy link to clipboard 
Print this post

Yes, you are very correct Phil about my code example as it is over a year old and done back in the version 4 days.... I will have to totally rewrite it and bring things up to date with the current version of Geoff's firmware...

I do like your example, as it forms a good working framework to get started with... Of course, everyone's code will be different from that point on, depending on what goes into the rest of the screen designs...

I remember back when i did the layout, that I created a simple "yellow box" with text to indicate the current screen tab that you are on. This was NOT a touchable object and it overlaid the "grayed out" button object underneath... To me, this seemed to provide a better indication (to the end user) of the current screen (and tab) that was being shown... Maybe we need to consider this as a possible change in the way that "currently selected", and now "inactive" buttons are shown on the screen...

Currently, when selected, they are shown as "grayed out" or "dimmed" in appearance to the end user... Maybe Geoff needs to add a new "attribute" for the buttons that when selected, could show as ether "dimmed/grayed out" OR shown as "reversed in selected colors", (or some other way), that the end user knows for sure that the currently selected tab, and screen objects that are shown below it, are indeed correct. I am not totally sure about this and I think more feedback from everybody would be very helpful in getting this sorted out... But, the person creating the program can always do something (like I tried), to change things anyway...

Anyway, keep going with your program work and do post the results, as I an very sure many of us (me included), will be needing good examples to build upon.. This is the very reason why a forum like TBS is an excellent place where many people are allowed to throw in their "2 cents worth", and increase the overall understanding of many things..!

Coding up "proper" touch screen designs for control panels is a lot tougher to do than just throwing together a bunch of objects... Careful thinking must be applied to make sure the end user does not "miss interpret" what is being shown and possibly make wrong selections in the overall control program in charge of the system controls...

Nuff babbling for now...

 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 11:42am 13 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said  ... Maybe we need to consider this as a possible change in the way that "currently selected", and now "inactive" buttons are shown on the screen...

Currently, when selected, they are shown as "grayed out" or "dimmed" in appearance to the end user... Maybe Geoff needs to add a new "attribute" for the buttons that when selected, could show as ether "dimmed/grayed out" OR shown as "reversed in selected colors", (or some other way), that the end user knows for sure that the currently selected tab, and screen objects that are shown below it, are indeed correct......[/quote]

Totally agree.
Currently the code shows the Tabs, which are actually a SWITCH, Highlighted when it's selected for the tab & the others dimmed, which looks Ok; Only 1 can be highlighted.

But, the SWITCH's need to be in the Off position to be highlighted, & On to be dimmed,
I sorta think this characteristic of the switches seems inverted.

Normal expectation is for a switch to illuminate when on in my world.
Mentioned that in another thread...

[Quote]
Coding up "proper" touch screen designs for control panels is a lot tougher to do than just throwing together a bunch of objects...[/quote]
Yes; The number of objects required really changes things, particularly with a large amount of data.
Easily 40 plus just for the data I have in mind.

I did configure one of the Tabs to use Basic Graphics commands to avoid chewing up objects;
Just using TEXT output to Tab4;
I intended to display All raw data from 3 MM's on it;
Too many for the GUI method....

I know Geoff recommends not mixing the two...
[Quote]
Mixing the two on the screen is not a good idea because MMBasic does
not track the position of the basic drawing objects and they can clash with the GUI controls.
As a result, you should use either the GUI controls or the basic drawing objects – but not both. If you are using
GUI controls then everything on the screen must be a GUI control. So, for example, do not use TEXT....[/quote]

I did take notice of all he said & made sure that Tab4 didn't contain anything that would cause a popup; Cleared it, re-enabled objects etc & it worked just fine....

BUT..... I then discovered I could get screen corruption on Random situations...

If the TouchDown interrupt was called between text writes, it would change screens & write the balance to the wrong tab...

[Code]
Sub UpdateTab4
IF TabAct=4 then

Font 4,1
Text MM.HRes/40, MM.VRes*5/16, "Air Temp = ", LB,,, RGB(Cyan)
Text MM.HRes/40, MM.VRes*6/16, "Water Temp = ", LB,,, RGB(Green)
...
...
If Touch Down Occurs here, Text below is written on the wrong page....
...
...
Text MM.HRes/40, MM.VRes*10/16, "Solar Volts = ", LB, 2, 1, RGB(Cyan)
Text MM.HRes/40, MM.VRes*11/16, "Flow Rate l/m ", LB, 2, 1, RGB(Yellow)
Text MM.HRes/40, MM.VRes*12/16, "Energy Watts ", LB, 2, 1, RGB(255,165,0)
End if
End Sub
[/code]

Might be able to work around it if I can make sure the tab change does not happen while this Sub is being executed...

Thought about trying to disable touch while the Sub is running; It will be run on Tab change & then possible every 2 seconds while the tabs active.

Not keen on that approach as it might induce a lag....

Would be better if I could find a way to hold the tab change till after the Sub completed.

[Quote]
Nuff babbling for now...


Babbling is much a much more productive use of Bandwidth; that a day of clicking "Like"...

Cheers.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 12:55am 14 Aug 2016
Copy link to clipboard 
Print this post

  Phil23 said  BUT..... I then discovered I could get screen corruption on Random situations...

If the TouchDown interrupt was called between text writes, it would change screens & write the balance to the wrong tab...

[Code]
Sub UpdateTab4
IF TabAct=4 then

Font 4,1
Text MM.HRes/40, MM.VRes*5/16, "Air Temp = ", LB,,, RGB(Cyan)
Text MM.HRes/40, MM.VRes*6/16, "Water Temp = ", LB,,, RGB(Green)
...
...
If Touch Down Occurs here, Text below is written on the wrong page....
...
...
Text MM.HRes/40, MM.VRes*10/16, "Solar Volts = ", LB, 2, 1, RGB(Cyan)
Text MM.HRes/40, MM.VRes*11/16, "Flow Rate l/m ", LB, 2, 1, RGB(Yellow)
Text MM.HRes/40, MM.VRes*12/16, "Energy Watts ", LB, 2, 1, RGB(255,165,0)
End if
End Sub
[/code]

Might be able to work around it.....[/quote]

I think I might have it all sorted now.

Have both Basic & GUI objects mixed on one page and haven't been able to make it fall over yet.

Think I've trapped for what's needed.

Only condition is the mixed page must not contain GUI elements that can pop-up the keyboard or number pad.

It could be totally flawed & could end me up in the Sh#+, but If anyone can see that coming I'd appreciate the feedback; before I dig a bigger hole.

[Code]
Sub UpdateTab4
IF TabAct=4 then

Font 4,1
Text MM.HRes/40, MM.VRes*5/16, "Air Temp = ", LB,,, RGB(Cyan)
...
Text MM.HRes/40, MM.VRes*6/16, "Water Temp = ", LB,,, RGB(Green)
.
.
Text MM.HRes*16/40, MM.VRes*5/16, Str$(TmpAmb,4,1), RB,,, RGB(Cyan)
...
Text MM.HRes*16/40, MM.VRes*6/16, Str$(TmpCur,4,1), RB,,, RGB(Green)

If TabAct<>4 Then
Cls
Print "Clear Screen"
Gui Show All
End If
End if
End Sub
[/code]

I think the last IF Statement solved it.

Will try & post some code in the morning.


Cheers


Phil.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 01:27pm 14 Aug 2016
Copy link to clipboard 
Print this post

Seems to be working well;
Have trapped the screen update issues caused if the interrupt occurs during the Basic Graphics updates.

Page 4 has a mix of Basic & Advanced Graphics & it will be intended to display all Sensor data & key variables used in the control process.
Mostly for Debugging & seeing what things are doing.

That will amount to about 40 variables to display, which I might split over 2 pages;
Way to many for them all to be advanced objects.

Data is being collected from 3 other MM's via HC-12's.

This one will poll for that data & acknowledge it's receipt.
Have that Com stuff running on a 28P Backpack ATM;
Multiple Basic Graphics Pages with switching.

Tried building a data string and using it with GUI CAPTION on Page1,
but the Caption string doesn't update.

Edit;-

Posted the image of the 4 tab twice, Fixed now.

1st Tab;
Data not working & needs changing



2nd Tab;
Just mucking about on it.



4th Tab;
It's the mix of Basic & Advanced & all working fine now.




Edited by Phil23 2016-08-16
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 03:16pm 14 Aug 2016
Copy link to clipboard 
Print this post

Wow Phil..!!

Looks like your doin great buddy..!!

Screen layouts and tabs look well organized...

Add new "VAR" type objects and direct the data values to them.. The cool thing is that you can push data changes to the objects at any time or from anywhere in the program... Then, anytime that screen is being shown, the objects current data will be there..! So, invest some more of your time and new talent to this, and you will be kickin butt..! There IS a limit of objects as I remember... (I had only 2 left).. So choose wisely .. I think Geoff had increased this amount...

I would love to see the sensor data on those value readouts...

Nice job Phil..!!!
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:32pm 14 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said  
Add new "VAR" type objects and direct the data values to them.. The cool thing is that you can push data changes to the objects at any time or from anywhere in the program...
[/quote]

The VAR object?

Don't know about that one.

Have completely searched both manuals, damn well hundreds of VAR's (every mention of "Variable, Lol), but not sure what you are referring to.

[Quote]
I would love to see the sensor data on those value readouts...


That might be tonight's exercise....

Already have the Coms code for retrieving the data from the other MM's running on a 28 pin backpack.

Just need to bring the relevant Subs over.

15 Sensors & about 5 derived outputs.

Cheers.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 03:28pm 17 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said  I would love to see the sensor data on those value readouts...


Got some there now.

This data is being received on Com1 by a HC-12, which Polls the two other MM's,
one on the Spa, the other in the Heat Pump.

Home page is only Advanced Graphics.
Still requires 10 Objects to display 5 items of data.

Wouldn't mind seeing the option to suppress the border in the DISPLAYBOX though.
The other thing that would be good is display precision in the NUMBERBOX,
so you don't get situations where the decimal is dropped.

IE
29.8
29.9
30
30.1
30.2




This page uses the Mix of Basic & Advanced Graphics.


 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 04:58pm 17 Aug 2016
Copy link to clipboard 
Print this post

Man.! Shaping up nicely Phil..!!

I think if you display the values as "text" data, then you can used the print formatting command options to "force" the digit after the decimal point to always be shown... Maybe this also works with number values also.. (need to check this..!!)

Looks like I need to start over again and totally rewrite my code to match the newer firmware... Yours seems to function nicely... I like the different colors you used for the tab text.... Getting real data from the HC-12 subsystem parts proves that the unit is handling everything very well... (sweet)... Awesome project..! Edited by Zonker 2016-08-19
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 05:14pm 17 Aug 2016
Copy link to clipboard 
Print this post

  Zonker said  I think if you display the values as "text" data, then you can used the print formatting command options to "force" the digit after the decimal point to always be shown...


The values I'm displaying in the DISPLAYBOX are STR$(number,3,1), so the format fine.

It's the NUMBERBOX that you can't enter the decimals in;
It only displays whatever number is required.

Cheers.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 03:18pm 19 Aug 2016
Copy link to clipboard 
Print this post

Just updated Tab 4 a bit.

Now displaying thermistor data from the heat pump.
Thermistors might need a bit better calibration yet.

Energy output is calculated from flow rate on the basis of 4.2kJ to raise 1 litre if water 1°C (Yes, I know, it's a kilo really...).
1kJ=0.000278kWh; then kWh's back to Watts.

Not bad, the 2600 Watts out for the 730 Watts of electricity in.

Incidentally, that tab would require 37 advanced GUI objects if it was all advanced graphics.

Currently it's using 5 & I can't break it yet.

Cheers.



 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 03:51pm 19 Aug 2016
Copy link to clipboard 
Print this post

Excellent Work Phil..!

It amazing all the data you are collecting..!

Next maybe start thinking about storing log data in CSV format...

Where do you get the sensor data from..?

Lookin good..
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 07:13pm 19 Aug 2016
Copy link to clipboard 
Print this post


Thanks @Zonker.

[Quote=Zonker]Where do you get the sensor data from..?
[/quote]

The Spa has 4 DS18B20's installed in it & a flow sensor.
There's a small garden solar panel on the roof with the panels & a DS18B20 attached.

The Spa has it's own LCD Backpack to monitor all those & control the pumps & valves.
It has an ESP8266 on the console & a HC-12 on Com1.

The heat pump just has a bare 28 pin on protoboard that monitors the existing 5 thermistors in the unit.
It has the same wireless modules as the other one.

The 5" screen is connected to an E64 & it polls both the other.

Did you get my PM?

If you drop me an email address it can reply to that.

Cheers

Phil.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 09:59pm 19 Aug 2016
Copy link to clipboard 
Print this post

Just Adding to the above.

This is the 28 pin backpack that currently runs the Spa.
Uses a 3 level version of the Parking Sensors Menus to set the variables.

It will be replaced by a CGMicroboard2, with 2.8" LCD to obtain enable a better interface with Advanced graphics, but also because it's clean out of pins.

The one in the heat pump is still evolving.

It has the thermistors connected at the top, two LED's;
One indicated the code is still running, the second shows that Coms are happening.
It's the one that reads the flow meter at the moment, as I currently don't have a spare pin left on the Spa one to connect it to.

A 64 pin CG board will fix that, & the flow meter will be monitored by the Spa controller.

Cheers

Phil






 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 10:54am 29 Aug 2016
Copy link to clipboard 
Print this post

@Phil23

With your 'framework' code posted on page 1 of this thread; where are you calling the UpdateTab4 sub (or rather where do I insert the call)?
You posted th UpdateTab4 sub a couple of threads later than your framework code - and now that I am playing with this I notice I am missing something somewhere!

Thanks for any help . . .
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025