![]() |
Forum Index : Microcontroller and PC projects : Micromite MMBasic Ver 5.04.10 Beta 1
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
As promised, I have a new beta version of the Micromite firmware which fixes some of the things that did not make it into V5.04.09. You can download it from: http://geoffg.net/micromite.html The idea of the beta versions is to test new features and bug fixes that have the potential break something else within the interpreter. I will keep updating the beta version until it is stable and then make it into a final release. If you find any issues or bugs in this beta please report them in this thread and I will try to fix them ASAP. New in this version (compared to V5.04.09) is: - Further optimised the internal memory management. This improves the speed of string operations by up to 10% over and above the considerable speed improvement already in V5.04.09. - When pressing the enter key (Ent) on a GUI NUMBERBOX the resultant number displayed will be automatically formatted with the same number of digits after the decimal point as the number entered using the keypad. - Fixed a number of bugs which caused the CtrlVal() function to return an incorrect value for a NUMBERBOX or TEXTBOX when called from within the MM.KEYPRESS subroutine. I must have had a very "bad hair day" when I originally coded this function. - As part of the above fix CtrlVal() will always return a floating point value for NUMBERBOX - even within the MM.KEYPRESS subroutine (previously it was documented as returning a string inside this sub). I have tried to reproduce the bug reported by Mike (KeepIS) where a GUI NUMBERBOX would crash MMBasic when a SETTICK timer was also running. It seems to work fine for me so if you see this Mike I would be grateful if you could test this beta version - maybe I accidentally fixed the issue while working on the MM.KEYPRESS issues. Next on the list is to revise the TEXTBOX keyboard layout for Grogster. Geoff Geoff Graham - http://geoffg.net |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Geoff, The CtrlVal issue in NUMBERBOX that I highlighted has been fixed - thanks. Not sure about KeepIs's problem with timer interaction as I am unable to test that. Cheers, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
Hi Geoff. could I ask you to consider an enhancement for the RTC command to harmonise the operation of the two counterpart RTC commands in that they both work with the date/time system values? when setting the time, could it be that if you don't specify the argument string, SETTIME takes the current DATE$ and TIME$ values? when setting the RTC under software it is a chunk of code to split out the values so currently, we have to: RTC SETTIME VAL(RIGHT(DATE$,4)), VAL(MID$(DATE$,4,2)), VAL(LEFT$(DATE$,2)), VAL(LEFT$(TIME$,2)), VAL(MID$(TIME$,4,2)), VAL(RIGHT$(TIME$,2)) what I am proposing is that the above is still supported (for legacy code on new firmware) but in the event of a zero argument count, RTC SETTIME uses DATE$ and TIME$ so the command would also support RTC SETTIME ... which is neater and establishes a common mode of operation between the two commands. I don't know what is involved - nothing is ever impossible for the man that doesn't have to do the work ![]() |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
How about what I have implemented on the STM32H7 port? If you set time$ and the RTC is enabled then it automatically updates the RTC. Likewise date$. Then you can get rid of the command RTC SETTIME altogether. I've also implemented reading the RTC as part of the "NEW" command so the use of RTC GETTIME becomes much less important. Finally, I've implemented a "DAY$" function that returns the day of the week automatically calculated from the date. Code freely available of course. This made particular sense on the STM32H7 as it has a built in RTC with external battery backup that keeps running even when the chip isn't powered. |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
that sounds quite nice - I didn't specify above but I was referring specifically to the Mk2 (170 chip) - how would you determine the "RTC enabled"? You could probe the I2C bus at wake up but then MMBasic doesn't know what is attached to the pins - you might be using them for something else and could potentially cause a problem... suppose there is a mains relay connected - eek! I think in an arena where the hardware is more controlled/more pins (like STM and MMX), it is great to have that level of support but the flexibility of the 170 (not just but is the only one I use without going to a MMX) means you can't make any assumptions about what is connected to pins. The 170 can be short on pins and I have two specific examples where I use the I2C pins purely as 5V tolerant I/O. I wouldn't want anything playing with the pins without my express say-so. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
That could be done and I will have a look at it. One thing that worries me is that it has a certain circular illogicality about it. I mean, GETTIME sets the Micromite time from the RTC (which is supposed to be always correct). Then, SETTIME does the opposite and uses the Micromite time to set the RTC - now the Micromite is assumed to be the one that is correct. This sort of illogicality is not good in a programming language. There is also the question of how did DATE$ and TIME$ get to be set correctly in the first place? If the settings were entered by the user then why cannot this data be used to set the RTC (which can then be used to set the Micromite's clock). Geoff Geoff Graham - http://geoffg.net |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
it's down to the vigilance of the programmer ![]() There is something "complete" and pleasant where functions have a part-counterpart relationship, like VAL/STR$, Unixtime/HumanTime etc... GETTIME writes Date$/Time$ so could SETTIME read them? I think that focusing such actions all through system values feels like object orientated - I know DATE$/TIME$ are not real objects in the true sense of programming but they can be made to feel like it with a more symmetrical approach (I would love a single DATETIME$ "object" if you are feeling bold ![]() The validity of the time origin is a moot point really as it is only down to the application - all my MMs run UTC wherever they are so in the UK their clocks are only "right" 50% of the time. I have one in Hyderabad, India which is 5.5 hours slow from local perspective. I try to keep things at UTC +/- 2 secs everywhere and DS3231 can do that reliably for several months. As part of my "patrols" I always check the time with time.is and tweak as necessary. There are plenty of ways to make this more elegant I suppose but that isn't my point here. So long as not-too-much time is allowed to elapse between setting them and stashing in the RTC, the set values are trustworthy. The problem with all of this, of course, is the MM (170) is fairly stuffed so change for change-sake is difficult to justify. it's an idea that's all |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
On the MX170 where the system time is controlled by a free running oscillator, not a crystal, it is handy to keep RTC and system times separate. Having RTC SETTIME default to system time if no arguments are included would be good but that is as far as I would go. When I want to control the system oscillator with CLOCKTRIM, I like to read system time followed by RTC GETTIME then compare the before and after times and use the difference to adjust CLOCKTRIM. If I regularly talk to the mites from a PC, I use the PC time to update the mite and don't use a RTC. I can still do the trimming with CLOCKTRIM if desired. Jim VK7JH MMedit |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
agree with that. best not to get too ambitious on a system with a small amount of firmware space... and it is "only" a micro-controller. easy to forget that when you have the luxury of MMBasic in that arena. ... as an aside on obtaining time rather that having an RTC: I have a controller in my garage that does lights, door, alarm, pipe warmer etc. It is controlled from an android app on my family members' phones to a Bluetooth module (HC-05? can't remember now). CLOCKTRIM means I get a drift of just a few minutes a week so the outside lights still reliably track enough of the daytime to come on around dusk and go off at dawn. It doesn't have an RTC but rather picks unixtime from transmitted commands and sets its date/time, "just in time". ... If Len(b$)>=16 Then ' commands look like $D1505054337041! if Left$(b$,1)<>"$" Or Mid$(b$,16,1)<>"!" Then FlushIO:Goto BadFrame dt$=HumanTime(Val(Mid$(b$,3,10))) On Error Skip 1: Date$=Left$(dt$,10) ' set the clock (UTC) On Error Skip 1: Time$=Right$(dt$,8) ' parse the command Select Case Mid$(b$,2,1) ... Very similar method to what you describe above; I also have a snooker/pool hall table-timing product in a few clubs around UK. Each installation has anything from 9 to 22 slaves (using HC-12s) and the master is the only thing with a reliable clock (PC). Every poll/discovery cycle starts with a broadcast of the time from the master. I don't even bother with CLOCKTRIM on the slaves as they have their times set every 5 minutes or so. ... ELSEIF dst=999 THEN ' broadcast only SELECT CASE cmd$ CASE "TIME" IF LEN(pl$)=19 THEN IF MID$(pl$,9,1)="," THEN ON ERROR SKIP 1:TIME$=LEFT$(pl$,8) ON ERROR SKIP 1:DATE$=RIGHT$(pl$,10) END IF END IF ... |
||||
Andrew_G Guru ![]() Joined: 18/10/2016 Location: AustraliaPosts: 871 |
Hi, I'm hesitant to leap into a discussion amongst MM giants but in contributing to answers to Geoff's rhetorical question of "where do Date$ and Time$ come from" I have a base station with a GPS module purely for date and time (RTC sentence) - every two hours it broadcasts (via HC-12s) the current GPS value (corrected for UTC offset and DST) so that everyone is on the same page. The slight lag between GPS and remote device is not critical in my case and with two COM ports (GPS and HC-12) my base's MM170 is OK. Andrew I have dispensed with my RTC (the batteries do die and even after trying I couldn't control the drift as effectively/easily as the above method). |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Another day, another beta (V5.04.10 Beta 2). You can download it from: http://geoffg.net/micromite.html This version has a revised keyboard layout for the GUI TEXTBOX as per Grogster's suggestion. I have added an extra three keys down the right hand side and that allows for the addition of a number of permanent keys that are available on every layout of the keyboard. These are the delete/backspace key, the cancel key, and period ("."). To squeeze in the extra keys I made each key slightly narrower and reduced the space between keys. The result still looks OK (to my eyes at least). While doing this I realised why the original keyboard was 10 keys wide. With an 800 pixel wide screen each key was 80 pixels however with 11 keys wide each key now occupies 72.727 pixels and that fraction of a pixel was a real pain to deal with. I would be grateful if people could play with this as I am anxious to find out if the new layout has broken anyone's program. Geoff ![]() Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
hi geoff, is there any chance of slipping mouse-control (using the X-11 extenstions) into the editor? as a first step, just have clicking on a given location cause the cursor to go to that location. i've tried adding this support within gfxterm, but the timing is just too tight to get it working reliably. i do have mouse-wheel up/down map to the up/down keyboard arrows. cheers, rob :-) |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
I presume that you are referring to the Windows (DOS) version. In that I always thought of the built in editor as a secondary option given that you can just as easily use an external editor with full mouse control. Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
no no, the MX170 et al version. both teraterm and gfxterm support X10 mouse position reporting (i incorrectly said X11 before). run the following program on any terminal-connected micromite and you'll see the mouse position reported whenever the left or right mouse button is clicked: Const ESC=Chr$(27) Print ESC "[?9h"; ' enable mouse reporting Print ESC "[?1015h"; ' select URXVT encoding (if available) Print ESC "[?1006h"; ' select SGR encoding (if available) Do Do: A$=Inkey$: Loop Until A$<>"" If A$=Chr$(27) Then Print If Asc(A$)<32 Then Print "<" Str$(Asc(A$)) ">"; Else Print A$; Loop Until A$=Chr$(26) Print ESC "[?1006l"; ' disable SGR encoding Print ESC "[?1015l"; ' disable URXVT encoding Print ESC "[?9l"; ' disable mouse reporting > > run <27>[<0;1;1M <27>[<0;79;1M <27>[<0;1;24M <27>[<0;80;24M <27>[<2;1;1M <27>[<2;80;1M <27>[<2;1;24M <27>[<2;80;24M <26> > > cheers, rob :-) |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Geoff, For beta 2, when using a NUMBERBOX, pressing the 0 key has the same effect as pressing the CAN key (which is 'underneath' the 0 key). All other keys seem to work OK. Following code demonstrates Option explicit DIM MyNB = 1 Dim InsideNB DIM ExitNB DIM NBKeyVal CLS Font 3 GUI numberbox MyNB,10,120,180,40,RGB(red),RGB(Black) BackLight 100 GUI interrupt TouchDown,TouchUp ' subroutine to handle touch int Main: Do 'Main program loop, DO while InsideNB = 0 LOOP ' should only get here if touch detected If ExitNB = 1 Then ExitNB = 0 EndIf Loop ' end of main process loop ' Interrupt handling subroutines Sub TouchDown InsideNB = 1 ' entered numberbox end sub Sub TouchUp ExitNB = 1 ' left the numberbox pressing Ent InsideNB = 0 ' End Sub Sub MM.KEYPRESS ref as Integer, caption as string If ref = MyNB AND caption = "Ent" Then if CtrlVal(ref) > 60 then CtrlVal(ref) = 60 Endif End Sub Doug ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Damn, thanks Doug. I will get a new beta out ASAP. Geoff Graham - http://geoffg.net |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Thanks Doug, I have fixed the issue with the zero key in a new version (V5.04.10 Beta 3). It can be downloaded from the same place: http://geoffg.net/micromite.html#Downloads Geoff Geoff Graham - http://geoffg.net |
||||
Azure![]() Guru ![]() Joined: 09/11/2017 Location: AustraliaPosts: 446 |
Geoff, Just a suggestion to users for displaying the version number in a human friendly way that they do not need to think about. Since ver 10 will drop the trailing zero of the number they could do this to display the version number. ' How mm.ver will display by default > print mm.device$, mm.ver Micromite Plus 5.041 > ' How to make it display '10' instead of '1' > print mm.device$, str$(mm.ver,1,4) Micromite Plus 5.0410 > As a suggestion maybe you could start a TBS topic with just the version number like you have done on your website for the downloads (V5.04.10 Beta) and post update information there for beta releases under that version. That might make it easier for TBS members to track each beta update release. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Good points. It might be time to go to V5.05.01. There have been a few significant updates to the functionality (eg, new GUI controls) and that is the trigger that I use to go to a new sub version number. Geoff Graham - http://geoffg.net |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
MMEdit will do that: ![]() Once I get arround to posting the latest version. Jim VK7JH MMedit |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |