Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:03 07 Jul 2025 Privacy Policy
Jump to

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 : MAXIMITE:File error handling doesn’t work

Author Message
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1573
Posted: 06:06am 12 Oct 2014
Copy link to clipboard 
Print this post

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
  Quote  "Set the treatment for errors in file input/output. The option CONTINUE
will cause MMBasic to ignore file related errors. The program must
check the variable MM.ERRNO to determine if and what error has
occurred."


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
Edited by twofingers 2014-10-13
causality ≠ correlation ≠ coincidence
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9589
Posted: 02:04pm 12 Oct 2014
Copy link to clipboard 
Print this post

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)
Edited by Grogster 2014-10-14
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 05:56pm 12 Oct 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 3282
Posted: 07:20pm 12 Oct 2014
Copy link to clipboard 
Print this post

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: Germany
Posts: 1573
Posted: 01:31am 13 Oct 2014
Copy link to clipboard 
Print this post

Thanks a lot guys for checking this issue and quick answering. I was not sure.
@Jim: you're right: Inkey$!

Regards

Michael
causality ≠ correlation ≠ coincidence
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1868
Posted: 04:02pm 13 Oct 2014
Copy link to clipboard 
Print this post

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?

Edited by KeepIS 2014-10-15
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025