![]() |
Forum Index : Microcontroller and PC projects : CMM2:V5.07.01RC1 - release candidate for V5.07.01
![]() ![]() |
|||||
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
IIRC the -2 from FileSize was your response to a request (from me) for a mechanism to determine whether a directory existed or not. I don't object to what you propose (I'd rather have an error than a "false" -1), but would appreciate if some mechanism for determining the existence or not of a directory was maintained EDIT: and whether a filename refers to a directory. Best wishes, Tom Edited 2021-08-17 22:05 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Perhaps a distinct MM.INFO(FileType f$) returning different values for drive (?), directory, file and doesn't exist ? Of course then we would be talking about what formats for f$ were acceptable for drive and directory. Best wishes, Tom Edited 2021-08-17 22:27 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
Tom Have a play with this CMM2V5.07.01EXP.zip MM.INFO(filesize fname$) will now give an error if a directory name is specified. Will still give -2 if a directory that looks like a filename MM.INFO(EXISTS DIR dirname$) MM.INFO(EXISTS FILE fname$) should work as expected and should be generally useful Edited 2021-08-17 23:31 by matherp |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
No sorry - looked at it and too hard OK, thanks for looking at it. Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
That all seems to work Peter, but you still can't write a simple one line statement to answer the ostensibly "simple question", does the path f$ refer to: - an existing file - an existing directory (or drive) - nothing - or is it simply invalid ? Obviously you can workaround it with a user function and the facilities already provided, but shouldn't it be something the firmware/MMBasic can just answer ? Best wishes, Tom Edited 2021-08-18 00:08 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
How would you do it with stdio? Not aware that anything provides that as a basic facility |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
It's operating/file system level ... but of course we don't have a distinct operating system. On UNIX it's provided by the POSIX stat() function "sys/stat.h". Windoze provides a lookalike wrapper for stat() to help with porting but presumably the Windows API also provides it's own function. Is the issue that the system/file libraries you have can't provide this information (in which case how were you managing the -2 from FileSize) or that you can't decide how to expose it to MMBasic ? As I said in the PM perhaps better to roll-back to RC1 and leave this for a future revision ... or never. Best wishes, Tom Edited 2021-08-18 00:49 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
I'll stick with the last version posted. Filesize only responds to filenames and the exist functions do everything else needed status%=choice(mm.info(exists file test$),1,choice(mm.info(exists dir test$),2,0)) Edited 2021-08-18 00:59 by matherp |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
You're the Boss, but I'm going to make one more attempt before retiring from the field: x% = Mm.Info(Exists f$) Select Case x% Case -1 : Print f% + " is not a valid path" Case 0 : Print f% + " does not exist" Case 1 : Print f% + " is a file" Case 2 : Print f% + " is a directory" Case Else : Print f% + " is a cause of apoplexy" End Select Best wishes, Tom Edited 2021-08-18 01:11 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
status%=choice(mm.info(exists file test$),1,choice(mm.info(exists dir test$),2,0)) If you like ;-) Thanks for all your efforts, Tom Edited 2021-08-18 01:11 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
Dear Peter, Is it possible to port the ADC command from the pico to the CMM2 ? I am asking this since in my effort to turn it into a project, I am running into the memory constraints frequently. And the CMM2 has much more memory for data, especially the gen2. To give you an idea about the memory requirements: You have an input array with ADC data. Even if you limit that to 512 samples, that is 4k bytes per ADC. 3 ADC's is 12k (array1) + 12k (array2) (while 1 array fills, the other is processed). 3 ADC's read 3 phase 50Hz mains voltage. The raw data you need to re-sample to make RMS calculation more accurate (cycle by cycle RMS). After that you need DC correction on the data, but that can happen on the same data. But this is another 12k (array3). Then the raw data needs hann windowing for for FFT (another 12k, array4) Then the FFT MAGN output (another 12k, array5). And yes, that fits in the pico. With 60k I will need to reserve 80k for variables, leaving 40k for program (*). But larger sample base (1024) will never fit, and all this processing slows the system down, even at overclocking speed. So an H7 or CMM2 would be a better fit. Also the CMM2 has more ADC's and I will minimal need 3 phase voltage and 3 phase current (6 ADC's) in the end product. The end product also needs another buffer on the current channels, since it needs Rogowski support, where you integrate the samples. First offset correction, then integrate, then re-sample, then another offset correction. Anyway, a lot of technical blabla.... An ADC command for the CMM2 (6-8 ADC's) is that achievable ? Volhout (*) to be honest, the buffers for FFT are not needed for 3 channels at the same time, since you only do a FFT on one channel, and can use the same buffers for other channels too, after hann windowing you only need 4k, and the FFT MAGN also only needs 4k. Bu the RMS buffers are needed simultaneous to calculate phase relation. Edited 2021-09-01 21:17 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
The CMM2 has the ADC command - check the manual. It has only three ADCs |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
@ Peter, Found it. Stupid, should have looked first. Volhout PicomiteVGA PETSCII ROBOTS |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |