I have a Tronxy X5SA printer upon which I want to install the latest Marlin firmware v2.0.9.1.

I take the configuration example on GitHub for the X5SA printer and modify the lines in configuration.h as recommended in the guide (see this URL).

In Visual Studio Code, when I compile, I obtain this error :

Marlin\src\gcode\motion\G2_G3.cpp: In function 'void plan_arc(const xyze_pos_t&, const ab_float_t&, bool, uint8_t)':
Marlin\src\gcode\motion\G2_G3.cpp:154:7: error: 'MM_PER_ARC_SEGMENT' was not declared in this scope
Marlin\src\gcode\motion\G2_G3.cpp:154:7: note: suggested alternative: 'MAX_ARC_SEGMENT_MM'
Compiling .pio\build\chitu_f103\src\src\gcode\sd\M20.cpp.o
*** [.pio\build\chitu_f103\src\src\gcode\motion\G2_G3.cpp.o] Error 1
========================================================================================= [FAILED] Took 71.95 seconds ========================================================================================= 

Environment    Status    Duration
-------------  --------  ------------
chitu_f103     FAILED    00:01:11.945
==================================================================================== 1 failed, 0 succeeded in 00:01:11.945 ==================================================================================== 
PS D:\TRONXY\Marlin-\Marlin-> echo "done" >C:\Users\myUser\AppData\Local\Temp\ipc
PS D:\TRONXY\Marlin-\Marlin-> 

Here is the code in G2_G3.cpp on line 154, but I need some help to understand why it's wrong, and how to fix...

 // Start with a nominal segment length
  float seg_length = (
  // Divide total travel by nominal segment length
  uint16_t segments = FLOOR(mm_of_travel / seg_length);
  NOLESS(segments, min_segments);         // At least some segments
  seg_length = mm_of_travel / segments;

I have tried to compile the BugFix version successfully, but unfortunately the bugfix version does not work properly with my printer (I can't get the bed to lift to the probe. I have opened another post for the bugfix version issue).


The compiler can't see the definition of MM_PER_ARC_SEGMENT. Find the file that it is declared in and ensure that file in included in the compile command, as an include (#include) or path or whatever.

Looking at the current Configuration_adv.h on the Marlin Github repository, the definition is at Line 2033 in the section at Lines 2028-2041

// G2/G3 Arc Support
#define ARC_SUPPORT                 // Disable this feature to save ~3226 bytes
  #define MM_PER_ARC_SEGMENT      1 // (mm) Length (or minimum length) of each arc segment
  //#define ARC_SEGMENTS_PER_R    1 // Max segment length, MM_PER = Min
  #define MIN_ARC_SEGMENTS       24 // Minimum number of segments in a complete circle
  //#define ARC_SEGMENTS_PER_SEC 50 // Use feedrate to choose segment length (with MM_PER_ARC_SEGMENT as the minimum)
  #define N_ARC_CORRECTION       25 // Number of interpolated segments between corrections
  //#define ARC_P_CIRCLES           // Enable the 'P' parameter to specify complete circles
  //#define CNC_WORKSPACE_PLANES    // Allow G2/G3 to operate in XY, ZX, or YZ planes
  //#define SF_ARC_FIX              // Enable only if using SkeinForge with "Arc Point" fillet procedure

Ensure that you have ARC_SUPPORT enabled - do not have the following line (2031) commented out:

#define ARC_SUPPORT 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.