From b726511a3bc2db618e3f346431eb7f703fb501fd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 17 Dec 2014 20:22:33 -0800 Subject: [PATCH 1/5] A few constants where they belong --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/SdFatConfig.h | 4 +++- Marlin/cardreader.cpp | 10 +++++----- Marlin/cardreader.h | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 616b7a190..f65df7736 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -429,7 +429,7 @@ void enquecommand(const char *cmd) //this is dangerous if a mixing of serial and this happens strcpy(&(cmdbuffer[bufindw][0]),cmd); SERIAL_ECHO_START; - SERIAL_ECHOPGM("enqueing \""); + SERIAL_ECHOPGM(MSG_Enqueing); SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHOLNPGM("\""); bufindw= (bufindw + 1)%BUFSIZE; @@ -444,7 +444,7 @@ void enquecommand_P(const char *cmd) //this is dangerous if a mixing of serial and this happens strcpy_P(&(cmdbuffer[bufindw][0]),cmd); SERIAL_ECHO_START; - SERIAL_ECHOPGM("enqueing \""); + SERIAL_ECHOPGM(MSG_Enqueing); SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHOLNPGM("\""); bufindw= (bufindw + 1)%BUFSIZE; diff --git a/Marlin/SdFatConfig.h b/Marlin/SdFatConfig.h index 710b1f792..742f5aa35 100644 --- a/Marlin/SdFatConfig.h +++ b/Marlin/SdFatConfig.h @@ -113,8 +113,10 @@ uint8_t const SOFT_SPI_SCK_PIN = 13; */ /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ #define MAX_VFAT_ENTRIES (2) +/** Number of UTF-16 characters per entry */ +#define FILENAME_LENGTH 13 /** Total size of the buffer used to store the long filenames */ -#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1) +#define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1) #endif // SdFatConfig_h diff --git a/Marlin/cardreader.cpp b/Marlin/cardreader.cpp index d2fb418fb..6bf43b918 100644 --- a/Marlin/cardreader.cpp +++ b/Marlin/cardreader.cpp @@ -60,8 +60,8 @@ void CardReader::lsDive(const char *prepend,SdFile parent) if( DIR_IS_SUBDIR(&p) && lsAction!=LS_Count && lsAction!=LS_GetFilename) // hence LS_SerialPrint { - char path[13*2]; - char lfilename[13]; + char path[FILENAME_LENGTH*2]; + char lfilename[FILENAME_LENGTH]; createFilename(lfilename,p); path[0]=0; @@ -235,7 +235,7 @@ void CardReader::getAbsFilename(char *t) while(*t!=0 && cnt< MAXPATHNAMELENGTH) {t++;cnt++;} //crawl counter forward. } - if(cnt0 && dirname_end>dirname_start) { - char subdirname[13]; + char subdirname[FILENAME_LENGTH]; strncpy(subdirname, dirname_start, dirname_end-dirname_start); subdirname[dirname_end-dirname_start]=0; SERIAL_ECHOLN(subdirname); @@ -401,7 +401,7 @@ void CardReader::removeFile(char* name) //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); if(dirname_end>0 && dirname_end>dirname_start) { - char subdirname[13]; + char subdirname[FILENAME_LENGTH]; strncpy(subdirname, dirname_start, dirname_end-dirname_start); subdirname[dirname_end-dirname_start]=0; SERIAL_ECHOLN(subdirname); diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 78f7148b1..fa38508e3 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -52,7 +52,7 @@ public: bool logging; bool sdprinting ; bool cardOK ; - char filename[13]; + char filename[FILENAME_LENGTH]; char longFilename[LONG_FILENAME_LENGTH]; bool filenameIsDir; int lastnr; //last number of the autostart; @@ -63,7 +63,7 @@ private: SdVolume volume; SdFile file; #define SD_PROCEDURE_DEPTH 1 - #define MAXPATHNAMELENGTH (13*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1) + #define MAXPATHNAMELENGTH (FILENAME_LENGTH*MAX_DIR_DEPTH+MAX_DIR_DEPTH+1) uint8_t file_subcall_ctr; uint32_t filespos[SD_PROCEDURE_DEPTH]; char filenames[SD_PROCEDURE_DEPTH][MAXPATHNAMELENGTH]; From f074706d2e34e4b91e600b0809be5392db49c828 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 17 Dec 2014 20:29:34 -0800 Subject: [PATCH 2/5] And one more... --- Marlin/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 550b9cb0b..d0b0889e8 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1332,7 +1332,7 @@ void lcd_update() lcd_implementation_clear(); if (lcdDrawUpdate) lcdDrawUpdate--; - lcd_next_update_millis = millis() + 100; + lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL; } } From 60598b4cdda4132ad642ba42e60777e04c494f5a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 17 Dec 2014 20:22:33 -0800 Subject: [PATCH 3/5] A few constants where they belong --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/SdFatConfig.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e8d800eb4..bea1db727 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -429,7 +429,7 @@ void enquecommand(const char *cmd) //this is dangerous if a mixing of serial and this happens strcpy(&(cmdbuffer[bufindw][0]),cmd); SERIAL_ECHO_START; - SERIAL_ECHOPGM("enqueing \""); + SERIAL_ECHOPGM(MSG_Enqueing); SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHOLNPGM("\""); bufindw= (bufindw + 1)%BUFSIZE; @@ -444,7 +444,7 @@ void enquecommand_P(const char *cmd) //this is dangerous if a mixing of serial and this happens strcpy_P(&(cmdbuffer[bufindw][0]),cmd); SERIAL_ECHO_START; - SERIAL_ECHOPGM("enqueing \""); + SERIAL_ECHOPGM(MSG_Enqueing); SERIAL_ECHO(cmdbuffer[bufindw]); SERIAL_ECHOLNPGM("\""); bufindw= (bufindw + 1)%BUFSIZE; diff --git a/Marlin/SdFatConfig.h b/Marlin/SdFatConfig.h index 39ef38130..7492c5415 100644 --- a/Marlin/SdFatConfig.h +++ b/Marlin/SdFatConfig.h @@ -115,6 +115,8 @@ uint8_t const SOFT_SPI_SCK_PIN = 13; #define FILENAME_LENGTH 13 /** Number of VFAT entries used. Every entry has 13 UTF-16 characters */ #define MAX_VFAT_ENTRIES (2) +/** Number of UTF-16 characters per entry */ +#define FILENAME_LENGTH 13 /** Total size of the buffer used to store the long filenames */ #define LONG_FILENAME_LENGTH (FILENAME_LENGTH*MAX_VFAT_ENTRIES+1) #endif // SdFatConfig_h From e4b98011cf93070d21fff93f9dff42a9289ffc7b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 17 Dec 2014 20:29:34 -0800 Subject: [PATCH 4/5] And one more... --- Marlin/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 195d52bc4..3fdbb6cbf 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1350,7 +1350,7 @@ void lcd_update() lcd_implementation_clear(); if (lcdDrawUpdate) lcdDrawUpdate--; - lcd_next_update_millis = millis() + 100; + lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL; } } From 07c6b5ab717d41ea5bd827e6e5a5ed763cafc362 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 18 Dec 2014 08:13:08 -0800 Subject: [PATCH 5/5] Using axis constants --- Marlin/ConfigurationStore.cpp | 46 +++++++------- Marlin/Configuration_adv.h | 4 +- Marlin/Marlin_main.cpp | 60 +++++++++---------- .../SCARA/Configuration_adv.h | 4 +- .../delta/Configuration_adv.h | 4 +- .../makibox/Configuration_adv.h | 4 +- Marlin/planner.cpp | 12 ++-- Marlin/planner.h | 15 ++--- 8 files changed, 71 insertions(+), 78 deletions(-) diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/ConfigurationStore.cpp index dbbe33a23..54e69c013 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/ConfigurationStore.cpp @@ -116,38 +116,38 @@ void Config_PrintSettings() SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Steps per unit:"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]); - SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]); - SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]); - SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]); + SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]); + SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]); + SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]); + SERIAL_ECHOPAIR(" E",axis_steps_per_unit[E_AXIS]); SERIAL_ECHOLN(""); SERIAL_ECHO_START; #ifdef SCARA SERIAL_ECHOLNPGM("Scaling factors:"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M365 X",axis_scaling[0]); - SERIAL_ECHOPAIR(" Y",axis_scaling[1]); - SERIAL_ECHOPAIR(" Z",axis_scaling[2]); + SERIAL_ECHOPAIR(" M365 X",axis_scaling[X_AXIS]); + SERIAL_ECHOPAIR(" Y",axis_scaling[Y_AXIS]); + SERIAL_ECHOPAIR(" Z",axis_scaling[Z_AXIS]); SERIAL_ECHOLN(""); SERIAL_ECHO_START; #endif SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M203 X",max_feedrate[0]); - SERIAL_ECHOPAIR(" Y",max_feedrate[1] ); - SERIAL_ECHOPAIR(" Z", max_feedrate[2] ); - SERIAL_ECHOPAIR(" E", max_feedrate[3]); + SERIAL_ECHOPAIR(" M203 X", max_feedrate[X_AXIS]); + SERIAL_ECHOPAIR(" Y", max_feedrate[Y_AXIS]); + SERIAL_ECHOPAIR(" Z", max_feedrate[Z_AXIS]); + SERIAL_ECHOPAIR(" E", max_feedrate[E_AXIS]); SERIAL_ECHOLN(""); SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[0] ); - SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] ); - SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] ); - SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]); + SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[X_AXIS] ); + SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[Y_AXIS] ); + SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[Z_AXIS] ); + SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[E_AXIS]); SERIAL_ECHOLN(""); SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration"); @@ -170,17 +170,17 @@ SERIAL_ECHOLNPGM("Scaling factors:"); SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Home offset (mm):"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M206 X",add_homing[0] ); - SERIAL_ECHOPAIR(" Y" ,add_homing[1] ); - SERIAL_ECHOPAIR(" Z" ,add_homing[2] ); + SERIAL_ECHOPAIR(" M206 X",add_homing[X_AXIS] ); + SERIAL_ECHOPAIR(" Y" ,add_homing[Y_AXIS] ); + SERIAL_ECHOPAIR(" Z" ,add_homing[Z_AXIS] ); SERIAL_ECHOLN(""); #ifdef DELTA SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Endstop adjustement (mm):"); SERIAL_ECHO_START; - SERIAL_ECHOPAIR(" M666 X",endstop_adj[0] ); - SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] ); - SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] ); + SERIAL_ECHOPAIR(" M666 X",endstop_adj[X_AXIS] ); + SERIAL_ECHOPAIR(" Y" ,endstop_adj[Y_AXIS] ); + SERIAL_ECHOPAIR(" Z" ,endstop_adj[Z_AXIS] ); SERIAL_ECHOLN(""); SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second"); @@ -303,9 +303,9 @@ void Config_ResetDefault() max_xy_jerk=DEFAULT_XYJERK; max_z_jerk=DEFAULT_ZJERK; max_e_jerk=DEFAULT_EJERK; - add_homing[0] = add_homing[1] = add_homing[2] = 0; + add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0; #ifdef DELTA - endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0; + endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0; delta_radius= DELTA_RADIUS; delta_diagonal_rod= DELTA_DIAGONAL_ROD; delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND; diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d0f988c17..5eebec973 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -345,8 +345,8 @@ #define D_FILAMENT 2.85 #define STEPS_MM_E 836 - #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) + #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) + #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) #endif // ADVANCE diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index bea1db727..59b291cfe 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1537,7 +1537,7 @@ void process_commands() #ifdef SCARA current_position[X_AXIS]=code_value(); #else - current_position[X_AXIS]=code_value()+add_homing[0]; + current_position[X_AXIS]=code_value()+add_homing[X_AXIS]; #endif } } @@ -1547,7 +1547,7 @@ void process_commands() #ifdef SCARA current_position[Y_AXIS]=code_value(); #else - current_position[Y_AXIS]=code_value()+add_homing[1]; + current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS]; #endif } } @@ -1612,7 +1612,7 @@ void process_commands() if(code_seen(axis_codes[Z_AXIS])) { if(code_value_long() != 0) { - current_position[Z_AXIS]=code_value()+add_homing[2]; + current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS]; } } #ifdef ENABLE_AUTO_BED_LEVELING @@ -2745,9 +2745,9 @@ Sigma_Exit: SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLPGM("SCARA Cal - Theta:"); - SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[0]); + SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[X_AXIS]); SERIAL_PROTOCOLPGM(" Psi+Theta (90):"); - SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[1]); + SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[Y_AXIS]); SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:"); @@ -2883,11 +2883,11 @@ Sigma_Exit: #ifdef SCARA if(code_seen('T')) // Theta { - add_homing[0] = code_value() ; + add_homing[X_AXIS] = code_value() ; } if(code_seen('P')) // Psi { - add_homing[1] = code_value() ; + add_homing[Y_AXIS] = code_value() ; } #endif break; @@ -3275,11 +3275,11 @@ Sigma_Exit: //SERIAL_ECHOLN(" Soft endstops disabled "); if(Stopped == false) { //get_coordinates(); // For X Y Z E F - delta[0] = 0; - delta[1] = 120; + delta[X_AXIS] = 0; + delta[Y_AXIS] = 120; calculate_SCARA_forward_Transform(delta); - destination[0] = delta[0]/axis_scaling[X_AXIS]; - destination[1] = delta[1]/axis_scaling[Y_AXIS]; + destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; + destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; prepare_move(); //ClearToSend(); @@ -3293,11 +3293,11 @@ Sigma_Exit: //SERIAL_ECHOLN(" Soft endstops disabled "); if(Stopped == false) { //get_coordinates(); // For X Y Z E F - delta[0] = 90; - delta[1] = 130; + delta[X_AXIS] = 90; + delta[Y_AXIS] = 130; calculate_SCARA_forward_Transform(delta); - destination[0] = delta[0]/axis_scaling[X_AXIS]; - destination[1] = delta[1]/axis_scaling[Y_AXIS]; + destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; + destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; prepare_move(); //ClearToSend(); @@ -3310,11 +3310,11 @@ Sigma_Exit: //SERIAL_ECHOLN(" Soft endstops disabled "); if(Stopped == false) { //get_coordinates(); // For X Y Z E F - delta[0] = 60; - delta[1] = 180; + delta[X_AXIS] = 60; + delta[Y_AXIS] = 180; calculate_SCARA_forward_Transform(delta); - destination[0] = delta[0]/axis_scaling[X_AXIS]; - destination[1] = delta[1]/axis_scaling[Y_AXIS]; + destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; + destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; prepare_move(); //ClearToSend(); @@ -3327,11 +3327,11 @@ Sigma_Exit: //SERIAL_ECHOLN(" Soft endstops disabled "); if(Stopped == false) { //get_coordinates(); // For X Y Z E F - delta[0] = 50; - delta[1] = 90; + delta[X_AXIS] = 50; + delta[Y_AXIS] = 90; calculate_SCARA_forward_Transform(delta); - destination[0] = delta[0]/axis_scaling[X_AXIS]; - destination[1] = delta[1]/axis_scaling[Y_AXIS]; + destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; + destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; prepare_move(); //ClearToSend(); @@ -3344,11 +3344,11 @@ Sigma_Exit: //SERIAL_ECHOLN(" Soft endstops disabled "); if(Stopped == false) { //get_coordinates(); // For X Y Z E F - delta[0] = 45; - delta[1] = 135; + delta[X_AXIS] = 45; + delta[Y_AXIS] = 135; calculate_SCARA_forward_Transform(delta); - destination[0] = delta[0]/axis_scaling[X_AXIS]; - destination[1] = delta[1]/axis_scaling[Y_AXIS]; + destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS]; + destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS]; prepare_move(); //ClearToSend(); @@ -4020,9 +4020,9 @@ for (int s = 1; s <= steps; s++) { calculate_delta(destination); - //SERIAL_ECHOPGM("destination[0]="); SERIAL_ECHOLN(destination[0]); - //SERIAL_ECHOPGM("destination[1]="); SERIAL_ECHOLN(destination[1]); - //SERIAL_ECHOPGM("destination[2]="); SERIAL_ECHOLN(destination[2]); + //SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]); + //SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]); + //SERIAL_ECHOPGM("destination[Z_AXIS]="); SERIAL_ECHOLN(destination[Z_AXIS]); //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]); //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]); //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]); diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 10fbe9b31..840a1b288 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -353,8 +353,8 @@ #define D_FILAMENT 1.75 #define STEPS_MM_E 1000 - #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) + #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) + #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) #endif // ADVANCE diff --git a/Marlin/example_configurations/delta/Configuration_adv.h b/Marlin/example_configurations/delta/Configuration_adv.h index 6c9d56886..edc658047 100644 --- a/Marlin/example_configurations/delta/Configuration_adv.h +++ b/Marlin/example_configurations/delta/Configuration_adv.h @@ -340,8 +340,8 @@ #define D_FILAMENT 2.85 #define STEPS_MM_E 836 - #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) + #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) + #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) #endif // ADVANCE diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 312b2b964..21dbd46d7 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -344,8 +344,8 @@ #define D_FILAMENT 2.85 #define STEPS_MM_E 836 - #define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) - #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) + #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) + #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA) #endif // ADVANCE diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index fe617501f..c8942251e 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -63,9 +63,9 @@ //=========================================================================== unsigned long minsegmenttime; -float max_feedrate[4]; // set the max speeds -float axis_steps_per_unit[4]; -unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software +float max_feedrate[NUM_AXIS]; // set the max speeds +float axis_steps_per_unit[NUM_AXIS]; +unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software float minimumfeedrate; float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX @@ -85,8 +85,8 @@ matrix_3x3 plan_bed_level_matrix = { #endif // #ifdef ENABLE_AUTO_BED_LEVELING // The current position of the tool in absolute steps -long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode -static float previous_speed[4]; // Speed of previous path line segment +long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode +static float previous_speed[NUM_AXIS]; // Speed of previous path line segment static float previous_nominal_speed; // Nominal speed of previous path line segment #ifdef AUTOTEMP @@ -989,7 +989,7 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi else { long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * - (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA)*256; + (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUSION_AREA * EXTRUSION_AREA)*256; block->advance = advance; if(acc_dist == 0) { block->advance_rate = 0; diff --git a/Marlin/planner.h b/Marlin/planner.h index 837199eb7..0952b9dd3 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -106,9 +106,9 @@ void check_axes_activity(); uint8_t movesplanned(); //return the nr of buffered moves extern unsigned long minsegmenttime; -extern float max_feedrate[4]; // set the max speeds -extern float axis_steps_per_unit[4]; -extern unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software +extern float max_feedrate[NUM_AXIS]; // set the max speeds +extern float axis_steps_per_unit[NUM_AXIS]; +extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software extern float minimumfeedrate; extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX @@ -152,14 +152,7 @@ FORCE_INLINE block_t *plan_get_current_block() } // Returns true if the buffer has a queued block, false otherwise -FORCE_INLINE bool blocks_queued() -{ - if (block_buffer_head == block_buffer_tail) { - return false; - } - else - return true; -} +FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); } #ifdef PREVENT_DANGEROUS_EXTRUDE void set_extrude_min_temp(float temp);