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 : MMEdit V 5.1
Page 5 of 8 | |||||
Author | Message | ||||
LucV Regular Member Joined: 19/02/2023 Location: NetherlandsPosts: 62 |
Hi Jim, Just downloaded latest version and it looks good !! Thanks for this. Just a small question: Why is there two times a Color Picker. Once in the Edit Menu and once in the Design Menu. They look the same and as far as I can see they do the same....... Luc's tech Blog |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
3 times. There is also the one in the right click menu. That's the one I am most likely to use. I started by putting it in the edit menu before I had started work on the design code. I decided that the colour picker is most likely to be used when designing so I added it to the design menu. They all point to the same code so any one will do. Jim VK7JH MMedit MMBasic Help |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Hi Jim (and any other Linux users), I can normally figure out problems myself but getting the interaction between MMEdit (5.1.4 Linux version) and MMB4L and MMB4W has me stumped. Running Mint Cinnamon 21.1 MMEdit 5.1.4 installed in /home/doug/MMProgs/MMEdit5 MMB4L (latest release) installed in /home/doug/MMProgs/MMB4L MMB4W 5.07.03b19 installed in /home/doug/MMProgs/MMB4W MMB4W example:- [Desktop Entry] Name=MMB4W Exec=wine /home/doug/MMProgs/MMB4W/MMBasic_5.07.03b19.exe Comment= Terminal=true Icon=/home/doug/MMProgs/MMB4W.ico Type=Application Name[en_AU]=MMB4W GenericName[en_AU]=MMB4W_5.07.03b19 MMB4L example:- [Desktop Entry] Name=mmbasic Exec=/home/doug/MMProgs/MMB4L/mmbasic -i -d /home/doug/Garage_Share/WIP Comment= Terminal=true Icon=/home/doug/MMProgs/MMB4L.ico Type=Application Name[en_AU]=MMB4L All three are on launchers on the desktop (MMB4W via wine) and open and operate correctly when double clicked. What I have not been able to out is how to invoke either MMB4L or MMB4W from the launch icon in MMEdit (the gear icon). I have tried various combinations of command in the external programs section of ACTION/EDIT in MMEdit and I have checked Linux execute and write privileges as required. Any suggestions would be greatly appreciated. Regards, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1611 |
I use Windows so this may not be relevant but have you checked (ticked) the 'Use batch file' box? Bill Keep safe. Live long and prosper. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
I have had some success with launching MMB4W under wine from the Linux version of MMEdit (My Linux is worse than poor so beware) wine can be run from a terminal.Your version of Wine is certain to be different to mine so these notes might not work. On my Mint Mate the terminal is called "mate-terminal" My settings in MMEdit preferences is: Path to external program mate-terminal Parameters -e "wine mmbasic.exe '/home/jim/.wine/drive_c/users/jim/My Documents/%basshort%'" The -e causes wine to be executed when the terminal starts. most terminal incarnations will accept -e I think. I still have to sort out passing the commandline bas program. MMB4W doesn't like the space in "My Documents" and I have not finished playing with quotes to see if I can solve it. The other option is to put my BAS files somewhere in the Wine path that doesn't have bloody spaces. Downloads is a likely suspect. For MMB4L I used. -e mmb4l %q%%bas%%q%&disown Jim Edited 2023-05-21 16:03 by TassyJim VK7JH MMedit MMBasic Help |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Cheers Bill but pretty sure that is for Windows only (anyrate, tried it to no avail) Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
A demo just to show I can waste time... ' GUI design demo OPTION DEFAULT INTEGER DIM move = 10 DIM ctrl = 1 DIM maxctrl,n, a = 2, b = 1 DIM cpos(30,5) DIM maxX = MM.HRES, maxY = MM.VRES DIM doanimation = 1 RESTORE position_data DO INC n READ cpos(n,1),cpos(n,2),cpos(n,3),cpos(n,4),cpos(n,5) LOOP UNTIL cpos(n,1) = -1 AND cpos(n,2) = -1 maxctrl = n-1 CLS Txt$ = "Space= next, G= grid, Z= position/size, arrow= change, +-= Text/corner, S= save data" 'RUN_ONCE 'comment out the following 2 lines or modify to suit maxX = 320 maxY = 240 ' place any code needed for the GUI elements here eg string$ assignments DO 'GUI_ELEMENTS ' your GUI elements start here TEXT cpos(1,1), cpos(1,2), "MMEdit Demo" ,cm , 2 , cpos(1,5) , RGB(WHITE) , RGB(BLUE) CIRCLE cpos(2,1), cpos(2,2), cpos(2,4) , 2 , cpos(2,3)/10 , RGB(RED) LINE cpos(3,1), cpos(3,2), cpos(3,3), cpos(3,4) , 1 , RGB(GREEN) RBOX cpos(4,1), cpos(4,2), cpos(4,3), cpos(4,4) , cpos(4,5) ,RGB(MAGENTA) ' end of your GUI elements ' Control loop 'LOOP_CONTROL DO IF maxX < MM.HRES THEN ' draw the limits if designing on a larger display BOX 0,0,maxX,maxY,1,RGB(YELLOW) ENDIF printit txt$ = "" IF doanimation THEN animate ELSE DO k$ = INKEY$ LOOP UNTIL k$<>"" redrawit = 1 SELECT CASE k$ CASE "g","G" ' toggle grid 'move = grid + 1 - move IF move = 1 THEN : move = 5 ELSEIF move = 5 THEN : move = 10 ELSE : move = 1 : ENDIF redrawit = 0 CASE CHR$(128) ' up INC cpos(ctrl,a), -move cpos(ctrl,a) = (cpos(ctrl,a)\move)*move CASE CHR$(129) ' down INC cpos(ctrl,a) , move cpos(ctrl,a) = (cpos(ctrl,a)\move)*move CASE CHR$(130) ' left INC cpos(ctrl,b), -move cpos(ctrl,b) = (cpos(ctrl,b)\move)*move CASE CHR$(131) ' right INC cpos(ctrl,b) , move cpos(ctrl,b) = (cpos(ctrl,b)\move)*move CASE "+" INC cpos(ctrl,5), 1 IF cpos(ctrl,5)>30 THEN cpos(ctrl,5)=30 CASE "-" INC cpos(ctrl,5), -1 IF cpos(ctrl,5)<1 THEN cpos(ctrl,5)=1 CASE "z","Z" b = 4-b ' b = 1 or 3 a = 6-a ' a = 2 or 4 redrawit = 0 CASE CHR$(32) INC ctrl IF ctrl > maxctrl THEN ctrl = 1 ENDIF ' Txt$ = "Control "+str$(ctrl) redrawit = 0 CASE "s","S" ' save position data IF MM.DEVICE$ = "MMBasic for Windows" THEN OPEN "loopcontrol.bas" FOR output AS #1 PRINT #1, "position_data:" FOR n = 1 TO maxctrl PRINT #1, "DATA "+STR$(cpos(n,1))+","+STR$(cpos(n,2))+","+STR$(cpos(n,3))+","+STR$(cpos(n,4))+","+STR$(cpos(n,5)) IF cpos(n,1) = -1 THEN EXIT FOR NEXT n PRINT #1,"DATA -1, -1, -1, -1, -1" CLOSE #1 txt$ = MM.INFO$(DIRECTORY)+"loopcontrol.bas" SYSTEM txt$ ELSE PRINT "position_data:" FOR n = 1 TO maxctrl PRINT "DATA "+STR$(cpos(n,1))+","+STR$(cpos(n,2))+","+STR$(cpos(n,3))+","+STR$(cpos(n,4))+","+STR$(cpos(n,5)) NEXT n PRINT "DATA -1, -1, -1, -1, -1" ENDIF redrawit = 0 END SELECT IF cpos(ctrl,b) <4 AND b = 3 THEN cpos(ctrl,b) = 4 IF cpos(ctrl,b) <0 AND b = 1 THEN cpos(ctrl,b) = 0 IF cpos(ctrl,a) <4 AND b = 3 THEN cpos(ctrl,a) = 4 IF cpos(ctrl,a) <0 AND b = 1 THEN cpos(ctrl,a) = 0 IF cpos(ctrl,b) >maxX THEN cpos(ctrl,b) = maxX IF cpos(ctrl,a) >maxY THEN cpos(ctrl,a) = maxY LOOP UNTIL redrawit = 1 ENDIF GUI DELETE ALL CLS LOOP SUB printit IF txt$="" THEN IF b = 1 THEN txt$ = "Control "+STR$(ctrl)+", Step size "+STR$(move)+", X="+STR$(cpos(ctrl,1))+", Y="+STR$(cpos(ctrl,2))+", Txt/rnd="+STR$(cpos(ctrl,5)) ELSE txt$ = "Control "+STR$(ctrl)+", Step size "+STR$(move)+", W="+STR$(cpos(ctrl,3))+", H="+STR$(cpos(ctrl,4))+", Txt/rnd="+STR$(cpos(ctrl,5)) ENDIF ENDIF IF MM.DEVICE$ = "MMBasic for Windows" THEN TEXT 10, MM.VRES - 30, txt$+SPACE$(40) ELSE PRINT CHR$(27)+"[1A"+txt$+SPACE$(40) ENDIF txt$="" END SUB position_data: DATA 160,40,70,20,1 DATA 160,180,30,20,1 DATA 110,100,210,200,1 DATA 60,10,190,110,17 DATA -1, -1, -1, -1, -1 SUB animate LOCAL p STATIC d=1, n INC n IF n >= 100 THEN n = 1 p = n\10 cpos(2,3)=cpos(2,3)+d IF cpos(2,3)>=50 OR cpos(2,3)<=5 THEN d = 0-d ' circle aspect ratio cpos(4,5) = cpos(4,5)+d ' rbox corners IF cpos(4,5) <= 0 THEN cpos(4,5) = 2 'print p SELECT CASE p CASE 1 INC cpos(3,1), 10 CASE 2 INC cpos(3,2), 10 CASE 3 INC cpos(3,3), -10 CASE 4 INC cpos(3,4), -10 CASE 5 INC cpos(3,1), -10 CASE 6 INC cpos(3,2), -10 CASE 7 INC cpos(3,3), 10 CASE 8 INC cpos(3,4), 10 END SELECT IF p = 9 THEN cpos(1,5) = 2 ELSE cpos(1,5) = 1 PAUSE 300 END SUB 'USER_DATA ' place your resources here. Fonts etc. Jim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
With a new design, the cursor is at the start of the code when it would be better at the point where GUI controls get added. Empty lines in the GUI control section cause the control counter to increment. Remove any blank lines so make life easier. When playing with the demo code, I decided that changing the aspect ratio of circles would be nice. All the above will be attended to in the next update but I will hold off for a few days to see how many more things need tweaking. Jim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Doug, Try this In MMB4W, set the OPTION DEFAULT PATH to "My Documents" In MMEdit set it to send the bas file name without any path. Provided the bas file is in the default path folder, it 'should' work Jim VK7JH MMedit MMBasic Help |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Thanks very much Jim, all good - it was the link via the terminal that I could not get into my head, Best Regards, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
That's good to hear. Out of interest, what is the name for your terminal program? I assume that "mate-terminal" is not usable on Cinnamon. Jim VK7JH MMedit MMBasic Help |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Hi Jim, With Cinnamon, it is gnome-terminal. One thing that is a little annoying is that each time you hit the gear icon, you start up a new instance of MMB4W and its underlying console. You can get around this by closing MMB4W before starting a new upload but this is a bit clunky. Is there any way that you can think of that would detect if MMB4W and its attendant terminal program are running? This would then require some mechanism of just uploading the .bas file. Obviously, this is what MMCC does but I have not yet figured out how to connect MMCC to MMB4W running under wine on a linux system. Cheers, Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
With MMEdit and MMCC I use two methods. Windows can check for a running instance when you start a program and then pass the new command-line info by windows messaging before shutting down the new instance. With Linux, I try and talk to it with TCPIP and if there is no response, I know to start a new instance of the program. This seems to be the safest way across multiple incarnations of Linux. MMB4W doesn't cater for "only one instance" and I am not sure if it can be done. Gerry disco4now created the MMEdit add-on MMReplace and it does talk directly to a running MMB4W successfully. I think MMReplace is only for Windows. If I get MMEdit to start trying to 'kill' other running programs, the AV program will not be happy with me. If you want to get brutal, in a Linux terminal "wineserver -k" will kill ALL running wine applications. A shell script can be started from MMEdit and you could kill all apps before starting the new MMB4W. Brutal. Jim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Doug, change your Parameters to: --tab -e "wineserver -k" --tab -e %q%wine mmbasic.exe %basshort%%q% It will kill any and all wine apps then run a new MMB4W. Peter will rightly condemn me for suggesting anything other than a clean exit. Jim Edited 2023-05-22 14:46 by TassyJim VK7JH MMedit MMBasic Help |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
That's great Jim, works a treat,many thanks. Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Another update V5.1.5 I finally found a way to speed up the PC file listing in the file manager. It was embarrassingly slow. Now much better. I have also fixed a few bugs in the design feature of MMEdit. As I start to use MMB4W more, two issues kept coming up. MMEdit would start a new instance of MMB4W whenever you send a bas file to it. This can be very useful but at other times, two or more MMB4W is too much. quit_mmbasic is a short program that looks for a running instance of MMB4W and politely sends it "QUIT" to gracefully shut down. The next update to MMEdit will make use of this. quit_mmbasic is 99% the work of Gerry, disco4now The second issue is getting data from MMB4W. The output is all graphics, not text. I have sent data to a file then accessed that file from other programs. This works but I like to see some output streaming so I made use of TCP SEND. TCP SEND needs a server available so echo_chamber is a small program that listens on port 6832 and sends any data received to all other connected clients. The idea is, start echo-chamber, start a terminal program and connect to echo_chamber. Start your MMB4W program and use TeraTerm as a console to display messages while keeping the MMB4W graphics unmolested. Both the programs are Windows only but I think they should be usable if you run MMB4W in Wine. I will post the 32 bit versions of the two files here after I have had a play. If I am right, you will be able to monitor the MMB4W output from the comfort of your Linux terminal programs. Jim VK7JH MMedit MMBasic Help |
||||
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1057 |
Hi Jim I updated to the latest version today from a few versions ago on a couple of W10 machines with each connected to a CMM2 running essentially the same program. With both PC's, MMCC in ordinary monitor mode is slow to update (e.g., won't handle 1 sec clocks & timers) & crashes after a few minutes. There are a fair few print statements involved. Uploading programs etc appears OK with no problems which is great. I connected one to an F4 with 1 sec updates & that went OK. Is there anything I should look out for or do? BTW, all OK when connected to Tera Term Thanks Brian ChopperP |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Hi Brian, I made a change recently to better handle large data transfers. I think that might be where the problem is. I will investigate. VK7JH MMedit MMBasic Help |
||||
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1057 |
Thanks Jim ChopperP |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Brian, What baudrate are you using? I might as well test under the same conditions. My CMM2 is set to 460800. Assuming 64 bit, try the attached MMCC replacement. It should make a difference but I do still need to do a lot more testing other setups. MMCC.zip Jim VK7JH MMedit MMBasic Help |
||||
Page 5 of 8 |
Print this page |