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 : CMM2: Error in "on key" documentation?
Author | Message | ||||
Nelno Regular Member Joined: 22/01/2021 Location: United StatesPosts: 59 |
I have a program of which the following is the distilled version exhibiting an issue: on key 27, exitGame do loop sub exitGame end end Some time after coding this I noticed that the escape key was no longer working for me in the editor. If I restart the CMM2 and never execute the on key 27 line, escape works fine. Where this really became problematic was when I tried Ctrl+F in the editor. The only way to exit that is the escape key. I had to power cycle, but fortunately I had saved recently. I'm not sure if that part is a bug or not. I would expect that maybe run or ctrl+C reset keyboard interrupts similar to what the documentation says is done for FRAMEBUFFER (seems like "end" should probably also do this). Maybe ctrl+C does, but I was essentially using escape to exit my program, not ctrl+C. Run definitely didn't reset the interrupt. However, there's more to this story. The documentation for "on key AsciiCode, target" says: "In both variants to disable the interrupt, use numeric zero for the target, i.e.: ON KEY 0. or ON KEY ASCIIcode,0" However, if I change my exitGame subroutine to the following: on key 27, exitGame do loop sub exitGame on key 27, 0 end end I get the following error when I hit escape: Error in line 7: Line number. This may just be an error in the documentation. What I did find works is: on key 0, exitGame i.e. passing a valid label but setting the interrupt for key 0, which seems reasonable since that's the null character and should never be sent as a USB key press. -Jonathan |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8565 |
The documentation is what the code is supposed to do but doesn't. Your workround is as per the actual code so stick with that. I'll fix the code so either will work and also cancel the interrupt automatically after a program terminates for whatever reason. The fix will be in V5.07.00b7 which I'll post on the V5.07.00b6 profiling thread when ready Thanks for the report. |
||||
Nelno Regular Member Joined: 22/01/2021 Location: United StatesPosts: 59 |
Great, thanks for fixing it! |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8565 |
Fixed in V5.07.00b7 just posted http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip |
||||
Print this page |