Just an idea, but I wonder what it would take to make an API for communicating with the Maslow so developers could create alternative clients, etc.
I’m a developer, but I’m not too familiar with python or kivy. I may look further into this, but a spec would speed things up. What is sent to the Arduino over the serial port. An object? An array?
Well, yeah. It’s pretty obvious that gcode is sent over the serial port, but as what data structure? The firmware is expecting the gcode to be formatted a certain way, and in a certain order.
As I’ve said before, I’m no python developer, but skimming the source seems as if the gcode is sent over as a ‘queue’ of utf-8 encoded strings.
I believe a queue to be an array with special methods, kind of a first in, first out approach.
But you also must receive information over the serial port, like machine current settings and position, or is that all stored in the client?
A spec on how things are done would make developing libraries for other languages much easier.
I can sift through GC source and firmware source, but it will take much longer to understand exactly what is happening rather than having it laid out. Maybe that is what’s necessary though.
A line number, followed by a space, a G or M code, followed by a space, followed by any required parameters, separated by spaces. The line is terminated, if I recall by carriage-return newline (\r\n).
The line number looks line N followed by a span of digits,
G or M code is usually followed by 2 digits. Some implementations allow a single digit, so G01 can sometimes be written G1. (G01 is ‘draw a line’).
GC just sends the lines one at a time to the firmware. It then waits for a response, indicating that the command has been completed. This is normally ‘OK\r\n’.
GC does not have to keep any knowledge of the state of the client. It assumes that if the client signals OK, it is ready for the next line.
This is really primitive, and was designed for being loadable from paper tape, even.
yes, it is just a string. And actually pure ASCII, utf-8 is a bit of a red herring here. Well, on second thought, maybe non-ASCII characters are allowed in comments.
When the line is finished being run the machine will respond with an ‘ok’ command to indicate that the space that line took up in the Arduino buffer is free
If you have a spare Arduino Mega, you can set a switch in the firmware (Config.h FAKE_SERVO) that let’s you play without having chains and motors attached , one of my favorite ‘hidden options’!
The firmware sends position and position error information 5 or 6 times a second, so prepare to ignore or filter out a lot of chatter in the channel. Watch those values to see your gcodes have effect - they are used by GC to put position and speed on the screen. Send “$$\r\n” to see a dump of internal settings from the firmware.
I have exactly this thought @dlang. Theoretically, another sender like cncjs could be used in garbl mode for sending gcode, correct? (if maslow firmware adheres closely enough to the grbl protocol) but for calibration it is GC only as of now. The measurements ARE stored on the arduino eeprom, right? Because the firmware must use those measurements to correctly move the motors I guess, so that only makes sense.
They (the resulting numbers, not the measurements taken during calibration) are
now, in the past there were times when they were loaded from GC at
startup time.
Well, yeah. Okay, the values resulting from the calibration process (HEREINAFTER REFERRED TO AS “measurements”) are stored in the EEPROM. What about the current position of the machine? Is that information stored firmware side or in GC? Example, I’m in GC…move to X1, Y1, then I open cncjs/alternative client - can it query the Arduino to find the machine position to be X1, Y1?