![]() |
Forum Index : Microcontroller and PC projects : CMM2: Bug reports
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1835 |
Unfortunately it didn't take long to go weird on me. Copy & pasted a few times just fine, then I highlighted the 5 lines I had just pasted and cut them, but I noticed one extra line that was above the cut had disappeared so: I moved the cursor up one line and pressed enter to make room to type it back in, but instead of a line feed the line above was suddenly inserted, I deleted it and pressed enter above that line and the line above that was inserted esc,esc,esc and you know the rest. Spent another 10 minutes doing everything I could to reproduce that error but the editor hasn't missed a beat. ![]() I'm wondering if the buffer is roughly in the same location in memory, if I had a bad section of ram, could that be a cause? and yet remain hidden to all other tasks? Grasping at straws here and still pondering if there is a hidden problem in this dam board? NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
Please give me all possible info CPU version V or Y? USB keyboard or serial console I assume Waveshare version rather than all-in-one? Which version motherboard V1.6, V2.0, V2.1? Please post the file that you were editing Please describe as closely as possible which lines you were editing Selecting from start of lines or part way through end selection at end of line, start of next, or part way through etc. Thanks |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
BUG: 100% (?) reproducible editor bug Time for me to get off my arse ;-) Extract the attached editor_bug.zip in A:/ 1. Reset the Waveshare to rule out any "state" issues 2. edit "editor_bug.bas" 3. F4 - to start a selection 5. Cursor down until and including the final End Sub - entire document, 93 lines highlighted blue 6. Ctrl-X What should happen? Entire document cut and put in the buffer What does happen? This is left behind on the screen: End Sub Not sure if it is what we are looking for, but enjoy nevertheless, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Not meant to imply that anyone else is sitting on their arse, only that I have been neglecting my duty as an early adopter. Regards, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
No: that's just a silly end-effect bug but thanks anyway. Works fine if there is a CR after the END SUB. Probably the same issue as why typing END twice doesn't go to the end of the last line if it doesn't have a CR. The issue KeepIs is seeing is corruption of the paste buffer. The evidence isn't clear but it seems the buffer is filled correctly - certainly the character count is always correct although it could be copying the right number of characters from the wrong place. When the bug happens on paste you get zeroes rather than the expected characters. The way the editor memory works is that there is a table of pointers, one entry per line, and the memory for each line is taken from the MMbasic heap (not the C heap). When a line is deleted the table of pointers is shuffled up and the memory for the line freed. When information is cut or copied the data from the relevant lines is just copied into a single buffer from the start of the highlighted section to the end. When you paste the editor just uses the same primitives as when you type. The only difference is that the screen isn't updated after each character but only at the end. I have never seen the bug although I don't do a lot of MMBasic coding and reports from others are very rare. The latest release moved the paste buffer memory from the SDRAM into the processors internal memory. I hoped this wouldn't fix it as it would have suggested a problem with the SDRAM and it appears not to have. |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2401 |
hi peter, i assume that while the paste operation is in progress you are STRICTLY disabling both USB keyboard and console RxD? if not, it may be possible for a user to press keys while the editor itself is 'typing in' the pasted text. i could see this causing issues with the two distinct sections of code manipulate a common set of pointers. this could explain why some folks see the problem while others do not - individual keyboarding styles. cheers, rob :-) |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
Yes: the paste algorithm runs to completion and any keys entered are just buffered by the H/W interrupt routines for later processing |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
This doesn't sound like it either, but nevertheless: https://youtu.be/REoQn9Qy92g F4 to select, Ctrl-X to cut, Ctrl-V to paste Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
No but needs fixing - thanks |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
V5.05.03b1j Fixes bugs in editor Incorrect cursor placement after cutting text that required the page to scroll END END does not go to end of line if the last line doesn't have a CR CUT does not remove last line of the file if the last line doesn't have a CR http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Time for a useless bug report but perhaps it might serve as a data point if anyone else experiences something similar ... alternatively I might just be an idiot. It looks like I managed to corrupt my SD card again, though not fatally this time. I reached a point where LISTing one file would corrupt/overwrite the contents of another file !!! And after restoring the contents of both files it would do the same thing again, and again consistently. I honestly can't see how this makes any sense at all given LIST is presumably a read-only operation, but that didn't seem to prevent it happening. In the end, and suspecting an SD card corruption problem I took a copy of my files onto a PC, reformatted the SD card and copied them all back on, and so far it all seems good, but I haven't thrashed it much since. Just in case I am being stupid: 1. When is it safe to remove the SD card from the CMM2. 2. If I "eject" an SD card from a PC and am warned that it is in use, but given the option to continue anyway (after which it says it has been successfully ejected / is safe to remove) is it actually safe to remove? Regards, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1835 |
Loaded V5.05.03b1j I have not been able to induce any errors in any file. The editor has behaved perfectly. Fingers crossed. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1835 |
I've removed the SD card from the CMM2 and left it powered, however I'm sure MM basic polls the SD card every so often, as reinserting the card and immediately trying to access it reports some SD card error, wait a while and I can access it again, other wise a reset. No loss of data, likely as I had no files open and nothing pending to write. Note I've also often removed the micro SD from the adapter so Card present was still enabled. The Windows Eject Media dialogue is again only looking for anything that is accessing the SD and assuming it has writes pending, however it can tell you the media is in use (when it's clearly not) and warn against removing, I've never corrupted an SD card by removing it when I'm absolutely sure that there are no delayed writes pending from Windows. So yes, you can believe the Eject media Dialogue, AND no files open on the SD. Edited 2020-06-15 08:48 by KeepIS NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1835 |
Well, I still can't induce any faults in the editor. I don't know what changed in that last release but it's still running perfectly. Just as an FYI to questions about the Waveshare. Please give me all possible info: CPU version V or Y? V USB keyboard or serial console USB keyboard Waveshare board only with a CP2102 USB to serial, an SD card and a small R-2R board to LCD monitor. Please post the file that you were editing: Can be any file, all are short files of one page or less. Please describe as closely as possible which lines you were editing: Does not matter, totally random. Selecting from start of lines or part way through: From the start, single line or two to three lines. end selection at end of line, start of next, or part way through: Start of next mostly. Mike. EDIT: Just finished playing with some Graphic code in the editor, lots of cut & paste, run/edit (with errors) and the Editor is STILL absolutely perfect. . . Edited 2020-06-15 10:51 by KeepIS NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
![]() ![]() ![]() Any time when you don't have a file open. FatFS does buffer writes to some extent so this could create problems particularly when creating a new file. What OS? I've never seen this dialogue on W10 but if I did I certainly wouldn't continue as you have no idea what the OS has buffered |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1090 |
Noticed in the editor, TIME$ is not changing colour to indicate a keyword whereas DATE$ does. ChopperP |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
I like bugs like that - 5 second fix ![]() |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Hi Peter, OK. I assume all files are closed if a program reaches its natural END, but what if I Ctrl-C or an ERROR occurs ? What OS? I've never seen this dialogue on W10 but if I did I certainly wouldn't continue as you have no idea what the OS has buffered Windows 10 (and my more usual Raspbian), on the former it is this dialog: ![]() In any case I would have thought the worst I would get is a file not containing the latest/expected data and the symptoms I reported suggest I more seriously corrupted file-system - I'm very far from an expert on this. Regards, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10071 |
No, in all cases it is up to the user to close them. The only times files are all closed is when you run a program or load a new one. This follows exactly the way the MM+ works. In the specific case of Ctrl-C you wouldn't want them closed as this would invalidate CONTINUE. I can see an argument for closing them after an error. I'll review this with Geoff. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
In the specific case of Ctrl-C you wouldn't want them closed as this would invalidate CONTINUE. I can see an argument for closing them after an error. I'll review this with Geoff. OK, that makes sense. But if I don't close them and remove the SD card can I corrupt the filesystem or do I just have the possibility of a file not having the latest contents. Are the concerns any different depending on whether I have the file open for write or only for read? Edit: seems a bit of a stretch if after an error it is necessary for a user to manually attempt to close all files before switching off their CMM2. Tom Edited 2020-06-15 22:36 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |