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: AustraliaPosts: 844 |
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: AustraliaPosts: 5907 |
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: AustraliaPosts: 5907 |
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: AustraliaPosts: 3165 |
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: FrancePosts: 134 |
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. |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 844 |
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 ZealandPosts: 2290 |
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 :-) |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1133 |
@Geoff, about the User Manual (p.59): This entry exists two times. typo on Advanced Features Manual (p.33) width] [, height] [, scale] [, c] [, bc] should be GUI BITMAP ... Michael |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
Thanks Michael, I will fix them in the next release. Geoff Graham - http://geoffg.net |
||||
kiiid Guru Joined: 11/05/2013 Location: United KingdomPosts: 671 |
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: AustraliaPosts: 3165 |
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 KingdomPosts: 671 |
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. http://rittle.org -------------- |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
Only errors involving reading/writing the SD card Geoff Graham - http://geoffg.net |
||||
ajkw Senior Member Joined: 29/06/2011 Location: AustraliaPosts: 290 |
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. |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
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 |