Open breiler opened 6 years ago
Yes, no problem at all, subject to real life priorities, day job, sleep etc :)
Go to it! Thanks
I tried building with jdk-11 on my mac. I'm using VSC for my IDE, jdk-11 seems to be it's preference. I don't have a problem using jdk-9, I wanted to try it. I did a clean build with 11. UGS crashes:
[INFO] Compiler: HotSpot 64-Bit Tiered Compilers [INFO] Heap memory usage: initial 64.0MB maximum 4096.0MB [INFO] Non heap memory usage: initial 7.3MB maximum -1b [INFO] Garbage collector: G1 Young Generation (Collections=31 Total time spent=0s) [INFO] Garbage collector: G1 Old Generation (Collections=0 Total time spent=0s) [INFO] Classes: loaded=7912 total loaded=7912 unloaded 0 [INFO] INFO [org.netbeans.core.ui.warmup.DiagnosticTask]: Total memory 17,179,869,184 [INFO] INFO [null]: Total physical memory 17,179,869,184 [INFO] 2021-03-14 07:04:15.906 java[61949:2569825] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!' [INFO] First throw call stack: [INFO] ( [INFO] 0 CoreFoundation 0x00007fff36edfa9d __exceptionPreprocess + 256 [INFO] 1 libobjc.A.dylib 0x00007fff616d53c6 objc_exception_throw + 48 [INFO] 2 CoreFoundation 0x00007fff36ef98f5 -[NSException raise] + 9 [INFO] 3 AppKit 0x00007fff344905ca -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 317 [INFO] 4 AppKit 0x00007fff3448d9f7 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1479 [INFO] 5 AppKit 0x00007fff3448d42a -[NSWindow initWithContentRect:styleMask:backing:defer:] + 45 [INFO] 6 libnativewindow_macosx.jnilib 0x000000012aa293fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398 [INFO] 7 ??? 0x000000010d715690 0x0 + 4520498832 [INFO] ) [INFO] libc++abi.dylib: terminating with uncaught exception of type NSException [INFO] /Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/bin/../platform/lib/nbexec: line 425: 61949 Abort trap: 6 "/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java" -Djdk.home="/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home" -classpath "/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform/lib/boot.jar:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform/lib/org-openide-modules.jar:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform/lib/org-openide-util-lookup.jar:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform/lib/org-openide-util-ui.jar:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform/lib/org-openide-util.jar" -Dnetbeans.dirs="/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/ide:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/java:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/ugsplatform:/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/extra:" -Dnetbeans.home="/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/platform" '-Xdock:name=ugsplatform' '-Xdock:icon=/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/ugsplatform/bin/../../ugsplatform.icns' '-Xms64m' '-Xverify:none' '-Dsun.java2d.noddraw=true' '-Dsun.awt.noerasebackground=true' '-Dnetbeans.indexing.noFileRefresh=true' '-Dnetbeans.logger.console=true' '-ea' -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/userdir/var/log/heapdump.hprof" org.netbeans.Main --cachedir "/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/userdir/var/cache" --userdir "/Users/ron/Downloads/Universal-G-Code-Sender-marlin-sep2020/ugs-platform/application/target/userdir" "--branding" "ugsplatform" "--branding" "ugsplatform" 0<&0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 25.814 s [INFO] Finished at: 2021-03-14T07:04:15-07:00 [INFO] ------------------------------------------------------------------------
That looks like a native code exception. It should not happen even if the Java code does the wrong thing, so possibly a bug in that version of Java on the Mac. TBH if Java 9 is working then I'd stick with that - pick your battles.
Agreed, I have enough to do. I'm trying to add feedrate to the DRO status. I'll look at the visualizer update next, see if can make sense of it.
The way Marlin state is handled doesn't match well to Grbl. Marlin kind of blobs them together, I'm going to separate them in Marlin.
I see why the status timer doesn't start. It's looking for a string "Free Memory:". That doesn't show up.
Just pushed a commit containing some code to handle axis reset... not related to the current realtime command discussion but I should have committed this stuff months ago
I have now flashed my controller with a version built from your git fork. It took me a while to remember how to redo my pin config but that's all working now and is moving steppers when requested by UGS. Don't get too happy yet...
Then I realised that your realtime stuff was not present. Git clone had put me on the 2.0.x branch. I checked out the bugfix2.0.xautoreport branch and tried to build again. I have a compilation error in the Arduino IDE...
sketch\src\lcd\extui\lib\dgus\mks\DGUSScreenHandler.cpp:23:10: fatal error: ../../../../inc/MarlinConfigPre.h: No such file or directory
#include "../../../../inc/MarlinConfigPre.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Maybe I'm missing something simple but this doesn't make sense to me just now - the path in the include statement looks OK but the directory path element 'sketch' is not part of the source tree so maybe the Arduino IDE is doing something more complicated?
I'll try changing the board and compiling here.
I'm seeing issues, but I think it's related to the toolchain. The atmel compiler vs arm. I'll work on this. Are you using VSC and Platformio?
Oops, I guess I should be using a different IDE. I've never built for Atmel. This will take me while.
I just open the .ino file in the Arduino IDE and hit the build button. Not sure how that works under the hood. I can see that it's running g++ processes but beyond that I have not figured out how it works. Maybe the 'sketch\' path is a clue that it is using a temporary directory but I have not found it so far.
I found the 'sketch' directory now - it's in a folder 'arduino_build_426964' under my temp directory. The folder is cleared when I exit the IDE so my theory that old build files from other branches might need cleaning up does not hold water.
I will try installing the latest IDE version but that won't be today.
Marlin wants 1.8.8 or better. I’m downloading 1.8.10 now. I’ll let you know if it works.
On Mar 14, 2021, at 3:59 PM, Andy @.***> wrote:
I found the 'sketch' directory now - it's in a folder 'arduino_build_426964' under my temp directory. The folder is cleared when I exit the IDE so my theory that old build files from other branches might need cleaning up does not hold water.
I will try installing the latest IDE version but that won't be today.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winder/Universal-G-Code-Sender/issues/1080#issuecomment-798996034, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE67N33YEKWEPX4CVTYM3LTDU5WFANCNFSM4FKAQ7MQ.
There is a "../" missing in the file indicated. There are a couple c++ errors I'm running down now.
I was on 1.8.10. I have now installed 1.8.13. Same issue I'm afraid.
Yes, Sorry for the trouble. I'm running into 2 different problems depending on the IDE I use. Platformio has a linking problem, Arduino IDE has different issues. This is going to take a while. I'll let you know when I sort it out.
No worries.
FYI I tried building the latest bugfix branch from the main Marlin repository. That does not hit the compile error but it won't link with the Arduino IDE... 'avr-gcc.exe: The filename or extension is too long'. I'm not sure if it is carping about a single file name or just that the list of .o files being linked is too long. I do see other folks reporting this error with various versions of Marlin but have not found a clear (and relevant) answer about a fix. Lots of folks suggest moving the source tree nearer to the top of the file system but that's not where the IDE does the build so that won't help.
I guess that if we can get past the compile issue with your branch then we may still hit the linker issue.
My previous build was also from the bugfix branch. It built just fine but that was in late 2019 and a lot has changed since then.
I have compiled it with Platformio. I'll try it on an Arduino before I release it to you. I'm still working on the Arduino IDE stuff. Interesting since they use the compiler.
The Marlin group has been very busy. I'm trying to get the CNC support noticed so it can get into the main bugfix branch. One of the group wrote a very cool and quite accurate 3D printer simulator. I used to develop the feedhold stop. It made tracking the action of the command queue , planner and stepper possible.
I found the problem with Arduio IDE. I'd left an unfinished stub. I forgot about it. Platormio didn't care for reason. I got rid of it and it compiles. I want to run minimal tests on it before I turn it over. I loaned my Arduino board to a friend, I don't think I have another. I'll pick it up later today and test it.
I have now refreshed my UGS fork from the main repository. I've run a couple of XY axis only test jobs from the classic UI with a plastic pointer in the mill. It seems sane. The controller is running the build of Marlin 2.0.x that I compiled yesterday.
The new branch is...
https://github.com/andy-hnq/Universal-G-Code-Sender/tree/marlin-mar2021
I needed to disable two test cases in S3FileSystemViewTest to get the mvn build to complete - this one has been failing for some time for me but I've been nowhere near that code. I see there is a recent commit in the master branch relating to failures of this test but mine still failed after merging.
I overrode the open/close comm ports on my fork of UGS. I start the polling timer as soon as a connection is made and stop it when port is closed. This works better for the Mac.
I made a pull request for your mar2021. I'm not clear about pull requests. Am I asking you to incorporate my changes, or am I asking you permission to incorporate your changes. I want to get your changes into my fork
I have a question about the status request timing. The status request timer is independent of the code sender. Can the status request come in the middle of a command? Can the controller get something like "G1X0.?1Y0Z5.5F100" ? Also, I think I understand why the status response needs to be delimited in a unique way, like <<X:0.00 Y:1.5 ... >> and it should not send an "ok". I think the ok's are confusing UGS knocking it out of sync.
I used this article... https://gist.github.com/CristinaSolana/1885435 . You want an upstream fetch I think, not a pull request. Then you may get some merge conflicts... it depends which files have changed in your branch. On github you can also compare branches across related forks... for example I compared my mar2021 branch with the main repository master branch after I'd merged the latest changes. I won't pretend that I found it an easy process and there were some unexpected turns but I think the end result was what I intended.
I don't know the answer to your last question sorry - I guess you need to know whether it can happen with UGS+GRBL and also what is possible with Marlin. I'm not sure there is much benefit in being able to do it though - most g code commands are very short so sending them should be fast. Repeatably testing this kind of thing is also tricky. Executing commands on the other hand is not quick so being able to update the position display in mid move or while working through a backlog of multiple commands is a big benefit.
What's the URL for your fork BTW?
Are you using the classic UI or the platform UI to test with?
Here's my fork: https://github.com/mron/Universal-G-Code-Sender/tree/marlin-mar2021 I'm using Platform. I'm not good with git. I get confused about the terms. I made a new fork of yours and updated marlin-mar2021 with my stuff. I haven't run it yet, but you can see what I'm trying to do.
I'm trying to configure VSC to work with the java fork. Another rabbit hole, I want to compile in the VSC IDE. This could take a while, I can't even get "Hello World" working. ... Just got it to work!
I am making progress. I found a bunch of files containing "public static void main". "MainWindow.java", "VisualizerCLI.java" ... I can run|debug most of them. They are UI elements. Where is the main that pulls them together into a single UI? I'm still looking.
I have used the platform UI very little... practically not at all so far. I have a quick code/debug cycle working with the classic UI and the classic UI is the one I have used to cut metal. For the classic UI you need the ugs-classic project and the main class is...
com.willwinder.universalgcodesender.MainWindow
It's all pretty straightforward.
I thought since you have been using the platform UI then I really should put some effort into it myself. I've had a bit of a nightmare getting a working build (not sure why - best guess is it was conflicting in the Maven repos with a downloaded UGS binary version from the main web site).
I've also been struggling with the debug setup for the platform UI. There are some suggestions in the readme at the root of the git tree which may help... but I dont have that working properly at the moment. I finally got a remote debug setup to work. After a lot of failed attempts I finally found that adding this line to the configuration section of the nbm-maven-plugin in ugs-platform/pom.xml worked...
<additionalArguments>-J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</additionalArguments>
This means you run the same way as normal. It pauses so you can connect the debugger (IDE) to port 5005.
HTH!
I have now just run a test g code job on the machine from the platform UI. Seems somewhat sane but I could not find any way to resume after pausing in the G code, so there is stuff to do still.
Thanks Andy, I think the MainWindow.java has everything I need to debug the Marlin comms. Lots faster than mvn from the command line! I hope to have the Marlin side ready for you soon.
Ok, I have a version that compiles in Arduino IDE and uploads: https://github.com/mron/Marlin/tree/bugfix2.0.xautoreport The Configuration.h is setup for an arduino.
Here's the UGS marlin. It's forked from your marlin-mar2021, but I made a mess of the commits. I'll try and fix it.
https://github.com/mron/Universal-G-Code-Sender/tree/marlin-mar2021
They work, but there are issues. I want to learn to work with java in Visual Code Studio to clean them up. I saw a difference between the way an Arduino controller and a ARM controller behave. The ARM controller kills the serial connection when rebooting. The Arduino doesn't. That's why you can see: "Marlin bugfix-2.0.x echo: Last Updated: 2021-02-28 | Author: (none, default config) echo:Compiled: Mar 17 2021..."
When the ARM is rebooted, all of that is lost.
I've been testing some more today by writing a unit test and trying to make MarlinController less stubby.
I've found a couple of anomalies with pause/resume handling which I am trying to resolve. I was hoping this would fix the random behaviour of the pause/resume button on the classic UI when it (and Marlin) process M0 in the g code. Right now my unit test cases are passing but the more 'rational' behaviour seems to work less well in the UI, not better.
This is all related to the active command lists and the ability for some commands to queue jump so I really need to get M0/M108 stable before doing anything else.
I forgot to put feedhold into M0! I only put it in ‘!’. I’ll push a fix ASAP. What is M118?
On Mar 17, 2021, at 3:37 PM, Andy @.***> wrote:
I've been testing some more today by writing a unit test and trying to make MarlinController less stubby.
I've found a couple of anomalies with pause/resume handling which I am trying to resolve. I was hoping this would fix the random behaviour of the pause/resume button on the classic UI when it (and Marlin) process M0 in the g code. Right now my unit test cases are passing but the more 'rational' behaviour seems to work less well in the UI, not better.
This is all related to the active command lists and the ability for some commands to queue jump so I really need to get M0/M118 stable before doing anything else.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winder/Universal-G-Code-Sender/issues/1080#issuecomment-801486902, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE67N7WFKXYS25BZDRLPUTTEEVJZANCNFSM4FKAQ7MQ.
M118 was a typo. I meant M108... which is what I send to resume after M0
Ok, I just pushed them. I’ve not tested yet
On Mar 17, 2021, at 3:49 PM, Andy @.***> wrote:
M118 was a typo. I meant M108... which is what I send to resume after M0
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winder/Universal-G-Code-Sender/issues/1080#issuecomment-801491973, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE67NYBHEHC23SP3XQZXNLTEEWYHANCNFSM4FKAQ7MQ.
Andy, I just realized M0 is not caught by the emergency parser. It’s treated like any other command. I need to fix that. I have to go out a bit, should be back in a couple hours.
On Mar 17, 2021, at 3:58 PM, Ron Moreland @.***> wrote:
Ok, I just pushed them. I’ve not tested yet
On Mar 17, 2021, at 3:49 PM, Andy @. @.>> wrote:
M118 was a typo. I meant M108... which is what I send to resume after M0
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winder/Universal-G-Code-Sender/issues/1080#issuecomment-801491973, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE67NYBHEHC23SP3XQZXNLTEEWYHANCNFSM4FKAQ7MQ.
I pushed a version of Marlin with the M0 implemented in the e_parser. Seems to work on ugs-platform during single moves. Pausing during file transfer, the "run" button stays greyed out, so I can't restart . If you haven't tried Marlin support in Platformio, take a look at it. It's much faster than Arduino IDE for compile and loading. Much more modern toolset.
I have just pushed a commit (to the same branch). I have added some unit tests for the controller, made the controller less stubby and spent some time looking at the pause button behaviour and program row count with the classic UI. Both now work better and my XY axis test job works on the mill.
The test job also works on the platform UI BUT only if I remove the M0 command, otherwise M0 is sent, then Marlin replies 'echo:busy: paused for user'. This puts UGS into 'HOLD' state and the pause button (which was enabled) is disabled.
I have not used the platform UI much. Can anyone advise what should happen when the G code program contains an M0. Should the pause button be enabled?
I’m working on the controller side. The status isn’t updating when paused. I’m running that down now.
I’m staying off ugs-platform until I get everything in MainWIndow.java working smoothly.
There are changes in my commit around pause/resume. In some situations isPaused() was returning the wrong answer. Another issue was that the controller object was correctly in a paused state sometimes but was not sending notifications to the UI that the state had changed - there are multiple types of notification.
BTW, I checked the behaviour when running the platform UI - isPaused() is being called plenty of times and is reporting the correct answer so there is more work needed to find out why it works in the classic UI and not in the platform UI.
Note also that 'status' and 'state' are different things in the UGS controller classes. Also there are multiple places where g code commands are stored. They all need to fly in formation...
com.willwinder.universalgcodesender.BufferedCommunicator.activeCommandList (queue)
com.willwinder.universalgcodesender.BufferedCommunicator.nextCommand (single ref)
com.willwinder.universalgcodesender.BufferedCommunicator.commandStream (stream reader)
com.willwinder.universalgcodesender.BufferedCommunicator.commandBuffer (queue)
com.willwinder.universalgcodesender.AbstractController.activeCommands (list, private)
com.willwinder.universalgcodesender.AbstractController.streamCommands (stream reader)
I just pushed another Marlin. The status switches to HOLD when I pause. I’m going to switch to your latest mar2021.
The status switches to HOLD when I pause.
Same here but the label and enabling of the pause/resume button is driven by a different API call and pub/sub notification so it can show HOLD and the pause/resume button can be disabled or have the wrong label. I think my commit yesterday has sorted the behaviour in the classic UI but the disabling of the button in the platform UI is still a problem and I don't yet know why.
I'm looking again at installing your Marlin fork. The compile issue is resolved but as I half expected, the Arduino IDE build fails during linking. I have one more thing to try and if that doesn't work I'll try the other tool chain.
I’m up late.I’m trying a few things. Hold off installing till tomorrow.
Hi Andy, I spent hours trying to figure out why commands like M0, M108 aren’t sending ‘ok’ when the commands are captured by the e_parser. I really don’t like the way it’s been implemented in Marlin.
Please switch to single byte commands for status, pause and resume. Use ’sendByteImmediately’. This sends the byte to the controller with no expectation of an 'ok'. The response is a status line with the status value set. I pushed a version of your UGS that implements it. I also pushed a new version of Marlin. Here’s a example of a byte send.
protected void sendStatus() throws Exception {
if ( true ) {
logger.info("trying to '?'");
this.comm.sendByteImmediately('?' );
//nonScriptedCommandsSent++;
} else {
logger.info("trying to send ? as command");
GcodeCommand command = createCommand("?");
// sendCommandImmediately(command);
this.marlinComm.sendRealtimeCommand(command);
// adjust the sent counter
nonScriptedCommandsSent++;
}
}
I'm stuck just now with building your fork. I've installed VSC and platformio but I use a custom pin mapping and it doesn't like it. It complains that my definition of MOTHERBOARD is not compatible with my selection of mega2560 as the env in platformio.ini. I know my pins and boards.h stuff is OK but platformio is being clever and using additional metadata which does not know about my custom pin setup.
The docs suggest adding a new board type using a json file in buildroot/share/PlatformIO/boards. It says 'use an existing one as an example' but I dont see anything in there that relates the MOTHERBOARD value from boards.h to the board name used by platformio, nor can I see an example there that looks like a good template for an Arduino Mega.
With M0/M108 I DO get 'OK' but it's a bit non intuitive. There is no 'ok' straight after 'M0'. Instead the controller repeatedly sends 'echo:busy: paused for user'. When M108 is sent to resume processing, TWO 'OK' messages appear.
I'd like to do a version of UGS that will work either with or without the single byte commands. Ideally it would be good to be able to detect whether they are available by looking at the startup messages.
I'll keep working on the 'ok' problem. The pins stuff is spread out. What pins are you needing?
I haven't tried building with the cutter turned on. The build could explode. I'm just trying to get communication working right now.
Try starting with a generic RAMPS CNC, I set MOTHERBOARD to BOARD_RAMPS_14_SF Configuration_adv.h SPINDLE_FEATURE In pins_RAMPS.h // // M3/M4/M5 - Spindle/Laser Control //
#define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM
#define SPINDLE_DIR_PIN 5
#define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM
#define SPINDLE_DIR_PIN 65
#error "No auto-assignable Spindle/Laser pins available."
I was able to buildin Arduino as well as Platformio. Please send Arduino error output.
I use a Protoneer CNC shield. It is intended for GRBL on an Uno and uses the GRBL pins. GRBL on the Mega can't use those pins but Marlin can.
It was the 'file name too long' error. The file names are fine but there are too may of them and they blow a limit (32K chars maybe). It may be a Windows specific issue but plenty of people have hit the same thing. I tried moving my TMP dir but that didn't help because the file names in the link command are all relative paths so moving the TMP location makes no difference to the length of the link command string.
I'm not against using VSC and platformio... if I can figure out how to make it understand that my custom motherboard #define is compatible with the Mega.
Feature request
Add support for Marlin controllers: http://marlinfw.org/
It may not be the first alternative for CNC machines as it's mostly focused on 3D printing. But the firmware supports commands for controlling spindles or lasers. The Marlin community is large and their controllers are widely available and also runs on a plain Arduino Mega. Could be a great alternative for DIY hackers.
These features needs to be implemented: