diff --git a/Marlin/src/HAL/STM32/sdio.cpp b/Marlin/src/HAL/STM32/sdio.cpp index 4333006713..41fe90b825 100644 --- a/Marlin/src/HAL/STM32/sdio.cpp +++ b/Marlin/src/HAL/STM32/sdio.cpp @@ -369,7 +369,7 @@ void HAL_SD_MspInit(SD_HandleTypeDef *hsd) { /** * @brief Read a block - * @details Read a block to media with SDIO + * @details Read a block from media with SDIO * * @param block The block index * @param src The block buffer diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index fa11c97380..506b9cbd0e 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -238,6 +238,7 @@ #define BOARD_BTT_SKR_V1_1 2012 // BigTreeTech SKR v1.1 #define BOARD_BTT_SKR_V1_3 2013 // BigTreeTech SKR v1.3 #define BOARD_BTT_SKR_V1_4 2014 // BigTreeTech SKR v1.4 +#define BOARD_EMOTRONIC 2015 // eMotion-Tech eMotronic // // LPC1769 ARM Cortex M3 @@ -332,14 +333,14 @@ #define BOARD_BTT_SKR_E3_DIP 4029 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE) #define BOARD_BTT_SKR_CR6 4030 // BigTreeTech SKR CR6 v1.0 (STM32F103RE) #define BOARD_JGAURORA_A5S_A1 4031 // JGAurora A5S A1 (STM32F103ZE) -#define BOARD_FYSETC_AIO_II 4032 // FYSETC AIO_II -#define BOARD_FYSETC_CHEETAH 4033 // FYSETC Cheetah -#define BOARD_FYSETC_CHEETAH_V12 4034 // FYSETC Cheetah V1.2 -#define BOARD_LONGER3D_LK 4035 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VE +#define BOARD_FYSETC_AIO_II 4032 // FYSETC AIO_II (STM32F103RC) +#define BOARD_FYSETC_CHEETAH 4033 // FYSETC Cheetah (STM32F103RC) +#define BOARD_FYSETC_CHEETAH_V12 4034 // FYSETC Cheetah V1.2 (STM32F103RC) +#define BOARD_LONGER3D_LK 4035 // Longer3D LK1/2 - Alfawise U20/U20+/U30 (STM32F103VE) #define BOARD_CCROBOT_MEEB_3DP 4036 // ccrobot-online.com MEEB_3DP (STM32F103RC) -#define BOARD_CHITU3D_V5 4037 // Chitu3D TronXY X5SA V5 Board -#define BOARD_CHITU3D_V6 4038 // Chitu3D TronXY X5SA V6 Board -#define BOARD_CHITU3D_V9 4039 // Chitu3D TronXY X5SA V9 Board +#define BOARD_CHITU3D_V5 4037 // Chitu3D TronXY X5SA V5 Board (STM32F103ZE) +#define BOARD_CHITU3D_V6 4038 // Chitu3D TronXY X5SA V6 Board (STM32F103ZE) +#define BOARD_CHITU3D_V9 4039 // Chitu3D TronXY X5SA V9 Board (STM32F103ZE) #define BOARD_CREALITY_V4 4040 // Creality v4.x (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V422 4041 // Creality v4.2.2 (STM32F103RC / STM32F103RE) #define BOARD_CREALITY_V423 4042 // Creality v4.2.3 (STM32F103RC / STM32F103RE) @@ -395,7 +396,7 @@ #define BOARD_BTT_GTR_V1_0 4214 // BigTreeTech GTR v1.0 (STM32F407IGT) #define BOARD_BTT_OCTOPUS_V1_0 4215 // BigTreeTech Octopus v1.0 (STM32F446ZE) #define BOARD_BTT_OCTOPUS_V1_1 4216 // BigTreeTech Octopus v1.1 (STM32F446ZE) -#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE/STM32F429ZG) +#define BOARD_BTT_OCTOPUS_PRO_V1_0 4217 // BigTreeTech Octopus Pro v1.0 (STM32F446ZE / STM32F429ZG) #define BOARD_LERDGE_K 4218 // Lerdge K (STM32F407ZG) #define BOARD_LERDGE_S 4219 // Lerdge S (STM32F407VE) #define BOARD_LERDGE_X 4220 // Lerdge X (STM32F407VE) @@ -408,13 +409,13 @@ #define BOARD_MKS_ROBIN_PRO_V2 4227 // MKS Robin Pro V2 (STM32F407VE) #define BOARD_MKS_ROBIN_NANO_V3 4228 // MKS Robin Nano V3 (STM32F407VG) #define BOARD_MKS_ROBIN_NANO_V3_1 4229 // MKS Robin Nano V3.1 (STM32F407VE) -#define BOARD_MKS_MONSTER8_V1 4230 // MKS Monster8 V1 (STM32F407VG) -#define BOARD_MKS_MONSTER8_V2 4231 // MKS Monster8 V2 (STM32F407VG) +#define BOARD_MKS_MONSTER8_V1 4230 // MKS Monster8 V1 (STM32F407VE) +#define BOARD_MKS_MONSTER8_V2 4231 // MKS Monster8 V2 (STM32F407VE) #define BOARD_ANET_ET4 4232 // ANET ET4 V1.x (STM32F407VG) #define BOARD_ANET_ET4P 4233 // ANET ET4P V1.x (STM32F407VG) -#define BOARD_FYSETC_CHEETAH_V20 4234 // FYSETC Cheetah V2.0 -#define BOARD_TH3D_EZBOARD_V2 4235 // TH3D EZBoard v2.0 -#define BOARD_OPULO_LUMEN_REV3 4236 // Opulo Lumen PnP Controller REV3 (STM32F407VE/VG) +#define BOARD_FYSETC_CHEETAH_V20 4234 // FYSETC Cheetah V2.0 (STM32F401RC) +#define BOARD_TH3D_EZBOARD_V2 4235 // TH3D EZBoard v2.0 (STM32F405RG) +#define BOARD_OPULO_LUMEN_REV3 4236 // Opulo Lumen PnP Controller REV3 (STM32F407VE / STM32F407VG) #define BOARD_MKS_ROBIN_NANO_V1_3_F4 4237 // MKS Robin Nano V1.3 and MKS Robin Nano-S V1.3 (STM32F407VE) #define BOARD_MKS_EAGLE 4238 // MKS Eagle (STM32F407VE) #define BOARD_ARTILLERY_RUBY 4239 // Artillery Ruby (STM32F401RC) diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 335aa3a334..c9bb7d8c30 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -688,7 +688,7 @@ struct XYZEval { FI const T& operator[](const int n) const { return pos[n]; } // Assignment operator overrides do the expected thing - FI XYZEval& operator= (const T v) { set(LIST_N_1(NUM_AXES, v)); return *this; } + FI XYZEval& operator= (const T v) { set(LOGICAL_AXIS_LIST_1(v)); return *this; } FI XYZEval& operator= (const XYval &rs) { set(rs.x, rs.y); return *this; } FI XYZEval& operator= (const XYZval &rs) { set(NUM_AXIS_ELEM(rs)); return *this; } diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 21fa08fc10..1e436ffd96 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -306,7 +306,7 @@ typedef struct { LIMIT(e.x, X_MIN_POS + 1, X_MAX_POS - 1); #endif - if (position_is_reachable(s.x, s.y) && position_is_reachable(e.x, e.y)) + if (position_is_reachable(s) && position_is_reachable(e)) print_line_from_here_to_there(s, e); } } diff --git a/Marlin/src/gcode/calibrate/M665.cpp b/Marlin/src/gcode/calibrate/M665.cpp index aa21471b60..7dc657a61b 100644 --- a/Marlin/src/gcode/calibrate/M665.cpp +++ b/Marlin/src/gcode/calibrate/M665.cpp @@ -86,13 +86,13 @@ * * Parameters: * - * S[segments-per-second] - Segments-per-second + * S[segments] - Segments-per-second * * Without NO_WORKSPACE_OFFSETS: * - * P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle - * T[theta-offset] - Theta offset, added to the elbow (B/Y) angle - * Z[z-offset] - Z offset, added to Z + * P[theta-psi-offset] - Theta-Psi offset, added to the shoulder (A/X) angle + * T[theta-offset] - Theta offset, added to the elbow (B/Y) angle + * Z[z-offset] - Z offset, added to Z * * A, P, and X are all aliases for the shoulder angle * B, T, and Y are all aliases for the elbow angle @@ -152,18 +152,35 @@ * * Parameters: * - * S[segments-per-second] - Segments-per-second + * S[segments] - Segments-per-second + * L[left] - Work area minimum X + * R[right] - Work area maximum X + * T[top] - Work area maximum Y + * B[bottom] - Work area minimum Y + * H[length] - Maximum belt length */ void GcodeSuite::M665() { - if (parser.seenval('S')) - segments_per_second = parser.value_float(); - else - M665_report(); + if (!parser.seen_any()) return M665_report(); + if (parser.seenval('S')) segments_per_second = parser.value_float(); + if (parser.seenval('L')) draw_area_min.x = parser.value_linear_units(); + if (parser.seenval('R')) draw_area_max.x = parser.value_linear_units(); + if (parser.seenval('T')) draw_area_max.y = parser.value_linear_units(); + if (parser.seenval('B')) draw_area_min.y = parser.value_linear_units(); + if (parser.seenval('H')) polargraph_max_belt_len = parser.value_linear_units(); + draw_area_size.x = draw_area_max.x - draw_area_min.x; + draw_area_size.y = draw_area_max.y - draw_area_min.y; } void GcodeSuite::M665_report(const bool forReplay/*=true*/) { - report_heading_etc(forReplay, F(STR_POLARGRAPH_SETTINGS " (" STR_S_SEG_PER_SEC ")")); - SERIAL_ECHOLNPGM(" M665 S", segments_per_second); + report_heading_etc(forReplay, F(STR_POLARGRAPH_SETTINGS)); + SERIAL_ECHOLNPGM_P( + PSTR(" M665 S"), LINEAR_UNIT(segments_per_second), + PSTR(" L"), LINEAR_UNIT(draw_area_min.x), + PSTR(" R"), LINEAR_UNIT(draw_area_max.x), + SP_T_STR, LINEAR_UNIT(draw_area_max.y), + SP_B_STR, LINEAR_UNIT(draw_area_min.y), + PSTR(" H"), LINEAR_UNIT(polargraph_max_belt_len) + ); } #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 1cc113a3ae..a616653b9e 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -989,7 +989,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #endif #if IS_KINEMATIC - case 665: M665(); break; // M665: Set Delta/SCARA parameters + case 665: M665(); break; // M665: Set Kinematics parameters #endif #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index e754b6dc3d..3657ab2b12 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -262,6 +262,7 @@ * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) * M665 - Set delta configurations: "M665 H L R S B X Y Z (Requires DELTA) * Set SCARA configurations: "M665 S P T Z (Requires MORGAN_SCARA or MP_SCARA) + * Set Polargraph draw area and belt length: "M665 S L R T B H" * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops. (Requires [XYZ]_DUAL_ENDSTOPS) * M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires DUET_SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN) * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 5f9ab3dc7d..517e95c83e 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -471,6 +471,8 @@ #elif ENABLED(ZONESTAR_12864OLED) #define _LCD_CONTRAST_MIN 64 #define _LCD_CONTRAST_INIT 128 +#elif ENABLED(EMOTION_TECH_LCD) + #define _LCD_CONTRAST_INIT 140 #elif IS_TFTGLCD_PANEL #define _LCD_CONTRAST_INIT 250 #endif diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index e48788b7b4..054a006aff 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -35,8 +35,8 @@ #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!" #endif -#if LINEAR_AXES_WARNING - #warning "Note: LINEAR_AXES is now based on the *_DRIVER_TYPE settings so you can remove LINEAR_AXES from Configuration.h." +#if NUM_AXES_WARNING + #warning "Note: NUM_AXES is now based on the *_DRIVER_TYPE settings so you can remove NUM_AXES from Configuration.h." #endif // Safety Features diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 762a4fb627..f51da4cf5a 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -99,7 +99,7 @@ #define HAS_ONESTEP_LEVELING 1 #endif -#if HAS_MESH || HAS_ONESTEP_LEVELING +#if HAS_MESH || (HAS_LEVELING && HAS_ZOFFSET_ITEM) #include "../../../feature/bedlevel/bedlevel.h" #include "bedlevel_tools.h" #endif @@ -1825,7 +1825,7 @@ void DWIN_SetDataDefaults() { #endif TERN_(BAUD_RATE_GCODE, SetBaud250K()); #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS) - leds.set_default(); + TERN_(LED_COLOR_PRESETS, leds.set_default()); ApplyLEDColor(); #endif } @@ -2138,7 +2138,7 @@ void HomeZ() { queue.inject(F("G28Z")); } ); gcode.process_subcommands_now(cmd); #else - set_bed_leveling_enabled(false); + TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); gcode.process_subcommands_now(F("G28O\nG0Z0F300\nM400")); #endif ui.reset_status(); @@ -2226,10 +2226,9 @@ void SetPID(celsius_t t, heater_id_t h) { #endif #if ENABLED(BAUD_RATE_GCODE) - void HMI_SetBaudRate() { - if (HMI_data.Baud115K) SetBaud115K(); else SetBaud250K(); - } + void HMI_SetBaudRate() { HMI_data.Baud115K ? SetBaud115K() : SetBaud250K(); } void SetBaudRate() { + HMI_data.Baud115K ^= true; HMI_SetBaudRate(); Draw_Chkb_Line(CurrentMenu->line(), HMI_data.Baud115K); DWIN_UpdateLCD(); @@ -2268,9 +2267,7 @@ void SetPID(celsius_t t, heater_id_t h) { #endif #if HAS_COLOR_LEDS void ApplyLEDColor() { - HMI_data.Led_Color = LEDColor( - TERN(HAS_WHITE_LED, { 0, 0, 0, leds.color.w }, { leds.color.r, leds.color.g, leds.color.b }) - ); + HMI_data.Led_Color = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, HMI_data.Led_Color.w) } ); } void LiveLEDColor(uint8_t *color) { *color = MenuData.Value; leds.update(); } void LiveLEDColorR() { LiveLEDColor(&leds.color.r); } @@ -3415,7 +3412,7 @@ void Draw_GetColor_Menu() { EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_GREEN, onDrawPInt8Menu, SetLEDColorG, &leds.color.g); EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_BLUE, onDrawPInt8Menu, SetLEDColorB, &leds.color.b); #if ENABLED(HAS_WHITE_LED) - EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLedColorW, &leds.color.w); + EDIT_ITEM_F(ICON_LedControl, MSG_COLORS_WHITE, onDrawPInt8Menu, SetLEDColorW, &leds.color.w); #endif #endif #endif @@ -3828,6 +3825,7 @@ void Draw_Steps_Menu() { #endif // AUTO_BED_LEVELING_UBL #if HAS_MESH + void Draw_MeshSet_Menu() { checkkey = Menu; if (SetMenu(MeshMenu, GET_TEXT_F(MSG_MESH_LEVELING), 15)) { diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 98aadb8e73..dffc26478d 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -37,13 +37,15 @@ #include "../../../inc/MarlinConfigPre.h" #include "../common/dwin_color.h" +#if ENABLED(LED_CONTROL_MENU) + #include "../../../feature/leds/leds.h" +#endif #include #if defined(__STM32F1__) || defined(STM32F1) #define DASH_REDRAW 1 #endif - #define Def_Background_Color RGB( 1, 12, 8) #define Def_Cursor_color RGB(20, 49, 31) #define Def_TitleBg_color RGB( 0, 23, 16) diff --git a/Marlin/src/lcd/tft/tft_image.h b/Marlin/src/lcd/tft/tft_image.h index de046fb0c4..0697510774 100644 --- a/Marlin/src/lcd/tft/tft_image.h +++ b/Marlin/src/lcd/tft/tft_image.h @@ -114,7 +114,13 @@ enum colorMode_t : uint8_t { typedef colorMode_t ColorMode; -typedef struct __attribute__((__packed__)) { +#ifdef __AVR__ + #define PACKED __attribute__((__packed__)) +#else + #define PACKED +#endif + +typedef struct PACKED { void *data; uint16_t width; uint16_t height; diff --git a/Marlin/src/libs/MAX31865.cpp b/Marlin/src/libs/MAX31865.cpp index 0d709b1b0b..3fe0694644 100644 --- a/Marlin/src/libs/MAX31865.cpp +++ b/Marlin/src/libs/MAX31865.cpp @@ -489,9 +489,9 @@ float MAX31865::temperature(float rtd_res) { temp = RTD_C[0]; temp += rpoly * RTD_C[1]; rpoly *= rtd_res; temp += rpoly * RTD_C[2]; - if (MAX31865_APPROX >= 3) rpoly *= rtd_res; temp += rpoly * RTD_C[3]; - if (MAX31865_APPROX >= 4) rpoly *= rtd_res; temp += rpoly * RTD_C[4]; - if (MAX31865_APPROX >= 5) rpoly *= rtd_res; temp += rpoly * RTD_C[5]; + if (MAX31865_APPROX >= 3) { rpoly *= rtd_res; temp += rpoly * RTD_C[3]; } + if (MAX31865_APPROX >= 4) { rpoly *= rtd_res; temp += rpoly * RTD_C[4]; } + if (MAX31865_APPROX >= 5) { rpoly *= rtd_res; temp += rpoly * RTD_C[5]; } } return temp; diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index eaf3ab5409..0bf6dfb7d9 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -300,6 +300,73 @@ void report_current_position_projected() { #endif +#if IS_KINEMATIC + + bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset/*=0*/) { + + bool can_reach; + + #if ENABLED(DELTA) + + can_reach = HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS - inset + fslop); + + #elif ENABLED(AXEL_TPARA) + + const float R2 = HYPOT2(rx - TPARA_OFFSET_X, ry - TPARA_OFFSET_Y); + can_reach = ( + R2 <= sq(L1 + L2) - inset + #if MIDDLE_DEAD_ZONE_R > 0 + && R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) + #endif + ); + + #elif IS_SCARA + + const float R2 = HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y); + can_reach = ( + R2 <= sq(L1 + L2) - inset + #if MIDDLE_DEAD_ZONE_R > 0 + && R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) + #endif + ); + + #elif ENABLED(POLARGRAPH) + + const float d1 = rx - (draw_area_min.x), + d2 = (draw_area_max.x) - rx, + y = ry - (draw_area_max.y), + a = HYPOT(d1, y), + b = HYPOT(d2, y); + + can_reach = ( + a < polargraph_max_belt_len + 1 + && b < polargraph_max_belt_len + 1 + && (a + b) > _MIN(draw_area_size.x, draw_area_size.y) + ); + + #endif + + return can_reach; + } + +#else // CARTESIAN + + // Return true if the given position is within the machine bounds. + bool position_is_reachable(const_float_t rx, const_float_t ry) { + if (!COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false; + #if ENABLED(DUAL_X_CARRIAGE) + if (active_extruder) + return COORDINATE_OKAY(rx, X2_MIN_POS - fslop, X2_MAX_POS + fslop); + else + return COORDINATE_OKAY(rx, X1_MIN_POS - fslop, X1_MAX_POS + fslop); + #else + return COORDINATE_OKAY(rx, X_MIN_POS - fslop, X_MAX_POS + fslop); + #endif + } + +#endif // CARTESIAN + + void home_if_needed(const bool keeplev/*=false*/) { if (!all_axes_trusted()) gcode.home_all_axes(keeplev); } diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index ec47818877..ce90947657 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -549,63 +549,21 @@ void home_if_needed(const bool keeplev=false); #endif // Return true if the given point is within the printable area - inline bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset=0) { - #if ENABLED(DELTA) - - return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS - inset + fslop); - - #elif ENABLED(POLARGRAPH) - - const float x1 = rx - (X_MIN_POS), x2 = (X_MAX_POS) - rx, y = ry - (Y_MAX_POS), - a = HYPOT(x1, y), b = HYPOT(x2, y); - return a < (POLARGRAPH_MAX_BELT_LEN) + 1 - && b < (POLARGRAPH_MAX_BELT_LEN) + 1 - && (a + b) > _MIN(X_BED_SIZE, Y_BED_SIZE); - - #elif ENABLED(AXEL_TPARA) - - const float R2 = HYPOT2(rx - TPARA_OFFSET_X, ry - TPARA_OFFSET_Y); - return ( - R2 <= sq(L1 + L2) - inset - #if MIDDLE_DEAD_ZONE_R > 0 - && R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) - #endif - ); - - #elif IS_SCARA - - const float R2 = HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y); - return ( - R2 <= sq(L1 + L2) - inset - #if MIDDLE_DEAD_ZONE_R > 0 - && R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) - #endif - ); - - #endif - } + bool position_is_reachable(const_float_t rx, const_float_t ry, const float inset=0); inline bool position_is_reachable(const xy_pos_t &pos, const float inset=0) { return position_is_reachable(pos.x, pos.y, inset); } -#else // CARTESIAN +#else // Return true if the given position is within the machine bounds. - inline bool position_is_reachable(const_float_t rx, const_float_t ry) { - if (!COORDINATE_OKAY(ry, Y_MIN_POS - fslop, Y_MAX_POS + fslop)) return false; - #if ENABLED(DUAL_X_CARRIAGE) - if (active_extruder) - return COORDINATE_OKAY(rx, X2_MIN_POS - fslop, X2_MAX_POS + fslop); - else - return COORDINATE_OKAY(rx, X1_MIN_POS - fslop, X1_MAX_POS + fslop); - #else - return COORDINATE_OKAY(rx, X_MIN_POS - fslop, X_MAX_POS + fslop); - #endif + bool position_is_reachable(const_float_t rx, const_float_t ry); + inline bool position_is_reachable(const xy_pos_t &pos) { + return position_is_reachable(pos.x, pos.y); } - inline bool position_is_reachable(const xy_pos_t &pos) { return position_is_reachable(pos.x, pos.y); } -#endif // CARTESIAN +#endif /** * Duplication mode diff --git a/Marlin/src/module/polargraph.cpp b/Marlin/src/module/polargraph.cpp index b7eeeee8af..42f99304d7 100644 --- a/Marlin/src/module/polargraph.cpp +++ b/Marlin/src/module/polargraph.cpp @@ -39,8 +39,15 @@ float segments_per_second; // Initialized by settings.load() +xy_pos_t draw_area_min = { X_MIN_POS, Y_MIN_POS }, + draw_area_max = { X_MAX_POS, Y_MAX_POS }; + +xy_float_t draw_area_size = { X_MAX_POS - X_MIN_POS, Y_MAX_POS - Y_MIN_POS }; + +float polargraph_max_belt_len = HYPOT(draw_area_size.x, draw_area_size.y); + void inverse_kinematics(const xyz_pos_t &raw) { - const float x1 = raw.x - (X_MIN_POS), x2 = (X_MAX_POS) - raw.x, y = raw.y - (Y_MAX_POS); + const float x1 = raw.x - (draw_area_min.x), x2 = (draw_area_max.x) - raw.x, y = raw.y - (draw_area_max.y); delta.set(HYPOT(x1, y), HYPOT(x2, y), raw.z); } diff --git a/Marlin/src/module/polargraph.h b/Marlin/src/module/polargraph.h index 0406034253..b465de3287 100644 --- a/Marlin/src/module/polargraph.h +++ b/Marlin/src/module/polargraph.h @@ -29,5 +29,8 @@ #include "../core/macros.h" extern float segments_per_second; +extern xy_pos_t draw_area_min, draw_area_max; +extern xy_float_t draw_area_size; +extern float polargraph_max_belt_len; void inverse_kinematics(const xyz_pos_t &raw); diff --git a/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h new file mode 100644 index 0000000000..1cda5db669 --- /dev/null +++ b/Marlin/src/pins/lpc1768/pins_EMOTRONIC.h @@ -0,0 +1,151 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * eMotion-Tech eMotronic pin assignments + * + * Board pins<->features assignments are based on the + * Micro-Delta Rework printer default connections. + */ + +#include "env_validate.h" + +#define BOARD_INFO_NAME "eMotronic" +#define BOARD_WEBSITE_URL "www.reprap-france.com/article/lemotronic-quesaco" + +// +// Limit Switches +// +#define X_STOP_PIN P1_22 // S0 +#define Y_STOP_PIN P1_23 // S1 +#define Z_STOP_PIN P1_24 // S2 +#define I_STOP_PIN P1_25 // S3 + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN P0_26 // S4 (opto) +#endif + +// +// Steppers +// +#define X_STEP_PIN P2_02 // M3 +#define X_DIR_PIN P4_28 +#define X_ENABLE_PIN P4_29 + +#define Y_STEP_PIN P2_01 // M2 +#define Y_DIR_PIN P0_22 +#define Y_ENABLE_PIN P0_21 + +#define Z_STEP_PIN P2_00 // M1 +#define Z_DIR_PIN P3_26 +#define Z_ENABLE_PIN P3_25 + +#define E0_STEP_PIN P2_03 // M4 +#define E0_DIR_PIN P0_04 +#define E0_ENABLE_PIN P0_05 // Correct! + +#define E1_STEP_PIN P2_08 // M5 +#define E1_DIR_PIN P0_20 +#define E1_ENABLE_PIN P0_19 + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_0_PIN P0_24_A1 // A1 (TH1) +#define TEMP_1_PIN P0_23_A0 // A0 (TH0) +#define TEMP_BED_PIN P0_25_A2 // A2 (TH2) + +// +// Heaters / Fans +// +#define _H0_PIN P2_04 // (H0: 15A) + +#define HEATER_BED_PIN P2_05 // (H1: 10A shared) +#define HEATER_0_PIN P2_06 // (H2: 10A shared) +#define HEATER_1_PIN P2_07 // (H3: 10A shared) + +#define FAN_PIN P2_11 // (FAN0: 1A) +#define FAN1_PIN P2_13 // (FAN1: 1A) + +// +// Extension ports +// +// warning: pins are backward numbered w.r.t. to the +// schematics, e.g. EXP1_01 / EXP1_02 are X1-10 / X1-9. +#define EXP1_01_PIN P0_28 // SCL0 +#define EXP1_02_PIN P0_27 // SDA0 +#define EXP1_03_PIN P0_16 // SSEL0 +#define EXP1_04_PIN P0_15 // SCK0 +#define EXP1_05_PIN P0_18 // MOSI0 +#define EXP1_06_PIN P0_17 // MISO0 +#define EXP1_07_PIN P1_31 +#define EXP1_08_PIN P1_30 +#define EXP1_09_PIN P0_02 // TX0 +#define EXP1_10_PIN P0_03 // RX0 + +#define EXP2_03_PIN P1_27 +#define EXP2_04_PIN P1_26 +#define EXP2_05_PIN P1_29 +#define EXP2_06_PIN P1_28 +#define EXP2_07_PIN P0_01 // SCL1 +#define EXP2_08_PIN P0_00 // SDA1 +#define EXP2_09_PIN P0_11 +#define EXP2_10_PIN P0_10 + +// +// SD Support +// +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +#if SD_CONNECTION_IS(ONBOARD) + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN P0_06 +#elif SD_CONNECTION_IS(LCD) + #define SD_SCK_PIN EXP1_04_PIN + #define SD_MISO_PIN EXP1_06_PIN + #define SD_MOSI_PIN EXP1_05_PIN + #define SD_SS_PIN EXP1_03_PIN + #define SD_DETECT_PIN EXP1_07_PIN +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "No custom SD drive cable defined for this board." +#endif + +// +// LCD / Controller +// +#if ENABLED(EMOTION_TECH_LCD) + #define BEEPER_PIN EXP2_10_PIN + #define DOGLCD_A0 EXP2_05_PIN + #define DOGLCD_CS EXP2_07_PIN + #define DOGLCD_SCK EXP1_04_PIN + #define DOGLCD_MOSI EXP1_05_PIN + + #define BTN_EN1 EXP2_04_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP2_09_PIN +#endif diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 8925993c36..a60365d980 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -402,6 +402,8 @@ #include "lpc1768/pins_BTT_SKR_V1_3.h" // LPC1768 env:LPC1768 #elif MB(BTT_SKR_V1_4) #include "lpc1768/pins_BTT_SKR_V1_4.h" // LPC1768 env:LPC1768 +#elif MB(EMOTRONIC) + #include "lpc1768/pins_EMOTRONIC.h" // LPC1768 env:LPC1768 // // LPC1769 ARM Cortex M3 diff --git a/buildroot/bin/mftest b/buildroot/bin/mftest index 9aa5e12732..edb4068546 100755 --- a/buildroot/bin/mftest +++ b/buildroot/bin/mftest @@ -30,6 +30,7 @@ OPTIONS -u --autoupload PIO Upload using the MOTHERBOARD environment. -v --verbose Extra output for debugging. -s --silent Silence build output from PlatformIO. + -d --default Restore to defaults before applying configs. env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41 " @@ -44,6 +45,7 @@ shopt -s extglob nocasematch # Matching patterns ISNUM='^[0-9]+$' +ISRST='^(restore)_' ISCMD='^(restore|opt|exec|use|pins|env)_' ISEXEC='^exec_' ISCONT='\\ *$' @@ -53,9 +55,10 @@ TESTENV='-' CHOICE=0 DEBUG=0 -while getopts 'abhmrsuvyn:t:-:' OFLAG; do +while getopts 'abdhmrsuvyn:t:-:' OFLAG; do case "${OFLAG}" in a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;; + d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;; h) EXIT_USAGE=1 ;; m) USE_MAKE=1 ; bugout "Using make with Docker..." ;; n) case "$OPTARG" in @@ -88,6 +91,7 @@ while getopts 'abhmrsuvyn:t:-:' OFLAG; do silent) SILENT_FLAG="-s" ;; make) USE_MAKE=1 ; bugout "Using make with Docker..." ;; debug|verbose) DEBUG=1 ; bugout "Debug ON" ;; + default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;; build) case "$OVAL" in ''|y|yes) BUILD_YES='Y' ;; n|no) BUILD_YES='N' ;; @@ -282,6 +286,11 @@ if [[ $CHOICE == 0 ]]; then fi fi +# +# Restore to defaults if requested +# +((DL_DEFAULTS)) && use_example_configs + # # Run the specified test lines # @@ -303,6 +312,7 @@ echo "$OUT" | { } ((IND == CHOICE)) && { GOTX=1 + [[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs" [[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' ) [[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; } } diff --git a/buildroot/bin/use_example_configs b/buildroot/bin/use_example_configs index cb3c2424d6..de2edc2468 100755 --- a/buildroot/bin/use_example_configs +++ b/buildroot/bin/use_example_configs @@ -9,28 +9,35 @@ # If a configpath has spaces (or quotes) escape them or enquote the path # +which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' +which wget >/dev/null && TOOL='wget -q -O wgot' + CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g') [[ $CURR == "bugfix-2.0.x" ]] && BRANCH=bugfix-2.0.x || BRANCH=bugfix-2.1.x -IFS=: read -r PART1 PART2 <<< "$@" -[[ -n $PART2 ]] && { REPO="$PART1" ; UDIR="$PART2" ; } \ - || { REPO=$BRANCH ; UDIR="$PART1" ; } -EXAMPLES="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/examples" +REPO=$BRANCH -which curl >/dev/null && TOOL='curl -L -s -S -f -o wgot' -which wget >/dev/null && TOOL='wget -q -O wgot' +if [[ $# > 0 ]]; then + IFS=: read -r PART1 PART2 <<< "$@" + [[ -n $PART2 ]] && { UDIR="$PART2" ; REPO="$PART1" ; } \ + || { UDIR="$PART1" ; } + RDIR="${UDIR// /%20}" + echo "Fetching $UDIR configurations from $REPO..." + EXAMPLES="examples/$RDIR" +else + EXAMPLES="default" +fi + +CONFIGS="https://raw.githubusercontent.com/MarlinFirmware/Configurations/$REPO/config/${EXAMPLES}" restore_configs cd Marlin -RDIR="${UDIR// /%20}" -echo "Fetching $UDIR configurations from $REPO..." - -$TOOL "$EXAMPLES/$RDIR/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h -$TOOL "$EXAMPLES/$RDIR/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h -$TOOL "$EXAMPLES/$RDIR/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h -$TOOL "$EXAMPLES/$RDIR/_Statusscreen.h" >/dev/null 2>&1 && mv wgot _Statusscreen.h +$TOOL "$CONFIGS/Configuration.h" >/dev/null 2>&1 && mv wgot Configuration.h +$TOOL "$CONFIGS/Configuration_adv.h" >/dev/null 2>&1 && mv wgot Configuration_adv.h +$TOOL "$CONFIGS/_Bootscreen.h" >/dev/null 2>&1 && mv wgot _Bootscreen.h +$TOOL "$CONFIGS/_Statusscreen.h" >/dev/null 2>&1 && mv wgot _Statusscreen.h rm -f wgot cd - >/dev/null diff --git a/buildroot/share/git/mfprep b/buildroot/share/git/mfprep index 0c9e54fe8d..75776cbba3 100755 --- a/buildroot/share/git/mfprep +++ b/buildroot/share/git/mfprep @@ -2,7 +2,7 @@ # # mfprep tag1 [tag2] # -# Find commits in bugfix-2.1.x that are not yet in 2.0.x. +# Find commits in bugfix-2.1.x that are not yet in 2.1.x. # # Specify a version tag to start from, and optional version tag to end at. # For bugfix-2.1.x the tag will be prefixed by dev- to distinguish it from the version tag, diff --git a/platformio.ini b/platformio.ini index 30cd492695..66c085e06e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -272,7 +272,7 @@ lib_deps = ${common.lib_deps} monitor_speed = 250000 monitor_eol = LF monitor_echo = yes -monitor_filters = colorize, time, send_on_enter, log2file +monitor_filters = colorize, time, send_on_enter # # Just print the dependency tree