Closed drf5n closed 2 years ago
With those changes, all of the codes appear to compile in Arduino IDE.
The code will compile in Wokwi, but since only 4-wire steppers are available so far, ( https://github.com/wokwi/wokwi-features/issues/191#issuecomment-1085187294 ) the multi-axis code depending on step-dir type drivers won't have steppers to control. For example: ### https://wokwi.com/projects/327767540778402388
I'm with you in spirit. why rename parseNumber and serialBuffer?
In several of the codes, serialBuffer
is filled with assignments into buffer
, and parseNumber is called by parsenumber
For example:
versus
Left uncorrected, they fail to compile with errors like:
/Users/drf/Work/GcodeCNCDemo/GcodeCNCDemo2Axis/HG7881.ino:10:1: warning: multi-line comment [-Wcomment]
// * to reduce and avoid overheat on HG7881, use M18 after every G00, G01, G02, G03 on Gcode * \\
^
/Users/drf/Work/GcodeCNCDemo/GcodeCNCDemo2Axis/GcodeCNCDemo2Axis.ino: In function 'float parseNumber(char, float)':
GcodeCNCDemo2Axis:180:13: error: 'serialBuffer' was not declared in this scope
char *ptr=serialBuffer; // start at the beginning of buffer
^~~~~~~~~~~~
/Users/drf/Work/GcodeCNCDemo/GcodeCNCDemo2Axis/GcodeCNCDemo2Axis.ino: In function 'void processCommand()':
GcodeCNCDemo2Axis:239:13: error: 'parsenumber' was not declared in this scope
int cmd = parsenumber('G',-1);
^~~~~~~~~~~
/Users/drf/Work/GcodeCNCDemo/GcodeCNCDemo2Axis/GcodeCNCDemo2Axis.ino:239:13: note: suggested alternative: 'parseNumber'
int cmd = parsenumber('G',-1);
^~~~~~~~~~~
parseNumber
Using library AFMotorDrawbot in folder: /Users/drf/Documents/Arduino/libraries/AFMotorDrawbot (legacy)
exit status 1
'serialBuffer' was not declared in this scope
I see that the newer codes, like GcodeCNCDemo6AxisRumbaTimerInterrupt.ino use serialBuffer and parseNumber
...but the older ones are a mix.
With these changes, they all compile on a mega:
GcodeCNCDemo2Axis:
Sketch uses 11218 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 350 bytes (4%) of dynamic memory, leaving 7842 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo4AxisCNCShield:
Sketch uses 8878 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 436 bytes (5%) of dynamic memory, leaving 7756 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo4AxisRAMPS
Sketch uses 8894 bytes (3%) of program storage space. Maximum is 253952 bytes.
Global variables use 436 bytes (5%) of dynamic memory, leaving 7756 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo4axisV2
Sketch uses 14696 bytes (5%) of program storage space. Maximum is 253952 bytes.
Global variables use 778 bytes (9%) of dynamic memory, leaving 7414 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo6AxisRumba
Sketch uses 11962 bytes (4%) of program storage space. Maximum is 253952 bytes.
Global variables use 488 bytes (5%) of dynamic memory, leaving 7704 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo6AxisRumbaTimerInterrupt
Sketch uses 12800 bytes (5%) of program storage space. Maximum is 253952 bytes.
Global variables use 4094 bytes (49%) of dynamic memory, leaving 4098 bytes for local variables. Maximum is 8192 bytes.
GcodeCNCDemo6AxisV2
Sketch uses 14848 bytes (5%) of program storage space. Maximum is 253952 bytes.
Global variables use 886 bytes (10%) of dynamic memory, leaving 7306 bytes for local variables. Maximum is 8192 bytes.
Nice. Personally I would have kept the camelCasing and the longer serialBuffer (says more about what it does) but I'm not going to look a gift horse in the mouth.
Thank you!
Nice. Personally I would have kept the camelCasing and the longer serialBuffer (says more about what it does) but I'm not going to look a gift horse in the mouth.
Thank you!
You're welcome.
Yeah it would be nicer to have it all consistent, but I started from the 2 Axis code, and un-camel-casing the function and going with the less descriptive buffer name looked like a less invasive change.
Maybe I'll do a global search & replace and do another PR to regularize them.
This is a PR to fix https://github.com/MarginallyClever/GcodeCNCDemo/issues/29 and parts of https://github.com/MarginallyClever/GcodeCNCDemo/issues/28
It:
These changes make it compile for Arduino and the Wokwi simulator.
See https://wokwi.com/projects/327748577668366932