![]() |
Forum Index : Microcontroller and PC projects : CMM2:V5.07.01RC1 - release candidate for V5.07.01
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Please download and test V5.07.01RC1 http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip Changes from V5.07.00 Full implementation of the GUI controls as per MM+ Uses the mouse as the I/F rather than touch NB: GUI BEEP not implemented - use PLAY TONE or PULSE in the click interrupt routine if required NB: the TOUCH function is renamed CLICK. The mouse must be connected and working for the GUI commands to work and have been set up using the OPTION MOUSE command Space for the controls must be provided using the OPTION MAXCTRLS n command where "n" is the maximum number that can be used to identify a control. New math command MATH M_INVERSE array!(), inversearray!() This returns the inverse of array!() in inversearray!(). The array must be square and you will get an error if the array cannot be inverted (determinant=0). array!() and inversearray!() cannot be the same. New math function MATH(M_DETERMINANT array!()) returns the determinant of the array. The array must be square Enhancement of the RESTORE comand The restore command can now take a variable as the parameter. A numerical variable should be used for a line number and a string variable for a label Enhancement of the READ command The read command can now take arrays as one or more of the parameters. As usual arrays are specified with an empty set of brackets. e.g READ a,b c(), s$(), t$ This will read numbers into a and b, it will then fill the array c() with numbers (NB: if C is multidimensional then the leftmost dimension will be the fastest moving). It will then fill the array s$() with strings and then finally load the string t$. In all cases the firmwware uses the size of an array to determine how many elements are to be read. New GUI CURSOR commands GUI CURSOR LINK MOUSE GUI CURSOUR UNLINK MOUSE These commands link and unlink mouse activity to the cursor. When linked the cursor will automatically track the mouse activity. The mouse must be opened using the CONTROLLER MOUSE OPEN command before the cursor is linked. Bug fixes: Fixed lockup if the MODE command is used without parameters - now gives an error Fixes bugs in VAR and MEMORY commands when the saved variable area is corrupted for any reason. Improves reliability of VAR SAVE Fixes bug in CAT command when the two strings would exceed 255 characters Adds lightgrey as a valid colour as well as lightgray Fixes bugs in use of mouse with OPTION DEFAULT MODE 12 Fixes two bugs in the CALL function Enhancements to run command to allow reserved words and operators in the cmdline to be passed to a program Fixes bug where characters in the cmdline in a RUN command were converted to upper case MOUSE LINK demo program gui cursor on controller mouse open 0 gui cursor link mouse do:loop GUI demo program ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Demonstration program for the CMM2 ' It does not do anything useful except demo the various controls ' ' Geoff Graham, October 2015 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit Dim ledsY mode 10 option console serial Colour RGB(white), RGB(black) ' reference numbers for the controls are defined as constants Const c_head = 1, c_pmp = 2, sw_pmp = 3, c_flow = 4, tb_flow = 5 Const led_run = 6, led_alarm = 7 Const frm_alarm = 20, nbr_hi = 21, nbr_lo = 22, pb_test =23 Const c_hi = 24, c_lo = 25 Const frm_pump = 30, r_econ = 31, r_norm = 32, r_hi = 33 Const frm_log = 40, cb_enabled = 41, c_fname = 42, tb_fname = 43 Const c_log = 44, cb_flow = 45, cb_pwr = 46, cb_warn = 47 Const cb_alarm = 48, c_bright = 49, sb_bright = 50 ' now draw the "Pump Control" display 'CLS dim integer x, y, lb, rb, sb, xs, ys, cs, ss 'sprite load "mouse.spr",1 gui cursor on 0, mm.hres\2,mm.vres\2 GUI Interrupt TouchDown, TouchUp ' display the heading Font 2,2 : GUI Caption c_head, "Pump Control", 10, 0 Font 3 : GUI Caption c_pmp, "Pump", 20, 60, , RGB(brown) ' now, define and display the controls ' first GUI Switch sw_pmp, "ON|OFF", 20, 90, 150, 50, RGB(white),RGB(brown) CtrlVal(sw_pmp) = 1 ' the flow rate display box Font 3 : GUI Caption c_flow, "Flow Rate", 20, 170,, RGB(brown),0 Font 4 : GUI Displaybox tb_flow, 20, 200, 150, 45 CtrlVal(tb_flow) = "20.1" ' the radio buttons and their frame Font 3 : GUI Frame frm_pump, "Power", 20, 290, 170, 163,RGB(200,20,255) GUI Radio r_econ, "Economy", 40, 318, 15, RGB(230, 230, 255) GUI Radio r_norm, "Normal", 40, 364 GUI Radio r_hi, "High", 40, 408 CtrlVal(r_norm) = 1 ' start with the "normal" button selected ' the alarm frame with two number boxes and a push button switch Font 3 : GUI Frame frm_alarm, "Alarm", 220, 220, 200, 233,RGB(green) GUI Caption c_hi, "High:", 232, 260, LT, RGB(yellow) GUI Numberbox nbr_hi, 318,MM.info(VPos)-6,90,MM.info(FontHeight)+12,RGB(yellow),RGB(64,64,64) GUI Caption c_lo, "Low:", 232, 325, LT, RGB(yellow),0 GUI Numberbox nbr_lo, 318,MM.info(VPos)-6,90,MM.info(FontHeight)+12,RGB(yellow),RGB(64,64,64) GUI Button pb_test, "TEST", 257, 383, 130, 40,RGB(yellow), RGB(red) CtrlVal(nbr_lo) = 15.7 : CtrlVal(nbr_hi) = 35.5 ' draw the two LEDs Const ledsX = 240, coff = 50 ' define their position ledsY = 90 : GUI LED led_run, "Running", ledsX, ledsY, 15, RGB(green) ledsY = ledsY+49 : GUI LED led_alarm, "Alarm", ledsX, ledsY, 15, RGB(red) CtrlVal(led_run) = 1 ' the switch defaults to on so set the LED on ' the logging frame with check boxes and a text box Colour RGB(cyan), 0 GUI Frame frm_log, "Log File", 450, 20, 330, 355, RGB(green) GUI Checkbox cb_enabled, "Logging Enabled", 470, 50, 30, RGB(cyan) GUI Caption c_fname, "File Name", 470, 105 GUI Textbox tb_fname, 470, 135, 290, 40, RGB(cyan), RGB(64,64,64) GUI Caption c_log, "Record:", 470, 205, , RGB(cyan), 0 GUI Checkbox cb_flow, "Flow Rate", 500, 245, 25 GUI Checkbox cb_alarm, "Alarms", 500, 285, 25 GUI Checkbox cb_warn, "Warnings", 500, 325, 25 CtrlVal(cb_enabled) = 1 CtrlVal(tb_fname) = "LOGFILE.TXT" ' define and display the spinbox for controlling the backlight GUI Caption c_bright, "Backlight", 442, 415,,RGB(200,200,255),0 GUI Spinbox sb_bright, MM.info(HPos) + 8, 400, 200, 50,,,10, 10, 100 CtrlVal(sb_bright) = 50 ' All the controls have been defined and displayed. At this point ' the program could do some real work but because this is just a ' demo there is nothing to do. So it just sits in a loop. Do Loop ' the interrupt routine for touch down ' using a select case command it has a different process for each ' control Sub TouchDown local integer mbox ' print "down" Select Case click(REF) ' find out the control touched Case cb_enabled ' the enable check box If CtrlVal(cb_enabled) Then GUI Restore c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn Else mbox=MsgBox("Are you sure?", "YES","CANCEL") ' print mbox if mbox=1 then GUI Disable c_fname, tb_fname, c_log, cb_flow, cb_alarm, cb_warn else CtrlVal(cb_enabled)=1 endif EndIf Case sb_bright ' the brightness spin box ' BackLight CtrlVal(sb_bright) Case sw_pmp ' the pump on/off switch CtrlVal(led_run) = CtrlVal(sw_pmp) CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 20.1) CtrlVal(r_norm) = 1 Case pb_test ' the alarm test button CtrlVal(led_alarm) = 1 ' GUI beep 250 Case r_econ ' the economy radio button CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 18.3) Case r_norm ' the normal radio button CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 20.1) Case r_hi ' the high radio button CtrlVal(tb_flow) = Str$(CtrlVal(sw_pmp) * 23.7) End Select End Sub ' interrupt routine when the touch is removed Sub TouchUp Select Case click(LASTREF) ' use the last reference Case pb_test ' was it the test button CtrlVal(led_alarm) = 0 ' turn off the LED End Select End Sub ' function MM.CURSOR( t as integer) as integer static float lasttime if timer> lasttime+20 or timer<lasttime then x=mouse(x,1) y=mouse(y,1) lb=mouse(l,1) lasttime=timer gui cursor x,y endif MM.CURSOR=-1 if t=1 then MM.CURSOR=lb elseif t=2 then if lb then MM.CURSOR=x elseif t=3 then if lb then MM.CURSOR=y elseif t=4 then MM.CURSOR=lb else MM.CURSOR=lb endif end function ' sub mm.beep beeptime as integer if beeptime and mm.info(sound)="OFF" then play tone 600,600,beeptime end sub Edited 2021-08-13 22:07 by matherp |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Not a new issue in 5.0.7.01, but: > Print Mm.Info(FileSize "a:\") -1 > Print Mm.Info(FileSize "A:\") -1 > Print Mm.Info(FileSize "a:/") -1 > Print Mm.Info(FileSize "A:/") -1 > Print Mm.Info(FileSize "/") -1 > Print Mm.Info(FileSize "\") -1 > Print Mm.Info(FileSize "a:") -1 > Print Mm.Info(FileSize "A:") In my opinion these should all return -2 because the root directory is a DIRECTORY (-2), not a missing file (-1). Any chance of a change ? Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I have tested RC1 on both my G1 and G2 and my unit tests, Z-MIM, SAAINT, SPTools and Yellow River Kingdom all look good. Hope to test The Welcome Tape on at least one platform tomorrow night. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
gadgetjack Senior Member ![]() Joined: 15/07/2016 Location: United StatesPosts: 169 |
Am I the only one having trouble downloading this version? Tried everything , nothing comes back. |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1097 |
I had to copy & paste the link into a fresh browser page to get the correct version to download. It is also advised to clear the brower cache if having problems. Brian ChopperP |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
I'll wait until you have tested the welcome tape and if all OK will post RC2 with the change requested |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi Peter, I only had time for a hasty smoke-test of "The Welcome Tape" (on a G1 with OPTION OVERCLOCK ON) and the only "fatal" flaw I saw was that the "Credits" page has broken (exits with an error to the prompt). This is because there is coincidentally a label and variable with the same name that runs a cropper of the enhancements to RESTORE, i.e. Sub show_credits() Local denizens$(20, 2), i, s$, sz Restore denizens ' use of variable name "coincidental" ... End Sub ... denizens: Data "Andrew_G", "", "" Data "Bigmik", "Mick", "Gulovsen" Data "capsikin", "", "" Data "jirsoft", "", "" ... I'm sure you will agree this is something that should be fixed by a new release of The Welcome Tape rather than any firmware change - I'll try and fit in a maintenance release for use with 5.07.01 in the next couple of days, failing that it will have to wait a couple of weeks. There *may* also be an issue with the image on the "Mandelbrot Explorer" help page where it is covering the text describing the mouse controls. Can someone running the vanilla 5.06 firmware send me a screenshot from that page so I can see (without faffing around unwinding the firmwarre update myself) whether that is a pre-existing issue or it has been caused by a firmware change. Other than that I encountered a couple of sub-optimal behaviours in some of The Welcome Tape programs that I suspect are long-standing ... I may address them, but TBH I'm not thrilled at the idea of spending my currently very limited free time retreading old ground. Hope this has helped, Tom Edited 2021-08-17 01:03 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
gadgetjack Senior Member ![]() Joined: 15/07/2016 Location: United StatesPosts: 169 |
I got it !! Thanks. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Forgot to mention in the list of changes as requested CONTROLLER MOUSE OPEN [n] [,LBinterrupt ][,RBinterrupt] [,sensitivity][,LBUpinterrupt] You can now specify a mouse left click release interrupt Edited 2021-08-16 18:46 by matherp |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Please download and test V5.07.01RC2 http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip Just the tiny change to mm.info requested by Tom If no issues in the next week this will then be promoted to the final V5.07.01 release together with publication of the updated manual |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi Peter, can be MATH INSERT/SLICE be modified, so it can be also used for strings? If string array holds just pointer in memory, it can be possible... It will be very useful (at least for me ![]() Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
No sorry - looked at it and too hard |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Sorry Peter, awkward squad here again: > 480MHz Colour Maximite 2 G2 MMBasic Version 5.07.01RC2 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > mkdir "foo" > chdir "foo" > Print Mm.Info(Directory) A:/FOO/ > Print Mm.Info(FileSize "A:/FOO/") -1 > Print Mm.Info(FileSize "A:/FOO") -2 Basically Mm.Info(Directory) and Mm.Info(Path) return the directory name with the trailing "/" but Mm.Info(FileSize <file>) doesn't then recognise that as a directory name - obviously can be worked around, but prefer not to have the inconsistency. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Not going to change that one as I think the return is correct. "A:/FOO/" is not a valid filename and therefore you get file not found whereas "A:/FOO" is a valid filename but happens to be a directory. The only change I would make is to make "A:/FOO/" cause a full error "Error: Invalid filename" |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
OK, but if a trailing "/" means it isn't a valid filename why do Mm.Info(Directory) and Mm.Info(Path) return it ? Recall past conversation about CWD$ which does not include the trailing "/" except when it is called at the root when it will return "A:/" - you defended this on historical grounds. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
because they return directories not filenames. There is no right or wrong on this but I'm not making changes that have no useful significance |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I've always said there is no point in picking a fight with the referee, thanks for the change on the behaviour for root. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
The mistake I made was changing the behaviour for root which was correct before I made the change. Inquiring about the size of a file and giving a directory specification that could not be a file specification should either give an error or a file not found. Taking the logic further what should I return if you ask for mm.info(filesize "a:/doesnotexist/") ? |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
-1, it's a reference to a file/directory that (presumably) does not exist. Personally I'd do what Windows/DOS/Linux all "appear" to do which is ignore a trailing "/" or "\" on a filename/path specified to a command that can operate on a directory or file. However you have history to contend with - principally the awkwardness of the drive specifier A: EDIT: I'm not saying I'm right, consistency is an awkward mistress. Just noticed on Linux that "pwd" doesn't include the trailing "/" except when called at the root. Best wishes, Tom Edited 2021-08-17 21:50 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Yes but that is the point. MM.INFO(filesize "fname$") can't act on a directory only a file. This is why my agreement to the A:/ issue was incorrect. My current view now is that I should trap any string which can't be a filename and give a hard error. That at least is consistent. I can't remember the reason for the -2 return but when the specification is a valid filename but happens to be a directory it at least makes some sense. |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |