|
Forum Index : Microcontroller and PC projects : MAXIMITE:File error handling doesnt work
| Author | Message | ||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1772 |
Hi @all! It seems to me the file error handling doesn't work for SaveBMP? (invalid filename, No SD card found) MM Manual: Option error continue Option error continue
SaveBMP "Test ile" ' just a invalid filename If mm.errno>0 Then 'File number ist not open ? "File Error:"+mm.errno+"! Press any key to continue!" else ? "Success:"+mm.errno+"! Press any key to continue!" EndIf do:loop while inkey="" The program always aborts if I use a invalid filenames. And it waits (endlessly?) if there is no SD card. Is there any idea why this code does not work? I would like to know if this is a MMBasic bug or perhaps I understand something completely wrong. THX in advance for your help! Regards Michael ‚My name is Ozymandias, king of kings Look on my works, ye Mighty, and despair!‘ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and ... |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 10043 |
I can confirm this error - the same thing happens with me. If I use a name such as HELLO1, this saves fine. If I use something like "HELLO ILL", MMBASIC throws up an error - File number is not open. This despite OPTION ERROR CONTINUE. You might have found a bug perhaps?
EDIT: Hang on - I am using command prompt, so the error report is probably correct for that method - I will write a little code to test this..... EDIT: No, you are right - even with a code, it still fails with a file number not open error on line 2, even though I would also have expected MMBASIC to just ignore this error and save the problem in mm.errno. [code] Option Error Continue SaveBMP "Hello ill" Print "Done.",mm.errno End [/code] My guess at this point, is that the Option Error Continue just does not work with saveBMP(and perhaps loadBMP too - not tested). There are no problems with normal file reading and writing in this respect.(using option-error-continue and checking the mm.errno variable) Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6606 |
I agree that there seems to be a problem. There are a couple of coding errors in your test program. You cannot print strings and numbers with "+" INKEY should be INKEY$ Option error continue
'open "Test ile" for output as #1' just a invalid filename savebmp "Test ile" If mm.errno>0 Then 'File number ist not open ? "File Error:"+str$(mm.errno)+"! Press any key to continue!" else ? "Success:"+str$(mm.errno)+"! Press any key to continue!" EndIf do:loop while inkey$="" Jim VK7JH MMedit |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3368 |
Yes, it is a bug (or omission, or "feature"). SaveBMP does not respect "Option Error Continue". Thanks, Geoff Geoff Graham - http://geoffg.net |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1772 |
Thanks a lot guys for checking this issue and quick answering. I was not sure. @Jim: you're right: Inkey$! Regards Michael ‚My name is Ozymandias, king of kings Look on my works, ye Mighty, and despair!‘ Nothing beside remains. Round the decay Of that colossal wreck, boundless and bare The lone and ... |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 2265 |
I also have an issue with "Option Error Continue". Brief Background: I'm running the latest firmware on both an original Maxi and a Mini Maxi. The Mini Maxi is interfaced to 5 Vehicle sensors, 2 x ATF pressure sensors, 2 x K thermo sensors and the OEM transmission ATFT sensor. The data is sent to a vehicle gauge display via a 2nd serial port and also logged to the SD card with selectable sample rates. The program is run from Drive A: and there is always the possibility that I can forget to insert the SD card after downloading data, however I still need the pressure and temperature readings to be sent to the Vehicle computer display - hence my need to get this SD error catching to work. The error I have: If an SD card R/W error occurs then it's handled correctly with "Option Error Continue", however any subsequent R/W to a previously open serial port (my gauge data port) will halt with an error "SD card missing". I found the only way around this was to close the Serial port on entry to the SD card procedure and reopen on exit. Anyone else noticed this? NANO:Inverter V 8.4ks - Linux AvrDude GUI script V4.1 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |