Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:16 02 May 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 : Micromite and Micromite Plus Beta 32

     Page 3 of 3    
Author Message
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 06:33pm 01 Oct 2015
Copy link to clipboard 
Print this post

Beta32 MX470 100 pinner.
Issue when the currently selected button is disabled in the PenDown routine.
The code below demonstrates the issue. The plan is to disable both the ON and OFF buttons until the switching event completes and then RESTORE them. The switching is done via a SETTICK so that other routines such as time update continue uninterrupted while waiting for the switching to complete.

If the selected control is disable within the PenDown as used here then the buttons don't respond properly when RESTORED. One needs two taps to work again and the other doesn't work at all.

If the DISABLE is moved to the PenUp event then it works OK but doesn't look as nice as the buttons disabling straight away on touch down.
I am guessing that the button doesn't finish properly after its initial press down as it now thinks its disabled even though it still has something to do to finish its current operation.



'Test of 100 pinner and ILI9341
'Demonstrate issue with GUI DISABLE issue with PenDown Subroutine
'

CONST SWON=2
CONST SWOFF=3
CONST LEDON=4
CONSt LEDOFF=5
CONST SwitchTime=5000
'RTC GETTIME
cls
SETTICK 1000,tick4,4
FONT 2,2
GUI INTERRUPT PenDown
GUI BUTTON SWON,"On",10,120,90,40,RGB(white),RGB(blue)
GUI BUTTON SWOFF,"Off",10,160,90,40,RGB(white),RGB(blue)
GUI LED LEDON,160,120,30,RGB(green)
GUI LED LEDOFF,160,160,30,RGB(green)



Do:LOOP

SUB PenDown
SELECT CASE TOUCH(REF)
CASE SWON

CtrlVal(LEDON)=1
'GUI DISABLE SWON,SWOFF

GUI DISABLE SWOFF
GUI DISABLE SWON 'If the selected button is disabled here then
' then control misbehaves when RESTORED
SETTICK SwitchTime,StopMotor,3

CASE SWOFF
CtrlVal(LEDOFF)=1
'GUI DISABLE SWON,SWOFF
GUI DISABLE SWON
GUI DISABLE SWOFF 'If the selected button is disabled here then
' then control misbehaves when RESTORED
SETTICK SwitchTime,StopMotor,3

END SELECT
END SUB

'If disabled in the PenUp routine then control works OK when RESTORED
SUB PenUp
SELECT CASE TOUCH(LASTREF)
CASE SWON

GUI DISABLE SWOFF
GUI DISABLE SWON
SETTICK SwitchTime,StopMotor,3

CASE SWOFF

GUI DISABLE SWON
GUI DISABLE SWOFF
SETTICK SwitchTime,StopMotor,3

END SELECT
END SUB

SUB StopMotor
CtrlVal(LEDON)=0
CtrlVal(LEDOFF)=0
SETTICK 0,0,3
'GUI RESTORE SWON,SWOFF
'GUI RESTORE SWOFF
'GUI RESTORE SWON
GUI RESTORE ALL
END SUB

SUB tick4

TEXT 1,30,date$+" "+time$+" "

END SUB


Regards
Gerry
Latest F4 Latest H7
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5907
Posted: 07:50pm 01 Oct 2015
Copy link to clipboard 
Print this post

Try adding 'CTRLVAL(SWON)=0' just before you disable the button.
This puts it in the off state ready for when you re-enable it.
Ditto for the OFF button.


SUB PenDown
SELECT CASE TOUCH(REF)
CASE SWON

CTRLVAL(LEDON)=1
'GUI DISABLE SWON,SWOFF
CTRLVAL(SWON)=0
GUI DISABLE SWOFF
GUI DISABLE SWON 'If the selected button is disabled here then
' then control misbehaves when RESTORED
SETTICK SwitchTime,StopMotor,3

CASE SWOFF
CTRLVAL(LEDOFF)=1
'GUI DISABLE SWON,SWOFF
CTRLVAL(SWOFF)=0
GUI DISABLE SWON
GUI DISABLE SWOFF 'If the selected button is disabled here then
' then control misbehaves when RESTORED
SETTICK SwitchTime,StopMotor,3

END SELECT
END SUB



I would do it immediately before disabling to reduce the chance of a second trigger.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5907
Posted: 08:03pm 01 Oct 2015
Copy link to clipboard 
Print this post

Advanced features manual:

GUI BUTTON seems to be missing from the table of commands.

(It IS in the Advanced graphics section)

Jim
VK7JH
MMedit   MMBasic Help
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:02pm 01 Oct 2015
Copy link to clipboard 
Print this post

Yes, well put Jim. The secret is manually putting the control into the off state before you disable it.

Four controls (BUTTON/SWITCH, SPINBOX, NUMBERPAD and TEXTPAD) need to finish their animation when the touch is lifted. By disabling the control in the touch down interrupt you are preventing them from finishing their animation because disabled controls do not receive any touch signals and therefore they do not receive a touch up.

The controls are then stuck in a down mode while disabled. When you re enable them they still have not received the touch up signal - no wonder they are confused.

Geoff
Geoff Graham - http://geoffg.net
 
piclover
Senior Member

Joined: 14/06/2015
Location: France
Posts: 134
Posted: 09:34pm 01 Oct 2015
Copy link to clipboard 
Print this post

  Geoffg said  
  piclover said  something is annoying about the panel (and touch) configuration: the fact it's done via a persistent OPTION (which must be typed in the console, and can't even be part of a program

A lot of people hare complained about this but it was necessary because (on the MX470) the screen must be configured before the prompt is displayed.[/quote]
If it's just a MX470 issue, then why not allowing it at least on the MX170, which is in extreme need to keep reconfigurable pins (while the MX470 got plenty) ?

Also, you could make it so that those OPTIONs are *not* written down into the Flash RAM for the MX170, and permit having them invoked within the program...

[quote]Another issue is that calibration can only be done after the screen has been set up and you do not want to redo the calibration every time you start a program.[/quote]
But I don't see why there won't be a LCDPANEL/TOUCH CLOSE (to free all the pins but the CS, and perhaps RESET ones, albeit this could be left at the user's responsibility) and a LCDPANEL/TOUCH OPEN (that would not reinit the panel/touch, but simply re-use the pins for its control)...
Also, the touch calibration data could be kept into the Flash RAM, independently of the pins assignment data/mapping.

[quote]Some people like it the way that it is, others do not. It is only a problem when you are experimenting with different displays and configurations but, if your have a fixed setup (as in a final design) it works well.

It depends on your project... I already made several Micromite based projects, 2 of which are using the reconfigurable pins feature in order to "multiplex" the usages of some pins.

Also, think about another limitation of the current configuration process: you can't switch from portrait to landscape mode for the LCD panel within a program... Annoying for a portable device project.Edited by piclover 2015-10-03
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 10:42pm 01 Oct 2015
Copy link to clipboard 
Print this post

  TassyJim said   Try adding 'CTRLVAL(SWON)=0' just before you disable the button.
This puts it in the off state ready for when you re-enable it.
Ditto for the OFF button.

Jim



Yes, 'CTRLVAL(SWON)=0' to do what never happened after its disabled is the answer.

It can go before or after the DISABLE within the PenDown event, or out side where the RESTORE is done if you want the alternate caption shown while it is disabled.i.e
ON|Busy
OFF|Busy


Thanks
Gerry
Latest F4 Latest H7
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 01:53am 02 Oct 2015
Copy link to clipboard 
Print this post

  piclover said  If it's just a MX470 issue, then why not allowing it at least on the MX170, which is in extreme need to keep reconfigurable pins (while the MX470 got plenty) ?


for the MX170 only, would a viable option be to move the colour LCD support back to being through custom functions? if this was done, could the same present level of functionality still be maintained?

then the user could, if they so wished, place said custom function(s) into the library where they would remain mostly unseen, persistent, and installed on every startup. it would also free up a little more flash space to keep the MX170 MMbasic core up to date with the MX470 version in other regards.


a couple of semi-related suggestions i've been mulling over:

(1) having a PIN number to lock access to the library routines - this would be a different PIN number to the one currently available to lock all program access. this then provides two levels of user access to MMbasic, 'admin' and 'user'.

(2) the practicality of having the library routines and/or colour LCD configuration protected (if said PIN number has been set) from a factory reset ("!..."). this last point may more salient in the context of the MX470, where a factory reset may leave a system (MX470 + colour LCD, but no serial console) inaccessible afterwards due to the peripherals like colour LCD being unconfigured. i'm also thinking a bit forward here, when there may be a future call to have library routines that scan an attaches set of keyswitches and present them as an integrated ASCII keyboard. perhaps even a chorded keyboard: https://en.wikipedia.org/wiki/Chorded_keyboard


all just opinions and ideas to kick around.


cheers,
rob :-)Edited by robert.rozee 2015-10-03
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 01:37pm 06 Oct 2015
Copy link to clipboard 
Print this post

@Geoff,

about the User Manual (p.59):
  Quote  OPTION CLOCKTRIM ±n

This entry exists two times.

typo on Advanced Features Manual (p.33)
  Quote  GIU BITMAP x, y, bits [,
width] [, height] [, scale]
[, c] [, bc]

should be GUI BITMAP ...

Michael
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:37pm 06 Oct 2015
Copy link to clipboard 
Print this post

Thanks Michael, I will fix them in the next release.
Geoff Graham - http://geoffg.net
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 11:37pm 07 Oct 2015
Copy link to clipboard 
Print this post

A possible bug in VAR RESTORE?

example:
var restore x, y, z
Error: Unexpected text: x, y, z$

The error is raised for any var name, single or multiple


http://rittle.org

--------------
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 03:22am 08 Oct 2015
Copy link to clipboard 
Print this post

Nice try but VAR RESTORE does not take any arguments. The unexpected text message is the interpreter's way of saying that there was something following the command that it did not expect.
Geoff Graham - http://geoffg.net
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 03:44am 08 Oct 2015
Copy link to clipboard 
Print this post

Ah, thanks! My bad

BTW, the OPTION CLOCKTRIM section is repeated twice in the Manual, surrounding OPTION COLOURCODE

Also, I am reasonably sure there was a way to catch and redirect errors, but can't seem to find it in the manual.Edited by kiiid 2015-10-09
http://rittle.org

--------------
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 05:17am 08 Oct 2015
Copy link to clipboard 
Print this post

  kiiid said  I am reasonably sure there was a way to catch and redirect errors, but can't seem to find it in the manual.

Only errors involving reading/writing the SD card

Geoff Graham - http://geoffg.net
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 01:08am 10 Oct 2015
Copy link to clipboard 
Print this post

Geoff,

There appears a bug in
SETTICK period, target [, nbr]

Timer nbr = 1 will not tick when there are 2 timers.

For example, there is no tick in No.1 in the following.

Settick 1000,xxx,1
settick 2000,yyy,2

or

Settick 1000,xxx,2
Settick 2000,yyy,1

but

Settick 1000,xxx,2
Settick 2000,yyy,3

works.

Anthony.

MX170 on Big Mik's SMD BP170, LCD enabled.Edited by ajkw 2015-10-11
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:20am 10 Oct 2015
Copy link to clipboard 
Print this post

  ajkw said   Geoff,

There appears a bug in
SETTICK period, target [, nbr]

Timer nbr = 1 will not tick when there are 2 timers.


I can confirm that this bug has been 'squashed' in Geoff's next Beta

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
     Page 3 of 3    
Print this page


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

© JAQ Software 2024