From 75da3555ee0910f3d572f4b8176afecdc941524b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 14 Dec 2023 10:03:11 -0600 Subject: [PATCH 01/73] =?UTF-8?q?=F0=9F=94=A7=20Update=20CLASSIC=5FJERK=20?= =?UTF-8?q?conditionals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/calibrate/G28.cpp | 4 +-- Marlin/src/gcode/config/M200-M205.cpp | 10 +++---- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/host/M360.cpp | 4 +-- Marlin/src/inc/Conditionals_LCD.h | 14 ---------- Marlin/src/inc/Conditionals_adv.h | 15 +++++++++++ Marlin/src/inc/Conditionals_post.h | 5 ---- Marlin/src/inc/SanityCheck.h | 4 +-- Marlin/src/lcd/e3v2/common/limits.h | 2 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 26 +++++++++---------- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +++---- Marlin/src/lcd/e3v2/proui/dwin.cpp | 14 +++++----- Marlin/src/lcd/e3v2/proui/dwin.h | 2 +- .../lcd/extui/mks_ui/draw_jerk_settings.cpp | 4 +-- .../extui/mks_ui/draw_machine_settings.cpp | 4 +-- .../src/lcd/extui/mks_ui/draw_number_key.cpp | 16 ++++++------ Marlin/src/lcd/extui/mks_ui/draw_ui.cpp | 4 +-- Marlin/src/lcd/menu/menu_advanced.cpp | 12 +++------ Marlin/src/module/planner.cpp | 12 ++++----- Marlin/src/module/planner.h | 6 ++--- Marlin/src/module/settings.cpp | 6 ++--- 21 files changed, 83 insertions(+), 93 deletions(-) diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index dbdbdc5affee..98d0a401481c 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -155,7 +155,7 @@ planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100; planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100; TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = 100); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) motion_state.jerk_state = planner.max_jerk; planner.max_jerk.set(0, 0 OPTARG(DELTA, 0)); #endif @@ -167,7 +167,7 @@ planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x; planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y; TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z); - TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state); + TERN_(CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state); planner.refresh_acceleration_rates(); } diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 06fbef631e75..7cdf4026b8ef 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -297,7 +297,7 @@ void GcodeSuite::M205() { if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units(); if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units(); #if HAS_JUNCTION_DEVIATION - #if HAS_CLASSIC_JERK && AXIS_COLLISION('J') + #if ENABLED(CLASSIC_JERK) && AXIS_COLLISION('J') #error "Can't set_max_jerk for 'J' axis because 'J' is used for Junction Deviation." #endif if (parser.seenval('J')) { @@ -310,7 +310,7 @@ void GcodeSuite::M205() { SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)"); } #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) bool seenZ = false; LOGICAL_AXIS_CODE( if (parser.seenval('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units()), @@ -328,14 +328,14 @@ void GcodeSuite::M205() { if (seenZ && planner.max_jerk.z <= 0.1f) SERIAL_ECHOLNPGM("WARNING! Low Z Jerk may lead to unwanted pauses."); #endif - #endif // HAS_CLASSIC_JERK + #endif // CLASSIC_JERK } void GcodeSuite::M205_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F( "Advanced (" M205_MIN_SEG_TIME_STR " S T" TERN_(HAS_JUNCTION_DEVIATION, " J") - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) NUM_AXIS_GANG( " X", " Y", " Z", " " STR_I "", " " STR_J "", " " STR_K "", @@ -352,7 +352,7 @@ void GcodeSuite::M205_report(const bool forReplay/*=true*/) { #if HAS_JUNCTION_DEVIATION , PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm) #endif - #if HAS_CLASSIC_JERK && NUM_AXES + #if ENABLED(CLASSIC_JERK) && NUM_AXES , LIST_N(DOUBLE(NUM_AXES), SP_X_STR, LINEAR_UNIT(planner.max_jerk.x), SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y), diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 67f55e2232b0..01b32118c825 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -55,7 +55,7 @@ void GcodeSuite::M92() { const float value = parser.value_per_axis_units((AxisEnum)(E_AXIS_N(target_extruder))); if (value < 20) { float factor = planner.settings.axis_steps_per_mm[E_AXIS_N(target_extruder)] / value; // increase e constants if M92 E14 is given for netfab. - #if HAS_CLASSIC_JERK && HAS_CLASSIC_E_JERK + #if ALL(CLASSIC_JERK, HAS_CLASSIC_E_JERK) planner.max_jerk.e *= factor; #endif planner.settings.max_feedrate_mm_s[E_AXIS_N(target_extruder)] *= factor; diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index 9649e99e17de..87aad88952f0 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -91,7 +91,7 @@ void GcodeSuite::M360() { // // XYZ Axis Jerk // - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) if (planner.max_jerk.x == planner.max_jerk.y) config_line(F("XY"), planner.max_jerk.x, FPSTR(JERK_STR)); else { @@ -182,7 +182,7 @@ void GcodeSuite::M360() { config_line(F("NumExtruder"), EXTRUDERS); #if HAS_EXTRUDERS EXTRUDER_LOOP() { - config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(HAS_CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK))); + config_line_e(e, JERK_STR, TERN(HAS_LINEAR_E_JERK, planner.max_e_jerk[E_INDEX_N(e)], TERN(CLASSIC_JERK, planner.max_jerk.e, DEFAULT_EJERK))); config_line_e(e, F("MaxSpeed"), planner.settings.max_feedrate_mm_s[E_AXIS_N(e)]); config_line_e(e, F("Acceleration"), planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(e)]); config_line_e(e, F("Diameter"), TERN(NO_VOLUMETRICS, DEFAULT_NOMINAL_FILAMENT_DIA, planner.filament_size[e])); diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 955b8fd960f4..37d56d4f1e56 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1615,20 +1615,6 @@ #undef DELTA_HOME_TO_SAFE_ZONE #endif -// This flag indicates some kind of jerk storage is needed -#if ANY(CLASSIC_JERK, IS_KINEMATIC) - #define HAS_CLASSIC_JERK 1 -#endif - -#if DISABLED(CLASSIC_JERK) - #define HAS_JUNCTION_DEVIATION 1 -#endif - -// E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA -#if HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))) - #define HAS_CLASSIC_E_JERK 1 -#endif - // // Serial Port Info // diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 755b251b1879..f62714df4b62 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -302,6 +302,21 @@ #endif #endif +// Use Junction Deviation for motion if Jerk is disabled +#if DISABLED(CLASSIC_JERK) + #define HAS_JUNCTION_DEVIATION 1 +#endif + +// E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA +#if HAS_EXTRUDERS && (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))) + #define HAS_CLASSIC_E_JERK 1 +#endif + +// Linear advance uses Jerk since E is an isolated axis +#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) + #define HAS_LINEAR_E_JERK 1 +#endif + /** * Temperature Sensors; define what sensor(s) we have. */ diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 09e020dab885..85b3a22cbf73 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -37,11 +37,6 @@ #define ADC_VREF_MV HAL_ADC_VREF_MV #endif -// Linear advance uses Jerk since E is an isolated axis -#if ALL(HAS_JUNCTION_DEVIATION, LIN_ADVANCE) - #define HAS_LINEAR_E_JERK 1 -#endif - // Determine which type of 'EEPROM' is in use #if ENABLED(EEPROM_SETTINGS) // EEPROM type may be defined by compile flags, configs, HALs, or pins diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2e1149e66874..1471d2d13c23 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1225,7 +1225,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L * Junction deviation is incompatible with kinematic systems. */ #if HAS_JUNCTION_DEVIATION && IS_KINEMATIC - #error "CLASSIC_JERK is required for DELTA, SCARA, and POLAR." + #error "CLASSIC_JERK is required for the kinematics of DELTA, SCARA, POLAR, etc." #endif /** @@ -1583,7 +1583,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #error "Only enable RESTORE_LEVELING_AFTER_G28 or ENABLE_LEVELING_AFTER_G28, but not both." #endif -#if HAS_MESH && HAS_CLASSIC_JERK +#if ALL(HAS_MESH, CLASSIC_JERK) static_assert(DEFAULT_ZJERK > 0.1, "Low DEFAULT_ZJERK values are incompatible with mesh-based leveling."); #endif #if HAS_MESH && DGUS_LCD_UI_IA_CREALITY && GRID_MAX_POINTS > 25 diff --git a/Marlin/src/lcd/e3v2/common/limits.h b/Marlin/src/lcd/e3v2/common/limits.h index da75d9c982c2..5debc3ffdb87 100644 --- a/Marlin/src/lcd/e3v2/common/limits.h +++ b/Marlin/src/lcd/e3v2/common/limits.h @@ -67,7 +67,7 @@ constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_A #define MIN_JERK_EDIT_VALUE 0.1 #define DEFAULT_MAX_JERK_MULTIPLIER 2 -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE), default_jerk = LOGICAL_AXIS_ARRAY( DEFAULT_EJERK, diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index 274390189107..c1e7a358c007 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -460,7 +460,7 @@ void drawBackFirst(const bool is_sel=true) { #define MOTION_CASE_RATE 1 #define MOTION_CASE_ACCEL 2 -#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(HAS_CLASSIC_JERK)) +#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(CLASSIC_JERK)) #define MOTION_CASE_STEPS (MOTION_CASE_JERK + 1) #define MOTION_CASE_TOTAL MOTION_CASE_STEPS @@ -1004,7 +1004,7 @@ void drawMotionMenu() { itemAreaCopy(173, 133, 228, 147, MOTION_CASE_RATE); // Max speed itemAreaCopy(173, 133, 200, 147, MOTION_CASE_ACCEL); // Max... itemAreaCopy(28, 149, 69, 161, MOTION_CASE_ACCEL, 30, 1); // ...Acceleration - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) itemAreaCopy(173, 133, 200, 147, MOTION_CASE_JERK); // Max... itemAreaCopy(1, 180, 28, 192, MOTION_CASE_JERK, 30, 1); // ... itemAreaCopy(202, 133, 228, 147, MOTION_CASE_JERK, 57); // ...Jerk @@ -1020,14 +1020,14 @@ void drawMotionMenu() { #ifdef USE_STRING_TITLES dwinDrawLabel(MOTION_CASE_RATE, F("Feedrate")); // "Feedrate" dwinDrawLabel(MOTION_CASE_ACCEL, GET_TEXT_F(MSG_ACCELERATION)); // "Acceleration" - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dwinDrawLabel(MOTION_CASE_JERK, GET_TEXT_F(MSG_JERK)); // "Jerk" #endif dwinDrawLabel(MOTION_CASE_STEPS, GET_TEXT_F(MSG_STEPS_PER_MM)); // "Steps/mm" #else say_max_en(MOTION_CASE_RATE); say_speed_en(30, MOTION_CASE_RATE); // "Max Speed" say_max_accel_en(MOTION_CASE_ACCEL); // "Max Acceleration" - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) say_max_en(MOTION_CASE_JERK); say_jerk_en(MOTION_CASE_JERK); // "Max Jerk" #endif say_steps_per_mm_en(MOTION_CASE_STEPS); // "Steps-per-mm" @@ -1041,7 +1041,7 @@ void drawMotionMenu() { #define _MOTION_ICON(N) drawMenuLine(++i, ICON_MaxSpeed + (N) - 1) _MOTION_ICON(MOTION_CASE_RATE); drawMoreIcon(i); _MOTION_ICON(MOTION_CASE_ACCEL); drawMoreIcon(i); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) _MOTION_ICON(MOTION_CASE_JERK); drawMoreIcon(i); #endif _MOTION_ICON(MOTION_CASE_STEPS); drawMoreIcon(i); @@ -1597,7 +1597,7 @@ void hmiMaxAccelerationXYZE() { drawEditInteger4(select_acc.now, hmiValues.maxAcceleration, true); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void hmiMaxJerkXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); @@ -1617,7 +1617,7 @@ void hmiMaxAccelerationXYZE() { drawEditFloat3(select_jerk.now, hmiValues.maxJerkScaled, true); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK void hmiStepXYZE() { EncoderState encoder_diffState = encoderReceiveAnalyze(); @@ -3349,7 +3349,7 @@ void drawMaxAccelMenu() { #endif } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu() { clearMainWindow(); @@ -3489,7 +3489,7 @@ void hmiMotion() { select_acc.reset(); drawMaxAccelMenu(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case MOTION_CASE_JERK: checkkey = ID_MaxJerk; select_jerk.reset(); @@ -3996,7 +3996,7 @@ void hmiMaxAcceleration() { dwinUpdateLCD(); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) // Max Jerk void hmiMaxJerk() { EncoderState encoder_diffState = get_encoder_state(); @@ -4025,7 +4025,7 @@ void hmiMaxAcceleration() { } dwinUpdateLCD(); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK // Step void hmiStep() { @@ -4251,7 +4251,7 @@ void dwinHandleScreen() { #endif case ID_MaxSpeed: hmiMaxSpeed(); break; case ID_MaxAcceleration: hmiMaxAcceleration(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: hmiMaxJerk(); break; #endif case ID_Step: hmiStep(); break; @@ -4274,7 +4274,7 @@ void dwinHandleScreen() { case ID_PrintSpeed: hmiPrintSpeed(); break; case ID_MaxSpeedValue: hmiMaxFeedspeedXYZE(); break; case ID_MaxAccelerationValue: hmiMaxAccelerationXYZE(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerkValue: hmiMaxJerkXYZE(); break; #endif case ID_StepValue: hmiStepXYZE(); break; diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index be8605e3bba0..1cb2a2efedfb 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2333,7 +2333,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #define MOTION_HOMEOFFSETS (MOTION_BACK + 1) #define MOTION_SPEED (MOTION_HOMEOFFSETS + 1) #define MOTION_ACCEL (MOTION_SPEED + 1) - #define MOTION_JERK (MOTION_ACCEL + ENABLED(HAS_CLASSIC_JERK)) + #define MOTION_JERK (MOTION_ACCEL + ENABLED(CLASSIC_JERK)) #define MOTION_STEPS (MOTION_JERK + 1) #define MOTION_FLOW (MOTION_STEPS + ENABLED(HAS_HOTEND)) #define MOTION_LA (MOTION_FLOW + ENABLED(LIN_ADVANCE)) @@ -2364,7 +2364,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else drawMenu(ID_MaxAcceleration); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case MOTION_JERK: if (draw) drawMenuItem(row, ICON_MaxJerk, GET_TEXT_F(MSG_JERK), nullptr, true); @@ -2553,7 +2553,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #endif } break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: #define JERK_BACK 0 @@ -4170,7 +4170,7 @@ FSTR_P JyersDWIN::getMenuTitle(const uint8_t menu) { case ID_HomeOffsets: return GET_TEXT_F(MSG_SET_HOME_OFFSETS); case ID_MaxSpeed: return GET_TEXT_F(MSG_MAX_SPEED); case ID_MaxAcceleration: return F("Max Acceleration"); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: return F("Max Jerk"); #endif case ID_Steps: return GET_TEXT_F(MSG_STEPS_PER_MM); @@ -4247,7 +4247,7 @@ uint8_t JyersDWIN::getMenuSize(const uint8_t menu) { case ID_HomeOffsets: return HOMEOFFSETS_TOTAL; case ID_MaxSpeed: return SPEED_TOTAL; case ID_MaxAcceleration: return ACCEL_TOTAL; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MaxJerk: return JERK_TOTAL; #endif case ID_Steps: return STEPS_TOTAL; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 7c68c60f8195..8d54e0c582ec 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -236,7 +236,7 @@ Menu *filamentMenu = nullptr; Menu *temperatureMenu = nullptr; Menu *maxSpeedMenu = nullptr; Menu *maxAccelMenu = nullptr; -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) Menu *maxJerkMenu = nullptr; #endif Menu *stepsMenu = nullptr; @@ -2545,7 +2545,7 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu void setMaxAccelE() { hmiValue.axis = E_AXIS; setIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], applyMaxAccel); } #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void applyMaxJerk() { planner.set_max_jerk(hmiValue.axis, menuData.value / MINUNITMULT); } #if HAS_X_AXIS void setMaxJerkX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); } @@ -2880,7 +2880,7 @@ void onDrawAcc(MenuItem* menuitem, int8_t line) { } #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void onDrawJerk(MenuItem* menuitem, int8_t line) { if (hmiIsChinese()) { @@ -2941,7 +2941,7 @@ void onDrawAcc(MenuItem* menuitem, int8_t line) { #endif -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK #if HAS_X_AXIS void onDrawStepsX(MenuItem* menuitem, int8_t line) { @@ -3451,7 +3451,7 @@ void drawMotionMenu() { BACK_ITEM(drawControlMenu); MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, drawMaxSpeedMenu); MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, drawMaxAccelMenu); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) MENU_ITEM(ICON_MaxJerk, MSG_JERK, onDrawJerk, drawMaxJerkMenu); #elif HAS_JUNCTION_DEVIATION EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm); @@ -3616,7 +3616,7 @@ void drawMaxAccelMenu() { updateMenu(maxAccelMenu); } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu() { checkkey = ID_Menu; @@ -3638,7 +3638,7 @@ void drawMaxAccelMenu() { updateMenu(maxJerkMenu); } -#endif // HAS_CLASSIC_JERK +#endif // CLASSIC_JERK void drawStepsMenu() { checkkey = ID_Menu; diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index cf4f9e264353..8706a18fac65 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -341,7 +341,7 @@ void drawFilamentManMenu(); void drawTemperatureMenu(); void drawMaxSpeedMenu(); void drawMaxAccelMenu(); -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) void drawMaxJerkMenu(); #endif void drawStepsMenu(); diff --git a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp index 5b22103e8f2d..474f06939f8e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp @@ -22,7 +22,7 @@ #include "../../../inc/MarlinConfigPre.h" -#if ALL(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK) +#if ALL(HAS_TFT_LVGL_UI, CLASSIC_JERK) #include "draw_ui.h" #include @@ -96,4 +96,4 @@ void lv_clear_jerk_settings() { lv_obj_del(scr); } -#endif // HAS_TFT_LVGL_UI && HAS_CLASSIC_JERK +#endif // HAS_TFT_LVGL_UI && CLASSIC_JERK diff --git a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp index c81002e3e054..f6969783690e 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_machine_settings.cpp @@ -46,7 +46,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { case ID_MACHINE_RETURN: draw_return_ui(); break; case ID_MACHINE_ACCELERATION: lv_draw_acceleration_settings(); break; case ID_MACHINE_FEEDRATE: lv_draw_max_feedrate_settings(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case ID_MACHINE_JERK: lv_draw_jerk_settings(); break; #endif } @@ -58,7 +58,7 @@ void lv_draw_machine_settings() { lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_ACCELERATION, 0); y += PARA_UI_POS_Y; lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_FEEDRATE, 1); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) y += PARA_UI_POS_Y; lv_screen_menu_item(scr, machine_menu.JerkConf, PARA_UI_POS_X, y, event_handler, ID_MACHINE_JERK, 2); #endif diff --git a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp index 9bb93e333394..c39678ed0f88 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp @@ -118,22 +118,22 @@ static void disp_key_value() { break; case XJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.x, 1, 1, public_buf_m); #endif break; case YJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.y, 1, 1, public_buf_m); #endif break; case ZJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.z, 1, 1, public_buf_m); #endif break; case EJerk: - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) dtostrf(planner.max_jerk.e, 1, 1, public_buf_m); #endif break; @@ -307,10 +307,10 @@ static void set_value_confirm() { case ZMaxFeedRate: planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); break; case E0MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); break; case E1MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); break; - case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break; - case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break; - case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break; - case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break; + case XJerk: TERN_(CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break; + case YJerk: TERN_(CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break; + case ZJerk: TERN_(CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break; + case EJerk: TERN_(CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break; case Xstep: planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Ystep: planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); planner.refresh_positioning(); break; case Zstep: planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); planner.refresh_positioning(); break; diff --git a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp index 5d44090a775c..13dbb5dee5ff 100644 --- a/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/mks_ui/draw_ui.cpp @@ -951,7 +951,7 @@ void clear_cur_ui() { case MAXFEEDRATE_UI: lv_clear_max_feedrate_settings(); break; case STEPS_UI: lv_clear_step_settings(); break; case ACCELERATION_UI: lv_clear_acceleration_settings(); break; - case JERK_UI: TERN_(HAS_CLASSIC_JERK, lv_clear_jerk_settings()); break; + case JERK_UI: TERN_(CLASSIC_JERK, lv_clear_jerk_settings()); break; case MOTORDIR_UI: break; case HOMESPEED_UI: break; case NOZZLE_CONFIG_UI: break; @@ -1061,7 +1061,7 @@ void draw_return_ui() { case MAXFEEDRATE_UI: lv_draw_max_feedrate_settings(); break; case STEPS_UI: lv_draw_step_settings(); break; case ACCELERATION_UI: lv_draw_acceleration_settings(); break; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) case JERK_UI: lv_draw_jerk_settings(); break; #endif case MOTORDIR_UI: break; diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 51fb55c9a471..95d965bdf998 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -587,18 +587,12 @@ void menu_backlash(); #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) void menu_advanced_jerk() { START_MENU(); BACK_ITEM(MSG_ADVANCED_SETTINGS); - #if HAS_JUNCTION_DEVIATION - EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, TERN(LIN_ADVANCE, 0.3f, 0.5f) - OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) - ); - #endif - constexpr xyze_float_t max_jerk_edit = #ifdef MAX_JERK_EDIT_VALUES MAX_JERK_EDIT_VALUES @@ -711,12 +705,12 @@ void menu_advanced_settings() { if (!is_busy) SUBMENU(MSG_INPUT_SHAPING, menu_advanced_input_shaping); #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) // M205 - Max Jerk SUBMENU(MSG_JERK, menu_advanced_jerk); #elif HAS_JUNCTION_DEVIATION EDIT_ITEM(float43, MSG_JUNCTION_DEVIATION, &planner.junction_deviation_mm, 0.001f, 0.3f - OPTARG(LIN_ADVANCE, planner.recalculate_max_e_jerk) + OPTARG(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk) ); #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 70a1b105db74..61dff55caf94 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -155,7 +155,7 @@ float Planner::mm_per_step[DISTINCT_AXES]; // (mm) Millimeters per step #endif #endif -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) Planner::max_jerk; #endif @@ -1574,7 +1574,7 @@ void Planner::check_axes_activity() { saved_motion_state.acceleration.z = settings.max_acceleration_mm_per_s2[Z_AXIS]; settings.max_acceleration_mm_per_s2[Z_AXIS] = 100; #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) saved_motion_state.jerk_state = max_jerk; max_jerk.set(0, 0 OPTARG(DELTA, 0)); #endif @@ -1583,7 +1583,7 @@ void Planner::check_axes_activity() { settings.max_acceleration_mm_per_s2[X_AXIS] = saved_motion_state.acceleration.x; settings.max_acceleration_mm_per_s2[Y_AXIS] = saved_motion_state.acceleration.y; TERN_(DELTA, settings.max_acceleration_mm_per_s2[Z_AXIS] = saved_motion_state.acceleration.z); - TERN_(HAS_CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state); + TERN_(CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state); } refresh_acceleration_rates(); } @@ -2766,7 +2766,7 @@ bool Planner::_populate_block( #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) /** * Adapted from Průša MKS firmware @@ -2863,7 +2863,7 @@ bool Planner::_populate_block( vmax_junction_sqr = sq(vmax_junction); // Go up or down to the new speed #endif - #endif // Classic Jerk Limiting + #endif // CLASSIC_JERK // Max entry speed of this block equals the max exit speed of the previous block. block->max_entry_speed_sqr = vmax_junction_sqr; @@ -3398,7 +3398,7 @@ void Planner::set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS) { settings.max_feedrate_mm_s[axis] = inMaxFeedrateMMS; } -#if HAS_CLASSIC_JERK +#if ENABLED(CLASSIC_JERK) /** * For the specified 'axis' set the Maximum Jerk (instant change) to the given value (mm/s) diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 5c9830757790..e746071de9b3 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -355,7 +355,7 @@ typedef struct { #if ENABLED(IMPROVE_HOMING_RELIABILITY) struct motion_state_t { TERN(DELTA, xyz_ulong_t, xy_ulong_t) acceleration; - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) TERN(DELTA, xyz_float_t, xy_float_t) jerk_state; #endif }; @@ -477,7 +477,7 @@ class Planner { #endif #endif - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) // (mm/s^2) M205 XYZ(E) - The largest speed change requiring no acceleration. static TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) max_jerk; #endif @@ -602,7 +602,7 @@ class Planner { static void set_max_feedrate(const AxisEnum axis, float inMaxFeedrateMMS); // For an axis set the Maximum Jerk (instant change) in mm/s - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) static void set_max_jerk(const AxisEnum axis, float inMaxJerkMMS); #else static void set_max_jerk(const AxisEnum, const_float_t) {} diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index b99ae8ddcda7..fa7beee94b84 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -850,7 +850,7 @@ void MarlinSettings::postprocess() { { EEPROM_WRITE(planner.settings); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) EEPROM_WRITE(planner.max_jerk); #if HAS_LINEAR_E_JERK dummyf = float(DEFAULT_EJERK); @@ -1880,7 +1880,7 @@ void MarlinSettings::postprocess() { EEPROM_READ(planner.settings.min_feedrate_mm_s); EEPROM_READ(planner.settings.min_travel_feedrate_mm_s); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) EEPROM_READ(planner.max_jerk); #if HAS_LINEAR_E_JERK EEPROM_READ(dummyf); @@ -3094,7 +3094,7 @@ void MarlinSettings::reset() { planner.settings.min_feedrate_mm_s = feedRate_t(DEFAULT_MINIMUMFEEDRATE); planner.settings.min_travel_feedrate_mm_s = feedRate_t(DEFAULT_MINTRAVELFEEDRATE); - #if HAS_CLASSIC_JERK + #if ENABLED(CLASSIC_JERK) #if HAS_X_AXIS && !defined(DEFAULT_XJERK) #define DEFAULT_XJERK 0 #endif From b90133813a96ce839e17da039b2679601ee59afc Mon Sep 17 00:00:00 2001 From: Mihai <299015+mh-dm@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:16:15 +0200 Subject: [PATCH 02/73] =?UTF-8?q?=F0=9F=90=9B=20Fix=20planner=20jerk=20lim?= =?UTF-8?q?its=20(#26529)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/config/M200-M205.cpp | 5 +- Marlin/src/gcode/motion/G4.cpp | 7 +- Marlin/src/module/planner.cpp | 192 ++++++++++---------------- Marlin/src/module/planner.h | 4 +- 4 files changed, 79 insertions(+), 129 deletions(-) diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index 7cdf4026b8ef..899f12099bbd 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -297,14 +297,11 @@ void GcodeSuite::M205() { if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units(); if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units(); #if HAS_JUNCTION_DEVIATION - #if ENABLED(CLASSIC_JERK) && AXIS_COLLISION('J') - #error "Can't set_max_jerk for 'J' axis because 'J' is used for Junction Deviation." - #endif if (parser.seenval('J')) { const float junc_dev = parser.value_linear_units(); if (WITHIN(junc_dev, 0.01f, 0.3f)) { planner.junction_deviation_mm = junc_dev; - TERN_(LIN_ADVANCE, planner.recalculate_max_e_jerk()); + TERN_(HAS_LINEAR_E_JERK, planner.recalculate_max_e_jerk()); } else SERIAL_ERROR_MSG("?J out of range (0.01 to 0.3)"); diff --git a/Marlin/src/gcode/motion/G4.cpp b/Marlin/src/gcode/motion/G4.cpp index ebaa6aabc062..3244c4ea4d51 100644 --- a/Marlin/src/gcode/motion/G4.cpp +++ b/Marlin/src/gcode/motion/G4.cpp @@ -38,7 +38,8 @@ void GcodeSuite::G4() { SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP); #endif - if (!ui.has_status()) LCD_MESSAGE(MSG_DWELL); - - dwell(dwell_ms); + if (dwell_ms) { + if (!ui.has_status()) LCD_MESSAGE(MSG_DWELL); + dwell(dwell_ms); + } } diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 61dff55caf94..64c47301f58a 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -153,9 +153,7 @@ float Planner::mm_per_step[DISTINCT_AXES]; // (mm) Millimeters per step #if HAS_LINEAR_E_JERK float Planner::max_e_jerk[DISTINCT_E]; // Calculated from junction_deviation_mm #endif -#endif - -#if ENABLED(CLASSIC_JERK) +#else // CLASSIC_JERK TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) Planner::max_jerk; #endif @@ -2374,42 +2372,42 @@ bool Planner::_populate_block( // Limit speed on extruders, if any #if HAS_EXTRUDERS - { - current_speed.e = dist_mm.e * inverse_secs; - #if HAS_MIXER_SYNC_CHANNEL - // Move all mixing extruders at the specified rate - if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL) - current_speed.e *= MIXING_STEPPERS; - #endif - - const feedRate_t cs = ABS(current_speed.e), - max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)] - * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); - - if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); //respect max feedrate on any movement (doesn't matter if E axes only or not) - - #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) - const feedRate_t max_vfr = volumetric_extruder_feedrate_limit[extruder] - * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); + { + current_speed.e = dist_mm.e * inverse_secs; + #if HAS_MIXER_SYNC_CHANNEL + // Move all mixing extruders at the specified rate + if (mixer.get_current_vtool() == MIXER_AUTORETRACT_TOOL) + current_speed.e *= MIXING_STEPPERS; + #endif - // TODO: Doesn't work properly for joined segments. Set MIN_STEPS_PER_SEGMENT 1 as workaround. + const feedRate_t cs = ABS(current_speed.e), + max_fr = settings.max_feedrate_mm_s[E_AXIS_N(extruder)] + * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); - if (block->steps.a || block->steps.b || block->steps.c) { + if (cs > max_fr) NOMORE(speed_factor, max_fr / cs); //respect max feedrate on any movement (doesn't matter if E axes only or not) - if (max_vfr > 0 && cs > max_vfr) { - NOMORE(speed_factor, max_vfr / cs); // respect volumetric extruder limit (if any) - /* <-- add a slash to enable - SERIAL_ECHOPGM("volumetric extruder limit enforced: ", (cs * CIRCLE_AREA(filament_size[extruder] * 0.5f))); - SERIAL_ECHOPGM(" mm^3/s (", cs); - SERIAL_ECHOPGM(" mm/s) limited to ", (max_vfr * CIRCLE_AREA(filament_size[extruder] * 0.5f))); - SERIAL_ECHOPGM(" mm^3/s (", max_vfr); - SERIAL_ECHOLNPGM(" mm/s)"); - //*/ - } + #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) + const feedRate_t max_vfr = volumetric_extruder_feedrate_limit[extruder] + * TERN(HAS_MIXER_SYNC_CHANNEL, MIXING_STEPPERS, 1); + + // TODO: Doesn't work properly for joined segments. Set MIN_STEPS_PER_SEGMENT 1 as workaround. + + if (block->steps.a || block->steps.b || block->steps.c) { + + if (max_vfr > 0 && cs > max_vfr) { + NOMORE(speed_factor, max_vfr / cs); // respect volumetric extruder limit (if any) + /* <-- add a slash to enable + SERIAL_ECHOPGM("volumetric extruder limit enforced: ", (cs * CIRCLE_AREA(filament_size[extruder] * 0.5f))); + SERIAL_ECHOPGM(" mm^3/s (", cs); + SERIAL_ECHOPGM(" mm/s) limited to ", (max_vfr * CIRCLE_AREA(filament_size[extruder] * 0.5f))); + SERIAL_ECHOPGM(" mm^3/s (", max_vfr); + SERIAL_ECHOLNPGM(" mm/s)"); + //*/ } - #endif - } - #endif + } + #endif + } + #endif // HAS_EXTRUDERS #ifdef XY_FREQUENCY_LIMIT @@ -2492,7 +2490,7 @@ bool Planner::_populate_block( * * extruder_advance_K[extruder] : There is an advance factor set for this extruder. * - * dist.e > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) + * dist.e > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) */ use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && dist.e > 0; @@ -2511,9 +2509,10 @@ bool Planner::_populate_block( else { // Scale E acceleration so that it will be possible to jump to the advance speed. const uint32_t max_accel_steps_per_s2 = MAX_E_JERK(extruder) / (extruder_advance_K[E_INDEX_N(extruder)] * e_D_ratio) * steps_per_mm; - if (TERN0(LA_DEBUG, accel > max_accel_steps_per_s2)) - SERIAL_ECHOLNPGM("Acceleration limited."); - NOMORE(accel, max_accel_steps_per_s2); + if (accel > max_accel_steps_per_s2) { + accel = max_accel_steps_per_s2; + if (ENABLED(LA_DEBUG)) SERIAL_ECHOLNPGM("Acceleration limited."); + } } } #endif @@ -2764,104 +2763,59 @@ bool Planner::_populate_block( prev_unit_vec = unit_vec; - #endif - - #if ENABLED(CLASSIC_JERK) + #else // CLASSIC_JERK /** - * Adapted from Průša MKS firmware + * Heavily modified. Originally adapted from Průša firmware. * https://github.com/prusa3d/Prusa-Firmware */ - // Exit speed limited by a jerk to full halt of a previous last segment - static float previous_safe_speed; - - // Start with a safe speed (from which the machine may halt to stop immediately). - float safe_speed = block->nominal_speed; - #ifndef TRAVEL_EXTRA_XYJERK - #define TRAVEL_EXTRA_XYJERK 0 + #define TRAVEL_EXTRA_XYJERK 0.0f #endif - const float extra_xyjerk = TERN0(HAS_EXTRUDERS, dist.e <= 0) ? TRAVEL_EXTRA_XYJERK : 0; - - uint8_t limited = 0; - TERN(HAS_LINEAR_E_JERK, LOOP_NUM_AXES, LOOP_LOGICAL_AXES)(i) { - const float jerk = ABS(current_speed[i]), // cs : Starting from zero, change in speed for this axis - maxj = (max_jerk[i] + (i == X_AXIS || i == Y_AXIS ? extra_xyjerk : 0.0f)); // mj : The max jerk setting for this axis - if (jerk > maxj) { // cs > mj : New current speed too fast? - if (limited) { // limited already? - const float mjerk = block->nominal_speed * maxj; // ns*mj - if (jerk * safe_speed > mjerk) safe_speed = mjerk / jerk; // ns*mj/cs - } - else { - safe_speed *= maxj / jerk; // Initial limit: ns*mj/cs - ++limited; // Initially limited - } - } - } + const float extra_xyjerk = TERN0(HAS_EXTRUDERS, dist.e <= 0) ? TRAVEL_EXTRA_XYJERK : 0.0f; - float vmax_junction; - if (moves_queued && !UNEAR_ZERO(previous_nominal_speed)) { - // Estimate a maximum velocity allowed at a joint of two successive segments. - // If this maximum velocity allowed is lower than the minimum of the entry / exit safe velocities, - // then the machine is not coasting anymore and the safe entry / exit velocities shall be used. + if (!moves_queued || UNEAR_ZERO(previous_nominal_speed)) { + // Compute "safe" speed, limited by a jerk to/from full halt. - // Factor to multiply the previous / current nominal velocities to get componentwise limited velocities. - float v_factor = 1; - limited = 0; + float v_factor = 1.0f; + LOOP_LOGICAL_AXES(i) { + const float jerk = ABS(current_speed[i]), // Starting from zero, change in speed for this axis + maxj = max_jerk[i] + (i == X_AXIS || i == Y_AXIS ? extra_xyjerk : 0.0f); // The max jerk setting for this axis + if (jerk * v_factor > maxj) v_factor = maxj / jerk; + } + vmax_junction_sqr = sq(block->nominal_speed * v_factor); + NOLESS(minimum_planner_speed_sqr, vmax_junction_sqr); + } + else { + // Compute the maximum velocity allowed at a joint of two successive segments. // The junction velocity will be shared between successive segments. Limit the junction velocity to their minimum. - // Pick the smaller of the nominal speeds. Higher speed shall not be achieved at the junction during coasting. - float smaller_speed_factor = 1.0f; + float vmax_junction, previous_speed_factor, current_speed_factor; if (block->nominal_speed < previous_nominal_speed) { vmax_junction = block->nominal_speed; - smaller_speed_factor = vmax_junction / previous_nominal_speed; + previous_speed_factor = vmax_junction / previous_nominal_speed; + current_speed_factor = 1.0f; } - else + else { vmax_junction = previous_nominal_speed; + previous_speed_factor = 1.0f; + current_speed_factor = vmax_junction / block->nominal_speed; + } // Now limit the jerk in all axes. - TERN(HAS_LINEAR_E_JERK, LOOP_NUM_AXES, LOOP_LOGICAL_AXES)(axis) { - // Limit an axis. We have to differentiate: coasting, reversal of an axis, full stop. - float v_exit = previous_speed[axis] * smaller_speed_factor, - v_entry = current_speed[axis]; - if (limited) { - v_exit *= v_factor; - v_entry *= v_factor; - } - - // Calculate jerk depending on whether the axis is coasting in the same direction or reversing. - const float jerk = (v_exit > v_entry) - ? // coasting axis reversal - ( (v_entry > 0 || v_exit < 0) ? (v_exit - v_entry) : _MAX(v_exit, -v_entry) ) - : // v_exit <= v_entry coasting axis reversal - ( (v_entry < 0 || v_exit > 0) ? (v_entry - v_exit) : _MAX(-v_exit, v_entry) ); - - const float maxj = (max_jerk[axis] + (axis == X_AXIS || axis == Y_AXIS ? extra_xyjerk : 0.0f)); - - if (jerk > maxj) { - v_factor *= maxj / jerk; - ++limited; - } + float v_factor = 1.0f; + LOOP_LOGICAL_AXES(i) { + // Scale per-axis velocities for the same vmax_junction. + const float v_exit = previous_speed[i] * previous_speed_factor, + v_entry = current_speed[i] * current_speed_factor; + + // Jerk is the per-axis velocity difference. + const float jerk = ABS(v_exit - v_entry), + maxj = max_jerk[i] + (i == X_AXIS || i == Y_AXIS ? extra_xyjerk : 0.0f); + if (jerk * v_factor > maxj) v_factor = maxj / jerk; } - if (limited) vmax_junction *= v_factor; - // Now the transition velocity is known, which maximizes the shared exit / entry velocity while - // respecting the jerk factors, it may be possible, that applying separate safe exit / entry velocities will achieve faster prints. - const float vmax_junction_threshold = vmax_junction * 0.99f; - if (previous_safe_speed > vmax_junction_threshold && safe_speed > vmax_junction_threshold) - vmax_junction = safe_speed; + vmax_junction_sqr = sq(vmax_junction * v_factor); } - else - vmax_junction = safe_speed; - - previous_safe_speed = safe_speed; - - NOLESS(minimum_planner_speed_sqr, sq(safe_speed)); - - #if HAS_JUNCTION_DEVIATION - NOMORE(vmax_junction_sqr, sq(vmax_junction)); // Throttle down to max speed - #else - vmax_junction_sqr = sq(vmax_junction); // Go up or down to the new speed - #endif #endif // CLASSIC_JERK diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index e746071de9b3..726ccb4d3f81 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -475,9 +475,7 @@ class Planner { #if HAS_LINEAR_E_JERK static float max_e_jerk[DISTINCT_E]; // Calculated from junction_deviation_mm #endif - #endif - - #if ENABLED(CLASSIC_JERK) + #else // CLASSIC_JERK // (mm/s^2) M205 XYZ(E) - The largest speed change requiring no acceleration. static TERN(HAS_LINEAR_E_JERK, xyz_pos_t, xyze_pos_t) max_jerk; #endif From 7ab63cde62e35aa80f1c6fd65f35cb0bdc200b1d Mon Sep 17 00:00:00 2001 From: Bob Kuhn Date: Thu, 14 Dec 2023 17:37:40 -0600 Subject: [PATCH 03/73] =?UTF-8?q?=E2=9C=A8=20Creality=20E3=20Free-runs=20S?= =?UTF-8?q?ilent=20Motherboard=20(#25636)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 21 +- Marlin/src/pins/esp32/pins_MM_JOKER.h | 2 +- Marlin/src/pins/pins.h | 2 + .../pins/stm32f1/pins_CREALITY_V24S1_301.h | 2 +- .../pins/stm32f4/pins_CREALITY_CR4NTXXC10.h | 261 +++++++++ .../pins/stm32f4/pins_FYSETC_SPIDER_KING407.h | 2 +- .../boards/marlin_STM32F401RE_freeruns.json | 65 +++ .../PeripheralPins.c | 252 +++++++++ .../MARLIN_STM32F401RE_FREERUNS/PinNamesVar.h | 33 ++ .../hal_conf_custom.h | 495 ++++++++++++++++++ .../MARLIN_STM32F401RE_FREERUNS/ldscript.ld | 186 +++++++ .../MARLIN_STM32F401RE_FREERUNS/variant.cpp | 238 +++++++++ .../MARLIN_STM32F401RE_FREERUNS/variant.h | 154 ++++++ ini/stm32f4.ini | 27 + 14 files changed, 1727 insertions(+), 13 deletions(-) create mode 100644 Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_STM32F401RE_freeruns.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/hal_conf_custom.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index c55035e8f075..b51513bca9d6 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -454,16 +454,17 @@ #define BOARD_ARTILLERY_RUBY 5238 // Artillery Ruby (STM32F401RC) #define BOARD_FYSETC_SPIDER_V2_2 5239 // FYSETC Spider V2.2 (STM32F446VE) #define BOARD_CREALITY_V24S1_301F4 5240 // Creality v2.4.S1_301F4 (STM32F401RC) as found in the Ender-3 S1 F4 -#define BOARD_OPULO_LUMEN_REV4 5241 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG) -#define BOARD_FYSETC_SPIDER_KING407 5242 // FYSETC Spider King407 (STM32F407ZG) -#define BOARD_MKS_SKIPR_V1 5243 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) -#define BOARD_TRONXY_V10 5244 // TRONXY V10 (STM32F446ZE) -#define BOARD_CREALITY_F401RE 5245 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 -#define BOARD_BLACKPILL_CUSTOM 5246 // Custom board based on STM32F401CDU6. -#define BOARD_I3DBEEZ9_V1 5247 // I3DBEEZ9 V1 (STM32F407ZG) -#define BOARD_MELLOW_FLY_E3_V2 5248 // Mellow Fly E3 V2 (STM32F407VG) -#define BOARD_FYSETC_CHEETAH_V30 5249 // FYSETC Cheetah V3.0 (STM32F446RC) -#define BOARD_BLACKBEEZMINI_V1 5250 // BlackBeezMini V1 (STM32F401CCU6) +#define BOARD_CREALITY_CR4NTXXC10 5241 // Creality E3 Free-runs Silent Motherboard (STM32F401RET6) +#define BOARD_OPULO_LUMEN_REV4 5242 // Opulo Lumen PnP Controller REV4 (STM32F407VE / STM32F407VG) +#define BOARD_FYSETC_SPIDER_KING407 5243 // FYSETC Spider King407 (STM32F407ZG) +#define BOARD_MKS_SKIPR_V1 5244 // MKS SKIPR v1.0 all-in-one board (STM32F407VE) +#define BOARD_TRONXY_V10 5245 // TRONXY V10 (STM32F446ZE) +#define BOARD_CREALITY_F401RE 5246 // Creality CR4NS200141C13 (STM32F401RE) as found in the Ender-5 S1 +#define BOARD_BLACKPILL_CUSTOM 5247 // Custom board based on STM32F401CDU6. +#define BOARD_I3DBEEZ9_V1 5248 // I3DBEEZ9 V1 (STM32F407ZG) +#define BOARD_MELLOW_FLY_E3_V2 5249 // Mellow Fly E3 V2 (STM32F407VG) +#define BOARD_FYSETC_CHEETAH_V30 5250 // FYSETC Cheetah V3.0 (STM32F446RC) +#define BOARD_BLACKBEEZMINI_V1 5251 // BlackBeezMini V1 (STM32F401CCU6) // // ARM Cortex-M7 diff --git a/Marlin/src/pins/esp32/pins_MM_JOKER.h b/Marlin/src/pins/esp32/pins_MM_JOKER.h index 184a94c01b30..52ed543c33fd 100644 --- a/Marlin/src/pins/esp32/pins_MM_JOKER.h +++ b/Marlin/src/pins/esp32/pins_MM_JOKER.h @@ -220,7 +220,7 @@ #if HAS_WIRED_LCD //#define LCD_PINS_RS 13 - //#define LCD_PINS_ENABLE 17 + //#define LCD_PINS_EN 17 //#define LCD_PINS_D4 16 #if ENABLED(CR10_STOCKDISPLAY) diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 28ae5e8d42f8..842a79c320e4 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -796,6 +796,8 @@ #include "stm32f4/pins_ARTILLERY_RUBY.h" // STM32F4 env:Artillery_Ruby #elif MB(CREALITY_V24S1_301F4) #include "stm32f4/pins_CREALITY_V24S1_301F4.h" // STM32F4 env:STM32F401RC_creality env:STM32F401RC_creality_nobootloader env:STM32F401RC_creality_jlink env:STM32F401RC_creality_stlink +#elif MB(CREALITY_CR4NTXXC10) + #include "stm32f4/pins_CREALITY_CR4NTXXC10.h" // STM32F4 env:STM32F401RE_freeruns env:STM32F401RE_freeruns_jlink env:STM32F401RE_freeruns_stlink #elif MB(OPULO_LUMEN_REV4) #include "stm32f4/pins_OPULO_LUMEN_REV4.h" // STM32F4 env:Opulo_Lumen_REV4 #elif MB(FYSETC_SPIDER_KING407) diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h index ce942ba5450e..a99143bad976 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V24S1_301.h @@ -89,7 +89,7 @@ #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 #define SPINDLE_DIR_PIN PC0 // FET 4 - #define LASER_SOFT_PWM_PIN PC0 + //#define LASER_SOFT_PWM_PIN PC0 #endif #include "pins_CREALITY_V4.h" diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h new file mode 100644 index 000000000000..77be5777535a --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h @@ -0,0 +1,261 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * Creality CREALITY_CR4NTXXC10 (STM32F401RET6) board pin assignments + * + * Sold as "E3 Free-runs Silent Motherboard" + */ +#include "env_validate.h" + +#if HOTENDS > 1 || E_STEPPERS > 1 + #error "CR4NT220622C10 only supports one hotend / E-stepper." +#endif + +#if !AXIS_DRIVER_TYPE_X(TMC2209) || !AXIS_DRIVER_TYPE_Y(TMC2209) || !AXIS_DRIVER_TYPE_Z(TMC2209) || !AXIS_DRIVER_TYPE_E0(TMC2209) + #error "This board has onboard TMC2209 drivers for X, Y, Z, and E0." +#endif + +#ifndef BOARD_INFO_NAME + #define BOARD_INFO_NAME "CR4NT220622C10" +#endif +#ifndef DEFAULT_MACHINE_NAME + #define DEFAULT_MACHINE_NAME "Ender-3 Series" +#endif +#define BOARD_WEBSITE_URL "www.creality.com" + +#define BOARD_NO_NATIVE_USB +//#undef DISABLE_DEBUG // DISABLE_(DEBUG|JTAG) is not supported for STM32F4. +//#define DISABLE_JTAG + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #define IIC_BL24CXX_EEPROM // EEPROM on I2C-0 + //#define SDCARD_EEPROM_EMULATION + #undef NO_EEPROM_SELECTED +#endif + +#if ENABLED(IIC_BL24CXX_EEPROM) + #define IIC_EEPROM_SDA PA11 + #define IIC_EEPROM_SCL PA12 + #define MARLIN_EEPROM_SIZE 0x800 // 2K (24C16) +#elif ENABLED(SDCARD_EEPROM_EMULATION) + #define MARLIN_EEPROM_SIZE 0x800 // 2K +#endif + +// +// Servos +// +#define SERVO0_PIN PB0 // BLTouch PWM-OUT PIN (TOUCH pins in the schematic have changed) + +// +// Limit Switches +// +#define X_STOP_PIN PA5 +#define Y_STOP_PIN PA6 + +#if ENABLED(BLTOUCH) + #define Z_MIN_PIN PB1 // BLTouch IN PIN (TOUCH pins in the schematic have changed) + #define Z_MAX_PIN PA7 +#else + #define Z_STOP_PIN PA7 // Z-axis limit switch +#endif + +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PB1 // BLTouch IN +#endif + +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN PA4 // "Pulled-high" +#endif + +// +// Steppers +// +#define X_ENABLE_PIN PC3 +#define X_STEP_PIN PC2 +#define X_DIR_PIN PB9 + +#define Y_ENABLE_PIN PC3 +#define Y_STEP_PIN PB8 +#define Y_DIR_PIN PB7 + +#define Z_ENABLE_PIN PC3 +#define Z_STEP_PIN PB6 +#define Z_DIR_PIN PB5 + +#define E0_ENABLE_PIN PC3 +#define E0_STEP_PIN PB4 +#define E0_DIR_PIN PB3 + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC5 // TH1 +#define TEMP_BED_PIN PC4 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PA1 // HEATER1 +#define HEATER_BED_PIN PB10 // HOT BED + +#ifndef FAN0_PIN + #define FAN0_PIN PA0 // FAN +#endif +#if PIN_EXISTS(FAN0) + #define FAN_SOFT_PWM +#endif + +#if HAS_TMC_UART + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 + + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + #define X_HARDWARE_SERIAL Serial6 + #define Y_HARDWARE_SERIAL Serial6 + #define Z_HARDWARE_SERIAL Serial6 + #define E0_HARDWARE_SERIAL Serial6 + + #ifndef X_SLAVE_ADDRESS + #define X_SLAVE_ADDRESS 0 + #endif + #ifndef Y_SLAVE_ADDRESS + #define Y_SLAVE_ADDRESS 1 + #endif + #ifndef Z_SLAVE_ADDRESS + #define Z_SLAVE_ADDRESS 2 + #endif + #ifndef E0_SLAVE_ADDRESS + #define E0_SLAVE_ADDRESS 3 + #endif + + // Software serial + + #define X_SERIAL_TX_PIN PC6 + #define X_SERIAL_RX_PIN PC7 + + #define Y_SERIAL_TX_PIN X_SERIAL_TX_PIN + #define Y_SERIAL_RX_PIN X_SERIAL_RX_PIN + + #define Z_SERIAL_TX_PIN X_SERIAL_TX_PIN + #define Z_SERIAL_RX_PIN X_SERIAL_RX_PIN + + #define E0_SERIAL_TX_PIN X_SERIAL_TX_PIN + #define E0_SERIAL_RX_PIN X_SERIAL_RX_PIN + + #define E1_SERIAL_TX_PIN X_SERIAL_TX_PIN + #define E1_SERIAL_RX_PIN X_SERIAL_RX_PIN + + #define X_DIAG_PIN PC13 + #define Y_DIAG_PIN PC14 + #define Z_DIAG_PIN PC15 + #define E0_DIAG_PIN PA15 + +#endif // HAS_TMC_UART + +// +// SD Card +// +#define SD_DETECT_PIN PC1 +#define SDCARD_CONNECTION ONBOARD +#define ONBOARD_SPI_DEVICE 1 +//#define ONBOARD_SD_CS_PIN PA4 // SDSS +#define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer + +#if ENABLED(CR10_STOCKDISPLAY) + + #if ENABLED(RET6_12864_LCD) + // RET6 12864 LCD + #define LCD_PINS_RS PB12 + #define LCD_PINS_EN PB15 + #define LCD_PINS_D4 PB13 + + #define BTN_ENC PB2 + #define BTN_EN1 PA2 + #define BTN_EN2 PB14 + + #ifndef HAS_PIN_27_BOARD + #define BEEPER_PIN PC0 + #endif + + #elif ENABLED(VET6_12864_LCD) + // VET6 12864 LCD + #define LCD_PINS_RS PA4 + //#define LCD_PINS_EN PA7 + #define LCD_PINS_D4 PA5 + + #define BTN_ENC PC5 + #define BTN_EN1 PB10 + #define BTN_EN2 PA6 + + #else + #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the CREALITY_CR4NTXXC10 controller." + #endif + +#elif ENABLED(DWIN_CREALITY_LCD) + + // RET6 DWIN ENCODER LCD + #define BTN_ENC PB14 + #define BTN_EN1 PB15 + #define BTN_EN2 PB12 + + //#define LCD_LED_PIN PB2 + #ifndef BEEPER_PIN + #define BEEPER_PIN PB13 + #undef SPEAKER + #endif + +#elif ENABLED(DWIN_VET6_CREALITY_LCD) + + // VET6 DWIN ENCODER LCD + #define BTN_ENC PA6 + //#define BTN_EN1 PA7 + #define BTN_EN2 PA4 + + #define BEEPER_PIN PA5 + +#endif + +// +// M3/M4/M5 - Spindle/Laser Control +// +#if HAS_CUTTER + //#undef HEATER_0_PIN + //#undef HEATER_BED_PIN + //#undef FAN0_PIN + #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 + #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET + #define SPINDLE_DIR_PIN PC0 // FET 4 + //#define LASER_SOFT_PWM_PIN PC0 +#endif diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_KING407.h b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_KING407.h index c79a4f5eb545..bfe4469084f0 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_KING407.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_SPIDER_KING407.h @@ -309,7 +309,7 @@ #define LCD_SDSS EXP2_07_PIN - #define LCD_PINS_ENABLE EXP1_08_PIN + #define LCD_PINS_EN EXP1_08_PIN #define LCD_PINS_D4 EXP1_06_PIN #if ENABLED(FYSETC_MINI_12864) diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32F401RE_freeruns.json b/buildroot/share/PlatformIO/boards/marlin_STM32F401RE_freeruns.json new file mode 100644 index 000000000000..3a8848e93418 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32F401RE_freeruns.json @@ -0,0 +1,65 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m4", + "extra_flags": "-DSTM32F401xx", + "f_cpu": "84000000L", + "hwids": [ + [ + "0x1EAF", + "0x0003" + ], + [ + "0x0483", + "0x3748" + ] + ], + "ldscript": "ldscript.ld", + "mcu": "stm32f401ret6", + "variant": "MARLIN_STM32F401RE_FREERUNS" + }, + "debug": { + "jlink_device": "STM32F401RE", + "openocd_target": "stm32f4x", + "svd_path": "STM32F40x.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32f4x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32F401RE (96k RAM. 512k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 98304, + "maximum_size": 524288, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink" + ], + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f401re.html", + "vendor": "Generic" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PeripheralPins.c new file mode 100644 index 000000000000..418ef5aa7abc --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PeripheralPins.c @@ -0,0 +1,252 @@ +/* + ******************************************************************************* + * Copyright (c) 2019, STMicroelectronics + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + * Automatically generated from STM32F401R[(B-C)|(D-E)]Tx.xml + */ +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Note: Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC1_IN0 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_IN1 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_IN5 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_IN7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_IN9 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_IN11 + {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_IN12 + {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_IN14 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_IN15 + {NC, NP, 0} +}; +#endif + +//*** No DAC *** + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_3, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C2)}, + {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF9_I2C3)}, + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_PWM[] = { + //{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + //{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + //{PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + //{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 + //{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + //{PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + //{PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + //{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + //{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + //{PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_RX[] = { + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {NC, NP, 0} +}; + +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + //{PA_4, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + //{PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** No CAN *** + +//*** No ETHERNET *** + +//*** No QUADSPI *** + +//*** USB *** + +#ifdef HAL_PCD_MODULE_ENABLED +WEAK const PinMap PinMap_USB_OTG_FS[] = { +#ifndef ARDUINO_CoreBoard_F401RC + {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF + {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS + {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID +#endif + {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM + {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP + {NC, NP, 0} +}; +#endif + +//*** No USB_OTG_HS *** + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PB_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D4 + {PB_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D5 + {PC_6, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D6 + {PC_7, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D7 + {PC_8, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D0 + {PC_9, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D1 + {PC_10, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D2 + {PC_11, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDIO)}, // SDIO_D3 + {PC_12, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CK + {PD_2, SDIO, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDIO)}, // SDIO_CMD + {NC, NP, 0} +}; +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PinNamesVar.h new file mode 100644 index 000000000000..f5db451e6f19 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/PinNamesVar.h @@ -0,0 +1,33 @@ +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = NC, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = NC, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = NC, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif +/* USB */ +#ifdef USBCON + USB_OTG_FS_SOF = PA_8, + USB_OTG_FS_VBUS = PA_9, + USB_OTG_FS_ID = PA_10, + USB_OTG_FS_DM = PA_11, + USB_OTG_FS_DP = PA_12, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/hal_conf_custom.h b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/hal_conf_custom.h new file mode 100644 index 000000000000..808b5588ed5c --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/hal_conf_custom.h @@ -0,0 +1,495 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2017 STMicroelectronics. + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_CUSTOM +#define __STM32F4xx_HAL_CONF_CUSTOM + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ + /** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +//#define HAL_PCD_MODULE_ENABLED // Automatically added if any type of USB is enabled, as in Arduino IDE. (STM32 v3.10700.191028) + +//#define HAL_CAN_MODULE_ENABLED +//#define HAL_CAN_LEGACY_MODULE_ENABLED +//#define HAL_CEC_MODULE_ENABLED +//#define HAL_CRYP_MODULE_ENABLED +//#define HAL_DAC_MODULE_ENABLED +//#define HAL_DCMI_MODULE_ENABLED +//#define HAL_DMA2D_MODULE_ENABLED +//#define HAL_ETH_MODULE_ENABLED +//#define HAL_NAND_MODULE_ENABLED +//#define HAL_NOR_MODULE_ENABLED +//#define HAL_PCCARD_MODULE_ENABLED +//#define HAL_SRAM_MODULE_ENABLED +//#define HAL_SDRAM_MODULE_ENABLED +//#define HAL_HASH_MODULE_ENABLED +//#define HAL_EXTI_MODULE_ENABLED +//#define HAL_SMBUS_MODULE_ENABLED +//#define HAL_I2S_MODULE_ENABLED +//#define HAL_LTDC_MODULE_ENABLED +//#define HAL_DSI_MODULE_ENABLED +//#define HAL_QSPI_MODULE_ENABLED +//#define HAL_RNG_MODULE_ENABLED +//#define HAL_SAI_MODULE_ENABLED +#define HAL_SD_MODULE_ENABLED +//#define HAL_UART_MODULE_ENABLED +//#define HAL_USART_MODULE_ENABLED +//#define HAL_IRDA_MODULE_ENABLED +//#define HAL_SMARTCARD_MODULE_ENABLED +//#define HAL_WWDG_MODULE_ENABLED +//#define HAL_HCD_MODULE_ENABLED +//#define HAL_FMPI2C_MODULE_ENABLED +//#define HAL_SPDIFRX_MODULE_ENABLED +//#define HAL_DFSDM_MODULE_ENABLED +//#define HAL_LPTIM_MODULE_ENABLED +//#define HAL_MMC_MODULE_ENABLED + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#ifndef HSE_VALUE +#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#ifndef HSE_STARTUP_TIMEOUT +#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#ifndef HSI_VALUE +#define HSI_VALUE 16000000U /*!< Value of the Internal oscillator in Hz */ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#ifndef LSI_VALUE +#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz */ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz +The real value may vary depending on the variations +in voltage and temperature. */ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#ifndef LSE_VALUE +#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#ifndef LSE_STARTUP_TIMEOUT +#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#ifndef EXTERNAL_CLOCK_VALUE +#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External oscillator in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#if !defined (VDD_VALUE) +#define VDD_VALUE 3300U /*!< Value of VDD in mv */ +#endif +#if !defined (TICK_INT_PRIORITY) +#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */ +#endif +#if !defined (USE_RTOS) +#define USE_RTOS 0U +#endif +#if !defined (PREFETCH_ENABLE) +#define PREFETCH_ENABLE 1U +#endif +#if !defined (INSTRUCTION_CACHE_ENABLE) +#define INSTRUCTION_CACHE_ENABLE 1U +#endif +#if !defined (DATA_CACHE_ENABLE) +#define DATA_CACHE_ENABLE 1U +#endif + +#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */ +#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */ +#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */ +#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */ +#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */ +#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */ +#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */ +#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */ +#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */ +#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */ +#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */ +#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */ +#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */ +#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */ +#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */ +#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */ +#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */ +#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */ +#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */ +#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */ +#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */ +#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */ +#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */ +#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */ +#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */ +#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */ +#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */ +#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */ +#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */ +#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */ +#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */ +#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */ +#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */ +#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */ +#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */ +#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */ +#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */ +#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2U +#define MAC_ADDR1 0U +#define MAC_ADDR2 0U +#define MAC_ADDR3 0U +#define MAC_ADDR4 0U +#define MAC_ADDR5 0U + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848_PHY_ADDRESS Address*/ +#define DP83848_PHY_ADDRESS 0x01U +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY 0x000000FFU +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY 0x00000FFFU + +#define PHY_READ_TO 0x0000FFFFU +#define PHY_WRITE_TO 0x0000FFFFU + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ +#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ + +#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ + +/* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver + * Activated: CRC code is present inside driver + * Deactivated: CRC code cleaned from driver + */ +#ifndef USE_SPI_CRC +#define USE_SPI_CRC 0U +#endif + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED +#include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_EXTI_MODULE_ENABLED +#include "stm32f4xx_hal_exti.h" +#endif /* HAL_EXTI_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED +#include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CAN_LEGACY_MODULE_ENABLED +#include "stm32f4xx_hal_can_legacy.h" +#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED +#include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED +#include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED +#include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED +#include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED +#include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED +#include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED +#include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED +#include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED +#include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED +#include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED +#include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED +#include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED +#include "stm32f4xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED +#include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED +#include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED +#include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED +#include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED +#include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED +#include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED +#include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED +#include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED +#include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED +#include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED +#include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED +#include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +#ifdef HAL_DSI_MODULE_ENABLED +#include "stm32f4xx_hal_dsi.h" +#endif /* HAL_DSI_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "stm32f4xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_CEC_MODULE_ENABLED +#include "stm32f4xx_hal_cec.h" +#endif /* HAL_CEC_MODULE_ENABLED */ + +#ifdef HAL_FMPI2C_MODULE_ENABLED +#include "stm32f4xx_hal_fmpi2c.h" +#endif /* HAL_FMPI2C_MODULE_ENABLED */ + +#ifdef HAL_SPDIFRX_MODULE_ENABLED +#include "stm32f4xx_hal_spdifrx.h" +#endif /* HAL_SPDIFRX_MODULE_ENABLED */ + +#ifdef HAL_DFSDM_MODULE_ENABLED +#include "stm32f4xx_hal_dfsdm.h" +#endif /* HAL_DFSDM_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32f4xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_MMC_MODULE_ENABLED +#include "stm32f4xx_hal_mmc.h" +#endif /* HAL_MMC_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(uint8_t *file, uint32_t line); +#else +#define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_CUSTOM_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld new file mode 100644 index 000000000000..f34e389fb103 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld @@ -0,0 +1,186 @@ +/* +***************************************************************************** +** +** File : ldscript.ld +** +** Abstract : Linker script for STM32F401RETx Device with +** 512KByte FLASH, 96KByte RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +** Copyright (c) 2014 Ac6 +** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20017FFB; /* end of RAM */ + +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text ALIGN(4): + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.cpp new file mode 100644 index 000000000000..d603ad6ef1ab --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.cpp @@ -0,0 +1,238 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "pins_arduino.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // Digital pin 0 + PA_1, // Digital pin 1 + PA_2, // Digital pin 2 + PA_3, // Digital pin 3 + PA_4, // Digital pin 4 + PA_5, // Digital pin 5 + PA_6, // Digital pin 6 + PA_7, // Digital pin 7 + PA_8, // Digital pin 8 + PA_9, // Digital pin 9 + PA_10, // Digital pin 10 + PA_11, // Digital pin 11 + PA_12, // Digital pin 12 + PA_13, // Digital pin 13 + PA_14, // Digital pin 14 + PA_15, // Digital pin 15 + + PB_0, // Digital pin 16 + PB_1, // Digital pin 17 + PB_2, // Digital pin 18 + PB_3, // Digital pin 19 + PB_4, // Digital pin 20 + PB_5, // Digital pin 21 + PB_6, // Digital pin 22 + PB_7, // Digital pin 23 + PB_8, // Digital pin 24 + PB_9, // Digital pin 25 + PB_10, // Digital pin 26 + PB_12, // Digital pin 27 + PB_13, // Digital pin 28 + PB_14, // Digital pin 29 + PB_15, // Digital pin 30 + + PC_0, // Digital pin 31 + PC_1, // Digital pin 32 + PC_2, // Digital pin 33 + PC_3, // Digital pin 34 + PC_4, // Digital pin 35 + PC_5, // Digital pin 36 + PC_6, // Digital pin 37 + PC_7, // Digital pin 38 + PC_8, // Digital pin 39 + PC_9, // Digital pin 40 + PC_10, // Digital pin 41 + PC_11, // Digital pin 42 + PC_12, // Digital pin 43 + PC_13, // Digital pin 44 + PC_14, // Digital pin 45 + PC_15, // Digital pin 46 + + PD_2, // Digital pin 47 + + PH_0, // Digital pin 48, used by the external oscillator + PH_1 // Digital pin 49, used by the external oscillator +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 31, // A10, PC0 + 32, // A11, PC1 + 33, // A12, PC2 + 34, // A13, PC3 + 35, // A14, PC4 + 36 // A15, PC5 +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * @brief Configures the System clock source, PLL Multiplier and Divider factors, + * AHB/APBx prescalers and Flash settings + * @note This function should be called only once the RCC clock configuration + * is reset to the default reset state (done in SystemInit() function). + * @param None + * @retval None + */ + +/******************************************************************************/ +/* PLL (clocked by HSE) used as System clock source */ +/******************************************************************************/ +static uint8_t SetSysClock_PLL_HSE(uint8_t bypass) +{ + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); + + // Enable HSE oscillator and activate PLL with HSE as source + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + if (bypass == 0) { + RCC_OscInitStruct.HSEState = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT + } else { + RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN + } + + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = HSE_VALUE / 1000000L; // Expects an 8 MHz external clock by default. Redefine HSE_VALUE if not + RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336) + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4) + RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> OK for USB + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + return 0; // FAIL + } + + // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + return 0; // FAIL + } + + /* Output clock on MCO1 pin(PA8) for debugging purpose */ + /* + if (bypass == 0) + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_2); // 4 MHz + else + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1); // 8 MHz + */ + + return 1; // OK +} + +/******************************************************************************/ +/* PLL (clocked by HSI) used as System clock source */ +/******************************************************************************/ +uint8_t SetSysClock_PLL_HSI(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); + + // Enable HSI oscillator and activate PLL with HSI as source + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSEState = RCC_HSE_OFF; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 16; // VCO input clock = 1 MHz (16 MHz / 16) + RCC_OscInitStruct.PLL.PLLN = 336; // VCO output clock = 336 MHz (1 MHz * 336) + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; // PLLCLK = 84 MHz (336 MHz / 4) + RCC_OscInitStruct.PLL.PLLQ = 7; // USB clock = 48 MHz (336 MHz / 7) --> freq is ok but not precise enough + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { + return 0; // FAIL + } + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 84 MHz + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 84 MHz + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; // 42 MHz + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; // 84 MHz + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { + return 0; // FAIL + } + + /* Output clock on MCO1 pin(PA8) for debugging purpose */ + //HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); // 16 MHz + + return 1; // OK +} + +WEAK void SystemClock_Config(void) +{ + /* 1- If fail try to start with HSE and external xtal */ + if (SetSysClock_PLL_HSE(0) == 0) { + /* 2- Try to start with HSE and external clock */ + if (SetSysClock_PLL_HSE(1) == 0) { + /* 3- If fail start with HSI clock */ + if (SetSysClock_PLL_HSI() == 0) { + Error_Handler(); + } + } + } + /* Output clock on MCO2 pin(PC9) for debugging purpose */ + //HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_4); +} + +#ifdef __cplusplus +} +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h new file mode 100644 index 000000000000..b5c5a65a7426 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h @@ -0,0 +1,154 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ARDUINO_STM32_ +#define _VARIANT_ARDUINO_STM32_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + +// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PA0 0 // | 0 | A0 | | | | | +#define PA1 1 // | 1 | A1 | | | | | +#define PA2 2 // | 2 | A2 | USART2_TX | | | | +#define PA3 3 // | 3 | A3 | USART2_RX | | | | +#define PA4 4 // | 4 | A4 | | | SPI1_SS, (SPI3_SS) | | +#define PA5 5 // | 5 | A5 | | | SPI1_SCK | | +#define PA6 6 // | 6 | A6 | | | SPI1_MISO | | +#define PA7 7 // | 7 | A7 | | | SPI1_MOSI | | +#define PA8 8 // | 8 | | | TWI3_SCL | | | +#define PA9 9 // | 9 | | USART1_TX | | | | +#define PA10 10 // | 10 | | USART1_RX | | | | +#define PA11 11 // | 11 | | USART6_TX | | | | +#define PA12 12 // | 12 | | USART6_RX | | | | +#define PA13 13 // | 13 | | | | | SWD_SWDIO | +#define PA14 14 // | 14 | | | | | SWD_SWCLK | +#define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PB0 16 // | 16 | A8 | | | | | +#define PB1 17 // | 17 | A9 | | | | | +#define PB2 18 // | 18 | | | | | BOOT1 | +#define PB3 19 // | 19 | | | TWI2_SDA | SPI3_SCK, (SPI1_SCK) | | +#define PB4 20 // | 20 | | | TWI3_SDA | SPI3_MISO, (SPI1_MISO) | | +#define PB5 21 // | 21 | | | | SPI3_MOSI, (SPI1_MOSI) | | +#define PB6 22 // | 22 | | USART1_TX | TWI1_SCL | | | +#define PB7 23 // | 23 | | USART1_RX | TWI1_SDA | | | +#define PB8 24 // | 24 | | | TWI1_SCL | | | +#define PB9 25 // | 25 | | | TWI1_SDA | SPI2_SS | | +#define PB10 26 // | 26 | | | TWI2_SCL | SPI2_SCK | | +#define PB12 27 // | 27 | | | | SPI2_SS | | +#define PB13 28 // | 28 | | | | SPI2_SCK | | +#define PB14 29 // | 29 | | | | SPI2_MISO | | +#define PB15 30 // | 30 | | | | SPI2_MOSI | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PC0 31 // | 31 | A10 | | | | | +#define PC1 32 // | 32 | A11 | | | | | +#define PC2 33 // | 33 | A12 | | | SPI2_MISO | | +#define PC3 34 // | 34 | A13 | | | SPI2_MOSI | | +#define PC4 35 // | 35 | A14 | | | | | +#define PC5 36 // | 36 | A15 | | | | | +#define PC6 37 // | 37 | | USART6_TX | | | | +#define PC7 38 // | 38 | | USART6_RX | | | | +#define PC8 39 // | 39 | | | | | | +#define PC9 40 // | 40 | | | TWI3_SDA | | | +#define PC10 41 // | 41 | | | | SPI3_SCK | | +#define PC11 42 // | 42 | | | | SPI3_MISO | | +#define PC12 43 // | 43 | | | | SPI3_MOSI | | +#define PC13 44 // | 44 | | | | | | +#define PC14 45 // | 45 | | | | | OSC32_IN | +#define PC15 46 // | 46 | | | | | OSC32_OUT | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PD2 47 // | 47 | | | | | | +// |---------|--------|-----------|----------|------------------------|-----------| +#define PH0 48 // | 48 | | | | | OSC_IN | +#define PH1 49 // | 49 | | | | | OSC_OUT | +// |---------|--------|-----------|----------|------------------------|-----------| + +// This must be a literal +#define NUM_DIGITAL_PINS 50 +#define NUM_ANALOG_INPUTS 16 + +// SPI definitions +#define PIN_SPI_SS PA4 +#define PIN_SPI_SS1 PA4 +#define PIN_SPI_MOSI PA7 +#define PIN_SPI_MISO PA6 +#define PIN_SPI_SCK PA5 + + +// Timer Definitions +#define TIMER_TONE TIM2 +#define TIMER_SERVO TIM5 +#define TIMER_SERIAL TIM11 + +// UART Definitions +//#define ENABLE_HWSERIAL1 done automatically by the #define SERIAL_UART_INSTANCE below +#define ENABLE_HWSERIAL2 +#define ENABLE_HWSERIAL6 + + +// Define here Serial instance number to map on Serial generic name (if not already used by SerialUSB) +#define SERIAL_UART_INSTANCE 1 //1 for Serial = Serial1 (USART1) + +// Default pin used for 'Serial' instance +// Mandatory for Firmata +#define PIN_SERIAL_RX PA10 +#define PIN_SERIAL_TX PA9 + +// Used when the user instantiates a hardware Serial using its peripheral name. +// Example: HardwareSerial mySerial(USART3); +// will use PIN_SERIAL3_RX and PIN_SERIAL3_TX if defined. +#define PIN_SERIAL1_RX PA10 +#define PIN_SERIAL1_TX PA9 +#define PIN_SERIAL2_RX PA3 +#define PIN_SERIAL2_TX PA2 +#define PIN_SERIAL6_RX PC7 +#define PIN_SERIAL6_TX PC6 + +#ifdef __cplusplus +} // extern "C" +#endif +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #define SERIAL_PORT_MONITOR Serial + #define SERIAL_PORT_HARDWARE Serial1 + #define SERIAL_PORT_HARDWARE_OPEN Serial2 +#endif + +#endif /* _VARIANT_ARDUINO_STM32_ */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 60ccee94d89b..84d26553e08c 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -737,6 +737,33 @@ extends = env:STM32F401RE_creality debug_tool = stlink upload_protocol = stlink +# +# STM32F401RE_freeruns Creality E3 Free-runs Silent Motherboard +# +[env:STM32F401RE_freeruns] +extends = stm32_variant +board = genericSTM32F401RE +board_build.variant = marlin_STM32F401RE_freeruns +board_build.offset = 0x10000 +board_upload.offset_address = 0x08010000 +build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RE -DSTM32F4 + -DSS_TIMER=4 -DTIMER_SERVO=TIM5 + -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 +build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC +extra_scripts = ${stm32_variant.extra_scripts} + pre:buildroot/share/PlatformIO/scripts/random-bin.py +monitor_speed = 115200 + +[env:STM32F401RE_freeruns_jlink] +extends = env:STM32F401RE_freeruns +debug_tool = jlink +upload_protocol = jlink + +[env:STM32F401RE_freeruns_stlink] +extends = env:STM32F401RE_freeruns +debug_tool = stlink +upload_protocol = stlink + # # BigTree SKR mini E3 V3.0.1 (STM32F401RCT6 ARM Cortex-M4) # From 68ab7f6bb7d93ed24054b033334c5821ea4e4cbf Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 15 Dec 2023 00:21:58 +0000 Subject: [PATCH 04/73] [cron] Bump distribution date (2023-12-15) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 52512a611302..0aa31f056cac 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-14" +//#define STRING_DISTRIBUTION_DATE "2023-12-15" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 80b1de278bb1..225e323ded73 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-14" + #define STRING_DISTRIBUTION_DATE "2023-12-15" #endif /** From 00298e6681bfdc6231eeb5624dda1eebbd7fe075 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Dec 2023 20:23:59 -0600 Subject: [PATCH 05/73] =?UTF-8?q?=F0=9F=94=A7=20Update=20fan=200=20conflic?= =?UTF-8?q?t=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25568 --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 1471d2d13c23..3be670a222a1 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3744,7 +3744,7 @@ static_assert(_PLUS_TEST(3), "DEFAULT_MAX_ACCELERATION values must be positive." #error "SPINDLE_LASER_PWM_PIN conflicts with E6_AUTO_FAN_PIN." #elif _PIN_CONFLICT(E7_AUTO_FAN) #error "SPINDLE_LASER_PWM_PIN conflicts with E7_AUTO_FAN_PIN." - #elif _PIN_CONFLICT(FAN) + #elif _PIN_CONFLICT(FAN0) #error "SPINDLE_LASER_PWM_PIN conflicts with FAN0_PIN." #elif _PIN_CONFLICT(FAN1) #error "SPINDLE_LASER_PWM_PIN conflicts with FAN1_PIN." From 3f9c2f89fc61819331ec332eff1df939f47d82b5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Dec 2023 23:40:26 -0600 Subject: [PATCH 06/73] =?UTF-8?q?=F0=9F=94=A7=20Fix=20IDEX=20home=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25780 --- Marlin/src/inc/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 3be670a222a1..2bde7f6f4542 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1822,7 +1822,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #elif !defined(X2_HOME_POS) || !defined(X2_MIN_POS) || !defined(X2_MAX_POS) #error "DUAL_X_CARRIAGE requires X2_HOME_POS, X2_MIN_POS, and X2_MAX_POS." #elif X_HOME_TO_MAX - #error "DUAL_X_CARRIAGE requires X_HOME_DIR 1." + #error "DUAL_X_CARRIAGE requires X_HOME_DIR -1." #endif #endif From 145ab7b1ec99f24d8e6a5e9857e1e4a08e459b7d Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 16 Dec 2023 06:05:48 +0000 Subject: [PATCH 07/73] [cron] Bump distribution date (2023-12-16) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 0aa31f056cac..aa0701e65492 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-15" +//#define STRING_DISTRIBUTION_DATE "2023-12-16" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 225e323ded73..2a367c10ca4c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-15" + #define STRING_DISTRIBUTION_DATE "2023-12-16" #endif /** From 4a89ef6273c6b0fafd3132900863e5a1f332b579 Mon Sep 17 00:00:00 2001 From: geijt <3473304+geijt@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:33:46 +0100 Subject: [PATCH 08/73] Fix Creality E3 "Free-runs" (#26533) Followup to #25636 --- Marlin/src/inc/Conditionals_adv.h | 2 +- .../pins/stm32f4/pins_CREALITY_CR4NTXXC10.h | 20 +++++++++---------- .../MARLIN_STM32F401RE_FREERUNS/ldscript.ld | 10 +++++----- ini/stm32f4.ini | 3 ++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index f62714df4b62..f1caf52c7374 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1277,7 +1277,7 @@ #if LCD_IS_SERIAL_HOST && !defined(LCD_SERIAL_PORT) #if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_MINI_E3_V3_0, BTT_SKR_MINI_E3_V3_0_1, BTT_SKR_E3_TURBO, BTT_OCTOPUS_V1_1, AQUILA_V101) #define LCD_SERIAL_PORT 1 - #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) + #elif MB(CREALITY_V24S1_301, CREALITY_V24S1_301F4, CREALITY_F401RE, CREALITY_V423, CREALITY_CR4NTXXC10, MKS_ROBIN, PANOWIN_CUTLASS, KODAMA_BARDO) #define LCD_SERIAL_PORT 2 #else #define LCD_SERIAL_PORT 3 diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h index 77be5777535a..0a6f3e3059bf 100644 --- a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h @@ -100,15 +100,15 @@ #define X_STEP_PIN PC2 #define X_DIR_PIN PB9 -#define Y_ENABLE_PIN PC3 +#define Y_ENABLE_PIN X_ENABLE_PIN #define Y_STEP_PIN PB8 #define Y_DIR_PIN PB7 -#define Z_ENABLE_PIN PC3 +#define Z_ENABLE_PIN X_ENABLE_PIN #define Z_STEP_PIN PB6 #define Z_DIR_PIN PB5 -#define E0_ENABLE_PIN PC3 +#define E0_ENABLE_PIN X_ENABLE_PIN #define E0_STEP_PIN PB4 #define E0_DIR_PIN PB3 @@ -142,21 +142,21 @@ * If undefined software serial is used according to the pins below */ #define X_HARDWARE_SERIAL Serial6 - #define Y_HARDWARE_SERIAL Serial6 - #define Z_HARDWARE_SERIAL Serial6 - #define E0_HARDWARE_SERIAL Serial6 + #define Y_HARDWARE_SERIAL X_HARDWARE_SERIAL + #define Z_HARDWARE_SERIAL X_HARDWARE_SERIAL + #define E0_HARDWARE_SERIAL X_HARDWARE_SERIAL #ifndef X_SLAVE_ADDRESS - #define X_SLAVE_ADDRESS 0 + #define X_SLAVE_ADDRESS 0 #endif #ifndef Y_SLAVE_ADDRESS - #define Y_SLAVE_ADDRESS 1 + #define Y_SLAVE_ADDRESS 1 #endif #ifndef Z_SLAVE_ADDRESS - #define Z_SLAVE_ADDRESS 2 + #define Z_SLAVE_ADDRESS 2 #endif #ifndef E0_SLAVE_ADDRESS - #define E0_SLAVE_ADDRESS 3 + #define E0_SLAVE_ADDRESS 3 #endif // Software serial diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld index f34e389fb103..2c57307813d4 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/ldscript.ld @@ -51,17 +51,17 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ -_estack = 0x20017FFB; /* end of RAM */ +_estack = 0x20000000 + LD_MAX_DATA_SIZE; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ /* Specify the memory areas */ MEMORY { -FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET -RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE } /* Define output sections */ diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 84d26553e08c..3f3347194334 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -746,9 +746,10 @@ board = genericSTM32F401RE board_build.variant = marlin_STM32F401RE_freeruns board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 +board_build.rename = firmware-{date}-{time}.bin build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RE -DSTM32F4 -DSS_TIMER=4 -DTIMER_SERVO=TIM5 - -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 + -DTRANSFER_CLOCK_DIV=8 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC extra_scripts = ${stm32_variant.extra_scripts} pre:buildroot/share/PlatformIO/scripts/random-bin.py From 0ede16cd5ab75278e6b4a599ee451ba4bb5ac739 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 18 Dec 2023 00:22:22 +0000 Subject: [PATCH 09/73] [cron] Bump distribution date (2023-12-18) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index aa0701e65492..a096d32aa93f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-16" +//#define STRING_DISTRIBUTION_DATE "2023-12-18" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 2a367c10ca4c..bfdf5c7c2b1b 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-16" + #define STRING_DISTRIBUTION_DATE "2023-12-18" #endif /** From 67d7562609986fae14d80036ad1e7a7f3aaa49d0 Mon Sep 17 00:00:00 2001 From: narno2202 <130909513+narno2202@users.noreply.github.com> Date: Wed, 20 Dec 2023 02:56:47 +0100 Subject: [PATCH 10/73] =?UTF-8?q?=F0=9F=90=9B=E2=9A=A1=EF=B8=8F=20FT=5FMOT?= =?UTF-8?q?ION=20improvements=20(#26074)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Scott Lahteine --- Marlin/Configuration_adv.h | 84 ++- Marlin/src/gcode/bedlevel/G35.cpp | 4 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 1 + Marlin/src/gcode/bedlevel/mbl/G29.cpp | 1 + Marlin/src/gcode/calibrate/G34_M422.cpp | 1 + Marlin/src/gcode/feature/ft_motion/M493.cpp | 107 ++- Marlin/src/gcode/probe/G38.cpp | 1 + Marlin/src/inc/Conditionals_adv.h | 2 +- Marlin/src/lcd/language/language_en.h | 6 +- Marlin/src/lcd/menu/menu_motion.cpp | 23 +- Marlin/src/module/ft_motion.cpp | 701 ++++++++++---------- Marlin/src/module/ft_motion.h | 69 +- Marlin/src/module/ft_types.h | 29 +- Marlin/src/module/motion.cpp | 19 - Marlin/src/module/stepper.cpp | 244 +++---- Marlin/src/module/stepper.h | 7 +- 16 files changed, 654 insertions(+), 645 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 8b4fa1ab7ca1..72aee115884d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1121,42 +1121,62 @@ #if ENABLED(FT_MOTION) #define FTM_DEFAULT_MODE ftMotionMode_DISABLED // Default mode of fixed time control. (Enums in ft_types.h) #define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (Enums in ft_types.h) - #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. - #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers. - #define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false). - #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. - #define FTM_SHAPING_ZETA 0.1f // Zeta used by input shapers. - #define FTM_SHAPING_V_TOL 0.05f // Vibration tolerance used by EI input shapers. + #define FTM_SHAPING_DEFAULT_X_FREQ 37.0f // (Hz) Default peak frequency used by input shapers + #define FTM_SHAPING_DEFAULT_Y_FREQ 37.0f // (Hz) Default peak frequency used by input shapers + #define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false) + #define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain + #define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis + #define FTM_SHAPING_ZETA_Y 0.1f // Zeta used by input shapers for Y axis + + #define FTM_SHAPING_V_TOL_X 0.05f // Vibration tolerance used by EI input shapers for X axis + #define FTM_SHAPING_V_TOL_Y 0.05f // Vibration tolerance used by EI input shapers for Y axis + + //#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters /** * Advanced configuration */ - #define FTM_BATCH_SIZE 100 // Batch size for trajectory generation; - #define FTM_WINDOW_SIZE 200 // Window size for trajectory generation. - #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (1 / FTM_TS) - #define FTM_TS 0.001f // (s) Time step for trajectory generation. (1 / FTM_FS) - #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update. - #define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps. - #define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency. - #define FTM_ZMAX 100 // Maximum delays for shaping functions (even numbers only!). - // Calculate as: - // 1/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZV. - // (FTM_FS / FTM_MIN_SHAPE_FREQ) for ZVD, MZV. - // 3/2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 2HEI. - // 2 * (FTM_FS / FTM_MIN_SHAPE_FREQ) for 3HEI. - #define FTM_STEPS_PER_UNIT_TIME 20 // Interpolated stepper commands per unit time. - // Calculate as (FTM_STEPPER_FS / FTM_FS). - #define FTM_CTS_COMPARE_VAL 10 // Comparison value used in interpolation algorithm. - // Calculate as (FTM_STEPS_PER_UNIT_TIME / 2). - // These values may be configured to adjust duration of loop(). - #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop(). - #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop(). - - // This value may be configured to adjust duration to consume the command buffer. - // Try increasing this value if stepper motion is not smooth. - #define FTM_STEPPERCMD_BUFF_SIZE 1000 // Size of the stepper command buffers. - - //#define FT_MOTION_MENU // Provide a MarlinUI menu to set M493 parameters. + #define FTM_UNIFIED_BWS // DON'T DISABLE unless you use Ulendo FBS (not implemented) + #if ENABLED(FTM_UNIFIED_BWS) + #define FTM_BW_SIZE 100 // Unified Window and Batch size with a ratio of 2 + #else + #define FTM_WINDOW_SIZE 200 // Custom Window size for trajectory generation needed by Ulendo FBS + #define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS + #endif + + #define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS) + #define FTM_TS 0.001f // (s) Time step for trajectory generation. (Reciprocal of FTM_FS) + + // These values may be configured to adjust the duration of loop(). + #define FTM_STEPS_PER_LOOP 60 // Number of stepper commands to generate each loop() + #define FTM_POINTS_PER_LOOP 100 // Number of trajectory points to generate each loop() + + #if DISABLED(COREXY) + #define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update + + // Use this to adjust the time required to consume the command buffer. + // Try increasing this value if stepper motion is choppy. + #define FTM_STEPPERCMD_BUFF_SIZE 3000 // Size of the stepper command buffers + // (FTM_STEPS_PER_LOOP * FTM_POINTS_PER_LOOP) is a good start + // If you run out of memory, fall back to 3000 and increase progressively + #else + // CoreXY motion needs a larger buffer size. These values are based on our testing. + #define FTM_STEPPER_FS 30000 + #define FTM_STEPPERCMD_BUFF_SIZE 6000 + #endif + + #define FTM_STEPS_PER_UNIT_TIME (FTM_STEPPER_FS / FTM_FS) // Interpolated stepper commands per unit time + #define FTM_CTS_COMPARE_VAL (FTM_STEPS_PER_UNIT_TIME / 2) // Comparison value used in interpolation algorithm + #define FTM_MIN_TICKS ((STEPPER_TIMER_RATE) / (FTM_STEPPER_FS)) // Minimum stepper ticks between steps + + #define FTM_MIN_SHAPE_FREQ 10 // Minimum shaping frequency + #define FTM_RATIO (FTM_FS / FTM_MIN_SHAPE_FREQ) // Factor for use in FTM_ZMAX. DON'T CHANGE. + #define FTM_ZMAX (FTM_RATIO * 2) // Maximum delays for shaping functions (even numbers only!) + // Calculate as: + // ZV : FTM_RATIO / 2 + // ZVD, MZV : FTM_RATIO + // 2HEI : FTM_RATIO * 3 / 2 + // 3HEI : FTM_RATIO * 2 #endif /** diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 1b2f115cdfb7..224dd2a0aa2d 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -57,9 +57,9 @@ * 41 - Counter-Clockwise M4 * 50 - Clockwise M5 * 51 - Counter-Clockwise M5 - * - */ + **/ void GcodeSuite::G35() { + DEBUG_SECTION(log_G35, "G35", DEBUGGING(LEVELING)); if (DEBUGGING(LEVELING)) log_machine_info(); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index d6d648c12560..acd920c7290d 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -225,6 +225,7 @@ class G29_State { * There's no extra effect if you have a fixed Z probe. */ G29_TYPE GcodeSuite::G29() { + DEBUG_SECTION(log_G29, "G29", DEBUGGING(LEVELING)); // Leveling state is persistent when done manually with multiple G29 commands diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index c5e02b91f9bd..b3f03d03ba43 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -64,6 +64,7 @@ inline void echo_not_entered(const char c) { SERIAL_CHAR(c); SERIAL_ECHOLNPGM(" * S5 Reset and disable mesh */ void GcodeSuite::G29() { + DEBUG_SECTION(log_G29, "G29", true); // G29 Q is also available if debugging diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index f76df4316cd6..af2c6a5f6505 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -79,6 +79,7 @@ * R Flag to recalculate points based on current probe offsets */ void GcodeSuite::G34() { + DEBUG_SECTION(log_G34, "G34", DEBUGGING(LEVELING)); if (DEBUGGING(LEVELING)) log_machine_info(); diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index f6e6a1261d46..fd95a3b7baf8 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -26,6 +26,7 @@ #include "../../gcode.h" #include "../../../module/ft_motion.h" +#include "../../../module/stepper.h" void say_shaping() { // FT Enabled @@ -39,6 +40,8 @@ void say_shaping() { default: break; case ftMotionMode_ZV: SERIAL_ECHOPGM("ZV"); break; case ftMotionMode_ZVD: SERIAL_ECHOPGM("ZVD"); break; + case ftMotionMode_ZVDD: SERIAL_ECHOPGM("ZVDD"); break; + case ftMotionMode_ZVDDD: SERIAL_ECHOPGM("ZVDDD"); break; case ftMotionMode_EI: SERIAL_ECHOPGM("EI"); break; case ftMotionMode_2HEI: SERIAL_ECHOPGM("2 Hump EI"); break; case ftMotionMode_3HEI: SERIAL_ECHOPGM("3 Hump EI"); break; @@ -155,20 +158,19 @@ void GcodeSuite::M493() { if (!parser.seen_any()) flag.report_h = true; - else - planner.synchronize(); // Parse 'S' mode parameter. if (parser.seenval('S')) { - const ftMotionMode_t oldmm = ftMotion.cfg.mode, - newmm = (ftMotionMode_t)parser.value_byte(); + const ftMotionMode_t newmm = (ftMotionMode_t)parser.value_byte(); - if (newmm != oldmm) { + if (newmm != ftMotion.cfg.mode) { switch (newmm) { default: SERIAL_ECHOLNPGM("?Invalid control mode [S] value."); return; #if HAS_X_AXIS case ftMotionMode_ZV: case ftMotionMode_ZVD: + case ftMotionMode_ZVDD: + case ftMotionMode_ZVDDD: case ftMotionMode_EI: case ftMotionMode_2HEI: case ftMotionMode_3HEI: @@ -177,11 +179,10 @@ void GcodeSuite::M493() { //case ftMotionMode_DISCTF: flag.update_n = flag.update_a = true; #endif - case ftMotionMode_DISABLED: + case ftMotionMode_DISABLED: flag.reset_ft = true; case ftMotionMode_ENABLED: ftMotion.cfg.mode = newmm; flag.report_h = true; - if (oldmm == ftMotionMode_DISABLED) flag.reset_ft = true; break; } } @@ -193,6 +194,7 @@ void GcodeSuite::M493() { if (parser.seen('P')) { const bool val = parser.value_bool(); ftMotion.cfg.linearAdvEna = val; + flag.report_h = true; SERIAL_ECHO_TERNARY(val, "Linear Advance ", "en", "dis", "abled.\n"); } @@ -216,22 +218,16 @@ void GcodeSuite::M493() { if (ftMotion.cfg.modeHasShaper()) { const dynFreqMode_t val = dynFreqMode_t(parser.value_byte()); switch (val) { - case dynFreqMode_DISABLED: - ftMotion.cfg.dynFreqMode = val; - flag.report_h = true; - break; #if HAS_DYNAMIC_FREQ_MM case dynFreqMode_Z_BASED: - ftMotion.cfg.dynFreqMode = val; - flag.report_h = true; - break; #endif #if HAS_DYNAMIC_FREQ_G case dynFreqMode_MASS_BASED: - ftMotion.cfg.dynFreqMode = val; - flag.report_h = true; - break; #endif + case dynFreqMode_DISABLED: + ftMotion.cfg.dynFreqMode = val; + flag.report_h = true; + break; default: SERIAL_ECHOLNPGM("?Invalid Dynamic Frequency Mode [D] value."); break; @@ -279,6 +275,36 @@ void GcodeSuite::M493() { } #endif + // Parse zeta parameter (X axis). + if (parser.seenval('I')) { + const float val = parser.value_float(); + if (ftMotion.cfg.modeHasShaper()) { + if (WITHIN(val, 0.01f, 1.0f)) { + ftMotion.cfg.zeta[0] = val; + flag.update_n = flag.update_a = true; + } + else + SERIAL_ECHOLNPGM("Invalid X zeta [", AS_CHAR('I'), "] value."); // Zeta out of range. + } + else + SERIAL_ECHOLNPGM("Wrong mode for zeta parameter."); + } + + // Parse vtol parameter (X axis). + if (parser.seenval('Q')) { + const float val = parser.value_float(); + if (ftMotion.cfg.modeHasShaper() && IS_EI_MODE(ftMotion.cfg.mode)) { + if (WITHIN(val, 0.00f, 1.0f)) { + ftMotion.cfg.vtol[0] = val; + flag.update_a = true; + } + else + SERIAL_ECHOLNPGM("Invalid X vtol [", AS_CHAR('Q'), "] value."); // VTol out of range. + } + else + SERIAL_ECHOLNPGM("Wrong mode for vtol parameter."); + } + #endif // HAS_X_AXIS #if HAS_Y_AXIS @@ -310,15 +336,50 @@ void GcodeSuite::M493() { } #endif + // Parse zeta parameter (Y axis). + if (parser.seenval('J')) { + const float val = parser.value_float(); + if (ftMotion.cfg.modeHasShaper()) { + if (WITHIN(val, 0.01f, 1.0f)) { + ftMotion.cfg.zeta[1] = val; + flag.update_n = flag.update_a = true; + } + else + SERIAL_ECHOLNPGM("Invalid Y zeta [", AS_CHAR('J'), "] value."); // Zeta Out of range + } + else + SERIAL_ECHOLNPGM("Wrong mode for zeta parameter."); + } + + // Parse vtol parameter (Y axis). + if (parser.seenval('R')) { + const float val = parser.value_float(); + if (ftMotion.cfg.modeHasShaper() && IS_EI_MODE(ftMotion.cfg.mode)) { + if (WITHIN(val, 0.00f, 1.0f)) { + ftMotion.cfg.vtol[1] = val; + flag.update_a = true; + } + else + SERIAL_ECHOLNPGM("Invalid Y vtol [", AS_CHAR('R'), "] value."); // VTol out of range. + } + else + SERIAL_ECHOLNPGM("Wrong mode for vtol parameter."); + } + #endif // HAS_Y_AXIS - #if HAS_X_AXIS - if (flag.update_n) ftMotion.refreshShapingN(); - if (flag.update_a) ftMotion.updateShapingA(); - #endif - if (flag.reset_ft) ftMotion.reset(); - if (flag.report_h) say_shaping(); + planner.synchronize(); + if (flag.update_n) ftMotion.refreshShapingN(); + + if (flag.update_a) ftMotion.updateShapingA(); + + if (flag.reset_ft) { + stepper.ftMotion_syncPosition(); + ftMotion.reset(); + } + + if (flag.report_h) say_shaping(); } #endif // FT_MOTION diff --git a/Marlin/src/gcode/probe/G38.cpp b/Marlin/src/gcode/probe/G38.cpp index 5b138fdaf6dd..1f22cc84ed5c 100644 --- a/Marlin/src/gcode/probe/G38.cpp +++ b/Marlin/src/gcode/probe/G38.cpp @@ -105,6 +105,7 @@ inline bool G38_run_probe() { * G38.5 - Probe away from workpiece, stop on contact break */ void GcodeSuite::G38(const int8_t subcode) { + // Get X Y Z E F get_destination_from_command(); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index f1caf52c7374..89a57f274d54 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -1144,7 +1144,7 @@ #elif HAS_DRIVER(A4988) #define MINIMUM_STEPPER_POST_DIR_DELAY 200 #elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE - #define MINIMUM_STEPPER_POST_DIR_DELAY 60 + #define MINIMUM_STEPPER_POST_DIR_DELAY 70 #else #define MINIMUM_STEPPER_POST_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire #endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8c9dd08d07da..7945b26d5b72 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -802,6 +802,8 @@ namespace LanguageNarrow_en { LSTR MSG_FTM_MODE = _UxGT("Motion Mode:"); LSTR MSG_FTM_ZV = _UxGT("ZV"); LSTR MSG_FTM_ZVD = _UxGT("ZVD"); + LSTR MSG_FTM_ZVDD = _UxGT("ZVDD"); + LSTR MSG_FTM_ZVDDD = _UxGT("ZVDDD"); LSTR MSG_FTM_EI = _UxGT("EI"); LSTR MSG_FTM_2HEI = _UxGT("2HEI"); LSTR MSG_FTM_3HEI = _UxGT("3HEI"); @@ -813,8 +815,8 @@ namespace LanguageNarrow_en { LSTR MSG_FTM_MASS_BASED = _UxGT("Mass-based"); LSTR MSG_FTM_BASE_FREQ_N = _UxGT("@ Base Freq."); LSTR MSG_FTM_DFREQ_K_N = _UxGT("@ Dyn. Freq."); - LSTR MSG_FTM_ZETA = _UxGT("Damping"); - LSTR MSG_FTM_VTOL = _UxGT("Vib. Level"); + LSTR MSG_FTM_ZETA_N = _UxGT("@ Damping"); + LSTR MSG_FTM_VTOL_N = _UxGT("@ Vib. Level"); LSTR MSG_LEVEL_X_AXIS = _UxGT("Level X Axis"); LSTR MSG_AUTO_CALIBRATE = _UxGT("Auto Calibrate"); diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 35adf1211f04..239d03d9777a 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -342,6 +342,8 @@ void menu_move() { #if HAS_X_AXIS if (mode != ftMotionMode_ZV) ACTION_ITEM(MSG_FTM_ZV, []{ ftm_menu_setShaping(ftMotionMode_ZV); }); if (mode != ftMotionMode_ZVD) ACTION_ITEM(MSG_FTM_ZVD, []{ ftm_menu_setShaping(ftMotionMode_ZVD); }); + if (mode != ftMotionMode_ZVDD) ACTION_ITEM(MSG_FTM_ZVDD, []{ ftm_menu_setShaping(ftMotionMode_ZVDD); }); + if (mode != ftMotionMode_ZVDDD) ACTION_ITEM(MSG_FTM_ZVDDD,[]{ ftm_menu_setShaping(ftMotionMode_ZVDDD); }); if (mode != ftMotionMode_EI) ACTION_ITEM(MSG_FTM_EI, []{ ftm_menu_setShaping(ftMotionMode_EI); }); if (mode != ftMotionMode_2HEI) ACTION_ITEM(MSG_FTM_2HEI, []{ ftm_menu_setShaping(ftMotionMode_2HEI); }); if (mode != ftMotionMode_3HEI) ACTION_ITEM(MSG_FTM_3HEI, []{ ftm_menu_setShaping(ftMotionMode_3HEI); }); @@ -384,6 +386,8 @@ void menu_move() { case ftMotionMode_ENABLED: ftmode = GET_TEXT_F(MSG_LCD_ON); break; case ftMotionMode_ZV: ftmode = GET_TEXT_F(MSG_FTM_ZV); break; case ftMotionMode_ZVD: ftmode = GET_TEXT_F(MSG_FTM_ZVD); break; + case ftMotionMode_ZVDD: ftmode = GET_TEXT_F(MSG_FTM_ZVDD); break; + case ftMotionMode_ZVDDD: ftmode = GET_TEXT_F(MSG_FTM_ZVDDD);break; case ftMotionMode_EI: ftmode = GET_TEXT_F(MSG_FTM_EI); break; case ftMotionMode_2HEI: ftmode = GET_TEXT_F(MSG_FTM_2HEI); break; case ftMotionMode_3HEI: ftmode = GET_TEXT_F(MSG_FTM_3HEI); break; @@ -416,10 +420,21 @@ void menu_move() { EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_BASE_FREQ_N, &c.baseFreq[Y_AXIS], FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2, ftMotion.refreshShapingN); #endif - EDIT_ITEM_FAST(float42_52, MSG_FTM_ZETA, &c.zeta, 0.0f, 1.0f, ftMotion.refreshShapingN); + #if HAS_X_AXIS + EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_ZETA_N, &c.zeta[0], 0.0f, 1.0f, ftMotion.refreshShapingN); + #endif + #if HAS_Y_AXIS + EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_ZETA_N, &c.zeta[1], 0.0f, 1.0f, ftMotion.refreshShapingN); + #endif - if (WITHIN(c.mode, ftMotionMode_EI, ftMotionMode_3HEI)) - EDIT_ITEM_FAST(float42_52, MSG_FTM_VTOL, &c.vtol, 0.0f, 1.0f, ftMotion.refreshShapingN); + if (IS_EI_MODE(c.mode)) { + #if HAS_X_AXIS + EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_FTM_VTOL_N, &c.vtol[0], 0.0f, 1.0f, ftMotion.refreshShapingN); + #endif + #if HAS_Y_AXIS + EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_FTM_VTOL_N, &c.vtol[1], 0.0f, 1.0f, ftMotion.refreshShapingN); + #endif + } #if HAS_DYNAMIC_FREQ SUBMENU(MSG_FTM_DYN_MODE, menu_ftm_dyn_mode); @@ -437,7 +452,7 @@ void menu_move() { #if HAS_EXTRUDERS EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna); - EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0, 10); + if (c.linearAdvEna) EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0, 10); #endif END_MENU(); diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index ad37e8a9b3da..a2049db3b63f 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -32,6 +32,8 @@ FTMotion ftMotion; #if !HAS_X_AXIS static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZV, "ftMotionMode_ZV requires at least one linear axis."); static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZVD, "ftMotionMode_ZVD requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZVDD, "ftMotionMode_ZVD requires at least one linear axis."); + static_assert(FTM_DEFAULT_MODE == ftMotionMode_ZVDDD, "ftMotionMode_ZVD requires at least one linear axis."); static_assert(FTM_DEFAULT_MODE == ftMotionMode_EI, "ftMotionMode_EI requires at least one linear axis."); static_assert(FTM_DEFAULT_MODE == ftMotionMode_2HEI, "ftMotionMode_2HEI requires at least one linear axis."); static_assert(FTM_DEFAULT_MODE == ftMotionMode_3HEI, "ftMotionMode_3HEI requires at least one linear axis."); @@ -52,9 +54,7 @@ FTMotion ftMotion; ft_config_t FTMotion::cfg; bool FTMotion::busy; // = false -ft_command_t FTMotion::stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of stepper commands. -hal_timer_t FTMotion::stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Buffer of the stepper command timing. -uint8_t FTMotion::stepperCmdBuff_ApplyDir[FTM_STEPPERCMD_DIR_SIZE] = {0U}; // Buffer of whether DIR needs to be updated. +ft_command_t FTMotion::stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE] = {0U}; // Stepper commands buffer. uint32_t FTMotion::stepperCmdBuff_produceIdx = 0, // Index of next stepper command write to the buffer. FTMotion::stepperCmdBuff_consumeIdx = 0; // Index of next stepper command read from the buffer. @@ -62,10 +62,10 @@ bool FTMotion::sts_stepperBusy = false; // The stepper buffer has items // Private variables. // NOTE: These are sized for Ulendo FBS use. -xyze_trajectory_t FTMotion::traj; // = {0.0f} Storage for fixed-time-based trajectory. -xyze_trajectoryMod_t FTMotion::trajMod; // = {0.0f} Storage for modified fixed-time-based trajectory. + xyze_trajectory_t FTMotion::traj; // = {0.0f} Storage for fixed-time-based trajectory. + xyze_trajectoryMod_t FTMotion::trajMod; // = {0.0f} Storage for modified fixed-time-based trajectory. + xyze_trajectoryWin_t FTMotion::trajWin; // = {0.0f} Storage for fixed time trajectory window. -block_t* FTMotion::current_block_cpy = nullptr; // Pointer to current block being processed. bool FTMotion::blockProcRdy = false, // Indicates a block is ready to be processed. FTMotion::blockProcRdy_z1 = false, // Storage for the previous indicator. FTMotion::blockProcDn = false; // Indicates current block is done being processed. @@ -76,7 +76,7 @@ bool FTMotion::batchRdy = false; // Indicates a batch of the fixe bool FTMotion::batchRdyForInterp = false; // Indicates the batch is done being post processed, // if applicable, and is ready to be converted to step commands. bool FTMotion::runoutEna = false; // True if runout of the block hasn't been done and is allowed. -bool FTMotion::runout = false; // Indicates if runout is in progress. +bool FTMotion::blockDataIsRunout = false; // Indicates the last loaded block variables are for a runout. // Trapezoid data variables. xyze_pos_t FTMotion::startPosn, // (mm) Start position of block @@ -98,15 +98,13 @@ uint32_t FTMotion::max_intervals; // Total number of data points t // Make vector variables. uint32_t FTMotion::makeVector_idx = 0, // Index of fixed time trajectory generation of the overall block. FTMotion::makeVector_idx_z1 = 0, // Storage for the previously calculated index above. - FTMotion::makeVector_batchIdx = FTM_BATCH_SIZE; // Index of fixed time trajectory generation within the batch. + FTMotion::makeVector_batchIdx = 0; // Index of fixed time trajectory generation within the batch. // Interpolation variables. xyze_long_t FTMotion::steps = { 0 }; // Step count accumulator. -xyze_stepDir_t FTMotion::dirState = LOGICAL_AXIS_ARRAY_1(stepDirState_NOT_SET); // Memory of the currently set step direction of the axis. uint32_t FTMotion::interpIdx = 0, // Index of current data point being interpolated. FTMotion::interpIdx_z1 = 0; // Storage for the previously calculated index above. -hal_timer_t FTMotion::nextStepTicks = FTM_MIN_TICKS; // Accumulator for the next step time (in ticks). // Shaping variables. #if HAS_X_AXIS @@ -125,8 +123,6 @@ hal_timer_t FTMotion::nextStepTicks = FTM_MIN_TICKS; // Accumulator for the nex float FTMotion::e_advanced_z1 = 0.0f; // (ms) Unit delay of advanced extruder position. #endif -constexpr uint32_t last_batchIdx = (FTM_WINDOW_SIZE) - (FTM_BATCH_SIZE); - //-----------------------------------------------------------------// // Function definitions. //-----------------------------------------------------------------// @@ -134,8 +130,7 @@ constexpr uint32_t last_batchIdx = (FTM_WINDOW_SIZE) - (FTM_BATCH_SIZE); // Public functions. // Sets controller states to begin processing a block. -void FTMotion::startBlockProc(block_t * const current_block) { - current_block_cpy = current_block; +void FTMotion::startBlockProc() { blockProcRdy = true; blockProcDn = false; runoutEna = true; @@ -144,30 +139,16 @@ void FTMotion::startBlockProc(block_t * const current_block) { // Move any free data points to the stepper buffer even if a full batch isn't ready. void FTMotion::runoutBlock() { - if (runoutEna && !batchRdy) { // If the window is full already (block intervals was a multiple of - // the batch size), or runout is not enabled, no runout is needed. - // Fill out the trajectory window with the last position calculated. - if (makeVector_batchIdx > last_batchIdx) - for (uint32_t i = makeVector_batchIdx; i < (FTM_WINDOW_SIZE); i++) { - LOGICAL_AXIS_CODE( - traj.e[i] = traj.e[makeVector_batchIdx - 1], - traj.x[i] = traj.x[makeVector_batchIdx - 1], - traj.y[i] = traj.y[makeVector_batchIdx - 1], - traj.z[i] = traj.z[makeVector_batchIdx - 1], - traj.i[i] = traj.i[makeVector_batchIdx - 1], - traj.j[i] = traj.j[makeVector_batchIdx - 1], - traj.k[i] = traj.k[makeVector_batchIdx - 1], - traj.u[i] = traj.u[makeVector_batchIdx - 1], - traj.v[i] = traj.v[makeVector_batchIdx - 1], - traj.w[i] = traj.w[makeVector_batchIdx - 1] - ); - } + if (!runoutEna) return; - makeVector_batchIdx = last_batchIdx; - batchRdy = true; - runout = true; - } - runoutEna = false; + startPosn = endPosn_prevBlock; + ratio.reset(); + + max_intervals = cfg.modeHasShaper() ? shaper_intervals : 0; + if (max_intervals <= TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, min_max_intervals - (FTM_BATCH_SIZE))) max_intervals = min_max_intervals; + max_intervals += TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, FTM_WINDOW_SIZE) - makeVector_batchIdx; + blockProcRdy = blockDataIsRunout = true; + runoutEna = blockProcDn = false; } // Controller main, to be invoked from non-isr task. @@ -184,81 +165,63 @@ void FTMotion::loop() { if (sts_stepperBusy) return; // Wait until motion buffers are emptied reset(); blockProcDn = true; // Set queueing to look for next block. - runoutEna = false; // Disabling running out this block, since we want to halt the motion. stepper.abort_current_block = false; // Abort finished. } // Planner processing and block conversion. - if (!blockProcRdy && !runout) stepper.ftMotion_BlockQueueUpdate(); + if (!blockProcRdy) stepper.ftMotion_blockQueueUpdate(); if (blockProcRdy) { - if (!blockProcRdy_z1) loadBlockData(current_block_cpy); // One-shot. + if (!blockProcRdy_z1) { // One-shot. + if (!blockDataIsRunout) loadBlockData(stepper.current_block); + else blockDataIsRunout = false; + } while (!blockProcDn && !batchRdy && (makeVector_idx - makeVector_idx_z1 < (FTM_POINTS_PER_LOOP))) makeVector(); } - if (runout && !batchRdy) { // The lower half of the window has been runout. - // Runout the upper half of the window: the upper half has been shifted into the lower - // half. Fill out the upper half so another batch can be processed. - for (uint32_t i = last_batchIdx; i < (FTM_WINDOW_SIZE) - 1; i++) { - LOGICAL_AXIS_CODE( - traj.e[i] = traj.e[(FTM_WINDOW_SIZE) - 1], - traj.x[i] = traj.x[(FTM_WINDOW_SIZE) - 1], - traj.y[i] = traj.y[(FTM_WINDOW_SIZE) - 1], - traj.z[i] = traj.z[(FTM_WINDOW_SIZE) - 1], - traj.i[i] = traj.i[(FTM_WINDOW_SIZE) - 1], - traj.j[i] = traj.j[(FTM_WINDOW_SIZE) - 1], - traj.k[i] = traj.k[(FTM_WINDOW_SIZE) - 1], - traj.u[i] = traj.u[(FTM_WINDOW_SIZE) - 1], - traj.v[i] = traj.v[(FTM_WINDOW_SIZE) - 1], - traj.w[i] = traj.w[(FTM_WINDOW_SIZE) - 1] - ); - } - batchRdy = true; - runout = false; - } - // FBS / post processing. if (batchRdy && !batchRdyForInterp) { // Call Ulendo FBS here. - // Copy the uncompensated vectors. (XY done, other axes uncompensated) - LOGICAL_AXIS_CODE( - memcpy(trajMod.e, &traj.e[FTM_BATCH_SIZE], sizeof(trajMod.e)), - memcpy(trajMod.x, &traj.x[FTM_BATCH_SIZE], sizeof(trajMod.x)), - memcpy(trajMod.y, &traj.y[FTM_BATCH_SIZE], sizeof(trajMod.y)), - memcpy(trajMod.z, &traj.z[FTM_BATCH_SIZE], sizeof(trajMod.z)), - memcpy(trajMod.i, &traj.i[FTM_BATCH_SIZE], sizeof(trajMod.i)), - memcpy(trajMod.j, &traj.j[FTM_BATCH_SIZE], sizeof(trajMod.j)), - memcpy(trajMod.k, &traj.k[FTM_BATCH_SIZE], sizeof(trajMod.k)), - memcpy(trajMod.u, &traj.u[FTM_BATCH_SIZE], sizeof(trajMod.u)), - memcpy(trajMod.v, &traj.v[FTM_BATCH_SIZE], sizeof(trajMod.v)), - memcpy(trajMod.w, &traj.w[FTM_BATCH_SIZE], sizeof(trajMod.w)) - ); - - // Shift the time series back in the window for (shaped) X and Y - TERN_(HAS_X_AXIS, memcpy(traj.x, &traj.x[FTM_BATCH_SIZE], sizeof(traj.x) / 2)); - TERN_(HAS_Y_AXIS, memcpy(traj.y, &traj.y[FTM_BATCH_SIZE], sizeof(traj.y) / 2)); + #if ENABLED(FTM_UNIFIED_BWS) + trajMod = traj; // Copy the uncompensated vectors. + traj = trajWin; // Move the window to traj + #else + // Copy the uncompensated vectors. + #define TCOPY(A) memcpy(trajMod.A, traj.A, sizeof(trajMod.A)) + LOGICAL_AXIS_CODE( + TCOPY(e), + TCOPY(x), TCOPY(y), TCOPY(z), + TCOPY(i), TCOPY(j), TCOPY(k), + TCOPY(u), TCOPY(v), TCOPY(w) + ); - // Z...W and E Disabled! Uncompensated so the lower half is not used. - //TERN_(HAS_Z_AXIS, memcpy(&traj.z[0], &traj.z[FTM_BATCH_SIZE], sizeof(traj.z) / 2)); + // Shift the time series back in the window + #define TSHIFT(A) memcpy(traj.A, trajWin.A, sizeof(trajWin.A)) + LOGICAL_AXIS_CODE( + TSHIFT(e), + TSHIFT(x), TSHIFT(y), TSHIFT(z), + TSHIFT(i), TSHIFT(j), TSHIFT(k), + TSHIFT(u), TSHIFT(v), TSHIFT(w) + ); + #endif // ... data is ready in trajMod. batchRdyForInterp = true; - batchRdy = false; // Clear so that makeVector() may resume generating points. - - } // if (batchRdy && !batchRdyForInterp) + batchRdy = false; // Clear so makeVector() can resume generating points. + } // Interpolation. while ( batchRdyForInterp - && ( stepperCmdBuffItems() < ((FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME)) ) - && ( (interpIdx - interpIdx_z1) < (FTM_STEPS_PER_LOOP) ) + && ( stepperCmdBuffItems() < (FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME) ) + && ( interpIdx - interpIdx_z1 < (FTM_STEPS_PER_LOOP) ) ) { convertToSteps(interpIdx); - if (++interpIdx == FTM_BATCH_SIZE) { + if (++interpIdx == TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, FTM_BATCH_SIZE)) { batchRdyForInterp = false; interpIdx = 0; } @@ -277,76 +240,153 @@ void FTMotion::loop() { // Refresh the gains used by shaping functions. // To be called on init or mode or zeta change. - void FTMotion::Shaping::updateShapingA(const_float_t zeta/*=cfg.zeta*/, const_float_t vtol/*=cfg.vtol*/) { + void FTMotion::Shaping::updateShapingA(float zeta[]/*=cfg.zeta*/, float vtol[]/*=cfg.vtol*/) { - const float K = exp(-zeta * M_PI / sqrt(1.0f - sq(zeta))), - K2 = sq(K); + const float Kx = exp(-zeta[0] * M_PI / sqrt(1.0f - sq(zeta[0]))), + Ky = exp(-zeta[1] * M_PI / sqrt(1.0f - sq(zeta[1]))), + Kx2 = sq(Kx), + Ky2 = sq(Ky); switch (cfg.mode) { case ftMotionMode_ZV: max_i = 1U; - x.Ai[0] = 1.0f / (1.0f + K); - x.Ai[1] = x.Ai[0] * K; + x.Ai[0] = 1.0f / (1.0f + Kx); + x.Ai[1] = x.Ai[0] * Kx; + + y.Ai[0] = 1.0f / (1.0f + Ky); + y.Ai[1] = y.Ai[0] * Ky; break; case ftMotionMode_ZVD: max_i = 2U; - x.Ai[0] = 1.0f / ( 1.0f + 2.0f * K + K2 ); - x.Ai[1] = x.Ai[0] * 2.0f * K; - x.Ai[2] = x.Ai[0] * K2; + x.Ai[0] = 1.0f / (1.0f + 2.0f * Kx + Kx2); + x.Ai[1] = x.Ai[0] * 2.0f * Kx; + x.Ai[2] = x.Ai[0] * Kx2; + + y.Ai[0] = 1.0f / (1.0f + 2.0f * Ky + Ky2); + y.Ai[1] = y.Ai[0] * 2.0f * Ky; + y.Ai[2] = y.Ai[0] * Ky2; + break; + + case ftMotionMode_ZVDD: + max_i = 3U; + x.Ai[0] = 1.0f / (1.0f + 3.0f * Kx + 3.0f * Kx2 + cu(Kx)); + x.Ai[1] = x.Ai[0] * 3.0f * Kx; + x.Ai[2] = x.Ai[0] * 3.0f * Kx2; + x.Ai[3] = x.Ai[0] * cu(Kx); + + y.Ai[0] = 1.0f / (1.0f + 3.0f * Ky + 3.0f * Ky2 + cu(Ky)); + y.Ai[1] = y.Ai[0] * 3.0f * Ky; + y.Ai[2] = y.Ai[0] * 3.0f * Ky2; + y.Ai[3] = y.Ai[0] * cu(Ky); + break; + + case ftMotionMode_ZVDDD: + max_i = 4U; + x.Ai[0] = 1.0f / (1.0f + 4.0f * Kx + 6.0f * Kx2 + 4.0f * cu(Kx) + sq(Kx2)); + x.Ai[1] = x.Ai[0] * 4.0f * Kx; + x.Ai[2] = x.Ai[0] * 6.0f * Kx2; + x.Ai[3] = x.Ai[0] * 4.0f * cu(Kx); + x.Ai[4] = x.Ai[0] * sq(Kx2); + + y.Ai[0] = 1.0f / (1.0f + 4.0f * Ky + 6.0f * Ky2 + 4.0f * cu(Ky) + sq(Ky2)); + y.Ai[1] = y.Ai[0] * 4.0f * Ky; + y.Ai[2] = y.Ai[0] * 6.0f * Ky2; + y.Ai[3] = y.Ai[0] * 4.0f * cu(Ky); + y.Ai[4] = y.Ai[0] * sq(Ky2); break; case ftMotionMode_EI: { max_i = 2U; - x.Ai[0] = 0.25f * (1.0f + vtol); - x.Ai[1] = 0.50f * (1.0f - vtol) * K; - x.Ai[2] = x.Ai[0] * K2; - const float A_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2]); - for (uint32_t i = 0U; i < 3U; i++) { x.Ai[i] *= A_adj; } - } break; + x.Ai[0] = 0.25f * (1.0f + vtol[0]); + x.Ai[1] = 0.50f * (1.0f - vtol[0]) * Kx; + x.Ai[2] = x.Ai[0] * Kx2; + + y.Ai[0] = 0.25f * (1.0f + vtol[1]); + y.Ai[1] = 0.50f * (1.0f - vtol[1]) * Ky; + y.Ai[2] = y.Ai[0] * Ky2; + + const float X_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2]); + const float Y_adj = 1.0f / (y.Ai[0] + y.Ai[1] + y.Ai[2]); + for (uint32_t i = 0U; i < 3U; i++) { + x.Ai[i] *= X_adj; + y.Ai[i] *= Y_adj; + } + } + break; case ftMotionMode_2HEI: { max_i = 3U; - const float vtol2 = sq(vtol); - const float X = pow(vtol2 * (sqrt(1.0f - vtol2) + 1.0f), 1.0f / 3.0f); - x.Ai[0] = ( 3.0f * sq(X) + 2.0f * X + 3.0f * vtol2 ) / (16.0f * X); - x.Ai[1] = ( 0.5f - x.Ai[0] ) * K; - x.Ai[2] = x.Ai[1] * K; - x.Ai[3] = x.Ai[0] * cu(K); - const float A_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2] + x.Ai[3]); - for (uint32_t i = 0U; i < 4U; i++) { x.Ai[i] *= A_adj; } - } break; + const float vtolx2 = sq(vtol[0]); + const float X = pow(vtolx2 * (sqrt(1.0f - vtolx2) + 1.0f), 1.0f / 3.0f); + x.Ai[0] = (3.0f * sq(X) + 2.0f * X + 3.0f * vtolx2) / (16.0f * X); + x.Ai[1] = (0.5f - x.Ai[0]) * Kx; + x.Ai[2] = x.Ai[1] * Kx; + x.Ai[3] = x.Ai[0] * cu(Kx); + + const float vtoly2 = sq(vtol[1]); + const float Y = pow(vtoly2 * (sqrt(1.0f - vtoly2) + 1.0f), 1.0f / 3.0f); + y.Ai[0] = (3.0f * sq(Y) + 2.0f * Y + 3.0f * vtoly2) / (16.0f * Y); + y.Ai[1] = (0.5f - y.Ai[0]) * Ky; + y.Ai[2] = y.Ai[1] * Ky; + y.Ai[3] = y.Ai[0] * cu(Ky); + + const float X_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2] + x.Ai[3]); + const float Y_adj = 1.0f / (y.Ai[0] + y.Ai[1] + y.Ai[2] + y.Ai[3]); + for (uint32_t i = 0U; i < 4U; i++) { + x.Ai[i] *= X_adj; + y.Ai[i] *= Y_adj; + } + } + break; case ftMotionMode_3HEI: { max_i = 4U; - x.Ai[0] = 0.0625f * ( 1.0f + 3.0f * vtol + 2.0f * sqrt( 2.0f * ( vtol + 1.0f ) * vtol ) ); - x.Ai[1] = 0.25f * ( 1.0f - vtol ) * K; - x.Ai[2] = ( 0.5f * ( 1.0f + vtol ) - 2.0f * x.Ai[0] ) * K2; - x.Ai[3] = x.Ai[1] * K2; - x.Ai[4] = x.Ai[0] * sq(K2); - const float A_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2] + x.Ai[3] + x.Ai[4]); - for (uint32_t i = 0U; i < 5U; i++) { x.Ai[i] *= A_adj; } - } break; + x.Ai[0] = 0.0625f * ( 1.0f + 3.0f * vtol[0] + 2.0f * sqrt( 2.0f * ( vtol[0] + 1.0f ) * vtol[0] ) ); + x.Ai[1] = 0.25f * ( 1.0f - vtol[0] ) * Kx; + x.Ai[2] = ( 0.5f * ( 1.0f + vtol[0] ) - 2.0f * x.Ai[0] ) * Kx2; + x.Ai[3] = x.Ai[1] * Kx2; + x.Ai[4] = x.Ai[0] * sq(Kx2); + + y.Ai[0] = 0.0625f * (1.0f + 3.0f * vtol[1] + 2.0f * sqrt(2.0f * (vtol[1] + 1.0f) * vtol[1])); + y.Ai[1] = 0.25f * (1.0f - vtol[1]) * Ky; + y.Ai[2] = (0.5f * (1.0f + vtol[1]) - 2.0f * y.Ai[0]) * Ky2; + y.Ai[3] = y.Ai[1] * Ky2; + y.Ai[4] = y.Ai[0] * sq(Ky2); + + const float X_adj = 1.0f / (x.Ai[0] + x.Ai[1] + x.Ai[2] + x.Ai[3] + x.Ai[4]); + const float Y_adj = 1.0f / (y.Ai[0] + y.Ai[1] + y.Ai[2] + y.Ai[3] + y.Ai[4]); + for (uint32_t i = 0U; i < 5U; i++) { + x.Ai[i] *= X_adj; + y.Ai[i] *= Y_adj; + } + } + break; case ftMotionMode_MZV: { max_i = 2U; - const float B = 1.4142135623730950488016887242097f * K; - x.Ai[0] = 1.0f / (1.0f + B + K2); - x.Ai[1] = x.Ai[0] * B; - x.Ai[2] = x.Ai[0] * K2; - } break; + const float Bx = 1.4142135623730950488016887242097f * Kx; + x.Ai[0] = 1.0f / (1.0f + Bx + Kx2); + x.Ai[1] = x.Ai[0] * Bx; + x.Ai[2] = x.Ai[0] * Kx2; + + const float By = 1.4142135623730950488016887242097f * Ky; + y.Ai[0] = 1.0f / (1.0f + By + Ky2); + y.Ai[1] = y.Ai[0] * By; + y.Ai[2] = y.Ai[0] * Ky2; + } + break; default: - for (uint32_t i = 0U; i < 5U; i++) x.Ai[i] = 0.0f; + ZERO(x.Ai); + ZERO(y.Ai); max_i = 0; } - #if HAS_Y_AXIS - memcpy(y.Ai, x.Ai, sizeof(x.Ai)); // For now, zeta and vtol are shared across x and y. - #endif + } - void FTMotion::updateShapingA(const_float_t zeta/*=cfg.zeta*/, const_float_t vtol/*=cfg.vtol*/) { + void FTMotion::updateShapingA(float zeta[]/*=cfg.zeta*/, float vtol[]/*=cfg.vtol*/) { shaping.updateShapingA(zeta, vtol); } @@ -364,11 +404,13 @@ void FTMotion::loop() { Ni[1] = round((0.5f / f / df) * (FTM_FS)); Ni[2] = Ni[1] + Ni[1]; break; + case ftMotionMode_ZVDD: case ftMotionMode_2HEI: Ni[1] = round((0.5f / f / df) * (FTM_FS)); Ni[2] = Ni[1] + Ni[1]; Ni[3] = Ni[2] + Ni[1]; break; + case ftMotionMode_ZVDDD: case ftMotionMode_3HEI: Ni[1] = round((0.5f / f / df) * (FTM_FS)); Ni[2] = Ni[1] + Ni[1]; @@ -383,10 +425,14 @@ void FTMotion::loop() { } } - void FTMotion::updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), const_float_t zeta/*=cfg.zeta*/) { - const float df = sqrt(1.0f - sq(zeta)); - shaping.x.updateShapingN(xf, df); - TERN_(HAS_Y_AXIS, shaping.y.updateShapingN(yf, df)); + void FTMotion::updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), float zeta[]/*=cfg.zeta*/) { + const float xdf = sqrt(1.0f - sq(zeta[0])); + shaping.x.updateShapingN(xf, xdf); + + #if HAS_Y_AXIS + const float ydf = sqrt(1.0f - sq(zeta[1])); + shaping.y.updateShapingN(yf, ydf); + #endif } #endif // HAS_X_AXIS @@ -396,27 +442,24 @@ void FTMotion::reset() { stepperCmdBuff_produceIdx = stepperCmdBuff_consumeIdx = 0; - traj.reset(); // Reset trajectory history - trajMod.reset(); // Reset modified trajectory history + traj.reset(); + trajWin.reset(); blockProcRdy = blockProcRdy_z1 = blockProcDn = false; batchRdy = batchRdyForInterp = false; runoutEna = false; - runout = false; endPosn_prevBlock.reset(); makeVector_idx = makeVector_idx_z1 = 0; - makeVector_batchIdx = FTM_BATCH_SIZE; + makeVector_batchIdx = 0; steps.reset(); interpIdx = interpIdx_z1 = 0; - dirState = LOGICAL_AXIS_ARRAY_1(stepDirState_NOT_SET); - nextStepTicks = FTM_MIN_TICKS; #if HAS_X_AXIS - for (uint32_t i = 0U; i < (FTM_ZMAX); i++) - shaping.x.d_zi[i] = TERN_(HAS_Y_AXIS, shaping.y.d_zi[i] =) 0.0f; + ZERO(shaping.x.d_zi); + TERN_(HAS_Y_AXIS, ZERO(shaping.y.d_zi)); shaping.zi_idx = 0; #endif @@ -445,40 +488,26 @@ void FTMotion::loadBlockData(block_t * const current_block) { const float totalLength = current_block->millimeters, oneOverLength = 1.0f / totalLength; - const AxisBits direction = current_block->direction_bits; - startPosn = endPosn_prevBlock; xyze_pos_t moveDist = LOGICAL_AXIS_ARRAY( - current_block->steps.e / planner.settings.axis_steps_per_mm[E_AXIS_N(current_block->extruder)], - current_block->steps.x / planner.settings.axis_steps_per_mm[X_AXIS], - current_block->steps.y / planner.settings.axis_steps_per_mm[Y_AXIS], - current_block->steps.z / planner.settings.axis_steps_per_mm[Z_AXIS], - current_block->steps.i / planner.settings.axis_steps_per_mm[I_AXIS], - current_block->steps.j / planner.settings.axis_steps_per_mm[J_AXIS], - current_block->steps.k / planner.settings.axis_steps_per_mm[K_AXIS], - current_block->steps.u / planner.settings.axis_steps_per_mm[U_AXIS], - current_block->steps.v / planner.settings.axis_steps_per_mm[V_AXIS], - current_block->steps.w / planner.settings.axis_steps_per_mm[W_AXIS] - ); - - LOGICAL_AXIS_CODE( - if (!direction.e) moveDist.e *= -1.0f, - if (!direction.x) moveDist.x *= -1.0f, - if (!direction.y) moveDist.y *= -1.0f, - if (!direction.z) moveDist.z *= -1.0f, - if (!direction.i) moveDist.i *= -1.0f, - if (!direction.j) moveDist.j *= -1.0f, - if (!direction.k) moveDist.k *= -1.0f, - if (!direction.u) moveDist.u *= -1.0f, - if (!direction.v) moveDist.v *= -1.0f, - if (!direction.w) moveDist.w *= -1.0f + current_block->steps.e * planner.mm_per_step[E_AXIS_N(current_block->extruder)] * (current_block->direction_bits.e ? 1 : -1), + current_block->steps.x * planner.mm_per_step[X_AXIS] * (current_block->direction_bits.x ? 1 : -1), + current_block->steps.y * planner.mm_per_step[Y_AXIS] * (current_block->direction_bits.y ? 1 : -1), + current_block->steps.z * planner.mm_per_step[Z_AXIS] * (current_block->direction_bits.z ? 1 : -1), + current_block->steps.i * planner.mm_per_step[I_AXIS] * (current_block->direction_bits.i ? 1 : -1), + current_block->steps.j * planner.mm_per_step[J_AXIS] * (current_block->direction_bits.j ? 1 : -1), + current_block->steps.k * planner.mm_per_step[K_AXIS] * (current_block->direction_bits.k ? 1 : -1), + current_block->steps.u * planner.mm_per_step[U_AXIS] * (current_block->direction_bits.u ? 1 : -1), + current_block->steps.v * planner.mm_per_step[V_AXIS] * (current_block->direction_bits.v ? 1 : -1), + current_block->steps.w * planner.mm_per_step[W_AXIS] * (current_block->direction_bits.w ? 1 : -1) ); ratio = moveDist * oneOverLength; + /* Keep for comprehension const float spm = totalLength / current_block->step_event_count; // (steps/mm) Distance for each step - f_s = spm * current_block->initial_rate; // (steps/s) Start feedrate - const float f_e = spm * current_block->final_rate; // (steps/s) End feedrate + f_s = spm * current_block->initial_rate, // (steps/s) Start feedrate + f_e = spm * current_block->final_rate; // (steps/s) End feedrate const float a = current_block->acceleration, // (mm/s^2) Same magnitude for acceleration or deceleration oneby2a = 1.0f / (2.0f * a), // (s/mm) Time to accelerate or decelerate one mm (i.e., oneby2a * 2 @@ -499,25 +528,46 @@ void FTMotion::loadBlockData(block_t * const current_block) { const float T1 = (F_n - f_s) / a, // (s) Accel Time = difference in feedrate over acceleration T3 = (F_n - f_e) / a; // (s) Decel Time = difference in feedrate over acceleration + */ + + const float spm = totalLength / current_block->step_event_count, + f_s = spm * current_block->initial_rate, + f_e = spm * current_block->final_rate; + + const float accel = current_block->acceleration, + oneOverAccel = 1.0f / accel; + + float F_n = current_block->nominal_speed; + const float ldiff = totalLength + 0.5f * oneOverAccel * (sq(f_s) + sq(f_e)); + + float T2 = ldiff / F_n - oneOverAccel * F_n; + if (T2 < 0.0f) { + T2 = 0.0f; + F_n = SQRT(ldiff * accel); + } - N1 = ceil(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency - N2 = ceil(T2 * (FTM_FS)); // Coast - N3 = ceil(T3 * (FTM_FS)); // Decel - - const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution - T2_P = N2 * (FTM_TS), // (s) Coast - T3_P = N3 * (FTM_TS); // (s) Decel - - // Calculate the reachable feedrate at the end of the accel phase - // totalLength is the total distance to travel in mm - // f_s is the starting feedrate in mm/s - // f_e is the ending feedrate in mm/s - // T1_P is the time spent accelerating in seconds - // T2_P is the time spent coasting in seconds - // T3_P is the time spent decelerating in seconds - // f_s * T1_P is the distance traveled during the accel phase - // f_e * T3_P is the distance traveled during the decel phase - // + const float T1 = (F_n - f_s) * oneOverAccel, + T3 = (F_n - f_e) * oneOverAccel; + + N1 = ceil(T1 * (FTM_FS)); // Accel datapoints based on Hz frequency + N2 = ceil(T2 * (FTM_FS)); // Coast + N3 = ceil(T3 * (FTM_FS)); // Decel + + const float T1_P = N1 * (FTM_TS), // (s) Accel datapoints x timestep resolution + T2_P = N2 * (FTM_TS), // (s) Coast + T3_P = N3 * (FTM_TS); // (s) Decel + + /** + * Calculate the reachable feedrate at the end of the accel phase. + * totalLength is the total distance to travel in mm + * f_s : (mm/s) Starting feedrate + * f_e : (mm/s) Ending feedrate + * T1_P : (sec) Time spent accelerating + * T2_P : (sec) Time spent coasting + * T3_P : (sec) Time spent decelerating + * f_s * T1_P : (mm) Distance traveled during the accel phase + * f_e * T3_P : (mm) Distance traveled during the decel phase + */ F_P = (2.0f * totalLength - f_s * T1_P - f_e * T3_P) / (T1_P + 2.0f * T2_P + T3_P); // (mm/s) Feedrate at the end of the accel phase // Calculate the acceleration and deceleration rates @@ -531,77 +581,69 @@ void FTMotion::loadBlockData(block_t * const current_block) { // Calculate the distance traveled during the decel phase s_2e = s_1e + F_P * T2_P; - // One less than (Accel + Coasting + Decel) datapoints - max_intervals = N1 + N2 + N3 - 1U; + // Accel + Coasting + Decel datapoints + max_intervals = N1 + N2 + N3; endPosn_prevBlock += moveDist; } // Generate data points of the trajectory. void FTMotion::makeVector() { - float accel_k = 0.0f; // (mm/s^2) Acceleration K factor - float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block - float dist = 0.0f; // (mm) Distance traveled + float accel_k = 0.0f; // (mm/s^2) Acceleration K factor + float tau = (makeVector_idx + 1) * (FTM_TS); // (s) Time since start of block + float dist = 0.0f; // (mm) Distance traveled if (makeVector_idx < N1) { // Acceleration phase - dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase - accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase + dist = (f_s * tau) + (0.5f * accel_P * sq(tau)); // (mm) Distance traveled for acceleration phase since start of block + accel_k = accel_P; // (mm/s^2) Acceleration K factor from Accel phase } - else if (makeVector_idx >= N1 && makeVector_idx < (N1 + N2)) { + else if (makeVector_idx < (N1 + N2)) { // Coasting phase - dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase + dist = s_1e + F_P * (tau - N1 * (FTM_TS)); // (mm) Distance traveled for coasting phase since start of block //accel_k = 0.0f; } else { // Deceleration phase - const float tau_ = tau - (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase - dist = s_2e + F_P * tau_ + 0.5f * decel_P * sq(tau_); // (mm) Distance traveled for deceleration phase - accel_k = decel_P; // (mm/s^2) Acceleration K factor from Decel phase + tau -= (N1 + N2) * (FTM_TS); // (s) Time since start of decel phase + dist = s_2e + F_P * tau + 0.5f * decel_P * sq(tau); // (mm) Distance traveled for deceleration phase since start of block + accel_k = decel_P; // (mm/s^2) Acceleration K factor from Decel phase } - NUM_AXIS_CODE( - traj.x[makeVector_batchIdx] = startPosn.x + ratio.x * dist, - traj.y[makeVector_batchIdx] = startPosn.y + ratio.y * dist, - traj.z[makeVector_batchIdx] = startPosn.z + ratio.z * dist, - traj.i[makeVector_batchIdx] = startPosn.i + ratio.i * dist, - traj.j[makeVector_batchIdx] = startPosn.j + ratio.j * dist, - traj.k[makeVector_batchIdx] = startPosn.k + ratio.k * dist, - traj.u[makeVector_batchIdx] = startPosn.u + ratio.u * dist, - traj.v[makeVector_batchIdx] = startPosn.v + ratio.v * dist, - traj.w[makeVector_batchIdx] = startPosn.w + ratio.w * dist + LOGICAL_AXIS_CODE( + trajWin.e[makeVector_batchIdx] = startPosn.e + ratio.e * dist, + trajWin.x[makeVector_batchIdx] = startPosn.x + ratio.x * dist, + trajWin.y[makeVector_batchIdx] = startPosn.y + ratio.y * dist, + trajWin.z[makeVector_batchIdx] = startPosn.z + ratio.z * dist, + trajWin.i[makeVector_batchIdx] = startPosn.i + ratio.i * dist, + trajWin.j[makeVector_batchIdx] = startPosn.j + ratio.j * dist, + trajWin.k[makeVector_batchIdx] = startPosn.k + ratio.k * dist, + trajWin.u[makeVector_batchIdx] = startPosn.u + ratio.u * dist, + trajWin.v[makeVector_batchIdx] = startPosn.v + ratio.v * dist, + trajWin.w[makeVector_batchIdx] = startPosn.w + ratio.w * dist ); #if HAS_EXTRUDERS - const float new_raw_z1 = startPosn.e + ratio.e * dist; if (cfg.linearAdvEna) { - float dedt_adj = (new_raw_z1 - e_raw_z1) * (FTM_FS); + float dedt_adj = (trajWin.e[makeVector_batchIdx] - e_raw_z1) * (FTM_FS); if (ratio.e > 0.0f) dedt_adj += accel_k * cfg.linearAdvK; + e_raw_z1 = trajWin.e[makeVector_batchIdx]; e_advanced_z1 += dedt_adj * (FTM_TS); - traj.e[makeVector_batchIdx] = e_advanced_z1; - - e_raw_z1 = new_raw_z1; - } - else { - traj.e[makeVector_batchIdx] = new_raw_z1; - // Alternatively: ed[makeVector_batchIdx] = startPosn.e + (ratio.e * dist) / (N1 + N2 + N3); + trajWin.e[makeVector_batchIdx] = e_advanced_z1; } #endif // Update shaping parameters if needed. - #if HAS_DYNAMIC_FREQ_MM - static float zd_z1 = 0.0f; - #endif + switch (cfg.dynFreqMode) { #if HAS_DYNAMIC_FREQ_MM case dynFreqMode_Z_BASED: - if (traj.z[makeVector_batchIdx] != zd_z1) { // Only update if Z changed. - const float xf = cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * traj.z[makeVector_batchIdx], - yf = cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * traj.z[makeVector_batchIdx]; - updateShapingN(_MAX(xf, FTM_MIN_SHAPE_FREQ), _MAX(yf, FTM_MIN_SHAPE_FREQ)); - zd_z1 = traj.z[makeVector_batchIdx]; + if (trajWin.z[makeVector_batchIdx] != 0.0f) { // Only update if Z changed. + const float xf = cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * trajWin.z[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, yf = cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * trajWin.z[makeVector_batchIdx]); + updateShapingN(_MAX(xf, FTM_MIN_SHAPE_FREQ) OPTARG(HAS_Y_AXIS, _MAX(yf, FTM_MIN_SHAPE_FREQ))); } break; #endif @@ -610,8 +652,8 @@ void FTMotion::makeVector() { case dynFreqMode_MASS_BASED: // Update constantly. The optimization done for Z value makes // less sense for E, as E is expected to constantly change. - updateShapingN( cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * traj.e[makeVector_batchIdx] - OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * traj.e[makeVector_batchIdx]) ); + updateShapingN( cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * trajWin.e[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * trajWin.e[makeVector_batchIdx]) ); break; #endif @@ -621,18 +663,18 @@ void FTMotion::makeVector() { // Apply shaping if in mode. #if HAS_X_AXIS if (cfg.modeHasShaper()) { - shaping.x.d_zi[shaping.zi_idx] = traj.x[makeVector_batchIdx]; - traj.x[makeVector_batchIdx] *= shaping.x.Ai[0]; + shaping.x.d_zi[shaping.zi_idx] = trajWin.x[makeVector_batchIdx]; + trajWin.x[makeVector_batchIdx] *= shaping.x.Ai[0]; #if HAS_Y_AXIS - shaping.y.d_zi[shaping.zi_idx] = traj.y[makeVector_batchIdx]; - traj.y[makeVector_batchIdx] *= shaping.y.Ai[0]; + shaping.y.d_zi[shaping.zi_idx] = trajWin.y[makeVector_batchIdx]; + trajWin.y[makeVector_batchIdx] *= shaping.y.Ai[0]; #endif for (uint32_t i = 1U; i <= shaping.max_i; i++) { const uint32_t udiffx = shaping.zi_idx - shaping.x.Ni[i]; - traj.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx]; + trajWin.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx]; #if HAS_Y_AXIS const uint32_t udiffy = shaping.zi_idx - shaping.y.Ni[i]; - traj.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy]; + trajWin.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy]; #endif } if (++shaping.zi_idx == (FTM_ZMAX)) shaping.zi_idx = 0; @@ -640,18 +682,38 @@ void FTMotion::makeVector() { #endif // Filled up the queue with regular and shaped steps - if (++makeVector_batchIdx == (FTM_WINDOW_SIZE)) { - makeVector_batchIdx = last_batchIdx; + if (++makeVector_batchIdx == TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, (FTM_WINDOW_SIZE - FTM_BATCH_SIZE))) { + makeVector_batchIdx = 0; batchRdy = true; } - if (makeVector_idx == max_intervals) { + if (++makeVector_idx == max_intervals) { blockProcDn = true; blockProcRdy = false; makeVector_idx = 0; } - else - makeVector_idx++; +} + +/** + * Convert to steps + * - Commands are written in a bitmask with step and dir as single bits. + * - Tests for delta are moved outside the loop. + * - Two functions are used for command computation with an array of function pointers. + */ +static void (*command_set[NUM_AXES TERN0(HAS_EXTRUDERS, +1)])(int32_t&, int32_t&, ft_command_t&, int32_t, int32_t); + +static void command_set_pos(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) { + if (e < FTM_CTS_COMPARE_VAL) return; + s++; + b |= bd | bs; + e -= FTM_STEPS_PER_UNIT_TIME; +} + +static void command_set_neg(int32_t &e, int32_t &s, ft_command_t &b, int32_t bd, int32_t bs) { + if (e > -(FTM_CTS_COMPARE_VAL)) return; + s--; + b |= bs; + e += FTM_STEPS_PER_UNIT_TIME; } // Interpolates single data point to stepper commands. @@ -660,154 +722,61 @@ void FTMotion::convertToSteps(const uint32_t idx) { //#define STEPS_ROUNDING #if ENABLED(STEPS_ROUNDING) - const xyze_float_t steps_tar = LOGICAL_AXIS_ARRAY( - trajMod.e[idx] * planner.settings.axis_steps_per_mm[E_AXIS_N(current_block->extruder)] + (trajMod.e[idx] < 0.0f ? -0.5f : 0.5f), // May be eliminated if guaranteed positive. - trajMod.x[idx] * planner.settings.axis_steps_per_mm[X_AXIS] + (trajMod.x[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.y[idx] * planner.settings.axis_steps_per_mm[Y_AXIS] + (trajMod.y[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.z[idx] * planner.settings.axis_steps_per_mm[Z_AXIS] + (trajMod.z[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.i[idx] * planner.settings.axis_steps_per_mm[I_AXIS] + (trajMod.i[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.j[idx] * planner.settings.axis_steps_per_mm[J_AXIS] + (trajMod.j[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.k[idx] * planner.settings.axis_steps_per_mm[K_AXIS] + (trajMod.k[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.u[idx] * planner.settings.axis_steps_per_mm[U_AXIS] + (trajMod.u[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.v[idx] * planner.settings.axis_steps_per_mm[V_AXIS] + (trajMod.v[idx] < 0.0f ? -0.5f : 0.5f), - trajMod.w[idx] * planner.settings.axis_steps_per_mm[W_AXIS] + (trajMod.w[idx] < 0.0f ? -0.5f : 0.5f), + #define TOSTEPS(A,B) int32_t(trajMod.A[idx] * planner.settings.axis_steps_per_mm[B] + (trajMod.A[idx] < 0.0f ? -0.5f : 0.5f)) + const xyze_long_t steps_tar = LOGICAL_AXIS_ARRAY( + TOSTEPS(e, E_AXIS_N(current_block->extruder)), // May be eliminated if guaranteed positive. + TOSTEPS(x, X_AXIS), TOSTEPS(y, Y_AXIS), TOSTEPS(z, Z_AXIS), + TOSTEPS(i, I_AXIS), TOSTEPS(j, J_AXIS), TOSTEPS(k, K_AXIS), + TOSTEPS(u, U_AXIS), TOSTEPS(v, V_AXIS), TOSTEPS(w, W_AXIS) ); - xyze_long_t delta = xyze_long_t(steps_tar) - steps; - //const xyze_long_t delta = LOGICAL_AXIS_ARRAY( - // int32_t(steps_tar.e) - steps.e, - // int32_t(steps_tar.x) - steps.x, - // int32_t(steps_tar.y) - steps.y, - // int32_t(steps_tar.z) - steps.z, - // int32_t(steps_tar.i) - steps.i, - // int32_t(steps_tar.j) - steps.j, - // int32_t(steps_tar.k) - steps.k, - // int32_t(steps_tar.u) - steps.u, - // int32_t(steps_tar.v) - steps.v, - // int32_t(steps_tar.w) - steps.w - //); + xyze_long_t delta = steps_tar - steps; #else + #define TOSTEPS(A,B) int32_t(trajMod.A[idx] * planner.settings.axis_steps_per_mm[B]) - steps.A xyze_long_t delta = LOGICAL_AXIS_ARRAY( - int32_t(trajMod.e[idx] * planner.settings.axis_steps_per_mm[E_AXIS_N(current_block->extruder)]) - steps.e, - int32_t(trajMod.x[idx] * planner.settings.axis_steps_per_mm[X_AXIS]) - steps.x, - int32_t(trajMod.y[idx] * planner.settings.axis_steps_per_mm[Y_AXIS]) - steps.y, - int32_t(trajMod.z[idx] * planner.settings.axis_steps_per_mm[Z_AXIS]) - steps.z, - int32_t(trajMod.i[idx] * planner.settings.axis_steps_per_mm[I_AXIS]) - steps.i, - int32_t(trajMod.j[idx] * planner.settings.axis_steps_per_mm[J_AXIS]) - steps.j, - int32_t(trajMod.k[idx] * planner.settings.axis_steps_per_mm[K_AXIS]) - steps.k, - int32_t(trajMod.u[idx] * planner.settings.axis_steps_per_mm[U_AXIS]) - steps.u, - int32_t(trajMod.v[idx] * planner.settings.axis_steps_per_mm[V_AXIS]) - steps.v, - int32_t(trajMod.w[idx] * planner.settings.axis_steps_per_mm[W_AXIS]) - steps.w + TOSTEPS(e, E_AXIS_N(current_block->extruder)), + TOSTEPS(x, X_AXIS), TOSTEPS(y, Y_AXIS), TOSTEPS(z, Z_AXIS), + TOSTEPS(i, I_AXIS), TOSTEPS(j, J_AXIS), TOSTEPS(k, K_AXIS), + TOSTEPS(u, U_AXIS), TOSTEPS(v, V_AXIS), TOSTEPS(w, W_AXIS) ); #endif - bool any_dirChange = (false - LOGICAL_AXIS_GANG( - || (delta.e > 0 && dirState.e != stepDirState_POS) || (delta.e < 0 && dirState.e != stepDirState_NEG), - || (delta.x > 0 && dirState.x != stepDirState_POS) || (delta.x < 0 && dirState.x != stepDirState_NEG), - || (delta.y > 0 && dirState.y != stepDirState_POS) || (delta.y < 0 && dirState.y != stepDirState_NEG), - || (delta.z > 0 && dirState.z != stepDirState_POS) || (delta.z < 0 && dirState.z != stepDirState_NEG), - || (delta.i > 0 && dirState.i != stepDirState_POS) || (delta.i < 0 && dirState.i != stepDirState_NEG), - || (delta.j > 0 && dirState.j != stepDirState_POS) || (delta.j < 0 && dirState.j != stepDirState_NEG), - || (delta.k > 0 && dirState.k != stepDirState_POS) || (delta.k < 0 && dirState.k != stepDirState_NEG), - || (delta.u > 0 && dirState.u != stepDirState_POS) || (delta.u < 0 && dirState.u != stepDirState_NEG), - || (delta.v > 0 && dirState.v != stepDirState_POS) || (delta.v < 0 && dirState.v != stepDirState_NEG), - || (delta.w > 0 && dirState.w != stepDirState_POS) || (delta.w < 0 && dirState.w != stepDirState_NEG) - ) + LOGICAL_AXIS_CODE( + command_set[E_AXIS_N(current_block->extruder)] = delta.e >= 0 ? command_set_pos : command_set_neg, + command_set[X_AXIS] = delta.x >= 0 ? command_set_pos : command_set_neg, + command_set[Y_AXIS] = delta.y >= 0 ? command_set_pos : command_set_neg, + command_set[Z_AXIS] = delta.z >= 0 ? command_set_pos : command_set_neg, + command_set[I_AXIS] = delta.i >= 0 ? command_set_pos : command_set_neg, + command_set[J_AXIS] = delta.j >= 0 ? command_set_pos : command_set_neg, + command_set[K_AXIS] = delta.k >= 0 ? command_set_pos : command_set_neg, + command_set[U_AXIS] = delta.u >= 0 ? command_set_pos : command_set_neg, + command_set[V_AXIS] = delta.v >= 0 ? command_set_pos : command_set_neg, + command_set[W_AXIS] = delta.w >= 0 ? command_set_pos : command_set_neg ); for (uint32_t i = 0U; i < (FTM_STEPS_PER_UNIT_TIME); i++) { - // TODO: (?) Since the *delta variables will not change, - // the comparison may be done once before iterating at - // expense of storage and lines of code. - - bool anyStep = false; - - // Commands are written in a bitmask with step and dir as single bits - auto COMMAND_SET = [&](auto &d, auto &e, auto &s, auto &b, auto bd, auto bs) { - if (d >= 0) { - if (e + d < (FTM_CTS_COMPARE_VAL)) { - e += d; - } - else { - s++; - b |= bd | bs; - e += d - (FTM_STEPS_PER_UNIT_TIME); - anyStep = true; - } - } - else { - if ((e + d) > -(FTM_CTS_COMPARE_VAL)) { - e += d; - } - else { - s--; - b |= bs; - e += d + (FTM_STEPS_PER_UNIT_TIME); - anyStep = true; - } - } - }; - // Init all step/dir bits to 0 (defaulting to reverse/negative motion) stepperCmdBuff[stepperCmdBuff_produceIdx] = 0; + err_P += delta; + // Set up step/dir bits for all axes LOGICAL_AXIS_CODE( - COMMAND_SET(delta.e, err_P.e, steps.e, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_E), _BV(FT_BIT_STEP_E)), - COMMAND_SET(delta.x, err_P.x, steps.x, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_X), _BV(FT_BIT_STEP_X)), - COMMAND_SET(delta.y, err_P.y, steps.y, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Y), _BV(FT_BIT_STEP_Y)), - COMMAND_SET(delta.z, err_P.z, steps.z, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Z), _BV(FT_BIT_STEP_Z)), - COMMAND_SET(delta.i, err_P.i, steps.i, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_I), _BV(FT_BIT_STEP_I)), - COMMAND_SET(delta.j, err_P.j, steps.j, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_J), _BV(FT_BIT_STEP_J)), - COMMAND_SET(delta.k, err_P.k, steps.k, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_K), _BV(FT_BIT_STEP_K)), - COMMAND_SET(delta.u, err_P.u, steps.u, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_U), _BV(FT_BIT_STEP_U)), - COMMAND_SET(delta.v, err_P.v, steps.v, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_V), _BV(FT_BIT_STEP_V)), - COMMAND_SET(delta.w, err_P.w, steps.w, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_W), _BV(FT_BIT_STEP_W)), + command_set[E_AXIS_N(current_block->extruder)](err_P.e, steps.e, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_E), _BV(FT_BIT_STEP_E)), + command_set[X_AXIS](err_P.x, steps.x, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_X), _BV(FT_BIT_STEP_X)), + command_set[Y_AXIS](err_P.y, steps.y, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Y), _BV(FT_BIT_STEP_Y)), + command_set[Z_AXIS](err_P.z, steps.z, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Z), _BV(FT_BIT_STEP_Z)), + command_set[I_AXIS](err_P.i, steps.i, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_I), _BV(FT_BIT_STEP_I)), + command_set[J_AXIS](err_P.j, steps.j, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_J), _BV(FT_BIT_STEP_J)), + command_set[K_AXIS](err_P.k, steps.k, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_K), _BV(FT_BIT_STEP_K)), + command_set[U_AXIS](err_P.u, steps.u, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_U), _BV(FT_BIT_STEP_U)), + command_set[V_AXIS](err_P.v, steps.v, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_V), _BV(FT_BIT_STEP_V)), + command_set[W_AXIS](err_P.w, steps.w, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_W), _BV(FT_BIT_STEP_W)), ); - if (!anyStep) { - nextStepTicks += (FTM_MIN_TICKS); - } - else { - stepperCmdBuff_StepRelativeTi[stepperCmdBuff_produceIdx] = nextStepTicks; - - const uint8_t dir_index = stepperCmdBuff_produceIdx >> 3, - dir_bit = stepperCmdBuff_produceIdx & 0x7; - if (any_dirChange) { - - SBI(stepperCmdBuff_ApplyDir[dir_index], dir_bit); - - auto DIR_SET = [&](auto &d, auto &c, auto &b, auto bd) { - if (d > 0) { b |= bd; c = stepDirState_POS; } else { c = stepDirState_NEG; } - }; - - LOGICAL_AXIS_CODE( - DIR_SET(delta.e, dirState.e, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_E)), - DIR_SET(delta.x, dirState.x, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_X)), - DIR_SET(delta.y, dirState.y, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Y)), - DIR_SET(delta.z, dirState.z, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_Z)), - DIR_SET(delta.i, dirState.i, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_I)), - DIR_SET(delta.j, dirState.j, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_J)), - DIR_SET(delta.k, dirState.k, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_K)), - DIR_SET(delta.u, dirState.u, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_U)), - DIR_SET(delta.v, dirState.v, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_V)), - DIR_SET(delta.w, dirState.w, stepperCmdBuff[stepperCmdBuff_produceIdx], _BV(FT_BIT_DIR_W)), - ); - - any_dirChange = false; - } - else { // ...no direction change. - CBI(stepperCmdBuff_ApplyDir[dir_index], dir_bit); - } + if (++stepperCmdBuff_produceIdx == (FTM_STEPPERCMD_BUFF_SIZE)) + stepperCmdBuff_produceIdx = 0; - if (stepperCmdBuff_produceIdx == (FTM_STEPPERCMD_BUFF_SIZE) - 1) - stepperCmdBuff_produceIdx = 0; - else - stepperCmdBuff_produceIdx++; - - nextStepTicks = FTM_MIN_TICKS; - } } // FTM_STEPS_PER_UNIT_TIME loop } diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h index 3f620b2f5419..cea754088138 100644 --- a/Marlin/src/module/ft_motion.h +++ b/Marlin/src/module/ft_motion.h @@ -26,8 +26,6 @@ #include "ft_types.h" -#define FTM_STEPPERCMD_DIR_SIZE ((FTM_STEPPERCMD_BUFF_SIZE + 7) / 8) - #if HAS_X_AXIS && (HAS_Z_AXIS || HAS_EXTRUDERS) #define HAS_DYNAMIC_FREQ 1 #if HAS_Z_AXIS @@ -39,28 +37,30 @@ #endif typedef struct FTConfig { - ftMotionMode_t mode = FTM_DEFAULT_MODE; // Mode / active compensation mode configuration. + ftMotionMode_t mode = FTM_DEFAULT_MODE; // Mode / active compensation mode configuration. bool modeHasShaper() { return WITHIN(mode, 10U, 19U); } #if HAS_X_AXIS - float baseFreq[1 + ENABLED(HAS_Y_AXIS)] = // Base frequency. [Hz] + float baseFreq[1 + ENABLED(HAS_Y_AXIS)] = // Base frequency. [Hz] { FTM_SHAPING_DEFAULT_X_FREQ OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) }; + + float zeta[1 + ENABLED(HAS_Y_AXIS)] = // Damping factor + { FTM_SHAPING_ZETA_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_ZETA_Y) }; + float vtol[1 + ENABLED(HAS_Y_AXIS)] = // Vibration Level + { FTM_SHAPING_V_TOL_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_V_TOL_Y) }; #endif - float zeta = FTM_SHAPING_ZETA; // Damping factor - float vtol = FTM_SHAPING_V_TOL; // Vibration Level - - #if HAS_DYNAMIC_FREQ - dynFreqMode_t dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration. - float dynFreqK[1 + ENABLED(HAS_Y_AXIS)] = { 0.0f }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] +#if HAS_DYNAMIC_FREQ + dynFreqMode_t dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; // Dynamic frequency mode configuration. + float dynFreqK[1 + ENABLED(HAS_Y_AXIS)] = { 0.0f }; // Scaling / gain for dynamic frequency. [Hz/mm] or [Hz/g] #else static constexpr dynFreqMode_t dynFreqMode = dynFreqMode_DISABLED; #endif #if HAS_EXTRUDERS - bool linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration. - float linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain. + bool linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration. + float linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain. #endif } ft_config_t; @@ -78,8 +78,11 @@ class FTMotion { TERN_(HAS_X_AXIS, cfg.baseFreq[X_AXIS] = FTM_SHAPING_DEFAULT_X_FREQ); TERN_(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] = FTM_SHAPING_DEFAULT_Y_FREQ); - cfg.zeta = FTM_SHAPING_ZETA; // Damping factor - cfg.vtol = FTM_SHAPING_V_TOL; // Vibration Level + TERN_(HAS_X_AXIS, cfg.zeta[X_AXIS] = FTM_SHAPING_ZETA_X); + TERN_(HAS_Y_AXIS, cfg.zeta[Y_AXIS] = FTM_SHAPING_ZETA_Y); + + TERN_(HAS_X_AXIS, cfg.vtol[X_AXIS] = FTM_SHAPING_V_TOL_X); + TERN_(HAS_Y_AXIS, cfg.vtol[Y_AXIS] = FTM_SHAPING_V_TOL_Y); #if HAS_DYNAMIC_FREQ cfg.dynFreqMode = FTM_DEFAULT_DYNFREQ_MODE; @@ -99,47 +102,45 @@ class FTMotion { reset(); } - static ft_command_t stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of stepper commands. - static hal_timer_t stepperCmdBuff_StepRelativeTi[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of the stepper command timing. - static uint8_t stepperCmdBuff_ApplyDir[FTM_STEPPERCMD_DIR_SIZE]; // Buffer of whether DIR needs to be updated. - static uint32_t stepperCmdBuff_produceIdx, // Index of next stepper command write to the buffer. - stepperCmdBuff_consumeIdx; // Index of next stepper command read from the buffer. + static ft_command_t stepperCmdBuff[FTM_STEPPERCMD_BUFF_SIZE]; // Buffer of stepper commands. + static uint32_t stepperCmdBuff_produceIdx, // Index of next stepper command write to the buffer. + stepperCmdBuff_consumeIdx; // Index of next stepper command read from the buffer. - static bool sts_stepperBusy; // The stepper buffer has items and is in use. + static bool sts_stepperBusy; // The stepper buffer has items and is in use. // Public methods static void init(); - static void startBlockProc(block_t * const current_block); // Set controller states to begin processing a block. - static bool getBlockProcDn() { return blockProcDn; } // Return true if the controller no longer needs the current block. - static void runoutBlock(); // Move any free data points to the stepper buffer even if a full batch isn't ready. - static void loop(); // Controller main, to be invoked from non-isr task. + static void startBlockProc(); // Set controller states to begin processing a block. + static bool getBlockProcDn() { return blockProcDn; } // Return true if the controller no longer needs the current block. + static void runoutBlock(); // Move any free data points to the stepper buffer even if a full batch isn't ready. + static void loop(); // Controller main, to be invoked from non-isr task. #if HAS_X_AXIS // Refresh the gains used by shaping functions. // To be called on init or mode or zeta change. - static void updateShapingA(const_float_t zeta=cfg.zeta, const_float_t vtol=cfg.vtol); + static void updateShapingA(float zeta[]=cfg.zeta, float vtol[]=cfg.vtol); // Refresh the indices used by shaping functions. // To be called when frequencies change. - static void updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), const_float_t zeta=cfg.zeta); + static void updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), float zeta[]=cfg.zeta); static void refreshShapingN() { updateShapingN(cfg.baseFreq[X_AXIS] OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS])); } #endif - static void reset(); // Resets all states of the fixed time conversion to defaults. + static void reset(); // Reset all states of the fixed time conversion to defaults. private: static xyze_trajectory_t traj; static xyze_trajectoryMod_t trajMod; + static xyze_trajectoryWin_t trajWin; - static block_t *current_block_cpy; static bool blockProcRdy, blockProcRdy_z1, blockProcDn; static bool batchRdy, batchRdyForInterp; static bool runoutEna; - static bool runout; + static bool blockDataIsRunout; // Trapezoid data variables. static xyze_pos_t startPosn, // (mm) Start position of block @@ -154,6 +155,11 @@ class FTMotion { static uint32_t N1, N2, N3; static uint32_t max_intervals; + static constexpr uint32_t _ftm_size = TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, FTM_BATCH_SIZE), + _ftm_wind = TERN(FTM_UNIFIED_BWS, 2, ceil((FTM_WINDOW_SIZE) / _ftm_size)), + shaper_intervals = _ftm_size * ceil((FTM_ZMAX) / _ftm_size), + min_max_intervals = _ftm_size * _ftm_wind; + // Make vector variables. static uint32_t makeVector_idx, makeVector_idx_z1, @@ -164,9 +170,6 @@ class FTMotion { interpIdx_z1; static xyze_long_t steps; - static xyze_stepDir_t dirState; - - static hal_timer_t nextStepTicks; // Shaping variables. #if HAS_X_AXIS @@ -188,7 +191,7 @@ class FTMotion { axis_shaping_t y; #endif - void updateShapingA(const_float_t zeta=cfg.zeta, const_float_t vtol=cfg.vtol); + void updateShapingA(float zeta[]=cfg.zeta, float vtol[]=cfg.vtol); } shaping_t; diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h index 6b708677d19c..06680488754f 100644 --- a/Marlin/src/module/ft_types.h +++ b/Marlin/src/module/ft_types.h @@ -29,10 +29,12 @@ typedef enum FXDTICtrlMode : uint8_t { //ftMotionMode_ULENDO_FBS = 2U, ftMotionMode_ZV = 10U, ftMotionMode_ZVD = 11U, - ftMotionMode_EI = 12U, - ftMotionMode_2HEI = 13U, - ftMotionMode_3HEI = 14U, - ftMotionMode_MZV = 15U, + ftMotionMode_ZVDD = 12U, + ftMotionMode_ZVDDD = 13U, + ftMotionMode_EI = 14U, + ftMotionMode_2HEI = 15U, + ftMotionMode_3HEI = 16U, + ftMotionMode_MZV = 17U, //ftMotionMode_DISCTF = 20U } ftMotionMode_t; @@ -42,16 +44,17 @@ enum dynFreqMode_t : uint8_t { dynFreqMode_MASS_BASED = 2U }; -enum stepDirState_t : uint8_t { - stepDirState_NOT_SET = 0U, - stepDirState_POS = 1U, - stepDirState_NEG = 2U -}; - -typedef struct XYZEarray xyze_trajectory_t; -typedef struct XYZEarray xyze_trajectoryMod_t; +#define IS_EI_MODE(N) WITHIN(N, ftMotionMode_EI, ftMotionMode_3HEI) -typedef struct XYZEval xyze_stepDir_t; +#if ENABLED(FTM_UNIFIED_BWS) + typedef struct XYZEarray xyze_trajectory_t; + typedef struct XYZEarray xyze_trajectoryMod_t; + typedef struct XYZEarray xyze_trajectoryWin_t; +#else + typedef struct XYZEarray xyze_trajectory_t; + typedef struct XYZEarray xyze_trajectoryMod_t; + typedef struct XYZEarray xyze_trajectoryWin_t; +#endif enum { LIST_N(DOUBLE(LOGICAL_AXES), diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 74ba41ccf699..2259eedf41d4 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -33,10 +33,6 @@ #include "../lcd/marlinui.h" #include "../inc/MarlinConfig.h" -#if ENABLED(FT_MOTION) - #include "ft_motion.h" -#endif - #if IS_SCARA #include "../libs/buzzer.h" #include "../lcd/marlinui.h" @@ -2095,21 +2091,6 @@ void prepare_line_to_destination() { void homeaxis(const AxisEnum axis) { - #if ENABLED(FT_MOTION) - // Disable ft-motion for homing - struct OnExit { - ftMotionMode_t oldmm; - OnExit() { - oldmm = ftMotion.cfg.mode; - ftMotion.cfg.mode = ftMotionMode_DISABLED; - } - ~OnExit() { - ftMotion.cfg.mode = oldmm; - ftMotion.init(); - } - } on_exit; - #endif - #if ANY(MORGAN_SCARA, MP_SCARA) // Only Z homing (with probe) is permitted if (axis != Z_AXIS) { BUZZ(100, 880); return; } diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index c68db6bb89b4..862b2728042d 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1492,11 +1492,6 @@ void Stepper::isr() { uint8_t max_loops = 10; #if ENABLED(FT_MOTION) - static bool ftMotion_stepCmdRdy = false; // Indicates a step command was loaded from the - // buffers and is ready to be output. - static bool ftMotion_applyDir = false; // Indicates the DIR output should be set. - static ft_command_t ftMotion_stepCmd = 0U; // Storage for the step command to be output. - static uint32_t ftMotion_nextAuxISR = 0U; // Storage for the next ISR of the auxilliary tasks. const bool using_ftMotion = ftMotion.cfg.mode; #else constexpr bool using_ftMotion = false; @@ -1508,57 +1503,19 @@ void Stepper::isr() { // Enable ISRs to reduce USART processing latency hal.isr_on(); - hal_timer_t interval; + hal_timer_t interval = 0; #if ENABLED(FT_MOTION) if (using_ftMotion) { if (!nextMainISR) { - if (abort_current_block) { - ftMotion_stepCmdRdy = false; // If a command was ready, cancel it. - ftMotion.sts_stepperBusy = false; // Set busy false to allow a reset. - nextMainISR = 0.01f * (STEPPER_TIMER_RATE); // Come back in 10 msec. - } - else { // !(abort_current_block) - if (ftMotion_stepCmdRdy) { - ftMotion_stepper(ftMotion_applyDir, ftMotion_stepCmd); - ftMotion_stepCmdRdy = false; - } - // Check if there is data in the buffers. - if (ftMotion.stepperCmdBuff_produceIdx != ftMotion.stepperCmdBuff_consumeIdx) { - - ftMotion.sts_stepperBusy = true; - - // "Pop" one command from the command buffer. - ftMotion_stepCmd = ftMotion.stepperCmdBuff[ftMotion.stepperCmdBuff_consumeIdx]; - const uint8_t dir_index = ftMotion.stepperCmdBuff_consumeIdx >> 3, - dir_bit = ftMotion.stepperCmdBuff_consumeIdx & 0x7; - ftMotion_applyDir = TEST(ftMotion.stepperCmdBuff_ApplyDir[dir_index], dir_bit); - nextMainISR = ftMotion.stepperCmdBuff_StepRelativeTi[ftMotion.stepperCmdBuff_consumeIdx]; - ftMotion_stepCmdRdy = true; - - if (++ftMotion.stepperCmdBuff_consumeIdx == (FTM_STEPPERCMD_BUFF_SIZE)) - ftMotion.stepperCmdBuff_consumeIdx = 0; - - } - else { // Buffer empty. - ftMotion.sts_stepperBusy = false; - nextMainISR = 0.01f * (STEPPER_TIMER_RATE); // Come back in 10 msec. - } - } // !(abort_current_block) - } // if (!nextMainISR) - - // Define 2.5 msec task for auxiliary functions. - if (!ftMotion_nextAuxISR) { + nextMainISR = FTM_MIN_TICKS; + ftMotion_stepper(); endstops.update(); TERN_(BABYSTEPPING, if (babystep.has_steps()) babystepping_isr()); - ftMotion_refreshAxisDidMove(); - ftMotion_nextAuxISR = 0.0025f * (STEPPER_TIMER_RATE); } - - interval = _MIN(nextMainISR, ftMotion_nextAuxISR); + interval = nextMainISR; nextMainISR -= interval; - ftMotion_nextAuxISR -= interval; } #endif @@ -3365,6 +3322,28 @@ void Stepper::set_axis_position(const AxisEnum a, const int32_t &v) { #endif } +#if ENABLED(FT_MOTION) + + void Stepper::ftMotion_syncPosition() { + //planner.synchronize(); planner already synchronized in M493 + + #ifdef __AVR__ + // Protect the access to the position. Only required for AVR, as + // any 32bit CPU offers atomic access to 32bit variables + const bool was_enabled = suspend(); + #endif + + // Update stepper positions from the planner + count_position = planner.position; + + #ifdef __AVR__ + // Reenable Stepper ISR + if (was_enabled) wake_up(); + #endif + } + +#endif // FT_MOTION + // Signal endstops were triggered - This function can be called from // an ISR context (Temperature, Stepper or limits ISR), so we must // be very careful here. If the interrupt being preempted was the @@ -3459,65 +3438,70 @@ void Stepper::report_positions() { #if ENABLED(FT_MOTION) // Set stepper I/O for fixed time controller. - void Stepper::ftMotion_stepper(const bool applyDir, const ft_command_t command) { + void Stepper::ftMotion_stepper() { + + // Check if the buffer is empty. + ftMotion.sts_stepperBusy = (ftMotion.stepperCmdBuff_produceIdx != ftMotion.stepperCmdBuff_consumeIdx); + if (!ftMotion.sts_stepperBusy) return; + + // "Pop" one command from current motion buffer + // Use one byte to restore one stepper command in the format: + // |X_step|X_direction|Y_step|Y_direction|Z_step|Z_direction|E_step|E_direction| + const ft_command_t command = ftMotion.stepperCmdBuff[ftMotion.stepperCmdBuff_consumeIdx]; + if (++ftMotion.stepperCmdBuff_consumeIdx == (FTM_STEPPERCMD_BUFF_SIZE)) ftMotion.stepperCmdBuff_consumeIdx = 0U; + + if (abort_current_block) return; USING_TIMED_PULSE(); - const xyze_bool_t axis_step = LOGICAL_AXIS_ARRAY( + axis_did_move = LOGICAL_AXIS_ARRAY( TEST(command, FT_BIT_STEP_E), TEST(command, FT_BIT_STEP_X), TEST(command, FT_BIT_STEP_Y), TEST(command, FT_BIT_STEP_Z), TEST(command, FT_BIT_STEP_I), TEST(command, FT_BIT_STEP_J), TEST(command, FT_BIT_STEP_K), TEST(command, FT_BIT_STEP_U), TEST(command, FT_BIT_STEP_V), TEST(command, FT_BIT_STEP_W) ); + last_direction_bits = LOGICAL_AXIS_ARRAY( + axis_did_move.e ? TEST(command, FT_BIT_DIR_E) : last_direction_bits.e, + axis_did_move.x ? TEST(command, FT_BIT_DIR_X) : last_direction_bits.x, + axis_did_move.y ? TEST(command, FT_BIT_DIR_Y) : last_direction_bits.y, + axis_did_move.z ? TEST(command, FT_BIT_DIR_Z) : last_direction_bits.z, + axis_did_move.i ? TEST(command, FT_BIT_DIR_I) : last_direction_bits.i, + axis_did_move.j ? TEST(command, FT_BIT_DIR_J) : last_direction_bits.j, + axis_did_move.k ? TEST(command, FT_BIT_DIR_K) : last_direction_bits.k, + axis_did_move.u ? TEST(command, FT_BIT_DIR_U) : last_direction_bits.u, + axis_did_move.v ? TEST(command, FT_BIT_DIR_V) : last_direction_bits.v, + axis_did_move.w ? TEST(command, FT_BIT_DIR_W) : last_direction_bits.w + ); + // Apply directions (which will apply to the entire linear move) - AxisBits axis_dir = last_direction_bits; - if (applyDir) { - axis_dir = LOGICAL_AXIS_ARRAY( - TEST(command, FT_BIT_DIR_E), - TEST(command, FT_BIT_DIR_X), TEST(command, FT_BIT_DIR_Y), TEST(command, FT_BIT_DIR_Z), - TEST(command, FT_BIT_DIR_I), TEST(command, FT_BIT_DIR_J), TEST(command, FT_BIT_DIR_K), - TEST(command, FT_BIT_DIR_U), TEST(command, FT_BIT_DIR_V), TEST(command, FT_BIT_DIR_W) - ); - LOGICAL_AXIS_CODE( - E_APPLY_DIR(axis_dir.e, false), - X_APPLY_DIR(axis_dir.x, false), Y_APPLY_DIR(axis_dir.y, false), Z_APPLY_DIR(axis_dir.z, false), - I_APPLY_DIR(axis_dir.i, false), J_APPLY_DIR(axis_dir.j, false), K_APPLY_DIR(axis_dir.k, false), - U_APPLY_DIR(axis_dir.u, false), V_APPLY_DIR(axis_dir.v, false), W_APPLY_DIR(axis_dir.w, false) - ); - last_direction_bits = axis_dir; - DIR_WAIT_AFTER(); - } + LOGICAL_AXIS_CODE( + E_APPLY_DIR(last_direction_bits.e, false), + X_APPLY_DIR(last_direction_bits.x, false), Y_APPLY_DIR(last_direction_bits.y, false), Z_APPLY_DIR(last_direction_bits.z, false), + I_APPLY_DIR(last_direction_bits.i, false), J_APPLY_DIR(last_direction_bits.j, false), K_APPLY_DIR(last_direction_bits.k, false), + U_APPLY_DIR(last_direction_bits.u, false), V_APPLY_DIR(last_direction_bits.v, false), W_APPLY_DIR(last_direction_bits.w, false) + ); + + DIR_WAIT_AFTER(); // Start a step pulse LOGICAL_AXIS_CODE( - if (axis_step.e) E_APPLY_STEP(STEP_STATE_E, false), - if (axis_step.x) X_APPLY_STEP(STEP_STATE_X, false), if (axis_step.y) Y_APPLY_STEP(STEP_STATE_Y, false), - if (axis_step.z) Z_APPLY_STEP(STEP_STATE_Z, false), if (axis_step.i) I_APPLY_STEP(STEP_STATE_I, false), - if (axis_step.j) J_APPLY_STEP(STEP_STATE_J, false), if (axis_step.k) K_APPLY_STEP(STEP_STATE_K, false), - if (axis_step.u) U_APPLY_STEP(STEP_STATE_U, false), if (axis_step.v) V_APPLY_STEP(STEP_STATE_V, false), - if (axis_step.w) W_APPLY_STEP(STEP_STATE_W, false) + E_APPLY_STEP(axis_did_move.e, false), + X_APPLY_STEP(axis_did_move.x, false), Y_APPLY_STEP(axis_did_move.y, false), Z_APPLY_STEP(axis_did_move.z, false), + I_APPLY_STEP(axis_did_move.i, false), J_APPLY_STEP(axis_did_move.j, false), K_APPLY_STEP(axis_did_move.k, false), + U_APPLY_STEP(axis_did_move.u, false), V_APPLY_STEP(axis_did_move.v, false), W_APPLY_STEP(axis_did_move.w, false) ); // Begin waiting for the minimum pulse duration START_TIMED_PULSE(); - // Update axis direction adders - count_direction = LOGICAL_AXIS_ARRAY( - int8_t(axis_dir.e ? 1 : -1), - int8_t(axis_dir.x ? 1 : -1), int8_t(axis_dir.y ? 1 : -1), int8_t(axis_dir.z ? 1 : -1), - int8_t(axis_dir.i ? 1 : -1), int8_t(axis_dir.j ? 1 : -1), int8_t(axis_dir.k ? 1 : -1), - int8_t(axis_dir.u ? 1 : -1), int8_t(axis_dir.v ? 1 : -1), int8_t(axis_dir.w ? 1 : -1) - ); - - // Update stepper counts - required for various operations + // Update step counts LOGICAL_AXIS_CODE( - if (axis_step.e) count_position.e += count_direction.e, - if (axis_step.x) count_position.x += count_direction.x, if (axis_step.y) count_position.y += count_direction.y, - if (axis_step.z) count_position.z += count_direction.z, if (axis_step.i) count_position.i += count_direction.i, - if (axis_step.j) count_position.j += count_direction.j, if (axis_step.k) count_position.k += count_direction.k, - if (axis_step.u) count_position.u += count_direction.u, if (axis_step.v) count_position.v += count_direction.v, - if (axis_step.w) count_position.w += count_direction.w + if (axis_did_move.e) count_position.e += last_direction_bits.e ? 1 : -1, if (axis_did_move.x) count_position.x += last_direction_bits.x ? 1 : -1, + if (axis_did_move.y) count_position.y += last_direction_bits.y ? 1 : -1, if (axis_did_move.z) count_position.z += last_direction_bits.z ? 1 : -1, + if (axis_did_move.i) count_position.i += last_direction_bits.i ? 1 : -1, if (axis_did_move.j) count_position.j += last_direction_bits.j ? 1 : -1, + if (axis_did_move.k) count_position.k += last_direction_bits.k ? 1 : -1, if (axis_did_move.u) count_position.u += last_direction_bits.u ? 1 : -1, + if (axis_did_move.v) count_position.v += last_direction_bits.v ? 1 : -1, if (axis_did_move.w) count_position.w += last_direction_bits.w ? 1 : -1 ); #if HAS_EXTRUDERS @@ -3532,10 +3516,10 @@ void Stepper::report_positions() { // Only wait for axes without edge stepping const bool any_wait = false LOGICAL_AXIS_GANG( - || (!e_axis_has_dedge && axis_step.e), - || (!AXIS_HAS_DEDGE(X) && axis_step.x), || (!AXIS_HAS_DEDGE(Y) && axis_step.y), || (!AXIS_HAS_DEDGE(Z) && axis_step.z), - || (!AXIS_HAS_DEDGE(I) && axis_step.i), || (!AXIS_HAS_DEDGE(J) && axis_step.j), || (!AXIS_HAS_DEDGE(K) && axis_step.k), - || (!AXIS_HAS_DEDGE(U) && axis_step.u), || (!AXIS_HAS_DEDGE(V) && axis_step.v), || (!AXIS_HAS_DEDGE(W) && axis_step.w) + || (!e_axis_has_dedge && axis_did_move.e), + || (!AXIS_HAS_DEDGE(X) && axis_did_move.x), || (!AXIS_HAS_DEDGE(Y) && axis_did_move.y), || (!AXIS_HAS_DEDGE(Z) && axis_did_move.z), + || (!AXIS_HAS_DEDGE(I) && axis_did_move.i), || (!AXIS_HAS_DEDGE(J) && axis_did_move.j), || (!AXIS_HAS_DEDGE(K) && axis_did_move.k), + || (!AXIS_HAS_DEDGE(U) && axis_did_move.u), || (!AXIS_HAS_DEDGE(V) && axis_did_move.v), || (!AXIS_HAS_DEDGE(W) && axis_did_move.w) ); // Allow pulses to be registered by stepper drivers @@ -3543,80 +3527,46 @@ void Stepper::report_positions() { // Stop pulses. Axes with DEDGE will do nothing, assuming STEP_STATE_* is HIGH LOGICAL_AXIS_CODE( - if (axis_step.e) E_APPLY_STEP(!STEP_STATE_E, false), - if (axis_step.x) X_APPLY_STEP(!STEP_STATE_X, false), if (axis_step.y) Y_APPLY_STEP(!STEP_STATE_Y, false), - if (axis_step.z) Z_APPLY_STEP(!STEP_STATE_Z, false), if (axis_step.i) I_APPLY_STEP(!STEP_STATE_I, false), - if (axis_step.j) J_APPLY_STEP(!STEP_STATE_J, false), if (axis_step.k) K_APPLY_STEP(!STEP_STATE_K, false), - if (axis_step.u) U_APPLY_STEP(!STEP_STATE_U, false), if (axis_step.v) V_APPLY_STEP(!STEP_STATE_V, false), - if (axis_step.w) W_APPLY_STEP(!STEP_STATE_W, false) + E_APPLY_STEP(!STEP_STATE_E, false), + X_APPLY_STEP(!STEP_STATE_X, false), Y_APPLY_STEP(!STEP_STATE_Y, false), Z_APPLY_STEP(!STEP_STATE_Z, false), + I_APPLY_STEP(!STEP_STATE_I, false), J_APPLY_STEP(!STEP_STATE_J, false), K_APPLY_STEP(!STEP_STATE_K, false), + U_APPLY_STEP(!STEP_STATE_U, false), V_APPLY_STEP(!STEP_STATE_V, false), W_APPLY_STEP(!STEP_STATE_W, false) ); } // Stepper::ftMotion_stepper - void Stepper::ftMotion_BlockQueueUpdate() { + void Stepper::ftMotion_blockQueueUpdate() { if (current_block) { // If the current block is not done processing, return right away if (!ftMotion.getBlockProcDn()) return; axis_did_move.reset(); - current_block = nullptr; - discard_current_block(); + planner.release_current_block(); } - if (!current_block) { // No current block - - // Check the buffer for a new block - current_block = planner.get_current_block(); - - if (current_block) { - // Sync block? Sync the stepper counts and return - while (current_block->is_sync()) { - if (!(current_block->is_fan_sync() || current_block->is_pwr_sync())) _set_position(current_block->position); - discard_current_block(); - - // Try to get a new block - if (!(current_block = planner.get_current_block())) - return; // No more queued movements!image.png - } + // Check the buffer for a new block + current_block = planner.get_current_block(); - // this is needed by motor_direction() and subsequently bed leveling (somehow) - // update it here, even though it will may be out of sync with step commands - last_direction_bits = current_block->direction_bits; - - ftMotion.startBlockProc(current_block); + if (current_block) { + // Sync block? Sync the stepper counts and return + while (current_block->is_sync()) { + TERN_(LASER_FEATURE, if (!(current_block->is_fan_sync() || current_block->is_pwr_sync()))) _set_position(current_block->position); + + planner.release_current_block(); - } - else { - ftMotion.runoutBlock(); - return; // No queued blocks + // Try to get a new block + if (!(current_block = planner.get_current_block())) + return; // No queued blocks. } - } // if (!current_block) - - } // Stepper::ftMotion_BlockQueueUpdate() - - // Debounces the axis move indication to account for potential - // delay between the block information and the stepper commands - void Stepper::ftMotion_refreshAxisDidMove() { - - // Set the debounce time in seconds. - #define AXIS_DID_MOVE_DEB 5 // TODO: The debounce time should be calculated if possible, - // or the set conditions should be changed from the block to - // the motion trajectory or motor commands. - - AxisBits didmove; - static abce_ulong_t debounce{0}; - auto debounce_axis = [&](const AxisEnum axis) { - if (current_block->steps[axis]) debounce[axis] = (AXIS_DID_MOVE_DEB) * 400; // divide by 0.0025f */ - if (debounce[axis]) { didmove.bset(axis); debounce[axis]--; } - }; - #define _DEBOUNCE(N) debounce_axis(AxisEnum(N)); + ftMotion.startBlockProc(); + return; + } - if (current_block) { REPEAT(LOGICAL_AXES, _DEBOUNCE); } + ftMotion.runoutBlock(); - axis_did_move = didmove; - } + } // Stepper::ftMotion_blockQueueUpdate() #endif // FT_MOTION diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 2ccc9e7be9f8..99fd2d293609 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -655,7 +655,9 @@ class Stepper { #if ENABLED(FT_MOTION) // Manage the planner - static void ftMotion_BlockQueueUpdate(); + static void ftMotion_blockQueueUpdate(); + // Set current position in steps when reset flag is set in M493 and planner already synchronized + static void ftMotion_syncPosition(); #endif #if HAS_ZV_SHAPING @@ -694,8 +696,7 @@ class Stepper { #endif #if ENABLED(FT_MOTION) - static void ftMotion_stepper(const bool applyDir, const ft_command_t command); - static void ftMotion_refreshAxisDidMove(); + static void ftMotion_stepper(); #endif }; From f69effd2eb595fce676a2af625b8626686b814fd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 19 Dec 2023 20:57:26 -0600 Subject: [PATCH 11/73] =?UTF-8?q?=F0=9F=9A=B8=20Just=20"warn"=20on=20SD=20?= =?UTF-8?q?fail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/sd/cardreader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 175e4e5c05bc..ae7415548213 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -487,9 +487,9 @@ void CardReader::mount() { #endif ) SERIAL_ECHO_MSG(STR_SD_INIT_FAIL); else if (!volume.init(driver)) - SERIAL_ERROR_MSG(STR_SD_VOL_INIT_FAIL); + SERIAL_WARN_MSG(STR_SD_VOL_INIT_FAIL); else if (!root.openRoot(&volume)) - SERIAL_ERROR_MSG(STR_SD_OPENROOT_FAIL); + SERIAL_WARN_MSG(STR_SD_OPENROOT_FAIL); else { flag.mounted = true; SERIAL_ECHO_MSG(STR_SD_CARD_OK); From 738584d342768311845bebf8bc45494db2418eb6 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 20 Dec 2023 06:06:01 +0000 Subject: [PATCH 12/73] [cron] Bump distribution date (2023-12-20) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a096d32aa93f..4c10607eefa1 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-18" +//#define STRING_DISTRIBUTION_DATE "2023-12-20" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index bfdf5c7c2b1b..e21fe4c6e94e 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-18" + #define STRING_DISTRIBUTION_DATE "2023-12-20" #endif /** From eeacf76cfd1e936c44f53e05efb05fbac946996a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 20 Dec 2023 22:07:59 -0600 Subject: [PATCH 13/73] =?UTF-8?q?=F0=9F=94=A7=20config.ini=20/=20JSON=20du?= =?UTF-8?q?mp=20by=20@section=20(#26556)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/schema.py | 21 +- .../share/PlatformIO/scripts/signature.py | 375 ++++++++++++------ 2 files changed, 278 insertions(+), 118 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/schema.py b/buildroot/share/PlatformIO/scripts/schema.py index 80ba70a29812..381ee57a9543 100755 --- a/buildroot/share/PlatformIO/scripts/schema.py +++ b/buildroot/share/PlatformIO/scripts/schema.py @@ -80,7 +80,26 @@ def load_boards(): return '' # -# Extract a schema from the current configuration files +# Extract the current configuration files in the form of a structured schema. +# Contains the full schema for the configuration files, not just the enabled options, +# Contains the current values of the options, not just data structure, so "schema" is a slight misnomer. +# +# The returned object is a nested dictionary with the following indexing: +# +# - schema[filekey][section][define_name] = define_info +# +# Where the define_info contains the following keyed fields: +# - section = The @section the define is in +# - name = The name of the define +# - enabled = True if the define is enabled (not commented out) +# - line = The line number of the define +# - sid = A serial ID for the define +# - value = The value of the define, if it has one +# - type = The type of the define, if it has one +# - requires = The conditions that must be met for the define to be enabled +# - comment = The comment for the define, if it has one +# - units = The units for the define, if it has one +# - options = The options for the define, if it has one # def extract(): # Load board names from boards.h diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py index ab1a46bae523..d2502db35861 100755 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -8,24 +8,54 @@ from datetime import datetime from pathlib import Path -# -# Return all macro names in a header as an array, so we can take -# the intersection with the preprocessor output, giving a decent -# reflection of all enabled options that (probably) came from the -# configuration files. We end up with the actual configured state, -# better than what the config files say. You can then use the -# resulting config.ini to produce more exact configuration files. -# -def extract_defines(filepath): +''' +Return all enabled #define items from a given C header file in a dictionary. +A "#define" in a multi-line comment could produce a false positive if it's not +preceded by a non-space character (like * in a multi-line comment). + +Output: +Each entry is a dictionary with a 'name' and a 'section' key. We end up with: + { MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... } + +The 'name' key might get dropped as redundant, but it's useful for debugging. + +Because the option names are the keys, only the last occurrence is retained. +Use the Schema class for a more complete list of options, soon with full parsing. + +This list is used to filter what is actually a config-defined option versus +defines from elsewhere. + +While the Schema class parses the configurations on its own, this script will +get the preprocessor output and get the intersection of the enabled options from +our crude scraping method and the actual compiler output. +We end up with the actual configured state, +better than what the config files say. You can then use the +a decent reflection of all enabled options that (probably) came from +resulting config.ini to produce more exact configuration files. +''' +def enabled_defines(filepath): + outdict = {} + section = "user" + spatt = re.compile(r".*@section +([-a-zA-Z0-9_\s]+)$") # must match @section ... + f = open(filepath, encoding="utf8").read().split("\n") + + # Get the full contents of the file and remove all block comments. + # This will avoid false positives from #defines in comments + f = re.sub(r'/\*.*?\*/', '', '\n'.join(f), flags=re.DOTALL).split("\n") + a = [] for line in f: sline = line.strip() + m = re.match(spatt, sline) # @section ... + if m: + section = m.group(1).strip() + continue if sline[:7] == "#define": # Extract the key here (we don't care about the value) kv = sline[8:].strip().split() - a.append(kv[0]) - return a + outdict[kv[0]] = { 'name':kv[0], 'section': section } + return outdict # Compute the SHA256 hash of a file def get_file_sha256sum(filepath): @@ -44,25 +74,25 @@ def compress_file(filepath, storedname, outpath): with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_BZIP2, compresslevel=9) as zipf: zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9) -# -# Compute the build signature by extracting all configuration settings and -# building a unique reversible signature that can be included in the binary. -# The signature can be reversed to get a 1:1 equivalent configuration file. -# +''' +Compute the build signature by extracting all configuration settings and +building a unique reversible signature that can be included in the binary. +The signature can be reversed to get a 1:1 equivalent configuration file. +''' def compute_build_signature(env): - if 'BUILD_SIGNATURE' in env: - return + if 'BUILD_SIGNATURE' in env: return + env.Append(BUILD_SIGNATURE=1) build_path = Path(env['PROJECT_BUILD_DIR'], env['PIOENV']) marlin_json = build_path / 'marlin_config.json' marlin_zip = build_path / 'mc.zip' # Definitions from these files will be kept - files_to_keep = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ] + header_paths = [ 'Marlin/Configuration.h', 'Marlin/Configuration_adv.h' ] # Check if we can skip processing hashes = '' - for header in files_to_keep: + for header in header_paths: hashes += get_file_sha256sum(header)[0:10] # Read a previously exported JSON file @@ -77,121 +107,211 @@ def compute_build_signature(env): except: pass - # Get enabled config options based on preprocessor - from preprocessor import run_preprocessor - complete_cfg = run_preprocessor(env) - - # Dumb #define extraction from the configuration files + # Extract "enabled" #define lines by scraping the configuration files. + # This data also contains the @section for each option. conf_defines = {} - all_defines = [] - for header in files_to_keep: - defines = extract_defines(header) - # To filter only the define we want - all_defines += defines - # To remember from which file it cames from - conf_defines[header.split('/')[-1]] = defines + conf_names = [] + for hpath in header_paths: + # Get defines in the form of { name: { name:..., section:... }, ... } + defines = enabled_defines(hpath) + # Get all unique define names into a flat array + conf_names += defines.keys() + # Remember which file these defines came from + conf_defines[hpath.split('/')[-1]] = defines + + # Get enabled config options based on running GCC to preprocess the config files. + # The result is a list of line strings, each starting with '#define'. + from preprocessor import run_preprocessor + build_output = run_preprocessor(env) + # Dumb regex to filter out some dumb macros r = re.compile(r"\(+(\s*-*\s*_.*)\)+") - # First step is to collect all valid macros - defines = {} - for line in complete_cfg: - - # Split the define from the value + # Extract all the #define lines in the build output as key/value pairs + build_defines = {} + for line in build_output: + # Split the define from the value. key_val = line[8:].strip().decode().split(' ') key, value = key_val[0], ' '.join(key_val[1:]) - # Ignore values starting with two underscore, since it's low level - if len(key) > 2 and key[0:2] == "__" : - continue - # Ignore values containing a parenthesis (likely a function macro) - if '(' in key and ')' in key: - continue - + if len(key) > 2 and key[0:2] == "__": continue + # Ignore values containing parentheses (likely a function macro) + if '(' in key and ')' in key: continue # Then filter dumb values - if r.match(value): - continue + if r.match(value): continue - defines[key] = value if len(value) else "" + build_defines[key] = value if len(value) else "" # # Continue to gather data for CONFIGURATION_EMBEDDING or CONFIG_EXPORT # - if not ('CONFIGURATION_EMBEDDING' in defines or 'CONFIG_EXPORT' in defines): + if not ('CONFIGURATION_EMBEDDING' in build_defines or 'CONFIG_EXPORT' in build_defines): return - # Second step is to filter useless macro - resolved_defines = {} - for key in defines: + # Filter out useless macros from the output + cleaned_build_defines = {} + for key in build_defines: # Remove all boards now - if key.startswith("BOARD_") and key != "BOARD_INFO_NAME": - continue + if key.startswith("BOARD_") and key != "BOARD_INFO_NAME": continue # Remove all keys ending by "_T_DECLARED" as it's a copy of extraneous system stuff - if key.endswith("_T_DECLARED"): - continue + if key.endswith("_T_DECLARED"): continue # Remove keys that are not in the #define list in the Configuration list - if key not in all_defines + [ 'DETAILED_BUILD_VERSION', 'STRING_DISTRIBUTION_DATE' ]: - continue - - # Don't be that smart guy here - resolved_defines[key] = defines[key] - - # Generate a build signature now - # We are making an object that's a bit more complex than a basic dictionary here - data = {} - data['__INITIAL_HASH'] = hashes - # First create a key for each header here + if key not in conf_names + [ 'DETAILED_BUILD_VERSION', 'STRING_DISTRIBUTION_DATE' ]: continue + # Add to a new dictionary for simplicity + cleaned_build_defines[key] = build_defines[key] + + # And we only care about defines that (most likely) came from the config files + # Build a dictionary of dictionaries with keys: 'name', 'section', 'value' + # { 'file1': { 'option': { 'name':'option', 'section':..., 'value':... }, ... }, 'file2': { ... } } + real_config = {} for header in conf_defines: - data[header] = {} - - # Then populate the object where each key is going to (that's a O(N^2) algorithm here...) - for key in resolved_defines: - for header in conf_defines: + real_config[header] = {} + for key in cleaned_build_defines: if key in conf_defines[header]: - data[header][key] = resolved_defines[key] + if key[0:2] == '__': continue + val = cleaned_build_defines[key] + real_config[header][key] = { 'file':header, 'name': key, 'value': val, 'section': conf_defines[header][key]['section']} - # Every python needs this toy def tryint(key): - try: - return int(defines[key]) - except: - return 0 + try: return int(build_defines[key]) + except: return 0 + # Get the CONFIG_EXPORT value and do an extended dump if > 100 + # For example, CONFIG_EXPORT 102 will make a 'config.ini' with a [config:] group for each schema @section config_dump = tryint('CONFIG_EXPORT') + extended_dump = config_dump > 100 + if extended_dump: config_dump -= 100 # # Produce an INI file if CONFIG_EXPORT == 2 # if config_dump == 2: print("Generating config.ini ...") + + ini_fmt = '{0:40} = {1}' + ext_fmt = '{0:40} {1}' + ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXPORT') + + if extended_dump: + # Extended export will dump config options by section + + # We'll use Schema class to get the sections + try: + conf_schema = schema.extract() + except Exception as exc: + print("Error: " + str(exc)) + exit(1) + + # Then group options by schema @section + sections = {} + for header in real_config: + for name in real_config[header]: + #print(f" name: {name}") + if name not in ignore: + ddict = real_config[header][name] + #print(f" real_config[{header}][{name}]:", ddict) + sect = ddict['section'] + if sect not in sections: sections[sect] = {} + sections[sect][name] = ddict + + # Get all sections as a list of strings, with spaces and dashes replaced by underscores + long_list = [ re.sub(r'[- ]+', '_', x).lower() for x in sections.keys() ] + # Make comma-separated lists of sections with 64 characters or less + sec_lines = [] + while len(long_list): + line = long_list.pop(0) + ', ' + while len(long_list) and len(line) + len(long_list[0]) < 64 - 1: + line += long_list.pop(0) + ', ' + sec_lines.append(line.strip()) + sec_lines[-1] = sec_lines[-1][:-1] # Remove the last comma + + else: + sec_lines = ['all'] + + # Build the ini_use_config item + sec_list = ini_fmt.format('ini_use_config', sec_lines[0]) + for line in sec_lines[1:]: sec_list += '\n' + ext_fmt.format('', line) + config_ini = build_path / 'config.ini' with config_ini.open('w') as outfile: - ignore = ('CONFIGURATION_H_VERSION', 'CONFIGURATION_ADV_H_VERSION', 'CONFIG_EXPORT') filegrp = { 'Configuration.h':'config:basic', 'Configuration_adv.h':'config:advanced' } - vers = defines["CONFIGURATION_H_VERSION"] + vers = build_defines["CONFIGURATION_H_VERSION"] dt_string = datetime.now().strftime("%Y-%m-%d at %H:%M:%S") - ini_fmt = '{0:40}{1}\n' + outfile.write( - '#\n' - + '# Marlin Firmware\n' - + '# config.ini - Options to apply before the build\n' - + '#\n' - + f'# Generated by Marlin build on {dt_string}\n' - + '#\n' - + '\n' - + '[config:base]\n' - + ini_fmt.format('ini_use_config', ' = all') - + ini_fmt.format('ini_config_vers', f' = {vers}') - ) - # Loop through the data array of arrays - for header in data: - if header.startswith('__'): - continue - outfile.write('\n[' + filegrp[header] + ']\n') - for key in sorted(data[header]): - if key not in ignore: - val = 'on' if data[header][key] == '' else data[header][key] - outfile.write(ini_fmt.format(key.lower(), ' = ' + val)) +f'''# +# Marlin Firmware +# config.ini - Options to apply before the build +# +# Generated by Marlin build on {dt_string} +# +[config:base] +# +# ini_use_config - A comma-separated list of actions to apply to the Configuration files. +# The actions will be applied in the listed order. +# - none +# Ignore this file and don't apply any configuration options +# +# - base +# Just apply the options in config:base to the configuration +# +# - minimal +# Just apply the options in config:minimal to the configuration +# +# - all +# Apply all 'config:*' sections in this file to the configuration +# +# - another.ini +# Load another INI file with a path relative to this config.ini file (i.e., within Marlin/) +# +# - https://me.myserver.com/path/to/configs +# Fetch configurations from any URL. +# +# - example/Creality/Ender-5 Plus @ bugfix-2.1.x +# Fetch example configuration files from the MarlinFirmware/Configurations repository +# https://raw.githubusercontent.com/MarlinFirmware/Configurations/bugfix-2.1.x/config/examples/Creality/Ender-5%20Plus/ +# +# - example/default @ release-2.0.9.7 +# Fetch default configuration files from the MarlinFirmware/Configurations repository +# https://raw.githubusercontent.com/MarlinFirmware/Configurations/release-2.0.9.7/config/default/ +# +# - [disable] +# Comment out all #defines in both Configuration.h and Configuration_adv.h. This is useful +# to start with a clean slate before applying any config: options, so only the options explicitly +# set in config.ini will be enabled in the configuration. +# +# - [flatten] (Not yet implemented) +# Produce a flattened set of Configuration.h and Configuration_adv.h files with only the enabled +# #defines and no comments. A clean look, but context-free. +# +{sec_list} +{ini_fmt.format('ini_config_vers', vers)} +''' ) + + if extended_dump: + + # Loop through the sections + for skey in sorted(sections): + #print(f" skey: {skey}") + sani = re.sub(r'[- ]+', '_', skey).lower() + outfile.write(f"\n[config:{sani}]\n") + opts = sections[skey] + for name in sorted(opts): + val = opts[name]['value'] + if val == '': val = 'on' + #print(f" {name} = {val}") + outfile.write(ini_fmt.format(name.lower(), val) + '\n') + + else: + + # Standard export just dumps config:basic and config:advanced sections + for header in real_config: + outfile.write(f'\n[{filegrp[header]}]\n') + for name in sorted(real_config[header]): + if name not in ignore: + val = real_config[header][name]['value'] + if val == '': val = 'on' + outfile.write(ini_fmt.format(name.lower(), val) + '\n') # # CONFIG_EXPORT 3 = schema.json, 4 = schema.yml @@ -229,28 +349,51 @@ def tryint(key): import yaml schema.dump_yaml(conf_schema, build_path / 'schema.yml') - # Append the source code version and date - data['VERSION'] = {} - data['VERSION']['DETAILED_BUILD_VERSION'] = resolved_defines['DETAILED_BUILD_VERSION'] - data['VERSION']['STRING_DISTRIBUTION_DATE'] = resolved_defines['STRING_DISTRIBUTION_DATE'] - try: - curver = subprocess.check_output(["git", "describe", "--match=NeVeRmAtCh", "--always"]).strip() - data['VERSION']['GIT_REF'] = curver.decode() - except: - pass - # # Produce a JSON file for CONFIGURATION_EMBEDDING or CONFIG_EXPORT == 1 # Skip if an identical JSON file was already present. # - if not same_hash and (config_dump == 1 or 'CONFIGURATION_EMBEDDING' in defines): + if not same_hash and (config_dump == 1 or 'CONFIGURATION_EMBEDDING' in build_defines): with marlin_json.open('w') as outfile: - json.dump(data, outfile, separators=(',', ':')) + + json_data = {} + if extended_dump: + print("Extended dump ...") + for header in real_config: + confs = real_config[header] + json_data[header] = {} + for name in confs: + c = confs[name] + s = c['section'] + if s not in json_data[header]: json_data[header][s] = {} + json_data[header][s][name] = c['value'] + else: + for header in real_config: + conf = real_config[header] + print(f"real_config[{header}]", conf) + for name in conf: + json_data[name] = conf[name]['value'] + + json_data['__INITIAL_HASH'] = hashes + + # Append the source code version and date + json_data['VERSION'] = { + 'DETAILED_BUILD_VERSION': cleaned_build_defines['DETAILED_BUILD_VERSION'], + 'STRING_DISTRIBUTION_DATE': cleaned_build_defines['STRING_DISTRIBUTION_DATE'] + } + try: + curver = subprocess.check_output(["git", "describe", "--match=NeVeRmAtCh", "--always"]).strip() + json_data['VERSION']['GIT_REF'] = curver.decode() + except: + pass + + json.dump(json_data, outfile, separators=(',', ':')) # # The rest only applies to CONFIGURATION_EMBEDDING # - if not 'CONFIGURATION_EMBEDDING' in defines: + if not 'CONFIGURATION_EMBEDDING' in build_defines: + (build_path / 'mc.zip').unlink(missing_ok=True) return # Compress the JSON file as much as we can @@ -269,10 +412,8 @@ def tryint(key): for b in (build_path / 'mc.zip').open('rb').read(): result_file.write(b' 0x%02X,' % b) count += 1 - if count % 16 == 0: - result_file.write(b'\n ') - if count % 16: - result_file.write(b'\n') + if count % 16 == 0: result_file.write(b'\n ') + if count % 16: result_file.write(b'\n') result_file.write(b'};\n') if __name__ == "__main__": From 19617b79dbf5aedc62d5124c28e687c92d8a7e09 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 21 Dec 2023 06:06:34 +0000 Subject: [PATCH 14/73] [cron] Bump distribution date (2023-12-21) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 4c10607eefa1..f3e34d8702a8 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-20" +//#define STRING_DISTRIBUTION_DATE "2023-12-21" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e21fe4c6e94e..abd5973f3398 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-20" + #define STRING_DISTRIBUTION_DATE "2023-12-21" #endif /** From 401ba6613b1f9079ebd392adc8b0692c1525ab4f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Dec 2023 15:25:48 -0600 Subject: [PATCH 15/73] =?UTF-8?q?=F0=9F=94=A7=20Up=20to=2012=20PWM=20fans?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 51 +++++++++++++++---------- Marlin/src/lcd/dogm/dogm_Statusscreen.h | 22 ++++++----- 2 files changed, 44 insertions(+), 29 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 85b3a22cbf73..42379506ced7 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2473,11 +2473,7 @@ #define COOLER_MAX_TARGET (COOLER_MAXTEMP - (COOLER_OVERSHOOT)) #endif -#if HAS_HEATED_BED || HAS_TEMP_CHAMBER - #define BED_OR_CHAMBER 1 -#endif - -#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD || HAS_TEMP_SOC +#if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_TEMP_CHAMBER || HAS_TEMP_PROBE || HAS_TEMP_COOLER || HAS_TEMP_BOARD || HAS_TEMP_SOC #define HAS_TEMP_SENSOR 1 #endif @@ -2644,11 +2640,13 @@ #endif #endif -// Print Cooling fans (limit) +/** + * Up to 12 PWM fans + */ #ifdef NUM_M106_FANS #define MAX_FANS NUM_M106_FANS #else - #define MAX_FANS 8 // Max supported fans + #define MAX_FANS 12 // Max supported fans #endif #define _IS_E_AUTO(N,F) (PIN_EXISTS(E##N##_AUTO_FAN) && E##N##_AUTO_FAN_PIN == FAN##F##_PIN) @@ -2683,21 +2681,30 @@ #if _HAS_FAN(7) #define HAS_FAN7 1 #endif -#undef _NOT_E_AUTO -#undef _HAS_FAN - -#if BED_OR_CHAMBER || HAS_FAN0 - #define BED_OR_CHAMBER_OR_FAN 1 +#if _HAS_FAN(8) + #define HAS_FAN8 1 #endif - -/** - * Up to 8 PWM fans - */ -#ifndef FAN_INVERTING - #define FAN_INVERTING false +#if _HAS_FAN(9) + #define HAS_FAN9 1 #endif - -#if HAS_FAN7 +#if _HAS_FAN(10) + #define HAS_FAN10 1 +#endif +#if _HAS_FAN(11) + #define HAS_FAN11 1 +#endif +#undef _HAS_FAN +#undef _IS_E_AUTO + +#if HAS_FAN11 + #define FAN_COUNT 12 +#elif HAS_FAN10 + #define FAN_COUNT 11 +#elif HAS_FAN9 + #define FAN_COUNT 10 +#elif HAS_FAN8 + #define FAN_COUNT 9 +#elif HAS_FAN7 #define FAN_COUNT 8 #elif HAS_FAN6 #define FAN_COUNT 7 @@ -2721,6 +2728,10 @@ #define HAS_FAN 1 #endif +#ifndef FAN_INVERTING + #define FAN_INVERTING false +#endif + #if PIN_EXISTS(FANMUX0) #define HAS_FANMUX 1 // Part Cooling fan multipliexer #endif diff --git a/Marlin/src/lcd/dogm/dogm_Statusscreen.h b/Marlin/src/lcd/dogm/dogm_Statusscreen.h index 9eec9d198717..c8edae94f142 100644 --- a/Marlin/src/lcd/dogm/dogm_Statusscreen.h +++ b/Marlin/src/lcd/dogm/dogm_Statusscreen.h @@ -143,7 +143,7 @@ // Can also be overridden in Configuration_adv.h // If you can afford it, try the 3-frame fan animation! // Don't compile in the fan animation with no fan -#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && BED_OR_CHAMBER) || ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER)) +#if !HAS_FAN0 || (HOTENDS == 5 || (HOTENDS == 4 && (HAS_HEATED_BED || HAS_TEMP_CHAMBER)) || ALL(STATUS_COMBINE_HEATERS, HAS_HEATED_CHAMBER)) #undef STATUS_FAN_FRAMES #elif !STATUS_FAN_FRAMES #define STATUS_FAN_FRAMES 2 @@ -200,18 +200,22 @@ #undef STATUS_LOGO_WIDTH #endif - #if !defined(STATUS_HEATERS_X) && ((HAS_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN)) - #define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2) - #if STATUS_HOTEND1_WIDTH - #if HOTENDS > 2 - #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 6) + #ifndef STATUS_HEATERS_X + #define _BED_OR_CHAMBER_OR_FAN (HAS_HEATED_BED || HAS_TEMP_CHAMBER || HAS_FAN) + #if (HAS_HOTEND && STATUS_LOGO_WIDTH && _BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !_BED_OR_CHAMBER_OR_FAN) + #define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2) + #if STATUS_HOTEND1_WIDTH + #if HOTENDS > 2 + #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 6) + #else + #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 4) + #endif #else - #define STATUS_HEATERS_X _STATUS_HEATERS_X(HOTENDS, STATUS_HOTEND1_WIDTH, 4) + #define STATUS_HEATERS_X _STATUS_HEATERS_X(1, STATUS_HEATERS_WIDTH, 4) #endif - #else - #define STATUS_HEATERS_X _STATUS_HEATERS_X(1, STATUS_HEATERS_WIDTH, 4) #endif #endif + #undef _BED_OR_CHAMBER_OR_FAN #endif // From c18294d83cc891c47d5abe56a4842adbe6fbb1aa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Dec 2023 15:30:03 -0600 Subject: [PATCH 16/73] =?UTF-8?q?=F0=9F=94=A7=20Optional=20FAN=5FINVERTING?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_post.h | 4 ---- Marlin/src/module/temperature.cpp | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 42379506ced7..04e96177b5d1 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2728,10 +2728,6 @@ #define HAS_FAN 1 #endif -#ifndef FAN_INVERTING - #define FAN_INVERTING false -#endif - #if PIN_EXISTS(FANMUX0) #define HAS_FANMUX 1 // Part Cooling fan multipliexer #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index fc9e08fe7cac..afde7d3b3497 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -370,9 +370,9 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED); // Init fans according to whether they're native PWM or Software PWM #ifdef BOARD_OPENDRAIN_MOSFETS - #define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH) + #define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, ENABLED(FAN_INVERTING) ? LOW : HIGH) #else - #define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) + #define _INIT_SOFT_FAN(P) OUT_WRITE(P, ENABLED(FAN_INVERTING) ? LOW : HIGH) #endif #if ENABLED(FAN_SOFT_PWM) #define _INIT_FAN_PIN(P) _INIT_SOFT_FAN(P) @@ -3819,7 +3819,7 @@ void Temperature::isr() { static SoftPWM soft_pwm_controller; #endif - #define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ FAN_INVERTING) + #define WRITE_FAN(n, v) WRITE(FAN##n##_PIN, (v) ^ ENABLED(FAN_INVERTING)) #if DISABLED(SLOW_PWM_HEATERS) From dbdb2ecdf756e657322977911460f43e76a9962b Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 22 Dec 2023 00:21:13 +0000 Subject: [PATCH 17/73] [cron] Bump distribution date (2023-12-22) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f3e34d8702a8..bdce222e8692 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-21" +//#define STRING_DISTRIBUTION_DATE "2023-12-22" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index abd5973f3398..7c8ba14665b6 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-21" + #define STRING_DISTRIBUTION_DATE "2023-12-22" #endif /** From 2c5468ce333cd4a8c6ddfde8d4ad66d8417f32bd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Dec 2023 22:34:19 -0600 Subject: [PATCH 18/73] =?UTF-8?q?=F0=9F=8E=A8=20Planner=20indent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/planner.cpp | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 64c47301f58a..f7ab42ad8164 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -257,11 +257,15 @@ void Planner::init() { position.reset(); TERN_(HAS_POSITION_FLOAT, position_float.reset()); TERN_(IS_KINEMATIC, position_cart.reset()); + previous_speed.reset(); previous_nominal_speed = 0; + TERN_(ABL_PLANAR, bed_level_matrix.set_to_identity()); + clear_block_buffer(); delay_before_delivering = 0; + #if ENABLED(DIRECT_STEPPING) last_page_step_rate = 0; last_page_dir.reset(); @@ -1970,23 +1974,21 @@ bool Planner::_populate_block( dm.hy = (dist.b > 0); // ...and Y TERN_(HAS_Z_AXIS, dm.z = (dist.c > 0)); #endif - #if IS_CORE - #if CORE_IS_XY - dm.a = (dist.a + dist.b > 0); // Motor A direction - dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction - #elif CORE_IS_XZ - dm.hx = (dist.a > 0); // Save the toolhead's true direction in X - dm.y = (dist.b > 0); - dm.hz = (dist.c > 0); // ...and Z - dm.a = (dist.a + dist.c > 0); // Motor A direction - dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction - #elif CORE_IS_YZ - dm.x = (dist.a > 0); - dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y - dm.hz = (dist.c > 0); // ...and Z - dm.b = (dist.b + dist.c > 0); // Motor B direction - dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction - #endif + #if CORE_IS_XY + dm.a = (dist.a + dist.b > 0); // Motor A direction + dm.b = (CORESIGN(dist.a - dist.b) > 0); // Motor B direction + #elif CORE_IS_XZ + dm.hx = (dist.a > 0); // Save the toolhead's true direction in X + dm.y = (dist.b > 0); + dm.hz = (dist.c > 0); // ...and Z + dm.a = (dist.a + dist.c > 0); // Motor A direction + dm.c = (CORESIGN(dist.a - dist.c) > 0); // Motor C direction + #elif CORE_IS_YZ + dm.x = (dist.a > 0); + dm.hy = (dist.b > 0); // Save the toolhead's true direction in Y + dm.hz = (dist.c > 0); // ...and Z + dm.b = (dist.b + dist.c > 0); // Motor B direction + dm.c = (CORESIGN(dist.b - dist.c) > 0); // Motor C direction #elif ENABLED(MARKFORGED_XY) dm.a = (dist.a TERN(MARKFORGED_INVERSE, -, +) dist.b > 0); // Motor A direction dm.b = (dist.b > 0); // Motor B direction @@ -2090,23 +2092,21 @@ bool Planner::_populate_block( dist_mm.head.y = dist.b * mm_per_step[B_AXIS]; TERN_(HAS_Z_AXIS, dist_mm.z = dist.c * mm_per_step[Z_AXIS]); #endif - #if IS_CORE - #if CORE_IS_XY - dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS]; - dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS]; - #elif CORE_IS_XZ - dist_mm.head.x = dist.a * mm_per_step[A_AXIS]; - dist_mm.y = dist.b * mm_per_step[Y_AXIS]; - dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; - dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS]; - dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS]; - #elif CORE_IS_YZ - dist_mm.x = dist.a * mm_per_step[X_AXIS]; - dist_mm.head.y = dist.b * mm_per_step[B_AXIS]; - dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; - dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS]; - dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS]; - #endif + #if CORE_IS_XY + dist_mm.a = (dist.a + dist.b) * mm_per_step[A_AXIS]; + dist_mm.b = CORESIGN(dist.a - dist.b) * mm_per_step[B_AXIS]; + #elif CORE_IS_XZ + dist_mm.head.x = dist.a * mm_per_step[A_AXIS]; + dist_mm.y = dist.b * mm_per_step[Y_AXIS]; + dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; + dist_mm.a = (dist.a + dist.c) * mm_per_step[A_AXIS]; + dist_mm.c = CORESIGN(dist.a - dist.c) * mm_per_step[C_AXIS]; + #elif CORE_IS_YZ + dist_mm.x = dist.a * mm_per_step[X_AXIS]; + dist_mm.head.y = dist.b * mm_per_step[B_AXIS]; + dist_mm.head.z = dist.c * mm_per_step[C_AXIS]; + dist_mm.b = (dist.b + dist.c) * mm_per_step[B_AXIS]; + dist_mm.c = CORESIGN(dist.b - dist.c) * mm_per_step[C_AXIS]; #elif ENABLED(MARKFORGED_XY) dist_mm.a = (dist.a TERN(MARKFORGED_INVERSE, +, -) dist.b) * mm_per_step[A_AXIS]; dist_mm.b = dist.b * mm_per_step[B_AXIS]; @@ -2540,6 +2540,7 @@ bool Planner::_populate_block( #if DISABLED(S_CURVE_ACCELERATION) block->acceleration_rate = (uint32_t)(accel * (float(1UL << 24) / (STEPPER_TIMER_RATE))); #endif + #if ENABLED(LIN_ADVANCE) block->la_advance_rate = 0; block->la_scaling = 0; From ec7ab5a277a0210e1349f9e8608c372e40fdb6e6 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 21 Dec 2023 22:35:51 -0600 Subject: [PATCH 19/73] =?UTF-8?q?=F0=9F=94=A8=20Build=20flag=20tweaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/macros.h | 11 ++++++----- ini/avr.ini | 4 ++-- ini/stm32f1-maple.ini | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index beb6bfe3e9a5..784002c769c4 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -37,11 +37,12 @@ #define FORCE_INLINE __attribute__((always_inline)) inline #define NO_INLINE __attribute__((noinline)) #define _UNUSED __attribute__((unused)) -#define __O0 __attribute__((optimize("O0"))) -#define __Os __attribute__((optimize("Os"))) -#define __O1 __attribute__((optimize("O1"))) -#define __O2 __attribute__((optimize("O2"))) -#define __O3 __attribute__((optimize("O3"))) +#define __O0 __attribute__((optimize("O0"))) // No optimization and less debug info +#define __Og __attribute__((optimize("Og"))) // Optimize the debugging experience +#define __Os __attribute__((optimize("Os"))) // Optimize for size +#define __O1 __attribute__((optimize("O1"))) // Try to reduce size and cycles; nothing that takes a lot of time to compile +#define __O2 __attribute__((optimize("O2"))) // Optimize even more +#define __O3 __attribute__((optimize("O3"))) // Optimize yet more #define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead diff --git a/ini/avr.ini b/ini/avr.ini index 7c5f369dc6d7..f2f0658d842f 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -14,8 +14,8 @@ # [common_avr8] platform = atmelavr@~4.0.1 -build_flags = ${common.build_flags} -Wl,--relax -build_src_flags = -std=gnu++1z +build_flags = ${common.build_flags} -std=gnu++1z -Wl,--relax +build_unflags = -std=gnu++11 board_build.f_cpu = 16000000L build_src_filter = ${common.default_src_filter} + diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index a113d1a7b154..16563fcc9105 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -326,7 +326,7 @@ extends = STM32F1_maple board = marlin_malyanM200 build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103CB -D__STM32F1__=1 -std=c++1y -DSERIAL_USB -ffunction-sections -fdata-sections - -Wl,--gc-sections -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ + -Wl,--gc-sections -DDEBUG_LEVEL=0 lib_ignore = ${STM32F1_maple.lib_ignore} SoftwareSerialM From 56ac5d03ed0901b721d816a41126854a96b1d67f Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 22 Dec 2023 13:57:06 -0500 Subject: [PATCH 20/73] =?UTF-8?q?=F0=9F=9A=B8=20Update=20ProUI=20Plot=20gr?= =?UTF-8?q?aph=20(#26539)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Warnings.cpp | 13 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 174 ++++++++++++++++------- Marlin/src/lcd/e3v2/proui/dwin.h | 1 + Marlin/src/lcd/e3v2/proui/dwin_defines.h | 3 + Marlin/src/lcd/e3v2/proui/plot.cpp | 48 ++++--- Marlin/src/lcd/e3v2/proui/plot.h | 11 +- Marlin/src/lcd/language/language_en.h | 2 + buildroot/share/dwin/bin/DWIN_ICO.py | 39 +++-- 8 files changed, 199 insertions(+), 92 deletions(-) diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 3efbb67a0cd5..1824ac58c9b6 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -792,10 +792,17 @@ #endif /** - * ProUI Boot Screen Duration + * ProUI Extras */ -#if ENABLED(DWIN_LCD_PROUI) && BOOTSCREEN_TIMEOUT > 2000 - #warning "For ProUI the original BOOTSCREEN_TIMEOUT of 1100 is recommended." +#if ENABLED(DWIN_LCD_PROUI) + #if BOOTSCREEN_TIMEOUT > 2000 + #warning "For ProUI the original BOOTSCREEN_TIMEOUT of 1100 is recommended." + #endif + #if HAS_PID_HEATING && NONE(PID_AUTOTUNE_MENU, PID_EDIT_MENU) + #warning "For ProUI PID_AUTOTUNE_MENU and PID_EDIT_MENU is recommended for PID tuning." + #elif ENABLED(MPCTEMP) && NONE(MPC_EDIT_MENU, MPC_AUTOTUNE_MENU) + #warning "For ProUI MPC_EDIT_MENU and MPC_AUTOTUNE_MENU is recommended for MPC tuning." + #endif #endif /** diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 8d54e0c582ec..fcebdb8c5726 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -735,7 +735,7 @@ void _drawIconBlink(bool &flag, const bool sensor, const uint8_t icon1, const ui void _drawZOffsetIcon() { #if HAS_LEVELING static bool _leveling_active = false; - _drawIconBlink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 186, 416); + _drawIconBlink(_leveling_active, planner.leveling_active, ICON_Zoffset, ICON_SetZOffset, 187, 416); #else DWINUI::drawIcon(ICON_Zoffset, 187, 416); #endif @@ -763,9 +763,9 @@ void _drawFeedrate() { } void _drawXYZPosition(const bool force) { - _update_axis_value(X_AXIS, 27, 459, force); - _update_axis_value(Y_AXIS, 112, 459, force); - _update_axis_value(Z_AXIS, 197, 459, force); + _update_axis_value(X_AXIS, 27, 457, force); + _update_axis_value(Y_AXIS, 112, 457, force); + _update_axis_value(Z_AXIS, 197, 457, force); } void updateVariable() { @@ -778,7 +778,18 @@ void updateVariable() { _new_hotend_target = _hotendtarget != ht; if (_new_hotend_temp) _hotendtemp = hc; if (_new_hotend_target) _hotendtarget = ht; - #endif + + // if hotend is near target or heating, ICON indicates hot + if (thermalManager.degHotendNear(0, ht) || thermalManager.isHeatingHotend(0)) { + dwinDrawBox(1, hmiData.colorBackground, 10, 383, 20, 20); + DWINUI::drawIcon(ICON_SetEndTemp, 10, 383); + } + else { + dwinDrawBox(1, hmiData.colorBackground, 10, 383, 20, 20); + DWINUI::drawIcon(ICON_HotendTemp, 10, 383); + } + #endif // HAS_HOTEND + #if HAS_HEATED_BED static celsius_t _bedtemp = 0, _bedtarget = 0; const celsius_t bc = thermalManager.wholeDegBed(), @@ -787,7 +798,18 @@ void updateVariable() { _new_bed_target = _bedtarget != bt; if (_new_bed_temp) _bedtemp = bc; if (_new_bed_target) _bedtarget = bt; - #endif + + // if bed is near target, heating, or if degrees > 44, ICON indicates hot + if (thermalManager.degBedNear(bt) || thermalManager.isHeatingBed() || (bc > 44)) { + dwinDrawBox(1, hmiData.colorBackground, 10, 416, 20, 20); + DWINUI::drawIcon(ICON_BedTemp, 10, 416); + } + else { + dwinDrawBox(1, hmiData.colorBackground, 10, 416, 20, 20); + DWINUI::drawIcon(ICON_SetBedTemp, 10, 416); + } + #endif // HAS_HEATED_BED + #if HAS_FAN static uint8_t _fanspeed = 0; const bool _new_fanspeed = _fanspeed != thermalManager.fan_speed[0]; @@ -1022,9 +1044,9 @@ void dwinDrawDashboard() { dwinDrawRectangle(1, hmiData.colorBackground, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); dwinDrawRectangle(1, hmiData.colorSplitLine, 0, 449, DWIN_WIDTH, 451); - DWINUI::drawIcon(ICON_MaxSpeedX, 10, 456); - DWINUI::drawIcon(ICON_MaxSpeedY, 95, 456); - DWINUI::drawIcon(ICON_MaxSpeedZ, 180, 456); + DWINUI::drawIcon(ICON_MaxSpeedX, 10, 454); + DWINUI::drawIcon(ICON_MaxSpeedY, 95, 454); + DWINUI::drawIcon(ICON_MaxSpeedZ, 180, 454); _drawXYZPosition(true); #if HAS_HOTEND @@ -1033,7 +1055,7 @@ void dwinDrawDashboard() { DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0)); - DWINUI::drawIcon(ICON_StepE, 112, 417); + DWINUI::drawIcon(ICON_StepE, 113, 416); DWINUI::drawInt(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); DWINUI::drawString(DWIN_FONT_STAT, hmiData.colorIndicator, hmiData.colorBackground, 116 + 5 * STAT_CHR_W + 2, 417, F("%")); #endif @@ -1269,6 +1291,16 @@ void eachMomentUpdate() { TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) plot.update(thermalManager.wholeDegBed())); } TERN_(MPCTEMP, if (checkkey == ID_MPCProcess) plot.update(thermalManager.wholeDegHotend(0))); + #if ENABLED(PROUI_ITEM_PLOT) + if (checkkey == ID_PlotProcess) { + TERN_(PIDTEMP, if (hmiValue.tempControl == PIDTEMP_START) { plot.update(thermalManager.wholeDegHotend(0)); }) + TERN_(PIDTEMPBED, if (hmiValue.tempControl == PIDTEMPBED_START) { plot.update(thermalManager.wholeDegBed()); }) + TERN_(MPCTEMP, if (hmiValue.tempControl == MPCTEMP_START) { plot.update(thermalManager.wholeDegHotend(0)); }) + if (hmiFlag.abort_flag || hmiFlag.pause_flag || print_job_timer.isPaused()) { + hmiReturnScreen(); + } + } + #endif #endif } @@ -1402,29 +1434,32 @@ void dwinHandleScreen() { case ID_SetIntNoDraw: hmiSetNoDraw(); break; case ID_PrintProcess: hmiPrinting(); break; case ID_Popup: hmiPopup(); break; - case ID_Leveling: break; #if HAS_LOCKSCREEN case ID_Locked: hmiLockScreen(); break; #endif - case ID_PrintDone: + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) + TERN_(PROUI_ITEM_PLOT, case ID_PlotProcess:) + case ID_PrintDone: case ID_WaitResponse: hmiWaitForUser(); break; + + TERN_(HAS_BED_PROBE, case ID_Leveling:) case ID_Homing: case ID_PIDProcess: - case ID_NothingToDo: break; + case ID_NothingToDo: default: break; } } bool idIsPopUp() { // If ID is popup... switch (checkkey) { + TERN_(HAS_BED_PROBE, case ID_Leveling:) + TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) case ID_NothingToDo: case ID_WaitResponse: case ID_Popup: case ID_Homing: - case ID_Leveling: case ID_PIDProcess: - TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) return true; default: break; } @@ -1439,8 +1474,9 @@ void hmiSaveProcessID(const uint8_t id) { case ID_Popup: case ID_WaitResponse: case ID_PrintDone: - case ID_Leveling: + TERN_(HAS_BED_PROBE, case ID_Leveling:) TERN_(HAS_ESDIAG, case ID_ESDiagProcess:) + TERN_(PROUI_ITEM_PLOT, case ID_PlotProcess:) wait_for_user = true; default: break; } @@ -1515,7 +1551,7 @@ void dwinLevelingDone() { celsius_t _maxtemp, _target; void dwinDrawPIDMPCPopup() { - constexpr frame_rect_t gfrm = { 40, 180, DWIN_WIDTH - 80, 120 }; + constexpr frame_rect_t gfrm = { 30, 150, DWIN_WIDTH - 60, 160 }; DWINUI::clearMainArea(); drawPopupBkgd(); @@ -1523,50 +1559,27 @@ void dwinLevelingDone() { default: return; #if ENABLED(MPC_AUTOTUNE) case MPCTEMP_START: - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_MPC_AUTOTUNE)); - DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); - break; - #endif - #if ANY(PIDTEMP, PIDTEMPBED) - TERN_(PIDTEMP, case PIDTEMP_START:) - TERN_(PIDTEMPBED, case PIDTEMPBED_START:) - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 100, GET_TEXT_F(MSG_PID_AUTOTUNE)); - DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); - break; - #endif - } - - switch (hmiValue.tempControl) { - default: break; - #if ANY(PIDTEMP, MPC_AUTOTUNE) - TERN_(PIDTEMP, case PIDTEMP_START:) - TERN_(MPC_AUTOTUNE, case MPCTEMP_START:) - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for Nozzle is running.")); - break; - #endif - #if ENABLED(PIDTEMPBED) - case PIDTEMPBED_START: - DWINUI::drawCenteredString(hmiData.colorPopupTxt, 120, F("for BED is running.")); - break; - #endif - } - - switch (hmiValue.tempControl) { - default: break; - #if ENABLED(MPC_AUTOTUNE) - case MPCTEMP_START: + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_MPC_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("MPC target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for NOZZLE is running.")); _maxtemp = thermalManager.hotend_maxtemp[0]; _target = 200; break; #endif #if ENABLED(PIDTEMP) case PIDTEMP_START: + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for NOZZLE is running.")); _maxtemp = thermalManager.hotend_maxtemp[0]; _target = hmiData.hotendPidT; break; #endif #if ENABLED(PIDTEMPBED) case PIDTEMPBED_START: + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 70, GET_TEXT_F(MSG_PID_AUTOTUNE)); + DWINUI::drawString(hmiData.colorPopupTxt, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("PID target: Celsius")); + DWINUI::drawCenteredString(hmiData.colorPopupTxt, 92, F("for BED is running.")); _maxtemp = BED_MAXTEMP; _target = hmiData.bedPidT; break; @@ -1574,9 +1587,58 @@ void dwinLevelingDone() { } plot.draw(gfrm, _maxtemp, _target); - DWINUI::drawInt(hmiData.colorPopupTxt, 3, gfrm.x + 90, gfrm.y - DWINUI::fontHeight() - 4, _target); + DWINUI::drawInt(false, 2, hmiData.colorStatusTxt, hmiData.colorPopupTxt, 3, gfrm.x + 92, gfrm.y - DWINUI::fontHeight() - 6, _target); } + // Plot Temperature Graph (PID Tuning Graph) + #if ENABLED(PROUI_ITEM_PLOT) + + void dwinDrawPlot(tempcontrol_t result) { + hmiValue.tempControl = result; + constexpr frame_rect_t gfrm = {30, 135, DWIN_WIDTH - 60, 160}; + DWINUI::clearMainArea(); + drawPopupBkgd(); + hmiSaveProcessID(ID_PlotProcess); + + switch (result) { + #if ENABLED(MPCTEMP) + case MPCTEMP_START: + #elif ENABLED(PIDTEMP) + case PIDTEMP_START: + #endif + title.showCaption(GET_TEXT_F(MSG_HOTEND_TEMP_GRAPH)); + DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, F("Nozzle Temperature")); + _maxtemp = thermalManager.hotend_max_target(0); + _target = thermalManager.degTargetHotend(0); + break; + #if ENABLED(PIDTEMPBED) + case PIDTEMPBED_START: + title.showCaption(GET_TEXT_F(MSG_BED_TEMP_GRAPH)); + DWINUI::drawCenteredString(3, hmiData.colorPopupTxt, 75, F("Bed Temperature")); + _maxtemp = BED_MAX_TARGET; + _target = thermalManager.degTargetBed(); + break; + #endif + default: break; + } + + dwinDrawString(false, 2, hmiData.colorPopupTxt, hmiData.colorPopupBg, gfrm.x, gfrm.y - DWINUI::fontHeight() - 4, F("Target: Celsius")); + plot.draw(gfrm, _maxtemp, _target); + DWINUI::drawInt(false, 2, hmiData.colorStatusTxt, hmiData.colorPopupBg, 3, gfrm.x + 80, gfrm.y - DWINUI::fontHeight() - 4, _target); + DWINUI::drawButton(BTN_Continue, 86, 305); + dwinUpdateLCD(); + } + + void drawHPlot() { + TERN_(PIDTEMP, dwinDrawPlot(PIDTEMP_START);) + TERN_(MPCTEMP, dwinDrawPlot(MPCTEMP_START);) + } + void drawBPlot() { + TERN_(PIDTEMPBED, dwinDrawPlot(PIDTEMPBED_START);) + } + + #endif // PROUI_ITEM_PLOT + #endif // PROUI_TUNING_GRAPH #if PROUI_PID_TUNE @@ -2993,7 +3055,7 @@ frame_rect_t selrect(frame_rect_t) { void drawPrepareMenu() { checkkey = ID_Menu; - if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 10 + PREHEAT_COUNT)) { + if (SET_MENU_R(prepareMenu, selrect({133, 1, 28, 13}), MSG_PREPARE, 12 + PREHEAT_COUNT)) { BACK_ITEM(gotoMainMenu); MENU_ITEM(ICON_FilMan, MSG_FILAMENT_MAN, onDrawSubMenu, drawFilamentManMenu); MENU_ITEM(ICON_Axis, MSG_MOVE_AXIS, onDrawMoveSubMenu, drawMoveMenu); @@ -3023,6 +3085,10 @@ void drawPrepareMenu() { REPEAT_1(PREHEAT_COUNT, _ITEM_PREHEAT) #endif MENU_ITEM(ICON_Cool, MSG_COOLDOWN, onDrawCooldown, doCoolDown); + #if ALL(PROUI_TUNING_GRAPH, PROUI_ITEM_PLOT) + MENU_ITEM(ICON_PIDNozzle, MSG_HOTEND_TEMP_GRAPH, onDrawMenuItem, drawHPlot); + MENU_ITEM(ICON_PIDBed, MSG_BED_TEMP_GRAPH, onDrawMenuItem, drawBPlot); + #endif MENU_ITEM(ICON_Language, MSG_UI_LANGUAGE, onDrawLanguage, setLanguage); } ui.reset_status(true); @@ -3304,7 +3370,7 @@ void drawFilSetMenu() { void drawTuneMenu() { checkkey = ID_Menu; - if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 18)) { + if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 20)) { BACK_ITEM(gotoPrintProcess); EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, setSpeed, &feedrate_percentage); #if HAS_HOTEND @@ -3350,6 +3416,10 @@ void drawTuneMenu() { #if ENABLED(EDITABLE_DISPLAY_TIMEOUT) EDIT_ITEM(ICON_Brightness, MSG_SCREEN_TIMEOUT, onDrawPIntMenu, setTimer, &ui.backlight_timeout_minutes); #endif + #if ALL(PROUI_TUNING_GRAPH, PROUI_ITEM_PLOT) + MENU_ITEM(ICON_PIDNozzle, MSG_HOTEND_TEMP_GRAPH, onDrawMenuItem, drawHPlot); + MENU_ITEM(ICON_PIDBed, MSG_BED_TEMP_GRAPH, onDrawMenuItem, drawBPlot); + #endif #if ENABLED(CASE_LIGHT_MENU) EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #if CASELIGHT_USES_BRIGHTNESS diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index 8706a18fac65..675c087074ac 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -67,6 +67,7 @@ enum processID : uint8_t { ID_WaitResponse, ID_Homing, ID_PIDProcess, + ID_PlotProcess, ID_MPCProcess, ID_NothingToDo }; diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 1b987906ae87..c03ac66af1ab 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -106,6 +106,9 @@ #if ANY(PROUI_PID_TUNE, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH) #define PROUI_TUNING_GRAPH 1 #endif +#if PROUI_TUNING_GRAPH + #define PROUI_ITEM_PLOT // Plot temp graph viewer +#endif #define HAS_GCODE_PREVIEW 1 // Preview G-code model thumbnail #define HAS_CUSTOM_COLORS 1 // Change display colors #define HAS_ESDIAG 1 // View End-stop/Runout switch continuity diff --git a/Marlin/src/lcd/e3v2/proui/plot.cpp b/Marlin/src/lcd/e3v2/proui/plot.cpp index 84c58389a6f7..f77ffaf13a96 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.cpp +++ b/Marlin/src/lcd/e3v2/proui/plot.cpp @@ -39,40 +39,42 @@ #include "../../marlinui.h" #include "plot.h" -#define Plot_Bg_Color RGB( 1, 12, 8) +#define plotBgColor RGB(1, 12, 8) Plot plot; -uint16_t graphpoints, r, x2, y2 = 0; -frame_rect_t graphframe = {0}; -float scale = 0; +Plot::PlotData Plot::data; -void Plot::draw(const frame_rect_t &frame, const_celsius_float_t max, const_float_t ref/*=0*/) { - graphframe = frame; - graphpoints = 0; - scale = frame.h / max; - x2 = frame.x + frame.w - 1; - y2 = frame.y + frame.h - 1; - r = round((y2) - ref * scale); - DWINUI::drawBox(1, Plot_Bg_Color, frame); +void Plot::draw(const frame_rect_t &frame, const_celsius_float_t max, const_celsius_float_t ref/*=0*/) { + data.graphframe = frame; + data.graphpoints = 0; + data.scale = frame.h / max; + data.x2 = frame.x + frame.w - 1; + data.y2 = frame.y + frame.h - 1; + data.r = LROUND((data.y2) - ref * data.scale); + DWINUI::drawBox(1, plotBgColor, frame); for (uint8_t i = 1; i < 4; i++) if (i * 60 < frame.w) dwinDrawVLine(COLOR_LINE, i * 60 + frame.x, frame.y, frame.h); DWINUI::drawBox(0, COLOR_WHITE, DWINUI::extendFrame(frame, 1)); - dwinDrawHLine(COLOR_RED, frame.x, r, frame.w); + dwinDrawHLine(COLOR_RED, frame.x, data.r, frame.w); } -void Plot::update(const_float_t value) { - if (!scale) return; - const uint16_t y = round((y2) - value * scale); - if (graphpoints < graphframe.w) { - dwinDrawPoint(COLOR_YELLOW, 1, 1, graphpoints + graphframe.x, y); +void Plot::update(const_celsius_float_t value) { + if (!data.scale) return; + const uint16_t y = LROUND((data.y2) - value * data.scale); + if (data.graphpoints < data.graphframe.w) { + if (data.graphpoints < 1) + dwinDrawPoint(COLOR_YELLOW, 1, 1, data.graphframe.x, y); + else + dwinDrawLine(COLOR_YELLOW, data.graphpoints + data.graphframe.x - 1, data.yP, data.graphpoints + data.graphframe.x, y); } else { - dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, graphframe.x, graphframe.y, x2, y2); - if ((graphpoints % 60) == 0) dwinDrawVLine(COLOR_LINE, x2 - 1, graphframe.y + 1, graphframe.h - 2); - dwinDrawPoint(COLOR_RED, 1, 1, x2 - 1, r); - dwinDrawPoint(COLOR_YELLOW, 1, 1, x2 - 1, y); + dwinFrameAreaMove(1, 0, 1, plotBgColor, data.graphframe.x, data.graphframe.y, data.x2, data.y2); + if ((data.graphpoints % 60) == 0) dwinDrawVLine(COLOR_LINE, data.x2 - 1, data.graphframe.y + 1, data.graphframe.h - 2); + dwinDrawPoint(COLOR_RED, 1, 1, data.x2 - 1, data.r); + dwinDrawLine(COLOR_YELLOW, data.x2 - 2, data.yP, data.x2 - 1, y); } - graphpoints++; + data.yP = y; + data.graphpoints++; TERN_(HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout()); } diff --git a/Marlin/src/lcd/e3v2/proui/plot.h b/Marlin/src/lcd/e3v2/proui/plot.h index 275f0453becc..2617d78061f0 100644 --- a/Marlin/src/lcd/e3v2/proui/plot.h +++ b/Marlin/src/lcd/e3v2/proui/plot.h @@ -32,8 +32,15 @@ class Plot { public: - static void draw(const frame_rect_t &frame, const_celsius_float_t max, const_float_t ref=0); - static void update(const_float_t value); + static void draw(const frame_rect_t &frame, const_celsius_float_t max, const_celsius_float_t ref=0); + static void update(const_celsius_float_t value); + +private: + static struct PlotData { + uint16_t graphpoints, r, x2, y2, yP = 0; + frame_rect_t graphframe = {0}; + float scale = 0; + } data; }; extern Plot plot; diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 7945b26d5b72..97d8183f5200 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -448,6 +448,8 @@ namespace LanguageNarrow_en { LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness"); LSTR MSG_SCREEN_TIMEOUT = _UxGT("LCD Timeout (m)"); + LSTR MSG_HOTEND_TEMP_GRAPH = _UxGT("Hotend Temp Graph"); + LSTR MSG_BED_TEMP_GRAPH = _UxGT("Bed Temp Graph"); LSTR MSG_BRIGHTNESS_OFF = _UxGT("Backlight Off"); LSTR MSG_STORE_EEPROM = _UxGT("Store Settings"); LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings"); diff --git a/buildroot/share/dwin/bin/DWIN_ICO.py b/buildroot/share/dwin/bin/DWIN_ICO.py index 3ddc734022ee..4896f3ce45e1 100644 --- a/buildroot/share/dwin/bin/DWIN_ICO.py +++ b/buildroot/share/dwin/bin/DWIN_ICO.py @@ -247,16 +247,16 @@ def serialize(self): return rawdata _iconNames = { - 0 : 'ICON_LOGO', - 1 : 'ICON_Print_0', - 2 : 'ICON_Print_1', - 3 : 'ICON_Prepare_0', - 4 : 'ICON_Prepare_1', - 5 : 'ICON_Control_0', - 6 : 'ICON_Control_1', - 7 : 'ICON_Leveling_0', - 8 : 'ICON_Leveling_1', - 9 : 'ICON_HotendTemp', + 0 : 'ICON_LOGO', + 1 : 'ICON_Print_0', + 2 : 'ICON_Print_1', + 3 : 'ICON_Prepare_0', + 4 : 'ICON_Prepare_1', + 5 : 'ICON_Control_0', + 6 : 'ICON_Control_1', + 7 : 'ICON_Leveling_0', + 8 : 'ICON_Leveling_1', + 9 : 'ICON_HotendTemp', 10 : 'ICON_BedTemp', 11 : 'ICON_Speed', 12 : 'ICON_Zoffset', @@ -338,5 +338,20 @@ def serialize(self): 88 : 'ICON_Confirm_C', 89 : 'ICON_Confirm_E', 90 : 'ICON_Info_0', - 91 : 'ICON_Info_1' - } + 91 : 'ICON_Info_1', + 93 : 'ICON_Printer_0', + #94 : 'ICON_Printer_1', + 200 : 'ICON_Checkbox_F', + 201 : 'ICON_Checkbox_T', + 202 : 'ICON_Fade', + 203 : 'ICON_Mesh', + 204 : 'ICON_Tilt', + 205 : 'ICON_Brightness', + 206 : 'ICON_Probe', + 249 : 'ICON_AxisD', + 250 : 'ICON_AxisBR', + 251 : 'ICON_AxisTR', + 252 : 'ICON_AxisBL', + 253 : 'ICON_AxisTL', + 254 : 'ICON_AxisC' +} From ec060f979f0c836610b7fc1b02eb166df2143f28 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 22 Dec 2023 17:47:29 -0600 Subject: [PATCH 21/73] =?UTF-8?q?=F0=9F=93=9D=20Clean=20up=20variant=20lab?= =?UTF-8?q?els?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../variant.h | 224 +++++++++--------- .../MARLIN_BIGTREE_OCTOPUS_V1/variant.h | 224 +++++++++--------- .../MARLIN_CREALITY_STM32F401RC/variant.h | 15 +- .../MARLIN_CREALITY_STM32F401RE/variant.h | 35 ++- .../variants/MARLIN_F103Rx/variant.h | 82 +++---- .../variants/MARLIN_F407ZE/variant.h | 224 +++++++++--------- .../MARLIN_FYSETC_CHEETAH_V20/variant.h | 15 +- .../variants/MARLIN_FYSETC_S6/variant.h | 160 ++++++------- .../MARLIN_STM32F401RE_FREERUNS/variant.h | 15 +- .../variants/MARLIN_TH3D_EZBOARD_V2/variant.h | 84 +++---- .../marlin_maple_CHITU_F103/board/board.h | 116 +-------- 11 files changed, 539 insertions(+), 655 deletions(-) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h index b8e4b9667e80..b51da1bda575 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_PRO_V1_F429/variant.h @@ -27,118 +27,118 @@ extern "C" { * Pins *----------------------------------------------------------------------------*/ -#define PA0 0 //D0 -#define PA1 1 //D1 -#define PA2 2 //D2 -#define PA3 3 //D3 -#define PA4 4 //D4 -#define PA5 5 //D5 -#define PA6 6 //D6 -#define PA7 7 //D7 -#define PA8 8 //D8 -#define PA9 9 //D9 -#define PA10 10 //D10 -#define PA11 11 //D11 -#define PA12 12 //D12 -#define PA13 13 //D13 -#define PA14 14 //D14 -#define PA15 15 //D15 -#define PB0 16 //D16 -#define PB1 17 //D17 -#define PB2 18 //D18 -#define PB3 19 //D19 -#define PB4 20 //D20 -#define PB5 21 //D21 -#define PB6 22 //D22 -#define PB7 23 //D23 -#define PB8 24 //D24 -#define PB9 25 //D25 -#define PB10 26 //D26 -#define PB11 27 //D27 -#define PB12 28 //D28 -#define PB13 29 //D29 -#define PB14 30 //D30 -#define PB15 31 //D31 -#define PC0 32 //D32 -#define PC1 33 //D33 -#define PC2 34 //D34 -#define PC3 35 //D35 -#define PC4 36 //D36 -#define PC5 37 //D37 -#define PC6 38 //D38 -#define PC7 39 //D39 -#define PC8 40 //D40 -#define PC9 41 //D41 -#define PC10 42 //D42 -#define PC11 43 //D43 -#define PC12 44 //D44 -#define PC13 45 //D45 -#define PC14 46 //D46 -#define PC15 47 //D47 -#define PD0 48 //D48 -#define PD1 49 //D49 -#define PD2 50 //D50 -#define PD3 51 //D51 -#define PD4 52 //D52 -#define PD5 53 //D53 -#define PD6 54 //D54 -#define PD7 55 //D55 -#define PD8 56 //D56 -#define PD9 57 //D57 -#define PD10 58 //D58 -#define PD11 59 //D59 -#define PD12 60 //D60 -#define PD13 61 //D61 -#define PD14 62 //D62 -#define PD15 63 //D63 -#define PE0 64 //D64 -#define PE1 65 //D65 -#define PE2 66 //D66 -#define PE3 67 //D67 -#define PE4 68 //D68 -#define PE5 69 //D69 -#define PE6 70 //D70 -#define PE7 71 //D71 -#define PE8 72 //D72 -#define PE9 73 //D73 -#define PE10 74 //D74 -#define PE11 75 //D75 -#define PE12 76 //D76 -#define PE13 77 //D77 -#define PE14 78 //D78 -#define PE15 79 //D79 -#define PF0 80 //D64 -#define PF1 81 //D65 -#define PF2 82 //D66 -#define PF3 83 //D67 -#define PF4 84 //D68 -#define PF5 85 //D69 -#define PF6 86 //D70 -#define PF7 87 //D71 -#define PF8 88 //D72 -#define PF9 89 //D73 -#define PF10 90 //D74 -#define PF11 91 //D75 -#define PF12 92 //D76 -#define PF13 93 //D77 -#define PF14 94 //D78 -#define PF15 95 //D79 -#define PG0 96 //D64 -#define PG1 97 //D65 -#define PG2 98 //D66 -#define PG3 99 //D67 -#define PG4 100 //D68 -#define PG5 101 //D69 -#define PG6 102 //D70 -#define PG7 103 //D71 -#define PG8 104 //D72 -#define PG9 105 //D73 -#define PG10 106 //D74 -#define PG11 107 //D75 -#define PG12 108 //D76 -#define PG13 109 //D77 -#define PG14 110 //D78 -#define PG15 111 //D79 +#define PA0 0 +#define PA1 1 +#define PA2 2 +#define PA3 3 +#define PA4 4 +#define PA5 5 +#define PA6 6 +#define PA7 7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 16 +#define PB1 17 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 32 +#define PC1 33 +#define PC2 34 +#define PC3 35 +#define PC4 36 +#define PC5 37 +#define PC6 38 +#define PC7 39 +#define PC8 40 +#define PC9 41 +#define PC10 42 +#define PC11 43 +#define PC12 44 +#define PC13 45 +#define PC14 46 +#define PC15 47 +#define PD0 48 +#define PD1 49 +#define PD2 50 +#define PD3 51 +#define PD4 52 +#define PD5 53 +#define PD6 54 +#define PD7 55 +#define PD8 56 +#define PD9 57 +#define PD10 58 +#define PD11 59 +#define PD12 60 +#define PD13 61 +#define PD14 62 +#define PD15 63 +#define PE0 64 +#define PE1 65 +#define PE2 66 +#define PE3 67 +#define PE4 68 +#define PE5 69 +#define PE6 70 +#define PE7 71 +#define PE8 72 +#define PE9 73 +#define PE10 74 +#define PE11 75 +#define PE12 76 +#define PE13 77 +#define PE14 78 +#define PE15 79 +#define PF0 80 +#define PF1 81 +#define PF2 82 +#define PF3 83 +#define PF4 84 +#define PF5 85 +#define PF6 86 +#define PF7 87 +#define PF8 88 +#define PF9 89 +#define PF10 90 +#define PF11 91 +#define PF12 92 +#define PF13 93 +#define PF14 94 +#define PF15 95 +#define PG0 96 +#define PG1 97 +#define PG2 98 +#define PG3 99 +#define PG4 100 +#define PG5 101 +#define PG6 102 +#define PG7 103 +#define PG8 104 +#define PG9 105 +#define PG10 106 +#define PG11 107 +#define PG12 108 +#define PG13 109 +#define PG14 110 +#define PG15 111 // This must be a literal with the same value as PEND #define NUM_DIGITAL_PINS 112 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/variant.h index 22b919697027..b07e9d7f05e5 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_BIGTREE_OCTOPUS_V1/variant.h @@ -27,118 +27,118 @@ extern "C" { * Pins *----------------------------------------------------------------------------*/ -#define PA0 0 //D0 -#define PA1 1 //D1 -#define PA2 2 //D2 -#define PA3 3 //D3 -#define PA4 4 //D4 -#define PA5 5 //D5 -#define PA6 6 //D6 -#define PA7 7 //D7 -#define PA8 8 //D8 -#define PA9 9 //D9 -#define PA10 10 //D10 -#define PA11 11 //D11 -#define PA12 12 //D12 -#define PA13 13 //D13 -#define PA14 14 //D14 -#define PA15 15 //D15 -#define PB0 16 //D16 -#define PB1 17 //D17 -#define PB2 18 //D18 -#define PB3 19 //D19 -#define PB4 20 //D20 -#define PB5 21 //D21 -#define PB6 22 //D22 -#define PB7 23 //D23 -#define PB8 24 //D24 -#define PB9 25 //D25 -#define PB10 26 //D26 -#define PB11 27 //D27 -#define PB12 28 //D28 -#define PB13 29 //D29 -#define PB14 30 //D30 -#define PB15 31 //D31 -#define PC0 32 //D32 -#define PC1 33 //D33 -#define PC2 34 //D34 -#define PC3 35 //D35 -#define PC4 36 //D36 -#define PC5 37 //D37 -#define PC6 38 //D38 -#define PC7 39 //D39 -#define PC8 40 //D40 -#define PC9 41 //D41 -#define PC10 42 //D42 -#define PC11 43 //D43 -#define PC12 44 //D44 -#define PC13 45 //D45 -#define PC14 46 //D46 -#define PC15 47 //D47 -#define PD0 48 //D48 -#define PD1 49 //D49 -#define PD2 50 //D50 -#define PD3 51 //D51 -#define PD4 52 //D52 -#define PD5 53 //D53 -#define PD6 54 //D54 -#define PD7 55 //D55 -#define PD8 56 //D56 -#define PD9 57 //D57 -#define PD10 58 //D58 -#define PD11 59 //D59 -#define PD12 60 //D60 -#define PD13 61 //D61 -#define PD14 62 //D62 -#define PD15 63 //D63 -#define PE0 64 //D64 -#define PE1 65 //D65 -#define PE2 66 //D66 -#define PE3 67 //D67 -#define PE4 68 //D68 -#define PE5 69 //D69 -#define PE6 70 //D70 -#define PE7 71 //D71 -#define PE8 72 //D72 -#define PE9 73 //D73 -#define PE10 74 //D74 -#define PE11 75 //D75 -#define PE12 76 //D76 -#define PE13 77 //D77 -#define PE14 78 //D78 -#define PE15 79 //D79 -#define PF0 80 //D64 -#define PF1 81 //D65 -#define PF2 82 //D66 -#define PF3 83 //D67 -#define PF4 84 //D68 -#define PF5 85 //D69 -#define PF6 86 //D70 -#define PF7 87 //D71 -#define PF8 88 //D72 -#define PF9 89 //D73 -#define PF10 90 //D74 -#define PF11 91 //D75 -#define PF12 92 //D76 -#define PF13 93 //D77 -#define PF14 94 //D78 -#define PF15 95 //D79 -#define PG0 96 //D64 -#define PG1 97 //D65 -#define PG2 98 //D66 -#define PG3 99 //D67 -#define PG4 100 //D68 -#define PG5 101 //D69 -#define PG6 102 //D70 -#define PG7 103 //D71 -#define PG8 104 //D72 -#define PG9 105 //D73 -#define PG10 106 //D74 -#define PG11 107 //D75 -#define PG12 108 //D76 -#define PG13 109 //D77 -#define PG14 110 //D78 -#define PG15 111 //D79 +#define PA0 0 +#define PA1 1 +#define PA2 2 +#define PA3 3 +#define PA4 4 +#define PA5 5 +#define PA6 6 +#define PA7 7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 16 +#define PB1 17 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 32 +#define PC1 33 +#define PC2 34 +#define PC3 35 +#define PC4 36 +#define PC5 37 +#define PC6 38 +#define PC7 39 +#define PC8 40 +#define PC9 41 +#define PC10 42 +#define PC11 43 +#define PC12 44 +#define PC13 45 +#define PC14 46 +#define PC15 47 +#define PD0 48 +#define PD1 49 +#define PD2 50 +#define PD3 51 +#define PD4 52 +#define PD5 53 +#define PD6 54 +#define PD7 55 +#define PD8 56 +#define PD9 57 +#define PD10 58 +#define PD11 59 +#define PD12 60 +#define PD13 61 +#define PD14 62 +#define PD15 63 +#define PE0 64 +#define PE1 65 +#define PE2 66 +#define PE3 67 +#define PE4 68 +#define PE5 69 +#define PE6 70 +#define PE7 71 +#define PE8 72 +#define PE9 73 +#define PE10 74 +#define PE11 75 +#define PE12 76 +#define PE13 77 +#define PE14 78 +#define PE15 79 +#define PF0 80 +#define PF1 81 +#define PF2 82 +#define PF3 83 +#define PF4 84 +#define PF5 85 +#define PF6 86 +#define PF7 87 +#define PF8 88 +#define PF9 89 +#define PF10 90 +#define PF11 91 +#define PF12 92 +#define PF13 93 +#define PF14 94 +#define PF15 95 +#define PG0 96 +#define PG1 97 +#define PG2 98 +#define PG3 99 +#define PG4 100 +#define PG5 101 +#define PG6 102 +#define PG7 103 +#define PG8 104 +#define PG9 105 +#define PG10 106 +#define PG11 107 +#define PG12 108 +#define PG13 109 +#define PG14 110 +#define PG15 111 // This must be a literal with the same value as PEND #define NUM_DIGITAL_PINS 112 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h index 722a29d00dd4..9c5c2530225d 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RC/variant.h @@ -23,9 +23,8 @@ extern "C" { #endif // __cplusplus - -// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | -// |---------|--------|-----------|----------|------------------------|-----------| + // | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | + // |---------|--------|-----------|----------|------------------------|-----------| #define PA0 0 // | 0 | A0 | | | | | #define PA1 1 // | 1 | A1 | | | | | #define PA2 2 // | 2 | A2 | USART2_TX | | | | @@ -42,7 +41,7 @@ extern "C" { #define PA13 13 // | 13 | | | | | SWD_SWDIO | #define PA14 14 // | 14 | | | | | SWD_SWCLK | #define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PB0 16 // | 16 | A8 | | | | | #define PB1 17 // | 17 | A9 | | | | | #define PB2 18 // | 18 | | | | | BOOT1 | @@ -58,7 +57,7 @@ extern "C" { #define PB13 28 // | 28 | | | | SPI2_SCK | | #define PB14 29 // | 29 | | | | SPI2_MISO | | #define PB15 30 // | 30 | | | | SPI2_MOSI | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PC0 31 // | 31 | A10 | | | | | #define PC1 32 // | 32 | A11 | | | | | #define PC2 33 // | 33 | A12 | | | SPI2_MISO | | @@ -75,12 +74,12 @@ extern "C" { #define PC13 44 // | 44 | | | | | | #define PC14 45 // | 45 | | | | | OSC32_IN | #define PC15 46 // | 46 | | | | | OSC32_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PD2 47 // | 47 | | | | | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PH0 48 // | 48 | | | | | OSC_IN | #define PH1 49 // | 49 | | | | | OSC_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| // This must be a literal #define NUM_DIGITAL_PINS 50 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RE/variant.h index 591571bf2c89..dc73ccc51868 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_CREALITY_STM32F401RE/variant.h @@ -23,26 +23,25 @@ extern "C" { #endif // __cplusplus - -// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | -// |---------|--------|-----------|----------|------------------------|-----------| -#define PA0 0 // | 0 | A0 | | | | | -#define PA1 1 // | 1 | A1 | | | | | -#define PA2 2 // | 2 | A2 | USART2_TX | | | | -#define PA3 3 // | 3 | A3 | USART2_RX | | | | -#define PA4 4 // | 4 | A4 | | | SPI1_SS, (SPI3_SS) | | -#define PA5 5 // | 5 | A5 | | | SPI1_SCK | | -#define PA6 6 // | 6 | A6 | | | SPI1_MISO | | -#define PA7 7 // | 7 | A7 | | | SPI1_MOSI | | -#define PA8 8 // | 8 | | | TWI3_SCL | | | -#define PA9 9 // | 9 | | USART1_TX | | | | + // | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | + // |---------|--------|-----------|----------|------------------------|-----------| +#define PA0 0 // | 0 | A0 | | | | | +#define PA1 1 // | 1 | A1 | | | | | +#define PA2 2 // | 2 | A2 | USART2_TX | | | | +#define PA3 3 // | 3 | A3 | USART2_RX | | | | +#define PA4 4 // | 4 | A4 | | | SPI1_SS, (SPI3_SS) | | +#define PA5 5 // | 5 | A5 | | | SPI1_SCK | | +#define PA6 6 // | 6 | A6 | | | SPI1_MISO | | +#define PA7 7 // | 7 | A7 | | | SPI1_MOSI | | +#define PA8 8 // | 8 | | | TWI3_SCL | | | +#define PA9 9 // | 9 | | USART1_TX | | | | #define PA10 10 // | 10 | | USART1_RX | | | | #define PA11 11 // | 11 | | USART6_TX | | | | #define PA12 12 // | 12 | | USART6_RX | | | | #define PA13 13 // | 13 | | | | | SWD_SWDIO | #define PA14 14 // | 14 | | | | | SWD_SWCLK | #define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PB0 16 // | 16 | A8 | | | | | #define PB1 17 // | 17 | A9 | | | | | #define PB2 18 // | 18 | | | | | BOOT1 | @@ -58,7 +57,7 @@ extern "C" { #define PB13 28 // | 28 | | | | SPI2_SCK | | #define PB14 29 // | 29 | | | | SPI2_MISO | | #define PB15 30 // | 30 | | | | SPI2_MOSI | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PC0 31 // | 31 | A10 | | | | | #define PC1 32 // | 32 | A11 | | | | | #define PC2 33 // | 33 | A12 | | | SPI2_MISO | | @@ -75,12 +74,12 @@ extern "C" { #define PC13 44 // | 44 | | | | | | #define PC14 45 // | 45 | | | | | OSC32_IN | #define PC15 46 // | 46 | | | | | OSC32_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PD2 47 // | 47 | | | | | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PH0 48 // | 48 | | | | | OSC_IN | #define PH1 49 // | 49 | | | | | OSC_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| // This must be a literal #define NUM_DIGITAL_PINS 50 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h index 4a0245e7e9d5..7452020652c4 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F103Rx/variant.h @@ -26,8 +26,8 @@ extern "C" { // * = F103R8-B-C-D-E-F-G // ** = F103RC-D-E-F-G -// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | -// |---------|----------------|--------------------------|-----------|-----------------------|-----------| +// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | +// |---------|----------------|--------------------------|-----------|-----------------------|-----------| #define PA0 PIN_A0 // | 0 | A0 | | | | | #define PA1 PIN_A1 // | 1 | A1 | | | | | #define PA2 PIN_A2 // | 2 | A2 | USART2_TX | | | | @@ -36,53 +36,53 @@ extern "C" { #define PA5 PIN_A5 // | 5 | A5 | | | SPI1_SCK | | #define PA6 PIN_A6 // | 6 | A6 | | | SPI1_MISO | | #define PA7 PIN_A7 // | 7 | A7 | | | SPI1_MOSI | | -#define PA8 8 // | 8 | | | | | | -#define PA9 9 // | 9 | | USART1_TX | | | | -#define PA10 10 // | 10 | | USART1_RX | | | | -#define PA11 11 // | 11 | | | | | USB_DM | -#define PA12 12 // | 12 | | | | | USB_DP | -#define PA13 13 // | 13 | | | | | SWD_SWDIO | -#define PA14 14 // | 14 | | | | | SWD_SWCLK | -#define PA15 15 // | 15 | | | | SPI1_SS/SPI3_SS** | | -// |---------|----------------|--------------------------|-----------|-----------------------|-----------| +#define PA8 8 // | 8 | | | | | | +#define PA9 9 // | 9 | | USART1_TX | | | | +#define PA10 10 // | 10 | | USART1_RX | | | | +#define PA11 11 // | 11 | | | | | USB_DM | +#define PA12 12 // | 12 | | | | | USB_DP | +#define PA13 13 // | 13 | | | | | SWD_SWDIO | +#define PA14 14 // | 14 | | | | | SWD_SWCLK | +#define PA15 15 // | 15 | | | | SPI1_SS/SPI3_SS** | | +// |---------|----------------|--------------------------|-----------|-----------------------|-----------| #define PB0 PIN_A8 // | 16 | A8 | | | | | #define PB1 PIN_A9 // | 17 | A9 | | | | | -#define PB2 18 // | 18 | | | | | BOOT1 | -#define PB3 19 // | 19 | | | | SPI1_SCK/SPI3_SCK** | | -#define PB4 20 // | 20 | | | | SPI1_MISO/SPI3_MISO** | | -#define PB5 21 // | 21 | | | | SPI1_MOSI/SPI3_MOSI** | | -#define PB6 22 // | 22 | | USART1_TX | TWI1_SCL | | | -#define PB7 23 // | 23 | | USART1_RX | TWI1_SDA | | | -#define PB8 24 // | 24 | | | TWI1_SCL | | | -#define PB9 25 // | 25 | | | TWI1_SDA | | | -#define PB10 26 // | 26 | | USART3_TX* | TWI2_SCL* | | | -#define PB11 27 // | 27 | | USART3_RX* | TWI2_SDA* | | | -#define PB12 28 // | 28 | | | | SPI2_SS* | | -#define PB13 29 // | 29 | | | | SPI2_SCK* | | -#define PB14 30 // | 30 | | | | SPI2_MISO* | | -#define PB15 31 // | 31 | | | | SPI2_MOSI* | | -// |---------|----------------|--------------------------|-----------|-----------------------|-----------| +#define PB2 18 // | 18 | | | | | BOOT1 | +#define PB3 19 // | 19 | | | | SPI1_SCK/SPI3_SCK** | | +#define PB4 20 // | 20 | | | | SPI1_MISO/SPI3_MISO** | | +#define PB5 21 // | 21 | | | | SPI1_MOSI/SPI3_MOSI** | | +#define PB6 22 // | 22 | | USART1_TX | TWI1_SCL | | | +#define PB7 23 // | 23 | | USART1_RX | TWI1_SDA | | | +#define PB8 24 // | 24 | | | TWI1_SCL | | | +#define PB9 25 // | 25 | | | TWI1_SDA | | | +#define PB10 26 // | 26 | | USART3_TX* | TWI2_SCL* | | | +#define PB11 27 // | 27 | | USART3_RX* | TWI2_SDA* | | | +#define PB12 28 // | 28 | | | | SPI2_SS* | | +#define PB13 29 // | 29 | | | | SPI2_SCK* | | +#define PB14 30 // | 30 | | | | SPI2_MISO* | | +#define PB15 31 // | 31 | | | | SPI2_MOSI* | | +// |---------|----------------|--------------------------|-----------|-----------------------|-----------| #define PC0 PIN_A10 // | 32 | A10 | | | | | #define PC1 PIN_A11 // | 33 | A11 | | | | | #define PC2 PIN_A12 // | 34 | A12 | | | | | #define PC3 PIN_A13 // | 35 | A13 | | | | | #define PC4 PIN_A14 // | 36 | A14 | | | | | #define PC5 PIN_A15 // | 37 | A15 | | | | | -#define PC6 38 // | 38 | | | | | | -#define PC7 39 // | 39 | | | | | | -#define PC8 40 // | 40 | | | | | | -#define PC9 41 // | 41 | | | | | | -#define PC10 42 // | 42 | | USART3_TX*/UART4_TX** | | | | -#define PC11 43 // | 43 | | USART3_RX*/UART4_RX** | | | | -#define PC12 44 // | 44 | | UART5_TX** | | | | -#define PC13 45 // | 45 | | | | | | -#define PC14 46 // | 46 | | | | | OSC32_IN | -#define PC15 47 // | 47 | | | | | OSC32_OUT | -// |---------|----------------|--------------------------|-----------|-----------------------|-----------| -#define PD0 48 // | 48 | | | | | OSC_IN | -#define PD1 49 // | 48 | | | | | OSC_OUT | -#define PD2 50 // | 50 | | UART5_RX** | | | | -// |---------|----------------|--------------------------|-----------|-----------------------|-----------| +#define PC6 38 // | 38 | | | | | | +#define PC7 39 // | 39 | | | | | | +#define PC8 40 // | 40 | | | | | | +#define PC9 41 // | 41 | | | | | | +#define PC10 42 // | 42 | | USART3_TX*/UART4_TX** | | | | +#define PC11 43 // | 43 | | USART3_RX*/UART4_RX** | | | | +#define PC12 44 // | 44 | | UART5_TX** | | | | +#define PC13 45 // | 45 | | | | | | +#define PC14 46 // | 46 | | | | | OSC32_IN | +#define PC15 47 // | 47 | | | | | OSC32_OUT | +// |---------|----------------|--------------------------|-----------|-----------------------|-----------| +#define PD0 48 // | 48 | | | | | OSC_IN | +#define PD1 49 // | 48 | | | | | OSC_OUT | +#define PD2 50 // | 50 | | UART5_RX** | | | | +// |---------|----------------|--------------------------|-----------|-----------------------|-----------| // This must be a literal #define NUM_DIGITAL_PINS 51 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407ZE/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_F407ZE/variant.h index b8e4b9667e80..b51da1bda575 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F407ZE/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407ZE/variant.h @@ -27,118 +27,118 @@ extern "C" { * Pins *----------------------------------------------------------------------------*/ -#define PA0 0 //D0 -#define PA1 1 //D1 -#define PA2 2 //D2 -#define PA3 3 //D3 -#define PA4 4 //D4 -#define PA5 5 //D5 -#define PA6 6 //D6 -#define PA7 7 //D7 -#define PA8 8 //D8 -#define PA9 9 //D9 -#define PA10 10 //D10 -#define PA11 11 //D11 -#define PA12 12 //D12 -#define PA13 13 //D13 -#define PA14 14 //D14 -#define PA15 15 //D15 -#define PB0 16 //D16 -#define PB1 17 //D17 -#define PB2 18 //D18 -#define PB3 19 //D19 -#define PB4 20 //D20 -#define PB5 21 //D21 -#define PB6 22 //D22 -#define PB7 23 //D23 -#define PB8 24 //D24 -#define PB9 25 //D25 -#define PB10 26 //D26 -#define PB11 27 //D27 -#define PB12 28 //D28 -#define PB13 29 //D29 -#define PB14 30 //D30 -#define PB15 31 //D31 -#define PC0 32 //D32 -#define PC1 33 //D33 -#define PC2 34 //D34 -#define PC3 35 //D35 -#define PC4 36 //D36 -#define PC5 37 //D37 -#define PC6 38 //D38 -#define PC7 39 //D39 -#define PC8 40 //D40 -#define PC9 41 //D41 -#define PC10 42 //D42 -#define PC11 43 //D43 -#define PC12 44 //D44 -#define PC13 45 //D45 -#define PC14 46 //D46 -#define PC15 47 //D47 -#define PD0 48 //D48 -#define PD1 49 //D49 -#define PD2 50 //D50 -#define PD3 51 //D51 -#define PD4 52 //D52 -#define PD5 53 //D53 -#define PD6 54 //D54 -#define PD7 55 //D55 -#define PD8 56 //D56 -#define PD9 57 //D57 -#define PD10 58 //D58 -#define PD11 59 //D59 -#define PD12 60 //D60 -#define PD13 61 //D61 -#define PD14 62 //D62 -#define PD15 63 //D63 -#define PE0 64 //D64 -#define PE1 65 //D65 -#define PE2 66 //D66 -#define PE3 67 //D67 -#define PE4 68 //D68 -#define PE5 69 //D69 -#define PE6 70 //D70 -#define PE7 71 //D71 -#define PE8 72 //D72 -#define PE9 73 //D73 -#define PE10 74 //D74 -#define PE11 75 //D75 -#define PE12 76 //D76 -#define PE13 77 //D77 -#define PE14 78 //D78 -#define PE15 79 //D79 -#define PF0 80 //D64 -#define PF1 81 //D65 -#define PF2 82 //D66 -#define PF3 83 //D67 -#define PF4 84 //D68 -#define PF5 85 //D69 -#define PF6 86 //D70 -#define PF7 87 //D71 -#define PF8 88 //D72 -#define PF9 89 //D73 -#define PF10 90 //D74 -#define PF11 91 //D75 -#define PF12 92 //D76 -#define PF13 93 //D77 -#define PF14 94 //D78 -#define PF15 95 //D79 -#define PG0 96 //D64 -#define PG1 97 //D65 -#define PG2 98 //D66 -#define PG3 99 //D67 -#define PG4 100 //D68 -#define PG5 101 //D69 -#define PG6 102 //D70 -#define PG7 103 //D71 -#define PG8 104 //D72 -#define PG9 105 //D73 -#define PG10 106 //D74 -#define PG11 107 //D75 -#define PG12 108 //D76 -#define PG13 109 //D77 -#define PG14 110 //D78 -#define PG15 111 //D79 +#define PA0 0 +#define PA1 1 +#define PA2 2 +#define PA3 3 +#define PA4 4 +#define PA5 5 +#define PA6 6 +#define PA7 7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 16 +#define PB1 17 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 32 +#define PC1 33 +#define PC2 34 +#define PC3 35 +#define PC4 36 +#define PC5 37 +#define PC6 38 +#define PC7 39 +#define PC8 40 +#define PC9 41 +#define PC10 42 +#define PC11 43 +#define PC12 44 +#define PC13 45 +#define PC14 46 +#define PC15 47 +#define PD0 48 +#define PD1 49 +#define PD2 50 +#define PD3 51 +#define PD4 52 +#define PD5 53 +#define PD6 54 +#define PD7 55 +#define PD8 56 +#define PD9 57 +#define PD10 58 +#define PD11 59 +#define PD12 60 +#define PD13 61 +#define PD14 62 +#define PD15 63 +#define PE0 64 +#define PE1 65 +#define PE2 66 +#define PE3 67 +#define PE4 68 +#define PE5 69 +#define PE6 70 +#define PE7 71 +#define PE8 72 +#define PE9 73 +#define PE10 74 +#define PE11 75 +#define PE12 76 +#define PE13 77 +#define PE14 78 +#define PE15 79 +#define PF0 80 +#define PF1 81 +#define PF2 82 +#define PF3 83 +#define PF4 84 +#define PF5 85 +#define PF6 86 +#define PF7 87 +#define PF8 88 +#define PF9 89 +#define PF10 90 +#define PF11 91 +#define PF12 92 +#define PF13 93 +#define PF14 94 +#define PF15 95 +#define PG0 96 +#define PG1 97 +#define PG2 98 +#define PG3 99 +#define PG4 100 +#define PG5 101 +#define PG6 102 +#define PG7 103 +#define PG8 104 +#define PG9 105 +#define PG10 106 +#define PG11 107 +#define PG12 108 +#define PG13 109 +#define PG14 110 +#define PG15 111 // This must be a literal with the same value as PEND #define NUM_DIGITAL_PINS 112 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h index ca3664daa165..c629be7359bb 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_CHEETAH_V20/variant.h @@ -23,9 +23,8 @@ extern "C" { #endif // __cplusplus - -// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | -// |---------|--------|-----------|----------|------------------------|-----------| + // | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | + // |---------|--------|-----------|----------|------------------------|-----------| #define PA0 A0 // | 0 | A0 | | | | | #define PA1 A1 // | 1 | A1 | | | | | #define PA2 A2 // | 2 | A2 | USART2_TX | | | | @@ -42,7 +41,7 @@ extern "C" { #define PA13 13 // | 13 | | | | | SWD_SWDIO | #define PA14 14 // | 14 | | | | | SWD_SWCLK | #define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PB0 A8 // | 16 | A8 | | | | | #define PB1 A9 // | 17 | A9 | | | | | #define PB2 18 // | 18 | | | | | BOOT1 | @@ -58,7 +57,7 @@ extern "C" { #define PB13 28 // | 28 | | | | SPI2_SCK | | #define PB14 29 // | 29 | | | | SPI2_MISO | | #define PB15 30 // | 30 | | | | SPI2_MOSI | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PC0 A10 // | 31 | A10 | | | | | #define PC1 A11 // | 32 | A11 | | | | | #define PC2 A12 // | 33 | A12 | | | SPI2_MISO | | @@ -75,12 +74,12 @@ extern "C" { #define PC13 44 // | 44 | | | | | | #define PC14 45 // | 45 | | | | | OSC32_IN | #define PC15 46 // | 46 | | | | | OSC32_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PD2 47 // | 47 | | | | | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PH0 48 // | 48 | | | | | OSC_IN | #define PH1 49 // | 49 | | | | | OSC_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| // This must be a literal #define NUM_DIGITAL_PINS 50 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h index 4f77dc688f35..f64bbacc4566 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h @@ -27,86 +27,86 @@ extern "C" { * Pins *----------------------------------------------------------------------------*/ -#define PA0 0 //D0 -#define PA1 1 //D1 -#define PA2 2 //D2 -#define PA3 3 //D3 -#define PA4 4 //D4 -#define PA5 5 //D5 -#define PA6 6 //D6 -#define PA7 7 //D7 -#define PA8 8 //D8 -#define PA9 9 //D9 -#define PA10 10 //D10 -#define PA11 11 //D11 -#define PA12 12 //D12 -#define PA13 13 //D13 -#define PA14 14 //D14 -#define PA15 15 //D15 -#define PB0 16 //D16 -#define PB1 17 //D17 -#define PB2 18 //D18 -#define PB3 19 //D19 -#define PB4 20 //D20 -#define PB5 21 //D21 -#define PB6 22 //D22 -#define PB7 23 //D23 -#define PB8 24 //D24 -#define PB9 25 //D25 -#define PB10 26 //D26 -#define PB11 27 //D27 -#define PB12 28 //D28 -#define PB13 29 //D29 -#define PB14 30 //D30 -#define PB15 31 //D31 -#define PC0 32 //D32 -#define PC1 33 //D33 -#define PC2 34 //D34 -#define PC3 35 //D35 -#define PC4 36 //D36 -#define PC5 37 //D37 -#define PC6 38 //D38 -#define PC7 39 //D39 -#define PC8 40 //D40 -#define PC9 41 //D41 -#define PC10 42 //D42 -#define PC11 43 //D43 -#define PC12 44 //D44 -#define PC13 45 //D45 -#define PC14 46 //D46 -#define PC15 47 //D47 -#define PD0 48 //D48 -#define PD1 49 //D49 -#define PD2 50 //D50 -#define PD3 51 //D51 -#define PD4 52 //D52 -#define PD5 53 //D53 -#define PD6 54 //D54 -#define PD7 55 //D55 -#define PD8 56 //D56 -#define PD9 57 //D57 -#define PD10 58 //D58 -#define PD11 59 //D59 -#define PD12 60 //D60 -#define PD13 61 //D61 -#define PD14 62 //D62 -#define PD15 63 //D63 -#define PE0 64 //D64 -#define PE1 65 //D65 -#define PE2 66 //D66 -#define PE3 67 //D67 -#define PE4 68 //D68 -#define PE5 69 //D69 -#define PE6 70 //D70 -#define PE7 71 //D71 -#define PE8 72 //D72 -#define PE9 73 //D73 -#define PE10 74 //D74 -#define PE11 75 //D75 -#define PE12 76 //D76 -#define PE13 77 //D77 -#define PE14 78 //D78 -#define PE15 79 //D79 +#define PA0 0 +#define PA1 1 +#define PA2 2 +#define PA3 3 +#define PA4 4 +#define PA5 5 +#define PA6 6 +#define PA7 7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 16 +#define PB1 17 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 32 +#define PC1 33 +#define PC2 34 +#define PC3 35 +#define PC4 36 +#define PC5 37 +#define PC6 38 +#define PC7 39 +#define PC8 40 +#define PC9 41 +#define PC10 42 +#define PC11 43 +#define PC12 44 +#define PC13 45 +#define PC14 46 +#define PC15 47 +#define PD0 48 +#define PD1 49 +#define PD2 50 +#define PD3 51 +#define PD4 52 +#define PD5 53 +#define PD6 54 +#define PD7 55 +#define PD8 56 +#define PD9 57 +#define PD10 58 +#define PD11 59 +#define PD12 60 +#define PD13 61 +#define PD14 62 +#define PD15 63 +#define PE0 64 +#define PE1 65 +#define PE2 66 +#define PE3 67 +#define PE4 68 +#define PE5 69 +#define PE6 70 +#define PE7 71 +#define PE8 72 +#define PE9 73 +#define PE10 74 +#define PE11 75 +#define PE12 76 +#define PE13 77 +#define PE14 78 +#define PE15 79 // This must be a literal with the same value as PEND #define NUM_DIGITAL_PINS 87 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h index b5c5a65a7426..a1e347e7f229 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_STM32F401RE_FREERUNS/variant.h @@ -23,9 +23,8 @@ extern "C" { #endif // __cplusplus - -// | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | -// |---------|--------|-----------|----------|------------------------|-----------| + // | DIGITAL | ANALOG | USART | TWI | SPI | SPECIAL | + // |---------|--------|-----------|----------|------------------------|-----------| #define PA0 0 // | 0 | A0 | | | | | #define PA1 1 // | 1 | A1 | | | | | #define PA2 2 // | 2 | A2 | USART2_TX | | | | @@ -42,7 +41,7 @@ extern "C" { #define PA13 13 // | 13 | | | | | SWD_SWDIO | #define PA14 14 // | 14 | | | | | SWD_SWCLK | #define PA15 15 // | 15 | | | | SPI3_SS, (SPI1_SS) | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PB0 16 // | 16 | A8 | | | | | #define PB1 17 // | 17 | A9 | | | | | #define PB2 18 // | 18 | | | | | BOOT1 | @@ -58,7 +57,7 @@ extern "C" { #define PB13 28 // | 28 | | | | SPI2_SCK | | #define PB14 29 // | 29 | | | | SPI2_MISO | | #define PB15 30 // | 30 | | | | SPI2_MOSI | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PC0 31 // | 31 | A10 | | | | | #define PC1 32 // | 32 | A11 | | | | | #define PC2 33 // | 33 | A12 | | | SPI2_MISO | | @@ -75,12 +74,12 @@ extern "C" { #define PC13 44 // | 44 | | | | | | #define PC14 45 // | 45 | | | | | OSC32_IN | #define PC15 46 // | 46 | | | | | OSC32_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PD2 47 // | 47 | | | | | | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| #define PH0 48 // | 48 | | | | | OSC_IN | #define PH1 49 // | 49 | | | | | OSC_OUT | -// |---------|--------|-----------|----------|------------------------|-----------| + // |---------|--------|-----------|----------|------------------------|-----------| // This must be a literal #define NUM_DIGITAL_PINS 50 diff --git a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h index 5232a1eaf2e4..3b4d43054ddf 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_TH3D_EZBOARD_V2/variant.h @@ -27,8 +27,8 @@ extern "C" { * Pins (STM32F405RG and STM32F415RG) *----------------------------------------------------------------------------*/ -// | DIGITAL | ANALOG IN | ANALOG OUT | UART/USART | TWI | SPI | SPECIAL | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +// | DIGITAL | ANALOG IN | ANALOG OUT | UART/USART | TWI | SPI | SPECIAL | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| #define PA0 PIN_A0 // | 0 | A0 (ADC1) | | UART4_TX | | | | #define PA1 PIN_A1 // | 1 | A1 (ADC1) | | UART4_RX | | | | #define PA2 PIN_A2 // | 2 | A2 (ADC1) | | USART2_TX | | | | @@ -37,54 +37,54 @@ extern "C" { #define PA5 PIN_A5 // | 5 | A5 (ADC1) | DAC_OUT2 | | | SPI1_SCK | | #define PA6 PIN_A6 // | 6 | A6 (ADC1) | | | | SPI1_MISO | | #define PA7 PIN_A7 // | 7 | A7 (ADC1) | | | | SPI1_MOSI | | -#define PA8 8 // | 8 | | | | TWI3_SCL | | | -#define PA9 9 // | 9 | | | USART1_TX | | SPI2_SCK | | -#define PA10 10 // | 10 | | | USART1_RX | | | | -#define PA11 11 // | 11 | | | | | | | -#define PA12 12 // | 12 | | | | | | | -#define PA13 13 // | 13 | | | | | | SWD_SWDIO | -#define PA14 14 // | 14 | | | | | | SWD_SWCLK | -#define PA15 15 // | 15 | | | | | SPI3_SS, (SPI1_SS) | | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +#define PA8 8 // | 8 | | | | TWI3_SCL | | | +#define PA9 9 // | 9 | | | USART1_TX | | SPI2_SCK | | +#define PA10 10 // | 10 | | | USART1_RX | | | | +#define PA11 11 // | 11 | | | | | | | +#define PA12 12 // | 12 | | | | | | | +#define PA13 13 // | 13 | | | | | | SWD_SWDIO | +#define PA14 14 // | 14 | | | | | | SWD_SWCLK | +#define PA15 15 // | 15 | | | | | SPI3_SS, (SPI1_SS) | | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| #define PB0 PIN_A8 // | 16 | A8 (ADC1) | | | | | | #define PB1 PIN_A9 // | 17 | A9 (ADC1) | | | | | | -#define PB2 18 // | 18 | | | | | | BOOT1 | -#define PB3 19 // | 19 | | | | | SPI3_SCK, (SPI1_SCK) | | -#define PB4 20 // | 20 | | | | | SPI3_MISO, (SPI1_MISO) | | -#define PB5 21 // | 21 | | | | | SPI3_MOSI, (SPI1_MOSI) | | -#define PB6 22 // | 22 | | | USART1_TX | TWI1_SCL | | | -#define PB7 23 // | 23 | | | USART1_RX | TWI1_SDA | | | -#define PB8 24 // | 24 | | | | TWI1_SCL | | | -#define PB9 25 // | 25 | | | | TWI1_SDA | SPI2_SS | | -#define PB10 26 // | 26 | | | USART3_TX | TWI2_SCL | SPI2_SCK | | -#define PB11 27 // | 27 | | | USART3_RX | TWI2_SDA | | | -#define PB12 28 // | 28 | | | | | SPI2_SS | | -#define PB13 29 // | 29 | | | | | SPI2_SCK | | -#define PB14 30 // | 30 | | | | | SPI2_MISO | | -#define PB15 31 // | 31 | | | | | SPI2_MOSI | | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +#define PB2 18 // | 18 | | | | | | BOOT1 | +#define PB3 19 // | 19 | | | | | SPI3_SCK, (SPI1_SCK) | | +#define PB4 20 // | 20 | | | | | SPI3_MISO, (SPI1_MISO) | | +#define PB5 21 // | 21 | | | | | SPI3_MOSI, (SPI1_MOSI) | | +#define PB6 22 // | 22 | | | USART1_TX | TWI1_SCL | | | +#define PB7 23 // | 23 | | | USART1_RX | TWI1_SDA | | | +#define PB8 24 // | 24 | | | | TWI1_SCL | | | +#define PB9 25 // | 25 | | | | TWI1_SDA | SPI2_SS | | +#define PB10 26 // | 26 | | | USART3_TX | TWI2_SCL | SPI2_SCK | | +#define PB11 27 // | 27 | | | USART3_RX | TWI2_SDA | | | +#define PB12 28 // | 28 | | | | | SPI2_SS | | +#define PB13 29 // | 29 | | | | | SPI2_SCK | | +#define PB14 30 // | 30 | | | | | SPI2_MISO | | +#define PB15 31 // | 31 | | | | | SPI2_MOSI | | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| #define PC0 PIN_A10 // | 32 | A10 (ADC1) | | | | | | #define PC1 PIN_A11 // | 33 | A11 (ADC1) | | | | | | #define PC2 PIN_A12 // | 34 | A12 (ADC1) | | | | SPI2_MISO | | #define PC3 PIN_A13 // | 35 | A13 (ADC1) | | | | SPI2_MOSI | | #define PC4 PIN_A14 // | 36 | A14 (ADC1) | | | | | | #define PC5 PIN_A15 // | 37 | A15 (ADC1) | | | | | | -#define PC6 38 // | 38 | | | USART6_TX | | | | -#define PC7 39 // | 39 | | | USART3_RX | | SPI2_SCK | | -#define PC8 40 // | 40 | | | | | | | -#define PC9 41 // | 41 | | | | TWI3_SDA | | | -#define PC10 42 // | 42 | | | USART3_TX, (UART4_TX) | | SPI3_SCK | | -#define PC11 43 // | 43 | | | USART3_RX, (UART4_RX) | | SPI3_MISO | | -#define PC12 44 // | 44 | | | UART5_TX | | SPI3_MOSI | | -#define PC13 45 // | 45 | | | | | | | -#define PC14 46 // | 46 | | | | | | OSC32_IN | -#define PC15 47 // | 47 | | | | | | OSC32_OUT | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| -#define PD2 48 // | 48 | | | UART5_RX | | | | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| -#define PH0 49 // | 49 | | | | | | OSC_IN | -#define PH1 50 // | 50 | | | | | | OSC_OUT | -// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +#define PC6 38 // | 38 | | | USART6_TX | | | | +#define PC7 39 // | 39 | | | USART3_RX | | SPI2_SCK | | +#define PC8 40 // | 40 | | | | | | | +#define PC9 41 // | 41 | | | | TWI3_SDA | | | +#define PC10 42 // | 42 | | | USART3_TX, (UART4_TX) | | SPI3_SCK | | +#define PC11 43 // | 43 | | | USART3_RX, (UART4_RX) | | SPI3_MISO | | +#define PC12 44 // | 44 | | | UART5_TX | | SPI3_MOSI | | +#define PC13 45 // | 45 | | | | | | | +#define PC14 46 // | 46 | | | | | | OSC32_IN | +#define PC15 47 // | 47 | | | | | | OSC32_OUT | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +#define PD2 48 // | 48 | | | UART5_RX | | | | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| +#define PH0 49 // | 49 | | | | | | OSC_IN | +#define PH1 50 // | 50 | | | | | | OSC_OUT | +// |---------|------------|------------|-----------------------|----------------------|-----------------------------------|-----------| /// This must be a literal #define NUM_DIGITAL_PINS 51 diff --git a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h index 5664a1ad2c68..863c8041c9c2 100644 --- a/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h +++ b/buildroot/share/PlatformIO/variants/marlin_maple_CHITU_F103/board/board.h @@ -119,117 +119,5 @@ PE0,PE1,PE2,PE3,PE4,PE5,PE6,PE7,PE8,PE9,PE10,PE11,PE12,PE13,PE14,PE15, PF0,PF1,PF2,PF3,PF4,PF5,PF6,PF7,PF8,PF9,PF10,PF11,PF12,PF13,PF14,PF15, PG0,PG1,PG2,PG3,PG4,PG5,PG6,PG7,PG8,PG9,PG10,PG11,PG12,PG13,PG14,PG15 };/* Note PB2 is skipped as this is Boot1 and is not going to be much use as its likely to be pulled permanently low */ -/* -#define PA0 0 -#define PA1 1 -#define PA2 2 -#define PA3 3 -#define PA4 4 -#define PA5 5 -#define PA6 6 -#define PA7 7 -#define PA8 8 -#define PA9 9 -#define PA10 10 -#define PA11 11 -#define PA12 12 -#define PA13 13 -#define PA14 14 -#define PA15 15 -#define PB0 16 -#define PB1 17 -#define PB2 18 -#define PB3 19 -#define PB4 20 -#define PB5 21 -#define PB6 22 -#define PB7 23 -#define PB8 24 -#define PB9 25 -#define PB10 26 -#define PB11 27 -#define PB12 28 -#define PB13 29 -#define PB14 30 -#define PB15 31 -#define PC0 32 -#define PC1 33 -#define PC2 34 -#define PC3 35 -#define PC4 36 -#define PC5 37 -#define PC6 38 -#define PC7 39 -#define PC8 40 -#define PC9 41 -#define PC10 42 -#define PC11 43 -#define PC12 44 -#define PC13 45 -#define PC14 46 -#define PC15 47 -#define PD0 48 -#define PD1 49 -#define PD2 50 -#define PD3 51 -#define PD4 52 -#define PD5 53 -#define PD6 54 -#define PD7 55 -#define PD8 56 -#define PD9 57 -#define PD10 58 -#define PD11 59 -#define PD12 60 -#define PD13 61 -#define PD14 62 -#define PD15 63 -#define PE0 64 -#define PE1 65 -#define PE2 66 -#define PE3 67 -#define PE4 68 -#define PE5 69 -#define PE6 70 -#define PE7 71 -#define PE8 72 -#define PE9 73 -#define PE10 74 -#define PE11 75 -#define PE12 76 -#define PE13 77 -#define PE14 78 -#define PE15 79 -#define PF0 80 -#define PF1 81 -#define PF2 82 -#define PF3 83 -#define PF4 84 -#define PF5 85 -#define PF6 86 -#define PF7 87 -#define PF8 88 -#define PF9 89 -#define PF10 90 -#define PF11 91 -#define PF12 92 -#define PF13 93 -#define PF14 94 -#define PF15 95 -#define PG0 96 -#define PG1 97 -#define PG2 98 -#define PG3 99 -#define PG4 100 -#define PG5 101 -#define PG6 102 -#define PG7 103 -#define PG8 104 -#define PG9 105 -#define PG10 106 -#define PG11 107 -#define PG12 108 -#define PG13 109 -#define PG14 110 -#define PG15 111 */ -#endif + +#endif // _BOARDS_GENERIC_STM32F103Z_H_ From 342048b1dfbf41e64bc39cf5c448cbb0bb238651 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 23 Dec 2023 00:20:19 +0000 Subject: [PATCH 22/73] [cron] Bump distribution date (2023-12-23) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index bdce222e8692..62078b7b99db 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-22" +//#define STRING_DISTRIBUTION_DATE "2023-12-23" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7c8ba14665b6..5a54bb73aefd 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-22" + #define STRING_DISTRIBUTION_DATE "2023-12-23" #endif /** From 3029a6b1aa4c436cdda352e2add5cd421beaf104 Mon Sep 17 00:00:00 2001 From: Mihai <299015+mh-dm@users.noreply.github.com> Date: Sat, 23 Dec 2023 09:45:37 +0200 Subject: [PATCH 23/73] =?UTF-8?q?=F0=9F=A9=B9=20Jerk=20correction=20for=20?= =?UTF-8?q?LIN=5FADVANCE=20+=20CLASSIC=5FJERK=20(#26551)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/module/planner.cpp | 81 +++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index f7ab42ad8164..0c6027bfdead 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2490,9 +2490,9 @@ bool Planner::_populate_block( * * extruder_advance_K[extruder] : There is an advance factor set for this extruder. * - * dist.e > 0 : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) + * dm.e : Extruder is running forward (e.g., for "Wipe while retracting" (Slic3r) or "Combing" (Cura) moves) */ - use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && dist.e > 0; + use_advance_lead = esteps && extruder_advance_K[E_INDEX_N(extruder)] && dm.e; if (use_advance_lead) { float e_D_ratio = (target_float.e - position_float.e) / @@ -2770,53 +2770,70 @@ bool Planner::_populate_block( * Heavily modified. Originally adapted from Průša firmware. * https://github.com/prusa3d/Prusa-Firmware */ - #ifndef TRAVEL_EXTRA_XYJERK - #define TRAVEL_EXTRA_XYJERK 0.0f + #if defined(TRAVEL_EXTRA_XYJERK) || ENABLED(LIN_ADVANCE) + xyze_float_t max_j = max_jerk; + #else + const xyze_float_t &max_j = max_jerk; #endif - const float extra_xyjerk = TERN0(HAS_EXTRUDERS, dist.e <= 0) ? TRAVEL_EXTRA_XYJERK : 0.0f; - if (!moves_queued || UNEAR_ZERO(previous_nominal_speed)) { - // Compute "safe" speed, limited by a jerk to/from full halt. + #ifdef TRAVEL_EXTRA_XYJERK + if (dist.e <= 0) { + max_j.x += TRAVEL_EXTRA_XYJERK; + max_j.y += TRAVEL_EXTRA_XYJERK; + } + #endif - float v_factor = 1.0f; - LOOP_LOGICAL_AXES(i) { - const float jerk = ABS(current_speed[i]), // Starting from zero, change in speed for this axis - maxj = max_jerk[i] + (i == X_AXIS || i == Y_AXIS ? extra_xyjerk : 0.0f); // The max jerk setting for this axis - if (jerk * v_factor > maxj) v_factor = maxj / jerk; + #if ENABLED(LIN_ADVANCE) + // Advance affects E_AXIS speed and therefore jerk. Add a speed correction whenever + // LA is turned OFF. No correction is applied when LA is turned ON (because it didn't + // perform well; it takes more time/effort to push/melt filament than the reverse). + static uint32_t previous_advance_rate; + static float previous_e_mm_per_step; + if (dist.e < 0 && previous_advance_rate) { + // Retract move after a segment with LA that ended with an E speed decrease. + // Correct for this to allow a faster junction speed. Since the decrease always helps to + // get E to nominal retract speed, the equation simplifies to an increase in max jerk. + max_j.e += previous_advance_rate * previous_e_mm_per_step; } - vmax_junction_sqr = sq(block->nominal_speed * v_factor); - NOLESS(minimum_planner_speed_sqr, vmax_junction_sqr); + // Prepare for next segment. + previous_advance_rate = block->la_advance_rate; + previous_e_mm_per_step = mm_per_step[E_AXIS_N(extruder)]; + #endif + + xyze_float_t speed_diff = current_speed; + float vmax_junction; + const bool start_from_zero = !moves_queued || UNEAR_ZERO(previous_nominal_speed); + if (start_from_zero) { + // Limited by a jerk to/from full halt. + vmax_junction = block->nominal_speed; } else { // Compute the maximum velocity allowed at a joint of two successive segments. // The junction velocity will be shared between successive segments. Limit the junction velocity to their minimum. - float vmax_junction, previous_speed_factor, current_speed_factor; + // Scale per-axis velocities for the same vmax_junction. if (block->nominal_speed < previous_nominal_speed) { vmax_junction = block->nominal_speed; - previous_speed_factor = vmax_junction / previous_nominal_speed; - current_speed_factor = 1.0f; + const float previous_scale = vmax_junction / previous_nominal_speed; + LOOP_LOGICAL_AXES(i) speed_diff[i] -= previous_speed[i] * previous_scale; } else { vmax_junction = previous_nominal_speed; - previous_speed_factor = 1.0f; - current_speed_factor = vmax_junction / block->nominal_speed; + const float current_scale = vmax_junction / block->nominal_speed; + LOOP_LOGICAL_AXES(i) speed_diff[i] = speed_diff[i] * current_scale - previous_speed[i]; } + } - // Now limit the jerk in all axes. - float v_factor = 1.0f; - LOOP_LOGICAL_AXES(i) { - // Scale per-axis velocities for the same vmax_junction. - const float v_exit = previous_speed[i] * previous_speed_factor, - v_entry = current_speed[i] * current_speed_factor; - - // Jerk is the per-axis velocity difference. - const float jerk = ABS(v_exit - v_entry), - maxj = max_jerk[i] + (i == X_AXIS || i == Y_AXIS ? extra_xyjerk : 0.0f); - if (jerk * v_factor > maxj) v_factor = maxj / jerk; - } - vmax_junction_sqr = sq(vmax_junction * v_factor); + // Now limit the jerk in all axes. + float v_factor = 1.0f; + LOOP_LOGICAL_AXES(i) { + // Jerk is the per-axis velocity difference. + const float jerk = ABS(speed_diff[i]), maxj = max_j[i]; + if (jerk * v_factor > maxj) v_factor = maxj / jerk; } + vmax_junction_sqr = sq(vmax_junction * v_factor); + + if (start_from_zero) minimum_planner_speed_sqr = vmax_junction_sqr; #endif // CLASSIC_JERK From 205b0a679e3ca7cbf7ca590279d1cd4ed0c284c1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 23 Dec 2023 04:19:23 -0600 Subject: [PATCH 24/73] =?UTF-8?q?=F0=9F=8E=A8=20Whitespace=20in=20the=20ri?= =?UTF-8?q?ghtplace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/ft_motion.cpp | 10 +++++----- Marlin/src/module/ft_motion.h | 1 - Marlin/src/module/stepper.cpp | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index a2049db3b63f..674b66f581cb 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -324,7 +324,7 @@ void FTMotion::loop() { x.Ai[1] = (0.5f - x.Ai[0]) * Kx; x.Ai[2] = x.Ai[1] * Kx; x.Ai[3] = x.Ai[0] * cu(Kx); - + const float vtoly2 = sq(vtol[1]); const float Y = pow(vtoly2 * (sqrt(1.0f - vtoly2) + 1.0f), 1.0f / 3.0f); y.Ai[0] = (3.0f * sq(Y) + 2.0f * Y + 3.0f * vtoly2) / (16.0f * Y); @@ -361,7 +361,7 @@ void FTMotion::loop() { x.Ai[i] *= X_adj; y.Ai[i] *= Y_adj; } - } + } break; case ftMotionMode_MZV: { @@ -375,7 +375,7 @@ void FTMotion::loop() { y.Ai[0] = 1.0f / (1.0f + By + Ky2); y.Ai[1] = y.Ai[0] * By; y.Ai[2] = y.Ai[0] * Ky2; - } + } break; default: @@ -383,7 +383,7 @@ void FTMotion::loop() { ZERO(y.Ai); max_i = 0; } - + } void FTMotion::updateShapingA(float zeta[]/*=cfg.zeta*/, float vtol[]/*=cfg.vtol*/) { @@ -428,7 +428,7 @@ void FTMotion::loop() { void FTMotion::updateShapingN(const_float_t xf OPTARG(HAS_Y_AXIS, const_float_t yf), float zeta[]/*=cfg.zeta*/) { const float xdf = sqrt(1.0f - sq(zeta[0])); shaping.x.updateShapingN(xf, xdf); - + #if HAS_Y_AXIS const float ydf = sqrt(1.0f - sq(zeta[1])); shaping.y.updateShapingN(yf, ydf); diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h index cea754088138..f4a65fdd5e92 100644 --- a/Marlin/src/module/ft_motion.h +++ b/Marlin/src/module/ft_motion.h @@ -44,7 +44,6 @@ typedef struct FTConfig { #if HAS_X_AXIS float baseFreq[1 + ENABLED(HAS_Y_AXIS)] = // Base frequency. [Hz] { FTM_SHAPING_DEFAULT_X_FREQ OPTARG(HAS_Y_AXIS, FTM_SHAPING_DEFAULT_Y_FREQ) }; - float zeta[1 + ENABLED(HAS_Y_AXIS)] = // Damping factor { FTM_SHAPING_ZETA_X OPTARG(HAS_Y_AXIS, FTM_SHAPING_ZETA_Y) }; float vtol[1 + ENABLED(HAS_Y_AXIS)] = // Vibration Level diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 862b2728042d..8dda2eec4001 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3552,7 +3552,7 @@ void Stepper::report_positions() { // Sync block? Sync the stepper counts and return while (current_block->is_sync()) { TERN_(LASER_FEATURE, if (!(current_block->is_fan_sync() || current_block->is_pwr_sync()))) _set_position(current_block->position); - + planner.release_current_block(); // Try to get a new block From 71e0275a4c1c54b5083ac49b9a12e19e149f055e Mon Sep 17 00:00:00 2001 From: Skopus <71988971+skopusdotorg@users.noreply.github.com> Date: Sat, 23 Dec 2023 13:54:19 +0330 Subject: [PATCH 25/73] =?UTF-8?q?=E2=9C=A8=20Orca=203D=20Modular=20Control?= =?UTF-8?q?ler=20(#26534)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + .../src/pins/stm32f1/pins_ORCA_3D_SPRINGER.h | 341 ++++++++++++++++++ ini/stm32f1.ini | 12 + 4 files changed, 356 insertions(+) create mode 100644 Marlin/src/pins/stm32f1/pins_ORCA_3D_SPRINGER.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index b51513bca9d6..49570241e7fe 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -401,6 +401,7 @@ #define BOARD_KEDI_CONTROLLER_V1_2 5069 // EDUTRONICS Kedi Controller V1.2 (STM32F103RC) #define BOARD_MD_D301 5070 // Mingda D2 DZ301 V1.0 (STM32F103ZE) #define BOARD_VOXELAB_AQUILA 5071 // Voxelab Aquila V1.0.0/V1.0.1 (GD32F103RC / N32G455RE / STM32F103RE) +#define BOARD_SPRINGER_CONTROLLER 5072 // ORCA 3D SPRINGER Modular Controller (STM32F103VC) // // ARM Cortex-M4F diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 842a79c320e4..0728f5899498 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -702,6 +702,8 @@ #include "stm32f1/pins_MD_D301.h" // STM32F1 env:mingda_d301 env:mingda_d301_maple #elif MB(VOXELAB_AQUILA) #include "gd32f1/pins_VOXELAB_AQUILA.h" // GD32F1, N32G4, STM32F1 env:GD32F103RC_voxelab_maple env:N32G455RE_voxelab_maple env:STM32F103RE_creality_maple env:STM32F103RE_creality +#elif MB(SPRINGER_CONTROLLER) + #include "stm32f1/pins_ORCA_3D_SPRINGER.h" // STM32F1 env:STM32F103VC_orca3d // // ARM Cortex-M4F diff --git a/Marlin/src/pins/stm32f1/pins_ORCA_3D_SPRINGER.h b/Marlin/src/pins/stm32f1/pins_ORCA_3D_SPRINGER.h new file mode 100644 index 000000000000..b2afe6de9bde --- /dev/null +++ b/Marlin/src/pins/stm32f1/pins_ORCA_3D_SPRINGER.h @@ -0,0 +1,341 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * ORCA 3D Modular Controller (STM32F103VCT6) board pin assignments + */ + +#if NOT_TARGET(__STM32F1__, STM32F1) + #error "Oops! Select an STM32F1 board in 'Tools > Board.'" +#endif + +#define BOARD_INFO_NAME "ORCA 3D Modular Controller" + +// Avoid conflict with TIMER_SERVO when using the STM32 HAL +#define TEMP_TIMER 5 + +// +// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role +// +#define DISABLE_DEBUG + +// +// Servos +// +#define SERVO0_PIN PA8 // Enable BLTOUCH + +// +// Limit Switches +// +#define X_STOP_PIN PA15 +#define Y_STOP_PIN PA14 +#define Z_STOP_PIN PA12 + +// +// Steppers +// +#define X_ENABLE_PIN PC15 +#define X_STEP_PIN PE5 +#define X_DIR_PIN PE6 +#ifndef X_CS_PIN + #define X_CS_PIN PE3 +#endif + +#define Y_ENABLE_PIN PC15 +#define Y_STEP_PIN PC14 +#define Y_DIR_PIN PC13 +#ifndef Y_CS_PIN + #define Y_CS_PIN PE4 +#endif + +#define Z_ENABLE_PIN PB4 +#define Z_STEP_PIN PB5 +#define Z_DIR_PIN PB6 +#ifndef Z_CS_PIN + #define Z_CS_PIN PB3 +#endif + +#define E0_ENABLE_PIN PE2 +#define E0_STEP_PIN PE1 +#define E0_DIR_PIN PE0 +#ifndef E0_CS_PIN + #define E0_CS_PIN PB7 +#endif + +#define E1_ENABLE_PIN PB11 +#define E1_STEP_PIN PC7 +#define E1_DIR_PIN PC6 +#ifndef E1_CS_PIN + #define E1_CS_PIN PD15 +#endif + +#define E2_ENABLE_PIN PD7 +#define E2_STEP_PIN PD6 +#define E2_DIR_PIN PD5 +#ifndef E2_CS_PIN + #define E2_CS_PIN PD4 +#endif + +#define E3_ENABLE_PIN PD14 +#define E3_STEP_PIN PD13 +#define E3_DIR_PIN PC5 +#ifndef E3_CS_PIN + #define E3_CS_PIN PD11 +#endif + +#define E4_ENABLE_PIN PD3 +#define E4_STEP_PIN PE14 +#define E4_DIR_PIN PD9 +#ifndef E4_CS_PIN + #define E4_CS_PIN PD8 +#endif + +// +// SPI pins for TMC2130 stepper drivers +// +#ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PB15 +#endif +#ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PB14 +#endif +#ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PB13 +#endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL MSerial1 + //#define Y_HARDWARE_SERIAL MSerial1 + //#define Z_HARDWARE_SERIAL MSerial1 + //#define E0_HARDWARE_SERIAL MSerial1 + //#define E1_HARDWARE_SERIAL MSerial1 + + #define X_SERIAL_TX_PIN PE3 + #define X_SERIAL_RX_PIN PE3 + + #define Y_SERIAL_TX_PIN PE4 + #define Y_SERIAL_RX_PIN PE4 + + #define Z_SERIAL_TX_PIN PB3 + #define Z_SERIAL_RX_PIN PB3 + + #define E0_SERIAL_TX_PIN PB7 + #define E0_SERIAL_RX_PIN PB7 + + #define E1_SERIAL_TX_PIN PD15 + #define E1_SERIAL_RX_PIN PD15 + + #define E2_SERIAL_TX_PIN PD11 + #define E2_SERIAL_RX_PIN PD11 + + #define E3_SERIAL_TX_PIN PD8 + #define E3_SERIAL_RX_PIN PD8 + + // Reduce baud rate to improve software serial reliability + #ifndef TMC_BAUD_RATE + #define TMC_BAUD_RATE 19200 + #endif + +#endif // HAS_TMC_UART + +// +// Temperature Sensors +// +#define TEMP_0_PIN PC1 // TH1 +#define TEMP_1_PIN PC2 // TH2 +#define TEMP_2_PIN PC3 // TH2 +#define TEMP_3_PIN PC4 // TH2 +#define TEMP_BED_PIN PC0 // TB1 + +// +// Heaters / Fans +// +#define HEATER_0_PIN PB1 // HEATER1 +#define HEATER_1_PIN PB2 // HEATER2 +#define HEATER_2_PIN PB10 // HEATER2 +#define HEATER_3_PIN PB12 // HEATER2 +#define HEATER_BED_PIN PB0 // HOT BED + +#define FAN0_PIN PA0 // FAN +#define FAN1_PIN PA1 // FAN +#define FAN2_PIN PA2 // FAN +#define FAN3_PIN PA3 // FAN + +// +// LCD / Controller +// + +/** + * Note: ORCA 3D Modular Controller uses various TFT controllers. + * - For TFT displays use UART0 + * - For 12864 displays use the expansion headers + */ + +/** ------ ------ + * -- | 1 2 | PE10 (BTN_ENC) (MISO) PA6 | 1 2 | PA5 (SCK) + * (LCD_EN) PE11 | 3 4 | PD10 (LCD_RS) (BTN_EN1) PE8 | 3 4 | PA4 (SD_SS) + * (LCD_D4) PE12 | 5 6 | PE13 (LCD_D5) (BTN_EN2) PE9 | 5 6 | PA7 (MOSI) + * (LCD_D6) PE15 | 7 8 | PE7 (LCD_D7) (SD_DETECT) PD12 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_01_PIN -1 // No BEEPER +#define EXP1_02_PIN PE10 // ENC +#define EXP1_03_PIN PE11 // LCD_EN +#define EXP1_04_PIN PD10 // LCD_RS +#define EXP1_05_PIN PE12 // LCD_D4 +#define EXP1_06_PIN PE13 // LCD_D5 +#define EXP1_07_PIN PE15 // LCD_D6 +#define EXP1_08_PIN PE7 // LCD_D7 + +#define EXP2_01_PIN PA6 // MISO +#define EXP2_02_PIN PA5 // SCK +#define EXP2_03_PIN PE8 // EN1 +#define EXP2_04_PIN PA4 // SD_SS +#define EXP2_05_PIN PE9 // EN2 +#define EXP2_06_PIN PA7 // MOSI +#define EXP2_07_PIN PD12 // SD_DET +#define EXP2_08_PIN -1 // RESET + +// +// SD Card +// +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +#if SD_CONNECTION_IS(LCD) + #define SPI_DEVICE 1 + #define SD_DETECT_PIN EXP2_07_PIN + #define SD_SCK_PIN EXP2_02_PIN + #define SD_MISO_PIN EXP2_01_PIN + #define SD_MOSI_PIN EXP2_06_PIN + #define SD_SS_PIN EXP2_04_PIN +#elif SD_CONNECTION_IS(ONBOARD) + #define SD_DETECT_PIN PA3 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 + #define SD_SS_PIN PA4 +#endif +#define ONBOARD_SPI_DEVICE 1 // SPI1 +#define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card + +// +// LCD / Controller +// +#if HAS_WIRED_LCD + #define BEEPER_PIN EXP1_01_PIN // NC + #define BTN_ENC EXP1_02_PIN + + #if ENABLED(CR10_STOCKDISPLAY) + #define LCD_PINS_RS EXP1_07_PIN + + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #elif IS_TFTGLCD_PANEL + + #undef BEEPER_PIN + #undef BTN_ENC + + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_03_PIN + #endif + + #define SD_DETECT_PIN EXP2_07_PIN + + #else + + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_EN EXP1_03_PIN + + #if ENABLED(FYSETC_MINI_12864) + + #define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_SCK EXP2_02_PIN + #define DOGLCD_MOSI EXP2_06_PIN + + #define FORCE_SOFT_SPI // SPI MODE3 + + #define LED_PIN EXP1_06_PIN // red pwm + //#define LED_PIN EXP1_07_PIN // green + //#define LED_PIN EXP1_08_PIN // blue + + //#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + // #ifndef RGB_LED_R_PIN + // #define RGB_LED_R_PIN EXP1_06_PIN + // #endif + // #ifndef RGB_LED_G_PIN + // #define RGB_LED_G_PIN EXP1_07_PIN + // #endif + // #ifndef RGB_LED_B_PIN + // #define RGB_LED_B_PIN EXP1_08_PIN + // #endif + //#elif ENABLED(FYSETC_MINI_12864_2_1) + // #define NEOPIXEL_PIN EXP1_06_PIN + //#endif + + #else // !FYSETC_MINI_12864 + + #define LCD_PINS_D4 EXP1_05_PIN + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif + + #endif + + #endif // !FYSETC_MINI_12864 + + #endif + +#endif // HAS_WIRED_LCD + +// Alter timing for graphical display +#if IS_U8GLIB_ST7920 + #define BOARD_ST7920_DELAY_1 125 + #define BOARD_ST7920_DELAY_2 125 + #define BOARD_ST7920_DELAY_3 125 +#endif diff --git a/ini/stm32f1.ini b/ini/stm32f1.ini index 11814e4b160d..b164615c891c 100644 --- a/ini/stm32f1.ini +++ b/ini/stm32f1.ini @@ -493,3 +493,15 @@ board_build.variant = MARLIN_F103Zx board_build.offset = 0x7000 board_upload.offset_address = 0x08007000 build_flags = ${stm32_variant.build_flags} -DSTM32F1xx + +# +# ORCA 3D SPRINGER Modular Controller (STM32F103VCT6) +# +[env:STM32F103VC_orca3d] +extends = stm32_variant +board = genericSTM32F103VC +board_build.variant = MARLIN_F103Vx +build_flags = ${stm32_variant.build_flags} -DDEBUG_LEVEL=0 +monitor_speed = 115200 +board_build.offset = 0x8000 +board_upload.offset_address = 0x08008000 From d1ebaba71d4256485f0e306b548f52d921718679 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 23 Dec 2023 16:25:55 -0600 Subject: [PATCH 26/73] =?UTF-8?q?=F0=9F=94=A8=20Remove=20signature.py=20de?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/PlatformIO/scripts/signature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py index d2502db35861..bfe7ab4a7394 100755 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -370,7 +370,7 @@ def tryint(key): else: for header in real_config: conf = real_config[header] - print(f"real_config[{header}]", conf) + #print(f"real_config[{header}]", conf) for name in conf: json_data[name] = conf[name]['value'] From fa8d2bd108725eb9b23468e3823e5936e03a4209 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 24 Dec 2023 00:23:04 +0000 Subject: [PATCH 27/73] [cron] Bump distribution date (2023-12-24) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 62078b7b99db..a2f0cc81abaa 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-23" +//#define STRING_DISTRIBUTION_DATE "2023-12-24" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 5a54bb73aefd..3fd20c352542 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-23" + #define STRING_DISTRIBUTION_DATE "2023-12-24" #endif /** From 18b0dbb5018dafbb298d043e15b0623c3f0f72b3 Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Mon, 25 Dec 2023 07:07:00 +1300 Subject: [PATCH 28/73] =?UTF-8?q?=F0=9F=90=9B=20Creality=20Free=20Runs=20f?= =?UTF-8?q?ixups=20(#26562)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25636, #26533 Co-authored-by: Scott Lahteine --- Marlin/src/inc/Changes.h | 2 + Marlin/src/inc/Warnings.cpp | 7 ++ Marlin/src/pins/mega/pins_GT2560_V3_A20.h | 4 - Marlin/src/pins/mega/pins_GT2560_V4_A20.h | 4 - .../src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h | 2 +- Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h | 2 +- .../src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h | 2 +- .../pins/stm32f4/pins_CREALITY_CR4NTXXC10.h | 99 ++++++++----------- Marlin/src/pins/stm32f4/pins_CREALITY_F401.h | 2 +- ini/stm32f4.ini | 7 +- 10 files changed, 55 insertions(+), 76 deletions(-) diff --git a/Marlin/src/inc/Changes.h b/Marlin/src/inc/Changes.h index f951d76ee7a0..693cb592e62c 100644 --- a/Marlin/src/inc/Changes.h +++ b/Marlin/src/inc/Changes.h @@ -669,6 +669,8 @@ #error "Z_PROBE_OFFSET_RANGE_(MIN|MAX) is now PROBE_OFFSET_Z(MIN|MAX)." #elif defined(LARGE_MOVE_ITEMS) #error "LARGE_MOVE_ITEMS is obsolete. Instead define MANUAL_MOVE_DISTANCE_MM and MANUAL_MOVE_DISTANCE_IN." +#elif defined(SDIO_SUPPORT) + #error "SDIO_SUPPORT is now ONBOARD_SDIO." #endif // L64xx stepper drivers have been removed diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 1824ac58c9b6..7965336df7eb 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -811,3 +811,10 @@ #if HAL_ADC_VREF_MV < 5000 && ANY_THERMISTOR_IS(-1) && DISABLED(ALLOW_AD595_3V3_VREF) #warning "The (-1) AD595 Thermocouple Amplifier requires 5V input supply! Use AD8495 for 3.3V ADC." #endif + +/** + * No PWM on the Piezo Beeper? + */ +#if PIN_EXISTS(BEEPER) && ALL(SPEAKER, NO_SPEAKER) + #warning "The BEEPER cannot produce tones so you can disable SPEAKER." +#endif diff --git a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h index 2422dfdd73e5..9bc0a9d56ca6 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V3_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V3_A20.h @@ -33,10 +33,6 @@ #define LCD_PINS_D7 6 #endif -#ifndef SPEAKER - #define SPEAKER // The speaker can produce tones -#endif - #if IS_NEWPANEL #define BTN_EN1 16 #define BTN_EN2 17 diff --git a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h index 405a3aba5bf8..95e24f5d31e6 100644 --- a/Marlin/src/pins/mega/pins_GT2560_V4_A20.h +++ b/Marlin/src/pins/mega/pins_GT2560_V4_A20.h @@ -35,10 +35,6 @@ #define LCD_PINS_D7 6 #endif -#ifndef SPEAKER - #define SPEAKER // The speaker can produce tones -#endif - #if IS_NEWPANEL #define BTN_EN1 16 #define BTN_EN2 17 diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h index 6f41bd6848c9..87f83a5c96bc 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_LITE_V1_0.h @@ -228,7 +228,7 @@ #ifndef BEEPER_PIN #define BEEPER_PIN EXP1_01_PIN - #undef SPEAKER + #define NO_SPEAKER #endif #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) diff --git a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h index 699f10ed481e..d55669ac90c6 100644 --- a/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h +++ b/Marlin/src/pins/samd/pins_BRICOLEMON_V1_0.h @@ -281,7 +281,7 @@ #ifndef BEEPER_PIN #define BEEPER_PIN EXP1_01_PIN - #undef SPEAKER + #define NO_SPEAKER #endif #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD) diff --git a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h index 039333adfa91..9ad0da13f53d 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h +++ b/Marlin/src/pins/stm32f4/pins_BLACKPILL_CUSTOM.h @@ -114,7 +114,7 @@ #define SD_DETECT_PIN -1 #define SDCARD_CONNECTION ONBOARD -//#define SDIO_SUPPORT +//#define ONBOARD_SDIO #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer #if SD_CONNECTION_IS(ONBOARD) diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h index 0a6f3e3059bf..d25cd6c17e42 100644 --- a/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_CR4NTXXC10.h @@ -100,15 +100,15 @@ #define X_STEP_PIN PC2 #define X_DIR_PIN PB9 -#define Y_ENABLE_PIN X_ENABLE_PIN +#define Y_ENABLE_PIN X_ENABLE_PIN #define Y_STEP_PIN PB8 #define Y_DIR_PIN PB7 -#define Z_ENABLE_PIN X_ENABLE_PIN +#define Z_ENABLE_PIN X_ENABLE_PIN #define Z_STEP_PIN PB6 #define Z_DIR_PIN PB5 -#define E0_ENABLE_PIN X_ENABLE_PIN +#define E0_ENABLE_PIN X_ENABLE_PIN #define E0_STEP_PIN PB4 #define E0_DIR_PIN PB3 @@ -188,74 +188,55 @@ // #define SD_DETECT_PIN PC1 #define SDCARD_CONNECTION ONBOARD -#define ONBOARD_SPI_DEVICE 1 -//#define ONBOARD_SD_CS_PIN PA4 // SDSS -#define SDIO_SUPPORT +#define ONBOARD_SDIO +#define SDIO_CLOCK 4500000 +#define SDIO_READ_RETRIES 16 #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer -#if ENABLED(CR10_STOCKDISPLAY) - - #if ENABLED(RET6_12864_LCD) - // RET6 12864 LCD - #define LCD_PINS_RS PB12 - #define LCD_PINS_EN PB15 - #define LCD_PINS_D4 PB13 - - #define BTN_ENC PB2 - #define BTN_EN1 PA2 - #define BTN_EN2 PB14 +/** + * ------ + * PC0 | 1 2 | PB2 + * TX2 PA2 | 3 4 | PA3 RX2 + * SPI2_MISO PB14 | 5 6 | PB13 SPI2_SCK + * SPI2_NSS PB12 | 7 8 | PB15 SPI2_MOSI + * GND | 9 10 | 5V + * ------ + * EXP1 + */ +#define EXP1_01_PIN PC0 +#define EXP1_02_PIN PB2 +#define EXP1_03_PIN PA2 +#define EXP1_04_PIN PA3 +#define EXP1_05_PIN PB14 +#define EXP1_06_PIN PB13 +#define EXP1_07_PIN PB12 +#define EXP1_08_PIN PB15 - #ifndef HAS_PIN_27_BOARD - #define BEEPER_PIN PC0 - #endif +#if ENABLED(CR10_STOCKDISPLAY) - #elif ENABLED(VET6_12864_LCD) - // VET6 12864 LCD - #define LCD_PINS_RS PA4 - //#define LCD_PINS_EN PA7 - #define LCD_PINS_D4 PA5 + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN - #define BTN_ENC PC5 - #define BTN_EN1 PB10 - #define BTN_EN2 PA6 + #define BTN_ENC EXP1_02_PIN + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN - #else - #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the CREALITY_CR4NTXXC10 controller." + #ifndef HAS_PIN_27_BOARD + #define BEEPER_PIN EXP1_01_PIN #endif #elif ENABLED(DWIN_CREALITY_LCD) - // RET6 DWIN ENCODER LCD - #define BTN_ENC PB14 - #define BTN_EN1 PB15 - #define BTN_EN2 PB12 + // DWIN ENCODER LCD + #define BTN_ENC EXP1_05_PIN + #define BTN_EN1 EXP1_08_PIN + #define BTN_EN2 EXP1_07_PIN - //#define LCD_LED_PIN PB2 + //#define LCD_LED_PIN EXP1_02_PIN #ifndef BEEPER_PIN - #define BEEPER_PIN PB13 - #undef SPEAKER + #define BEEPER_PIN EXP1_06_PIN + #define NO_SPEAKER #endif -#elif ENABLED(DWIN_VET6_CREALITY_LCD) - - // VET6 DWIN ENCODER LCD - #define BTN_ENC PA6 - //#define BTN_EN1 PA7 - #define BTN_EN2 PA4 - - #define BEEPER_PIN PA5 - -#endif - -// -// M3/M4/M5 - Spindle/Laser Control -// -#if HAS_CUTTER - //#undef HEATER_0_PIN - //#undef HEATER_BED_PIN - //#undef FAN0_PIN - #define SPINDLE_LASER_ENA_PIN PC0 // FET 1 - #define SPINDLE_LASER_PWM_PIN PC0 // Bed FET - #define SPINDLE_DIR_PIN PC0 // FET 4 - //#define LASER_SOFT_PWM_PIN PC0 #endif diff --git a/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h b/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h index b4c5bad0938a..50e766c35bd4 100644 --- a/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h +++ b/Marlin/src/pins/stm32f4/pins_CREALITY_F401.h @@ -125,7 +125,7 @@ #define SDCARD_CONNECTION ONBOARD #define ONBOARD_SPI_DEVICE 1 #define ONBOARD_SD_CS_PIN PC12 // SDSS -#define SDIO_SUPPORT +#define ONBOARD_SDIO #define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer // SPI 2 diff --git a/ini/stm32f4.ini b/ini/stm32f4.ini index 3f3347194334..de0a5c7d37ae 100644 --- a/ini/stm32f4.ini +++ b/ini/stm32f4.ini @@ -742,17 +742,14 @@ upload_protocol = stlink # [env:STM32F401RE_freeruns] extends = stm32_variant -board = genericSTM32F401RE -board_build.variant = marlin_STM32F401RE_freeruns +board = marlin_STM32F401RE_freeruns board_build.offset = 0x10000 board_upload.offset_address = 0x08010000 board_build.rename = firmware-{date}-{time}.bin -build_flags = ${stm32_variant.build_flags} -DMCU_STM32F401RE -DSTM32F4 +build_flags = ${stm32_variant.build_flags} -DSTM32F401xE -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DTRANSFER_CLOCK_DIV=8 build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -extra_scripts = ${stm32_variant.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/random-bin.py monitor_speed = 115200 [env:STM32F401RE_freeruns_jlink] From 0f0955492994f4a7f4649c22e0f3aa5cc71541d7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Dec 2023 14:53:09 -0600 Subject: [PATCH 29/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20DWIN?= =?UTF-8?q?=20icon=20updates,=20etc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/pause.h | 6 +- Marlin/src/lcd/e3v2/common/dwin_color.h | 1 + Marlin/src/lcd/e3v2/common/dwin_set.h | 11 +- Marlin/src/lcd/e3v2/creality/dwin.cpp | 4 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 10 +- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 68 +++--- Marlin/src/lcd/e3v2/proui/dwin.cpp | 33 ++- Marlin/src/lcd/e3v2/proui/dwinui.h | 220 +++++++++--------- buildroot/share/dwin/bin/DWIN_ICO.py | 204 ++++++++-------- .../000-ICON_BootLogo.jpg | Bin .../001-ICON_OpenSourceFirmware.jpg | Bin .../{icons-2 => icons-3}/002-ICON_GitHub.jpg | Bin .../{icons-2 => icons-3}/003-ICON_Website.jpg | Bin .../004-ICON_Copyright.jpg | Bin .../000-ICON_LOGO_Marlin.jpg | Bin .../001-ICON_HotendOff.jpg | Bin .../002-ICON_HotendOn.jpg | Bin .../{icons-3 => icons-4}/003-ICON_BedOff.jpg | Bin .../{icons-3 => icons-4}/004-ICON_BedOn.jpg | Bin .../{icons-3 => icons-4}/005-ICON_Fan0.jpg | Bin .../{icons-3 => icons-4}/006-ICON_Fan1.jpg | Bin .../{icons-3 => icons-4}/007-ICON_Fan2.jpg | Bin .../{icons-3 => icons-4}/008-ICON_Fan3.jpg | Bin .../{icons-3 => icons-4}/009-ICON_Halted.jpg | Bin .../010-ICON_Question.jpg | Bin .../{icons-3 => icons-4}/011-ICON_Alert.jpg | Bin .../012-ICON_RotateCW.jpg | Bin .../013-ICON_RotateCCW.jpg | Bin .../{icons-3 => icons-4}/014-ICON_UpArrow.jpg | Bin .../015-ICON_DownArrow.jpg | Bin .../000-ICON_LOGO_Creality.jpg | Bin .../{icons-6 => icons-7}/001-ICON_Print_0.jpg | Bin .../{icons-6 => icons-7}/002-ICON_Print_1.jpg | Bin .../003-ICON_Prepare_0.jpg | Bin .../004-ICON_Prepare_1.jpg | Bin .../005-ICON_Control_0.jpg | Bin .../006-ICON_Control_1.jpg | Bin .../007-ICON_Leveling_0.jpg | Bin .../008-ICON_Leveling_1.jpg | Bin .../009-ICON_HotendTemp.jpg | Bin .../{icons-6 => icons-7}/010-ICON_BedTemp.jpg | Bin .../{icons-6 => icons-7}/011-ICON_Speed.jpg | Bin .../{icons-6 => icons-7}/012-ICON_Zoffset.jpg | Bin .../{icons-6 => icons-7}/013-ICON_Back.jpg | Bin .../{icons-6 => icons-7}/014-ICON_File.jpg | Bin .../015-ICON_PrintTime.jpg | Bin .../016-ICON_RemainTime.jpg | Bin .../{icons-6 => icons-7}/017-ICON_Setup_0.jpg | Bin .../{icons-6 => icons-7}/018-ICON_Setup_1.jpg | Bin .../{icons-6 => icons-7}/019-ICON_Pause_0.jpg | Bin .../{icons-6 => icons-7}/020-ICON_Pause_1.jpg | Bin .../021-ICON_Continue_0.jpg | Bin .../022-ICON_Continue_1.jpg | Bin .../{icons-6 => icons-7}/023-ICON_Stop_0.jpg | Bin .../{icons-6 => icons-7}/024-ICON_Stop_1.jpg | Bin .../{icons-6 => icons-7}/025-ICON_Bar.jpg | Bin .../{icons-6 => icons-7}/026-ICON_More.jpg | Bin .../{icons-6 => icons-7}/027-ICON_Axis.jpg | Bin .../028-ICON_CloseMotor.jpg | Bin .../{icons-6 => icons-7}/029-ICON_Homing.jpg | Bin .../{icons-6 => icons-7}/030-ICON_SetHome.jpg | Bin .../031-ICON_PLAPreheat.jpg | Bin .../032-ICON_ABSPreheat.jpg | Bin .../{icons-6 => icons-7}/033-ICON_Cool.jpg | Bin .../034-ICON_Language.jpg | Bin .../{icons-6 => icons-7}/035-ICON_MoveX.jpg | Bin .../{icons-6 => icons-7}/036-ICON_MoveY.jpg | Bin .../{icons-6 => icons-7}/037-ICON_MoveZ.jpg | Bin .../038-ICON_Extruder.jpg | Bin .../040-ICON_Temperature.jpg | Bin .../{icons-6 => icons-7}/041-ICON_Motion.jpg | Bin .../042-ICON_WriteEEPROM.jpg | Bin .../043-ICON_ReadEEPROM.jpg | Bin .../044-ICON_ResetEEPROM.jpg} | Bin .../{icons-6 => icons-7}/045-ICON_Info.jpg | Bin .../046-ICON_SetEndTemp.jpg | Bin .../047-ICON_SetBedTemp.jpg | Bin .../048-ICON_FanSpeed.jpg | Bin .../049-ICON_SetPLAPreheat.jpg | Bin .../050-ICON_SetABSPreheat.jpg | Bin .../051-ICON_MaxSpeed.jpg | Bin .../052-ICON_MaxAccelerated.jpg | Bin .../{icons-6 => icons-7}/053-ICON_MaxJerk.jpg | Bin .../{icons-6 => icons-7}/054-ICON_Step.jpg | Bin .../055-ICON_PrintSize.jpg | Bin .../{icons-6 => icons-7}/056-ICON_Version.jpg | Bin .../{icons-6 => icons-7}/057-ICON_Contact.jpg | Bin .../058-ICON_StockConfiguraton.jpg | Bin .../059-ICON_MaxSpeedX.jpg | Bin .../060-ICON_MaxSpeedY.jpg | Bin .../061-ICON_MaxSpeedZ.jpg | Bin .../062-ICON_MaxSpeedE.jpg | Bin .../{icons-6 => icons-7}/063-ICON_MaxAccX.jpg | Bin .../{icons-6 => icons-7}/064-ICON_MaxAccY.jpg | Bin .../{icons-6 => icons-7}/065-ICON_MaxAccZ.jpg | Bin .../{icons-6 => icons-7}/066-ICON_MaxAccE.jpg | Bin .../067-ICON_MaxSpeedJerkX.jpg | Bin .../068-ICON_MaxSpeedJerkY.jpg | Bin .../069-ICON_MaxSpeedJerkZ.jpg | Bin .../070-ICON_MaxSpeedJerkE.jpg | Bin .../{icons-6 => icons-7}/071-ICON_StepX.jpg | Bin .../{icons-6 => icons-7}/072-ICON_StepY.jpg | Bin .../{icons-6 => icons-7}/073-ICON_StepZ.jpg | Bin .../{icons-6 => icons-7}/074-ICON_StepE.jpg | Bin .../075-ICON_Setspeed.jpg | Bin .../076-ICON_SetZOffset.jpg | Bin .../077-ICON_Rectangle.jpg | Bin .../{icons-6 => icons-7}/078-ICON_BLTouch.jpg | Bin .../079-ICON_TempTooLow.jpg | Bin .../080-ICON_AutoLeveling.jpg | Bin .../081-ICON_TempTooHigh.jpg | Bin .../082-ICON_NoTips_C.jpg | Bin .../083-ICON_NoTips_E.jpg | Bin .../084-ICON_Continue_C.jpg | Bin .../085-ICON_Continue_E.jpg | Bin .../086-ICON_Cancel_C.jpg | Bin .../087-ICON_Cancel_E.jpg | Bin .../088-ICON_Confirm_C.jpg | Bin .../089-ICON_Confirm_E.jpg | Bin .../{icons-6 => icons-7}/090-ICON_Info_0.jpg | Bin .../{icons-6 => icons-7}/091-ICON_Info_1.jpg | Bin buildroot/share/dwin/make_jpgs.sh | 42 ++-- 122 files changed, 282 insertions(+), 317 deletions(-) rename buildroot/share/dwin/{icons-2 => icons-3}/000-ICON_BootLogo.jpg (100%) rename buildroot/share/dwin/{icons-2 => icons-3}/001-ICON_OpenSourceFirmware.jpg (100%) rename buildroot/share/dwin/{icons-2 => icons-3}/002-ICON_GitHub.jpg (100%) rename buildroot/share/dwin/{icons-2 => icons-3}/003-ICON_Website.jpg (100%) rename buildroot/share/dwin/{icons-2 => icons-3}/004-ICON_Copyright.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/000-ICON_LOGO_Marlin.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/001-ICON_HotendOff.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/002-ICON_HotendOn.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/003-ICON_BedOff.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/004-ICON_BedOn.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/005-ICON_Fan0.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/006-ICON_Fan1.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/007-ICON_Fan2.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/008-ICON_Fan3.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/009-ICON_Halted.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/010-ICON_Question.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/011-ICON_Alert.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/012-ICON_RotateCW.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/013-ICON_RotateCCW.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/014-ICON_UpArrow.jpg (100%) rename buildroot/share/dwin/{icons-3 => icons-4}/015-ICON_DownArrow.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/000-ICON_LOGO_Creality.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/001-ICON_Print_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/002-ICON_Print_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/003-ICON_Prepare_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/004-ICON_Prepare_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/005-ICON_Control_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/006-ICON_Control_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/007-ICON_Leveling_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/008-ICON_Leveling_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/009-ICON_HotendTemp.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/010-ICON_BedTemp.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/011-ICON_Speed.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/012-ICON_Zoffset.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/013-ICON_Back.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/014-ICON_File.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/015-ICON_PrintTime.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/016-ICON_RemainTime.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/017-ICON_Setup_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/018-ICON_Setup_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/019-ICON_Pause_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/020-ICON_Pause_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/021-ICON_Continue_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/022-ICON_Continue_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/023-ICON_Stop_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/024-ICON_Stop_1.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/025-ICON_Bar.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/026-ICON_More.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/027-ICON_Axis.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/028-ICON_CloseMotor.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/029-ICON_Homing.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/030-ICON_SetHome.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/031-ICON_PLAPreheat.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/032-ICON_ABSPreheat.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/033-ICON_Cool.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/034-ICON_Language.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/035-ICON_MoveX.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/036-ICON_MoveY.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/037-ICON_MoveZ.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/038-ICON_Extruder.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/040-ICON_Temperature.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/041-ICON_Motion.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/042-ICON_WriteEEPROM.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/043-ICON_ReadEEPROM.jpg (100%) rename buildroot/share/dwin/{icons-6/044-ICON_ResumeEEPROM.jpg => icons-7/044-ICON_ResetEEPROM.jpg} (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/045-ICON_Info.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/046-ICON_SetEndTemp.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/047-ICON_SetBedTemp.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/048-ICON_FanSpeed.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/049-ICON_SetPLAPreheat.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/050-ICON_SetABSPreheat.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/051-ICON_MaxSpeed.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/052-ICON_MaxAccelerated.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/053-ICON_MaxJerk.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/054-ICON_Step.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/055-ICON_PrintSize.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/056-ICON_Version.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/057-ICON_Contact.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/058-ICON_StockConfiguraton.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/059-ICON_MaxSpeedX.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/060-ICON_MaxSpeedY.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/061-ICON_MaxSpeedZ.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/062-ICON_MaxSpeedE.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/063-ICON_MaxAccX.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/064-ICON_MaxAccY.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/065-ICON_MaxAccZ.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/066-ICON_MaxAccE.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/067-ICON_MaxSpeedJerkX.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/068-ICON_MaxSpeedJerkY.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/069-ICON_MaxSpeedJerkZ.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/070-ICON_MaxSpeedJerkE.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/071-ICON_StepX.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/072-ICON_StepY.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/073-ICON_StepZ.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/074-ICON_StepE.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/075-ICON_Setspeed.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/076-ICON_SetZOffset.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/077-ICON_Rectangle.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/078-ICON_BLTouch.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/079-ICON_TempTooLow.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/080-ICON_AutoLeveling.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/081-ICON_TempTooHigh.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/082-ICON_NoTips_C.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/083-ICON_NoTips_E.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/084-ICON_Continue_C.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/085-ICON_Continue_E.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/086-ICON_Cancel_C.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/087-ICON_Cancel_E.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/088-ICON_Confirm_C.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/089-ICON_Confirm_E.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/090-ICON_Info_0.jpg (100%) rename buildroot/share/dwin/{icons-6 => icons-7}/091-ICON_Info_1.jpg (100%) diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 7ea0c03b6bbb..45f62dc31029 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -48,15 +48,15 @@ enum PauseMessage : char { PAUSE_MESSAGE_PARKING, PAUSE_MESSAGE_CHANGING, PAUSE_MESSAGE_WAITING, - PAUSE_MESSAGE_UNLOAD, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_LOAD, + PAUSE_MESSAGE_UNLOAD, PAUSE_MESSAGE_PURGE, PAUSE_MESSAGE_OPTION, PAUSE_MESSAGE_RESUME, - PAUSE_MESSAGE_STATUS, PAUSE_MESSAGE_HEAT, - PAUSE_MESSAGE_HEATING + PAUSE_MESSAGE_HEATING, + PAUSE_MESSAGE_STATUS }; #if M600_PURGE_MORE_RESUMABLE diff --git a/Marlin/src/lcd/e3v2/common/dwin_color.h b/Marlin/src/lcd/e3v2/common/dwin_color.h index 8df4f95151ac..1e47d2e9045a 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_color.h +++ b/Marlin/src/lcd/e3v2/common/dwin_color.h @@ -27,6 +27,7 @@ #define GetGColor(color) ((color >> 5) & 0x3F) #define GetBColor(color) ((color >> 0) & 0x1F) +// RGB565 colors: https://rgbcolorpicker.com/565 #define COLOR_WHITE 0xFFFF #define COLOR_YELLOW RGB(0x1F,0x3F,0x00) #define COLOR_RED RGB(0x1F,0x00,0x00) diff --git a/Marlin/src/lcd/e3v2/common/dwin_set.h b/Marlin/src/lcd/e3v2/common/dwin_set.h index 3601f58e133e..ada7dec71fea 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_set.h +++ b/Marlin/src/lcd/e3v2/common/dwin_set.h @@ -25,12 +25,7 @@ #define Language_English 1 #define Language_Chinese 2 -//#define USE_STOCK_DWIN_SET // Use the Creality stock DWIN_SET instead of Marlin's unified DWIN_SET by The-EG & thinkyhead -#ifdef USE_STOCK_DWIN_SET - #define ICON 9 // 9.ICO -#else - #define ICON 7 // 7.ICO -#endif +#define ICON 7 // 7.ICO #ifndef CORP_WEBSITE #define CORP_WEBSITE WEBSITE_URL @@ -82,7 +77,7 @@ #define ICON_Motion 41 #define ICON_WriteEEPROM 42 #define ICON_ReadEEPROM 43 -#define ICON_ResumeEEPROM 44 +#define ICON_ResetEEPROM 44 #define ICON_Info 45 #define ICON_SetEndTemp 46 @@ -144,7 +139,7 @@ #define ICON_ProbeOffsetY ICON_StepY #define ICON_ProbeOffsetZ ICON_StepZ #define ICON_PIDNozzle ICON_SetEndTemp -#define ICON_PIDbed ICON_SetBedTemp +#define ICON_PIDBed ICON_SetBedTemp #define ICON_FWRetract ICON_StepE #define ICON_FWRetLength ICON_StepE #define ICON_FWRetSpeed ICON_Setspeed diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index c1e7a358c007..8156489f7bc5 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -905,7 +905,7 @@ void drawControlMenu() { #if ENABLED(EEPROM_SETTINGS) _TEMP_ICON(CONTROL_CASE_SAVE, ICON_WriteEEPROM, false); _TEMP_ICON(CONTROL_CASE_LOAD, ICON_ReadEEPROM, false); - _TEMP_ICON(CONTROL_CASE_RESET, ICON_ResumeEEPROM, false); + _TEMP_ICON(CONTROL_CASE_RESET, ICON_ResetEEPROM, false); #endif } @@ -2468,7 +2468,7 @@ void itemAdvBedPID(const uint8_t row) { itemAreaCopy(145, 104, 167, 114, row, 27); // "PID" #endif } - drawMenuLine(row, ICON_PIDbed); + drawMenuLine(row, ICON_PIDBed); } #if ENABLED(POWER_LOSS_RECOVERY) diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 1cb2a2efedfb..847c4bfd088f 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -1158,7 +1158,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #if ENABLED(ADVANCED_PAUSE_FEATURE) case PREPARE_CHANGEFIL: if (draw) { - drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) + drawMenuItem(row, ICON_ResetEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) , nullptr, true #endif @@ -1766,7 +1766,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; case CHANGEFIL_CHANGE: if (draw) - drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); + drawMenuItem(row, ICON_ResetEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else { if (thermalManager.targetTooColdToExtrude(0)) popupHandler(Popup_ETemp); @@ -3449,7 +3449,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; case LEVELING_SETTINGS_PLANE: if (draw) - drawMenuItem(row, ICON_ResumeEEPROM, F("Convert Mesh to Plane")); + drawMenuItem(row, ICON_ResetEEPROM, F("Convert Mesh to Plane")); else { if (mesh_conf.createPlaneFromMesh()) break; gcode.process_subcommands_now(F("M420 S1")); @@ -3594,7 +3594,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #if ENABLED(AUTO_BED_LEVELING_UBL) case LEVELING_M_UNDEF: if (draw) - drawMenuItem(row, ICON_ResumeEEPROM, F("Clear Point Value")); + drawMenuItem(row, ICON_ResetEEPROM, F("Clear Point Value")); else { mesh_conf.manualValueUpdate(true); redrawMenu(false); @@ -3924,7 +3924,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) case TUNE_CHANGEFIL: if (draw) - drawMenuItem(row, ICON_ResumeEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); + drawMenuItem(row, ICON_ResetEEPROM, GET_TEXT_F(MSG_FILAMENTCHANGE)); else popupHandler(Popup_ConfFilChange); break; diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 64d145c95dfd..796c87e47e21 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -89,9 +89,10 @@ bool drawing_mesh = false; struct linear_fit_data lsf_results; incremental_LSF_reset(&lsf_results); GRID_LOOP(x, y) { - if (!isnan(bedlevel.z_values[x][y])) { + const float z = bedlevel.z_values[x][y]; + if (!isnan(z)) { xy_pos_t rpos = { bedlevel.get_mesh_x(x), bedlevel.get_mesh_y(y) }; - incremental_LSF(&lsf_results, rpos, bedlevel.z_values[x][y]); + incremental_LSF(&lsf_results, rpos, z); } } @@ -199,8 +200,8 @@ float BedLevelTools::getMinValue() { // Return 'true' if mesh is good and within LCD limits bool BedLevelTools::meshValidate() { GRID_LOOP(x, y) { - const float v = bedlevel.z_values[x][y]; - if (isnan(v) || !WITHIN(v, Z_OFFSET_MIN, Z_OFFSET_MAX)) return false; + const float z = bedlevel.z_values[x][y]; + if (isnan(z) || !WITHIN(z, Z_OFFSET_MIN, Z_OFFSET_MAX)) return false; } return true; } @@ -232,46 +233,49 @@ bool BedLevelTools::meshValidate() { const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; - dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ - isnan(bedlevel.z_values[x][y]) ? COLOR_GREY : ( // gray if undefined - (bedlevel.z_values[x][y] < 0 ? - (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / rmax) << 11 : // red if mesh point value is negative - (uint16_t)round(0x3F * bedlevel.z_values[x][y] / rmax) << 5) | // green if mesh point value is positive - _MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm - start_x_px, start_y_px, end_x_px, end_y_px + const float z = bedlevel.z_values[x][y]; + const uint16_t color = isnan(z) ? COLOR_GREY : ( // Gray if undefined + (z < 0 ? uint16_t(round(0x1F * -z / rmax)) << 11 // Red for negative mesh point + : uint16_t(round(0x3F * z / rmax)) << 5) // Green for positive mesh point + | _MIN(0x1F, (uint8_t(abs(z) * 0.4))) // + Blue stepping for every mm ); + dwinDrawRectangle(1, color, start_x_px, start_y_px, end_x_px, end_y_px); + safe_delay(10); LCD_SERIAL.flushTX(); // Draw value text on + if (!viewer_print_value) continue; + const uint8_t fs = DWINUI::fontWidth(meshfont); - if (viewer_print_value) { - const int8_t offset_y = cell_height_px / 2 - fs; - if (isnan(bedlevel.z_values[x][y])) { // undefined - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); - } - else { // has value - MString<12> msg; - if ((GRID_MAX_POINTS_X) < TERN(TJC_DISPLAY, 8, 10)) - msg.set(p_float_t(abs(bedlevel.z_values[x][y]), 2)); - else - msg.setf(F("%02i"), uint16_t(abs(bedlevel.z_values[x][y] - int16_t(bedlevel.z_values[x][y])) * 100)); - const int8_t offset_x = cell_width_px / 2 - (fs / 2) * msg.length() - 2; - if ((GRID_MAX_POINTS_X) >= TERN(TJC_DISPLAY, 8, 10)) - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y, F(".")); - dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y, msg); - } - safe_delay(10); - LCD_SERIAL.flushTX(); + const int8_t offset_y = cell_height_px / 2 - fs; + if (isnan(z)) { // undefined + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); } - } + else { // has value + MString<12> msg; + constexpr bool is_wide = (GRID_MAX_POINTS_X) >= TERN(TJC_DISPLAY, 8, 10); + if (is_wide) + msg.setf(F("%02i"), uint16_t(z * 100) % 100); + else + msg.set(p_float_t(abs(z), 2)); + const int8_t offset_x = cell_width_px / 2 - (fs / 2) * msg.length() - 2; + if (is_wide) + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px - 2 + offset_x, start_y_px + offset_y, F(".")); + dwinDrawString(false, meshfont, COLOR_WHITE, COLOR_BG_BLUE, start_x_px + 1 + offset_x, start_y_px + offset_y, msg); + } + + safe_delay(10); + LCD_SERIAL.flushTX(); + + } // GRID_LOOP } void BedLevelTools::setMeshViewerStatus() { // TODO: draw gradient with values as a legend instead float v_max = abs(getMaxValue()), v_min = abs(getMinValue()), rmax = _MAX(v_min, v_max), rmin = _MIN(v_min, v_max); - if (rmax > 3e+10f) rmax = 0.0000001; - if (rmin > 3e+10f) rmin = 0.0000001; + if (rmax > 3e+10f) rmax = 0.0000001f; + if (rmin > 3e+10f) rmin = 0.0000001f; ui.set_status(&MString<47>(F("Red "), p_float_t(-rmax, 3), F("..0.."), p_float_t(rmin, 3), F(" Green"))); drawing_mesh = false; } diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index fcebdb8c5726..894102e8a3bb 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -336,7 +336,7 @@ void ICON_Button(const bool selected, const int iconid, const frame_rect_t &ico, // void ICON_Print() { constexpr frame_rect_t ico = { 17, 110, 110, 100 }; - constexpr text_info_t txt = { 1, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 1, { 405, 447 }, 27, 15 }; ICON_Button(select_page.now == PAGE_PRINT, ICON_Print_0, ico, txt, GET_TEXT_F(MSG_BUTTON_PRINT)); } @@ -345,7 +345,7 @@ void ICON_Print() { // void ICON_Prepare() { constexpr frame_rect_t ico = { 145, 110, 110, 100 }; - constexpr text_info_t txt = { 31, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 31, { 405, 447 }, 27, 15 }; ICON_Button(select_page.now == PAGE_PREPARE, ICON_Prepare_0, ico, txt, GET_TEXT_F(MSG_PREPARE)); } @@ -354,7 +354,7 @@ void ICON_Prepare() { // void ICON_Control() { constexpr frame_rect_t ico = { 17, 226, 110, 100 }; - constexpr text_info_t txt = { 61, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 61, { 405, 447 }, 27, 15 }; ICON_Button(select_page.now == PAGE_CONTROL, ICON_Control_0, ico, txt, GET_TEXT_F(MSG_CONTROL)); } @@ -363,7 +363,7 @@ void ICON_Control() { // void ICON_AdvSettings() { constexpr frame_rect_t ico = { 145, 226, 110, 100 }; - constexpr text_info_t txt = { 91, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 91, { 405, 447 }, 27, 15 }; ICON_Button(select_page.now == PAGE_ADVANCE, ICON_Info_0, ico, txt, GET_TEXT_F(MSG_BUTTON_ADVANCED)); } @@ -372,7 +372,7 @@ void ICON_AdvSettings() { // void ICON_Tune() { constexpr frame_rect_t ico = { 8, 232, 80, 100 }; - constexpr text_info_t txt = { 121, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 121, { 405, 447 }, 27, 15 }; ICON_Button(select_print.now == PRINT_SETUP, ICON_Setup_0, ico, txt, GET_TEXT_F(MSG_TUNE)); } @@ -381,7 +381,7 @@ void ICON_Tune() { // void ICON_Pause() { constexpr frame_rect_t ico = { 96, 232, 80, 100 }; - constexpr text_info_t txt = { 181, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 181, { 405, 447 }, 27, 15 }; ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Pause_0, ico, txt, GET_TEXT_F(MSG_BUTTON_PAUSE)); } @@ -390,7 +390,7 @@ void ICON_Pause() { // void ICON_Resume() { constexpr frame_rect_t ico = { 96, 232, 80, 100 }; - constexpr text_info_t txt = { 1, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 15 }; + constexpr text_info_t txt = { 1, { 405, 447 }, 27, 15 }; ICON_Button(select_print.now == PRINT_PAUSE_RESUME, ICON_Continue_0, ico, txt, GET_TEXT_F(MSG_BUTTON_RESUME)); } @@ -399,7 +399,7 @@ void ICON_Resume() { // void ICON_Stop() { constexpr frame_rect_t ico = { 184, 232, 80, 100 }; - constexpr text_info_t txt = { 151, { 405, TERN(USE_STOCK_DWIN_SET, 446, 447) }, 27, 12 }; + constexpr text_info_t txt = { 151, { 405, 447 }, 27, 12 }; ICON_Button(select_print.now == PRINT_STOP, ICON_Stop_0, ico, txt, GET_TEXT_F(MSG_BUTTON_STOP)); } @@ -482,8 +482,7 @@ void dwinResetStatusLine() { // Djb2 hash algorithm uint32_t getHash(char * str) { uint32_t hash = 5381; - char c; - while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + for (char c; (c = *str++);) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; } @@ -1943,13 +1942,7 @@ void dwinRedrawScreen() { case PAUSE_MESSAGE_INSERT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INSERT), BTN_Continue); break; case PAUSE_MESSAGE_LOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_LOAD)); break; case PAUSE_MESSAGE_UNLOAD: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_UNLOAD)); break; // Unload of pause and Unload of M702 - case PAUSE_MESSAGE_PURGE: - #if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE) - dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_CONT_PURGE)); - #else - dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_PURGE)); - #endif - break; + case PAUSE_MESSAGE_PURGE: dwinPopupPause(GET_TEXT_F(TERN(ADVANCED_PAUSE_CONTINUOUS_PURGE, MSG_FILAMENT_CHANGE_CONT_PURGE, MSG_FILAMENT_CHANGE_PURGE))); break; case PAUSE_MESSAGE_OPTION: gotoFilamentPurge(); break; case PAUSE_MESSAGE_RESUME: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_RESUME)); break; case PAUSE_MESSAGE_HEAT: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_HEAT), BTN_Continue); break; @@ -3141,7 +3134,7 @@ void drawControlMenu() { #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, readEEPROM); - MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); + MENU_ITEM(ICON_ResetEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); #endif MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, rebootPrinter); MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, gotoInfoMenu); @@ -3957,8 +3950,8 @@ void drawStepsMenu() { if (SET_MENU(zOffsetWizMenu, MSG_PROBE_WIZARD, 4)) { BACK_ITEM(drawPrepareMenu); MENU_ITEM(ICON_Homing, MSG_AUTO_HOME, onDrawMenuItem, autoHome); - MENU_ITEM_F(ICON_MoveZ0, "Move Z to Home", onDrawMenuItem, setMoveZto0); - EDIT_ITEM(ICON_Zoffset, MSG_ZPROBE_ZOFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); + MENU_ITEM(ICON_MoveZ0, MSG_MOVE_NOZZLE_TO_BED, onDrawMenuItem, setMoveZto0); + EDIT_ITEM(ICON_Zoffset, MSG_XATC_UPDATE_Z_OFFSET, onDrawPFloat2Menu, setZOffset, &BABY_Z_VAR); } updateMenu(zOffsetWizMenu); if (!axis_is_trusted(Z_AXIS)) LCD_MESSAGE_F("WARNING: Z position unknown, move Z to home"); diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 636b4fbbad72..97da3f05abab 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -36,124 +36,112 @@ #include "dwin_lcd.h" // Extra Icons -#define ICON_AdvSet ICON_Language -#define ICON_BedSizeX ICON_PrintSize -#define ICON_BedSizeY ICON_PrintSize -#define ICON_BedTramming ICON_SetHome -#define ICON_Binary ICON_Contact -#define ICON_BltouchReset ICON_StockConfiguration -#define ICON_Brightness ICON_Motion -#define ICON_Cancel ICON_StockConfiguration -#define ICON_CustomPreheat ICON_SetEndTemp -#define ICON_Error ICON_TempTooHigh -#define ICON_esDiag ICON_Info -#define ICON_ExtrudeMinT ICON_HotendTemp -#define ICON_FilLoad ICON_WriteEEPROM -#define ICON_FilMan ICON_ResumeEEPROM -#define ICON_FilSet ICON_ResumeEEPROM -#define ICON_FilUnload ICON_ReadEEPROM -#define ICON_Flow ICON_StepE -#define ICON_Folder ICON_More -#define ICON_HomeX ICON_MoveX -#define ICON_HomeY ICON_MoveY -#define ICON_HomeZ ICON_MoveZ -#define ICON_HomeOffset ICON_AdvSet -#define ICON_HomeOffsetX ICON_StepX -#define ICON_HomeOffsetY ICON_StepY -#define ICON_HomeOffsetZ ICON_StepZ -#define ICON_HSMode ICON_StockConfiguration -#define ICON_InputShaping ICON_MaxAccelerated -#define ICON_JDmm ICON_MaxJerk -#define ICON_Tram ICON_SetEndTemp -#define ICON_Level ICON_HotendTemp -#define ICON_Lock ICON_Cool -#define ICON_ManualMesh ICON_HotendTemp -#define ICON_MaxPosX ICON_MoveX -#define ICON_MaxPosY ICON_MoveY -#define ICON_MaxPosZ ICON_MoveZ -#define ICON_MeshEdit ICON_Homing -#define ICON_MeshEditX ICON_MoveX -#define ICON_MeshEditY ICON_MoveY -#define ICON_MeshEditZ ICON_MoveZ -#define ICON_MeshNext ICON_Axis -#define ICON_MeshPoints ICON_SetEndTemp -#define ICON_MeshReset ICON_StockConfiguration -#define ICON_MeshSave ICON_WriteEEPROM -#define ICON_MeshViewer ICON_HotendTemp -#define ICON_MoveZ0 ICON_HotendTemp -#define ICON_Park ICON_Motion -#define ICON_ParkPos ICON_AdvSet -#define ICON_ParkPosX ICON_StepX -#define ICON_ParkPosY ICON_StepY -#define ICON_ParkPosZ ICON_StepZ -#define ICON_PhySet ICON_PrintSize -#define ICON_PIDNozzle ICON_SetEndTemp -#define ICON_PIDBed ICON_SetBedTemp -#define ICON_PIDCycles ICON_ResumeEEPROM -#define ICON_PIDValue ICON_Contact -#define ICON_PrintStats ICON_PrintTime -#define ICON_PrintStatsReset ICON_RemainTime -#define ICON_Preheat1 ICON_PLAPreheat -#define ICON_Preheat2 ICON_ABSPreheat -#define ICON_Preheat3 ICON_CustomPreheat -#define ICON_Preheat4 ICON_CustomPreheat -#define ICON_Preheat5 ICON_CustomPreheat -#define ICON_Preheat6 ICON_CustomPreheat -#define ICON_Preheat7 ICON_CustomPreheat -#define ICON_Preheat8 ICON_CustomPreheat -#define ICON_Preheat9 ICON_CustomPreheat -#define ICON_Preheat10 ICON_CustomPreheat -#define ICON_ProbeDeploy ICON_SetEndTemp -#define ICON_ProbeMargin ICON_PrintSize -#define ICON_ProbeOffsetX ICON_StepX -#define ICON_ProbeOffsetY ICON_StepY -#define ICON_ProbeOffsetZ ICON_StepZ -#define ICON_ProbeSet ICON_SetEndTemp -#define ICON_ProbeStow ICON_SetEndTemp -#define ICON_ProbeTest ICON_SetEndTemp -#define ICON_ProbeZSpeed ICON_MaxSpeedZ -#define ICON_Pwrlossr ICON_Motion -#define ICON_Reboot ICON_ResumeEEPROM -#define ICON_Runout ICON_MaxAccE -#define ICON_Scolor ICON_MaxSpeed -#define ICON_SetBaudRate ICON_Setspeed -#define ICON_SetCustomPreheat ICON_SetEndTemp -#define ICON_SetPreheat1 ICON_SetPLAPreheat -#define ICON_SetPreheat2 ICON_SetABSPreheat -#define ICON_SetPreheat3 ICON_SetCustomPreheat -#define ICON_SetPreheat4 ICON_SetCustomPreheat -#define ICON_SetPreheat5 ICON_SetCustomPreheat -#define ICON_SetPreheat6 ICON_SetCustomPreheat -#define ICON_SetPreheat7 ICON_SetCustomPreheat -#define ICON_SetPreheat8 ICON_SetCustomPreheat -#define ICON_SetPreheat9 ICON_SetCustomPreheat -#define ICON_SetPreheat10 ICON_SetCustomPreheat -#define ICON_ShapingX ICON_MoveX -#define ICON_ShapingY ICON_MoveY -#define ICON_Sound ICON_Cool -#define ICON_TMCSet ICON_PrintSize -#define ICON_TMCXSet ICON_MoveX -#define ICON_TMCYSet ICON_MoveY -#define ICON_TMCZSet ICON_MoveZ -#define ICON_TMCESet ICON_Extruder -#define ICON_UBLActive ICON_HotendTemp -#define ICON_UBLActive ICON_HotendTemp -#define ICON_UBLSlot ICON_ResumeEEPROM -#define ICON_UBLMeshSave ICON_WriteEEPROM -#define ICON_UBLMeshLoad ICON_ReadEEPROM -#define ICON_UBLTiltGrid ICON_PrintSize -#define ICON_UBLSmartFill ICON_StockConfiguration -#define ICON_ZAfterHome ICON_SetEndTemp - -#define ICON_CaseLight ICON_Motion -#define ICON_LedControl ICON_Motion +#define ICON_BedSizeX ICON_PrintSize +#define ICON_BedSizeY ICON_PrintSize +#define ICON_BedTramming ICON_SetHome +#define ICON_Binary ICON_Contact +#define ICON_BltouchReset ICON_StockConfiguration +#define ICON_Brightness ICON_Motion +#define ICON_Cancel ICON_StockConfiguration +#define ICON_CustomPreheat ICON_SetEndTemp +#define ICON_Error ICON_TempTooHigh +#define ICON_esDiag ICON_Info +#define ICON_ExtrudeMinT ICON_HotendTemp +#define ICON_FilLoad ICON_WriteEEPROM +#define ICON_FilMan ICON_ResetEEPROM +#define ICON_FilSet ICON_ResetEEPROM +#define ICON_FilUnload ICON_ReadEEPROM +#define ICON_Flow ICON_StepE +#define ICON_HomeX ICON_MoveX +#define ICON_HomeY ICON_MoveY +#define ICON_HomeZ ICON_MoveZ +#define ICON_HSMode ICON_StockConfiguration +#define ICON_InputShaping ICON_MaxAccelerated +#define ICON_JDmm ICON_MaxJerk +#define ICON_Tram ICON_SetEndTemp +#define ICON_Level ICON_HotendTemp +#define ICON_Lock ICON_Cool +#define ICON_ManualMesh ICON_HotendTemp +#define ICON_MaxPosX ICON_MoveX +#define ICON_MaxPosY ICON_MoveY +#define ICON_MaxPosZ ICON_MoveZ +#define ICON_MeshEdit ICON_Homing +#define ICON_MeshEditX ICON_MoveX +#define ICON_MeshEditY ICON_MoveY +#define ICON_MeshEditZ ICON_MoveZ +#define ICON_MeshNext ICON_Axis +#define ICON_MeshPoints ICON_SetEndTemp +#define ICON_MeshReset ICON_StockConfiguration +#define ICON_MeshSave ICON_WriteEEPROM +#define ICON_MeshViewer ICON_HotendTemp +#define ICON_MoveZ0 ICON_HotendTemp +#define ICON_Park ICON_Motion +#define ICON_ParkPos ICON_AdvSet +#define ICON_ParkPosX ICON_StepX +#define ICON_ParkPosY ICON_StepY +#define ICON_ParkPosZ ICON_StepZ +#define ICON_PhySet ICON_PrintSize +#define ICON_PIDCycles ICON_ResetEEPROM +#define ICON_PIDValue ICON_Contact +#define ICON_PrintStats ICON_PrintTime +#define ICON_PrintStatsReset ICON_RemainTime +#define ICON_Preheat1 ICON_PLAPreheat +#define ICON_Preheat2 ICON_ABSPreheat +#define ICON_Preheat3 ICON_CustomPreheat +#define ICON_Preheat4 ICON_CustomPreheat +#define ICON_Preheat5 ICON_CustomPreheat +#define ICON_Preheat6 ICON_CustomPreheat +#define ICON_Preheat7 ICON_CustomPreheat +#define ICON_Preheat8 ICON_CustomPreheat +#define ICON_Preheat9 ICON_CustomPreheat +#define ICON_Preheat10 ICON_CustomPreheat +#define ICON_ProbeDeploy ICON_SetEndTemp +#define ICON_ProbeMargin ICON_PrintSize +#define ICON_ProbeSet ICON_SetEndTemp +#define ICON_ProbeStow ICON_SetEndTemp +#define ICON_ProbeTest ICON_SetEndTemp +#define ICON_ProbeZSpeed ICON_MaxSpeedZ +#define ICON_Pwrlossr ICON_Motion +#define ICON_Reboot ICON_ResetEEPROM +#define ICON_Runout ICON_MaxAccE +#define ICON_Scolor ICON_MaxSpeed +#define ICON_SetBaudRate ICON_Setspeed +#define ICON_SetCustomPreheat ICON_SetEndTemp +#define ICON_SetPreheat1 ICON_SetPLAPreheat +#define ICON_SetPreheat2 ICON_SetABSPreheat +#define ICON_SetPreheat3 ICON_SetCustomPreheat +#define ICON_SetPreheat4 ICON_SetCustomPreheat +#define ICON_SetPreheat5 ICON_SetCustomPreheat +#define ICON_SetPreheat6 ICON_SetCustomPreheat +#define ICON_SetPreheat7 ICON_SetCustomPreheat +#define ICON_SetPreheat8 ICON_SetCustomPreheat +#define ICON_SetPreheat9 ICON_SetCustomPreheat +#define ICON_SetPreheat10 ICON_SetCustomPreheat +#define ICON_ShapingX ICON_MoveX +#define ICON_ShapingY ICON_MoveY +#define ICON_Sound ICON_Cool +#define ICON_TMCSet ICON_PrintSize +#define ICON_TMCXSet ICON_MoveX +#define ICON_TMCYSet ICON_MoveY +#define ICON_TMCZSet ICON_MoveZ +#define ICON_TMCESet ICON_Extruder +#define ICON_UBLActive ICON_HotendTemp +#define ICON_UBLSlot ICON_ResetEEPROM +#define ICON_UBLMeshSave ICON_WriteEEPROM +#define ICON_UBLMeshLoad ICON_ReadEEPROM +#define ICON_UBLTiltGrid ICON_PrintSize +#define ICON_UBLSmartFill ICON_StockConfiguration +#define ICON_ZAfterHome ICON_SetEndTemp + +#define ICON_CaseLight ICON_Motion +#define ICON_LedControl ICON_Motion // MPC -#define ICON_MPCNozzle ICON_SetEndTemp -#define ICON_MPCValue ICON_Contact -#define ICON_MPCHeater ICON_Temperature -#define ICON_MPCHeatCap ICON_SetBedTemp -#define ICON_MPCFan ICON_FanSpeed +#define ICON_MPCNozzle ICON_SetEndTemp +#define ICON_MPCValue ICON_Contact +#define ICON_MPCHeater ICON_Temperature +#define ICON_MPCHeatCap ICON_SetBedTemp +#define ICON_MPCFan ICON_FanSpeed // Buttons #define BTN_Continue 85 diff --git a/buildroot/share/dwin/bin/DWIN_ICO.py b/buildroot/share/dwin/bin/DWIN_ICO.py index 4896f3ce45e1..436a98701de0 100644 --- a/buildroot/share/dwin/bin/DWIN_ICO.py +++ b/buildroot/share/dwin/bin/DWIN_ICO.py @@ -113,8 +113,7 @@ def _splitEntryData(self, infile, outDir): # Seek file position, read length bytes, and write to new output file. print('%02d: offset: 0x%06x len: 0x%04x width: %d height: %d' % (count, entry.offset, entry.length, entry.width, entry.height)) - outfilename = os.path.join(outDir, - '%03d-%s.jpg' % (count, _iconNames[count])) + outfilename = os.path.join(outDir, '%03d-ICON_%s.jpg' % (count, _iconNames7[count])) with open(outfilename, 'wb') as outfile: infile.seek(entry.offset) blob = infile.read(entry.length) @@ -246,112 +245,97 @@ def serialize(self): 0, 0, 0, 0, 0) return rawdata -_iconNames = { - 0 : 'ICON_LOGO', - 1 : 'ICON_Print_0', - 2 : 'ICON_Print_1', - 3 : 'ICON_Prepare_0', - 4 : 'ICON_Prepare_1', - 5 : 'ICON_Control_0', - 6 : 'ICON_Control_1', - 7 : 'ICON_Leveling_0', - 8 : 'ICON_Leveling_1', - 9 : 'ICON_HotendTemp', - 10 : 'ICON_BedTemp', - 11 : 'ICON_Speed', - 12 : 'ICON_Zoffset', - 13 : 'ICON_Back', - 14 : 'ICON_File', - 15 : 'ICON_PrintTime', - 16 : 'ICON_RemainTime', - 17 : 'ICON_Setup_0', - 18 : 'ICON_Setup_1', - 19 : 'ICON_Pause_0', - 20 : 'ICON_Pause_1', - 21 : 'ICON_Continue_0', - 22 : 'ICON_Continue_1', - 23 : 'ICON_Stop_0', - 24 : 'ICON_Stop_1', - 25 : 'ICON_Bar', - 26 : 'ICON_More', - 27 : 'ICON_Axis', - 28 : 'ICON_CloseMotor', - 29 : 'ICON_Homing', - 30 : 'ICON_SetHome', - 31 : 'ICON_PLAPreheat', - 32 : 'ICON_ABSPreheat', - 33 : 'ICON_Cool', - 34 : 'ICON_Language', - 35 : 'ICON_MoveX', - 36 : 'ICON_MoveY', - 37 : 'ICON_MoveZ', - 38 : 'ICON_Extruder', - # no 39 - 40 : 'ICON_Temperature', - 41 : 'ICON_Motion', - 42 : 'ICON_WriteEEPROM', - 43 : 'ICON_ReadEEPROM', - 44 : 'ICON_ResumeEEPROM', - 45 : 'ICON_Info', - 46 : 'ICON_SetEndTemp', - 47 : 'ICON_SetBedTemp', - 48 : 'ICON_FanSpeed', - 49 : 'ICON_SetPLAPreheat', - 50 : 'ICON_SetABSPreheat', - 51 : 'ICON_MaxSpeed', - 52 : 'ICON_MaxAccelerated', - 53 : 'ICON_MaxJerk', - 54 : 'ICON_Step', - 55 : 'ICON_PrintSize', - 56 : 'ICON_Version', - 57 : 'ICON_Contact', - 58 : 'ICON_StockConfiguraton', - 59 : 'ICON_MaxSpeedX', - 60 : 'ICON_MaxSpeedY', - 61 : 'ICON_MaxSpeedZ', - 62 : 'ICON_MaxSpeedE', - 63 : 'ICON_MaxAccX', - 64 : 'ICON_MaxAccY', - 65 : 'ICON_MaxAccZ', - 66 : 'ICON_MaxAccE', - 67 : 'ICON_MaxSpeedJerkX', - 68 : 'ICON_MaxSpeedJerkY', - 69 : 'ICON_MaxSpeedJerkZ', - 70 : 'ICON_MaxSpeedJerkE', - 71 : 'ICON_StepX', - 72 : 'ICON_StepY', - 73 : 'ICON_StepZ', - 74 : 'ICON_StepE', - 75 : 'ICON_Setspeed', - 76 : 'ICON_SetZOffset', - 77 : 'ICON_Rectangle', - 78 : 'ICON_BLTouch', - 79 : 'ICON_TempTooLow', - 80 : 'ICON_AutoLeveling', - 81 : 'ICON_TempTooHigh', - 82 : 'ICON_NoTips_C', - 83 : 'ICON_NoTips_E', - 84 : 'ICON_Continue_C', - 85 : 'ICON_Continue_E', - 86 : 'ICON_Cancel_C', - 87 : 'ICON_Cancel_E', - 88 : 'ICON_Confirm_C', - 89 : 'ICON_Confirm_E', - 90 : 'ICON_Info_0', - 91 : 'ICON_Info_1', - 93 : 'ICON_Printer_0', - #94 : 'ICON_Printer_1', - 200 : 'ICON_Checkbox_F', - 201 : 'ICON_Checkbox_T', - 202 : 'ICON_Fade', - 203 : 'ICON_Mesh', - 204 : 'ICON_Tilt', - 205 : 'ICON_Brightness', - 206 : 'ICON_Probe', - 249 : 'ICON_AxisD', - 250 : 'ICON_AxisBR', - 251 : 'ICON_AxisTR', - 252 : 'ICON_AxisBL', - 253 : 'ICON_AxisTL', - 254 : 'ICON_AxisC' +_iconNames7 = { + 0 : "LOGO_Creality", + 1 : "Print_0", + 2 : "Print_1", + 3 : "Prepare_0", + 4 : "Prepare_1", + 5 : "Control_0", + 6 : "Control_1", + 7 : "Leveling_0", + 8 : "Leveling_1", + 9 : "HotendTemp", + 10 : "BedTemp", + 11 : "Speed", + 12 : "Zoffset", + 13 : "Back", + 14 : "File", + 15 : "PrintTime", + 16 : "RemainTime", + 17 : "Setup_0", + 18 : "Setup_1", + 19 : "Pause_0", + 20 : "Pause_1", + 21 : "Continue_0", + 22 : "Continue_1", + 23 : "Stop_0", + 24 : "Stop_1", + 25 : "Bar", + 26 : "More", + 27 : "Axis", + 28 : "CloseMotor", + 29 : "Homing", + 30 : "SetHome", + 31 : "PLAPreheat", + 32 : "ABSPreheat", + 33 : "Cool", + 34 : "Language", + 35 : "MoveX", + 36 : "MoveY", + 37 : "MoveZ", + 38 : "Extruder", + # Skip 39 + 40 : "Temperature", + 41 : "Motion", + 42 : "WriteEEPROM", + 43 : "ReadEEPROM", + 44 : "ResetEEPROM", + 45 : "Info", + 46 : "SetEndTemp", + 47 : "SetBedTemp", + 48 : "FanSpeed", + 49 : "SetPLAPreheat", + 50 : "SetABSPreheat", + 51 : "MaxSpeed", + 52 : "MaxAccelerated", + 53 : "MaxJerk", + 54 : "Step", + 55 : "PrintSize", + 56 : "Version", + 57 : "Contact", + 58 : "StockConfiguraton", + 59 : "MaxSpeedX", + 60 : "MaxSpeedY", + 61 : "MaxSpeedZ", + 62 : "MaxSpeedE", + 63 : "MaxAccX", + 64 : "MaxAccY", + 65 : "MaxAccZ", + 66 : "MaxAccE", + 67 : "MaxSpeedJerkX", + 68 : "MaxSpeedJerkY", + 69 : "MaxSpeedJerkZ", + 70 : "MaxSpeedJerkE", + 71 : "StepX", + 72 : "StepY", + 73 : "StepZ", + 74 : "StepE", + 75 : "Setspeed", + 76 : "SetZOffset", + 77 : "Rectangle", + 78 : "BLTouch", + 79 : "TempTooLow", + 80 : "AutoLeveling", + 81 : "TempTooHigh", + 82 : "NoTips_C", + 83 : "NoTips_E", + 84 : "Continue_C", + 85 : "Continue_E", + 86 : "Cancel_C", + 87 : "Cancel_E", + 88 : "Confirm_C", + 89 : "Confirm_E", + 90 : "Info_0", + 91 : "Info_1" } diff --git a/buildroot/share/dwin/icons-2/000-ICON_BootLogo.jpg b/buildroot/share/dwin/icons-3/000-ICON_BootLogo.jpg similarity index 100% rename from buildroot/share/dwin/icons-2/000-ICON_BootLogo.jpg rename to buildroot/share/dwin/icons-3/000-ICON_BootLogo.jpg diff --git a/buildroot/share/dwin/icons-2/001-ICON_OpenSourceFirmware.jpg b/buildroot/share/dwin/icons-3/001-ICON_OpenSourceFirmware.jpg similarity index 100% rename from buildroot/share/dwin/icons-2/001-ICON_OpenSourceFirmware.jpg rename to buildroot/share/dwin/icons-3/001-ICON_OpenSourceFirmware.jpg diff --git a/buildroot/share/dwin/icons-2/002-ICON_GitHub.jpg b/buildroot/share/dwin/icons-3/002-ICON_GitHub.jpg similarity index 100% rename from buildroot/share/dwin/icons-2/002-ICON_GitHub.jpg rename to buildroot/share/dwin/icons-3/002-ICON_GitHub.jpg diff --git a/buildroot/share/dwin/icons-2/003-ICON_Website.jpg b/buildroot/share/dwin/icons-3/003-ICON_Website.jpg similarity index 100% rename from buildroot/share/dwin/icons-2/003-ICON_Website.jpg rename to buildroot/share/dwin/icons-3/003-ICON_Website.jpg diff --git a/buildroot/share/dwin/icons-2/004-ICON_Copyright.jpg b/buildroot/share/dwin/icons-3/004-ICON_Copyright.jpg similarity index 100% rename from buildroot/share/dwin/icons-2/004-ICON_Copyright.jpg rename to buildroot/share/dwin/icons-3/004-ICON_Copyright.jpg diff --git a/buildroot/share/dwin/icons-3/000-ICON_LOGO_Marlin.jpg b/buildroot/share/dwin/icons-4/000-ICON_LOGO_Marlin.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/000-ICON_LOGO_Marlin.jpg rename to buildroot/share/dwin/icons-4/000-ICON_LOGO_Marlin.jpg diff --git a/buildroot/share/dwin/icons-3/001-ICON_HotendOff.jpg b/buildroot/share/dwin/icons-4/001-ICON_HotendOff.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/001-ICON_HotendOff.jpg rename to buildroot/share/dwin/icons-4/001-ICON_HotendOff.jpg diff --git a/buildroot/share/dwin/icons-3/002-ICON_HotendOn.jpg b/buildroot/share/dwin/icons-4/002-ICON_HotendOn.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/002-ICON_HotendOn.jpg rename to buildroot/share/dwin/icons-4/002-ICON_HotendOn.jpg diff --git a/buildroot/share/dwin/icons-3/003-ICON_BedOff.jpg b/buildroot/share/dwin/icons-4/003-ICON_BedOff.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/003-ICON_BedOff.jpg rename to buildroot/share/dwin/icons-4/003-ICON_BedOff.jpg diff --git a/buildroot/share/dwin/icons-3/004-ICON_BedOn.jpg b/buildroot/share/dwin/icons-4/004-ICON_BedOn.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/004-ICON_BedOn.jpg rename to buildroot/share/dwin/icons-4/004-ICON_BedOn.jpg diff --git a/buildroot/share/dwin/icons-3/005-ICON_Fan0.jpg b/buildroot/share/dwin/icons-4/005-ICON_Fan0.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/005-ICON_Fan0.jpg rename to buildroot/share/dwin/icons-4/005-ICON_Fan0.jpg diff --git a/buildroot/share/dwin/icons-3/006-ICON_Fan1.jpg b/buildroot/share/dwin/icons-4/006-ICON_Fan1.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/006-ICON_Fan1.jpg rename to buildroot/share/dwin/icons-4/006-ICON_Fan1.jpg diff --git a/buildroot/share/dwin/icons-3/007-ICON_Fan2.jpg b/buildroot/share/dwin/icons-4/007-ICON_Fan2.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/007-ICON_Fan2.jpg rename to buildroot/share/dwin/icons-4/007-ICON_Fan2.jpg diff --git a/buildroot/share/dwin/icons-3/008-ICON_Fan3.jpg b/buildroot/share/dwin/icons-4/008-ICON_Fan3.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/008-ICON_Fan3.jpg rename to buildroot/share/dwin/icons-4/008-ICON_Fan3.jpg diff --git a/buildroot/share/dwin/icons-3/009-ICON_Halted.jpg b/buildroot/share/dwin/icons-4/009-ICON_Halted.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/009-ICON_Halted.jpg rename to buildroot/share/dwin/icons-4/009-ICON_Halted.jpg diff --git a/buildroot/share/dwin/icons-3/010-ICON_Question.jpg b/buildroot/share/dwin/icons-4/010-ICON_Question.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/010-ICON_Question.jpg rename to buildroot/share/dwin/icons-4/010-ICON_Question.jpg diff --git a/buildroot/share/dwin/icons-3/011-ICON_Alert.jpg b/buildroot/share/dwin/icons-4/011-ICON_Alert.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/011-ICON_Alert.jpg rename to buildroot/share/dwin/icons-4/011-ICON_Alert.jpg diff --git a/buildroot/share/dwin/icons-3/012-ICON_RotateCW.jpg b/buildroot/share/dwin/icons-4/012-ICON_RotateCW.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/012-ICON_RotateCW.jpg rename to buildroot/share/dwin/icons-4/012-ICON_RotateCW.jpg diff --git a/buildroot/share/dwin/icons-3/013-ICON_RotateCCW.jpg b/buildroot/share/dwin/icons-4/013-ICON_RotateCCW.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/013-ICON_RotateCCW.jpg rename to buildroot/share/dwin/icons-4/013-ICON_RotateCCW.jpg diff --git a/buildroot/share/dwin/icons-3/014-ICON_UpArrow.jpg b/buildroot/share/dwin/icons-4/014-ICON_UpArrow.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/014-ICON_UpArrow.jpg rename to buildroot/share/dwin/icons-4/014-ICON_UpArrow.jpg diff --git a/buildroot/share/dwin/icons-3/015-ICON_DownArrow.jpg b/buildroot/share/dwin/icons-4/015-ICON_DownArrow.jpg similarity index 100% rename from buildroot/share/dwin/icons-3/015-ICON_DownArrow.jpg rename to buildroot/share/dwin/icons-4/015-ICON_DownArrow.jpg diff --git a/buildroot/share/dwin/icons-6/000-ICON_LOGO_Creality.jpg b/buildroot/share/dwin/icons-7/000-ICON_LOGO_Creality.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/000-ICON_LOGO_Creality.jpg rename to buildroot/share/dwin/icons-7/000-ICON_LOGO_Creality.jpg diff --git a/buildroot/share/dwin/icons-6/001-ICON_Print_0.jpg b/buildroot/share/dwin/icons-7/001-ICON_Print_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/001-ICON_Print_0.jpg rename to buildroot/share/dwin/icons-7/001-ICON_Print_0.jpg diff --git a/buildroot/share/dwin/icons-6/002-ICON_Print_1.jpg b/buildroot/share/dwin/icons-7/002-ICON_Print_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/002-ICON_Print_1.jpg rename to buildroot/share/dwin/icons-7/002-ICON_Print_1.jpg diff --git a/buildroot/share/dwin/icons-6/003-ICON_Prepare_0.jpg b/buildroot/share/dwin/icons-7/003-ICON_Prepare_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/003-ICON_Prepare_0.jpg rename to buildroot/share/dwin/icons-7/003-ICON_Prepare_0.jpg diff --git a/buildroot/share/dwin/icons-6/004-ICON_Prepare_1.jpg b/buildroot/share/dwin/icons-7/004-ICON_Prepare_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/004-ICON_Prepare_1.jpg rename to buildroot/share/dwin/icons-7/004-ICON_Prepare_1.jpg diff --git a/buildroot/share/dwin/icons-6/005-ICON_Control_0.jpg b/buildroot/share/dwin/icons-7/005-ICON_Control_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/005-ICON_Control_0.jpg rename to buildroot/share/dwin/icons-7/005-ICON_Control_0.jpg diff --git a/buildroot/share/dwin/icons-6/006-ICON_Control_1.jpg b/buildroot/share/dwin/icons-7/006-ICON_Control_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/006-ICON_Control_1.jpg rename to buildroot/share/dwin/icons-7/006-ICON_Control_1.jpg diff --git a/buildroot/share/dwin/icons-6/007-ICON_Leveling_0.jpg b/buildroot/share/dwin/icons-7/007-ICON_Leveling_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/007-ICON_Leveling_0.jpg rename to buildroot/share/dwin/icons-7/007-ICON_Leveling_0.jpg diff --git a/buildroot/share/dwin/icons-6/008-ICON_Leveling_1.jpg b/buildroot/share/dwin/icons-7/008-ICON_Leveling_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/008-ICON_Leveling_1.jpg rename to buildroot/share/dwin/icons-7/008-ICON_Leveling_1.jpg diff --git a/buildroot/share/dwin/icons-6/009-ICON_HotendTemp.jpg b/buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/009-ICON_HotendTemp.jpg rename to buildroot/share/dwin/icons-7/009-ICON_HotendTemp.jpg diff --git a/buildroot/share/dwin/icons-6/010-ICON_BedTemp.jpg b/buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/010-ICON_BedTemp.jpg rename to buildroot/share/dwin/icons-7/010-ICON_BedTemp.jpg diff --git a/buildroot/share/dwin/icons-6/011-ICON_Speed.jpg b/buildroot/share/dwin/icons-7/011-ICON_Speed.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/011-ICON_Speed.jpg rename to buildroot/share/dwin/icons-7/011-ICON_Speed.jpg diff --git a/buildroot/share/dwin/icons-6/012-ICON_Zoffset.jpg b/buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/012-ICON_Zoffset.jpg rename to buildroot/share/dwin/icons-7/012-ICON_Zoffset.jpg diff --git a/buildroot/share/dwin/icons-6/013-ICON_Back.jpg b/buildroot/share/dwin/icons-7/013-ICON_Back.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/013-ICON_Back.jpg rename to buildroot/share/dwin/icons-7/013-ICON_Back.jpg diff --git a/buildroot/share/dwin/icons-6/014-ICON_File.jpg b/buildroot/share/dwin/icons-7/014-ICON_File.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/014-ICON_File.jpg rename to buildroot/share/dwin/icons-7/014-ICON_File.jpg diff --git a/buildroot/share/dwin/icons-6/015-ICON_PrintTime.jpg b/buildroot/share/dwin/icons-7/015-ICON_PrintTime.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/015-ICON_PrintTime.jpg rename to buildroot/share/dwin/icons-7/015-ICON_PrintTime.jpg diff --git a/buildroot/share/dwin/icons-6/016-ICON_RemainTime.jpg b/buildroot/share/dwin/icons-7/016-ICON_RemainTime.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/016-ICON_RemainTime.jpg rename to buildroot/share/dwin/icons-7/016-ICON_RemainTime.jpg diff --git a/buildroot/share/dwin/icons-6/017-ICON_Setup_0.jpg b/buildroot/share/dwin/icons-7/017-ICON_Setup_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/017-ICON_Setup_0.jpg rename to buildroot/share/dwin/icons-7/017-ICON_Setup_0.jpg diff --git a/buildroot/share/dwin/icons-6/018-ICON_Setup_1.jpg b/buildroot/share/dwin/icons-7/018-ICON_Setup_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/018-ICON_Setup_1.jpg rename to buildroot/share/dwin/icons-7/018-ICON_Setup_1.jpg diff --git a/buildroot/share/dwin/icons-6/019-ICON_Pause_0.jpg b/buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/019-ICON_Pause_0.jpg rename to buildroot/share/dwin/icons-7/019-ICON_Pause_0.jpg diff --git a/buildroot/share/dwin/icons-6/020-ICON_Pause_1.jpg b/buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/020-ICON_Pause_1.jpg rename to buildroot/share/dwin/icons-7/020-ICON_Pause_1.jpg diff --git a/buildroot/share/dwin/icons-6/021-ICON_Continue_0.jpg b/buildroot/share/dwin/icons-7/021-ICON_Continue_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/021-ICON_Continue_0.jpg rename to buildroot/share/dwin/icons-7/021-ICON_Continue_0.jpg diff --git a/buildroot/share/dwin/icons-6/022-ICON_Continue_1.jpg b/buildroot/share/dwin/icons-7/022-ICON_Continue_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/022-ICON_Continue_1.jpg rename to buildroot/share/dwin/icons-7/022-ICON_Continue_1.jpg diff --git a/buildroot/share/dwin/icons-6/023-ICON_Stop_0.jpg b/buildroot/share/dwin/icons-7/023-ICON_Stop_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/023-ICON_Stop_0.jpg rename to buildroot/share/dwin/icons-7/023-ICON_Stop_0.jpg diff --git a/buildroot/share/dwin/icons-6/024-ICON_Stop_1.jpg b/buildroot/share/dwin/icons-7/024-ICON_Stop_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/024-ICON_Stop_1.jpg rename to buildroot/share/dwin/icons-7/024-ICON_Stop_1.jpg diff --git a/buildroot/share/dwin/icons-6/025-ICON_Bar.jpg b/buildroot/share/dwin/icons-7/025-ICON_Bar.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/025-ICON_Bar.jpg rename to buildroot/share/dwin/icons-7/025-ICON_Bar.jpg diff --git a/buildroot/share/dwin/icons-6/026-ICON_More.jpg b/buildroot/share/dwin/icons-7/026-ICON_More.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/026-ICON_More.jpg rename to buildroot/share/dwin/icons-7/026-ICON_More.jpg diff --git a/buildroot/share/dwin/icons-6/027-ICON_Axis.jpg b/buildroot/share/dwin/icons-7/027-ICON_Axis.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/027-ICON_Axis.jpg rename to buildroot/share/dwin/icons-7/027-ICON_Axis.jpg diff --git a/buildroot/share/dwin/icons-6/028-ICON_CloseMotor.jpg b/buildroot/share/dwin/icons-7/028-ICON_CloseMotor.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/028-ICON_CloseMotor.jpg rename to buildroot/share/dwin/icons-7/028-ICON_CloseMotor.jpg diff --git a/buildroot/share/dwin/icons-6/029-ICON_Homing.jpg b/buildroot/share/dwin/icons-7/029-ICON_Homing.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/029-ICON_Homing.jpg rename to buildroot/share/dwin/icons-7/029-ICON_Homing.jpg diff --git a/buildroot/share/dwin/icons-6/030-ICON_SetHome.jpg b/buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/030-ICON_SetHome.jpg rename to buildroot/share/dwin/icons-7/030-ICON_SetHome.jpg diff --git a/buildroot/share/dwin/icons-6/031-ICON_PLAPreheat.jpg b/buildroot/share/dwin/icons-7/031-ICON_PLAPreheat.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/031-ICON_PLAPreheat.jpg rename to buildroot/share/dwin/icons-7/031-ICON_PLAPreheat.jpg diff --git a/buildroot/share/dwin/icons-6/032-ICON_ABSPreheat.jpg b/buildroot/share/dwin/icons-7/032-ICON_ABSPreheat.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/032-ICON_ABSPreheat.jpg rename to buildroot/share/dwin/icons-7/032-ICON_ABSPreheat.jpg diff --git a/buildroot/share/dwin/icons-6/033-ICON_Cool.jpg b/buildroot/share/dwin/icons-7/033-ICON_Cool.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/033-ICON_Cool.jpg rename to buildroot/share/dwin/icons-7/033-ICON_Cool.jpg diff --git a/buildroot/share/dwin/icons-6/034-ICON_Language.jpg b/buildroot/share/dwin/icons-7/034-ICON_Language.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/034-ICON_Language.jpg rename to buildroot/share/dwin/icons-7/034-ICON_Language.jpg diff --git a/buildroot/share/dwin/icons-6/035-ICON_MoveX.jpg b/buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/035-ICON_MoveX.jpg rename to buildroot/share/dwin/icons-7/035-ICON_MoveX.jpg diff --git a/buildroot/share/dwin/icons-6/036-ICON_MoveY.jpg b/buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/036-ICON_MoveY.jpg rename to buildroot/share/dwin/icons-7/036-ICON_MoveY.jpg diff --git a/buildroot/share/dwin/icons-6/037-ICON_MoveZ.jpg b/buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/037-ICON_MoveZ.jpg rename to buildroot/share/dwin/icons-7/037-ICON_MoveZ.jpg diff --git a/buildroot/share/dwin/icons-6/038-ICON_Extruder.jpg b/buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/038-ICON_Extruder.jpg rename to buildroot/share/dwin/icons-7/038-ICON_Extruder.jpg diff --git a/buildroot/share/dwin/icons-6/040-ICON_Temperature.jpg b/buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/040-ICON_Temperature.jpg rename to buildroot/share/dwin/icons-7/040-ICON_Temperature.jpg diff --git a/buildroot/share/dwin/icons-6/041-ICON_Motion.jpg b/buildroot/share/dwin/icons-7/041-ICON_Motion.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/041-ICON_Motion.jpg rename to buildroot/share/dwin/icons-7/041-ICON_Motion.jpg diff --git a/buildroot/share/dwin/icons-6/042-ICON_WriteEEPROM.jpg b/buildroot/share/dwin/icons-7/042-ICON_WriteEEPROM.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/042-ICON_WriteEEPROM.jpg rename to buildroot/share/dwin/icons-7/042-ICON_WriteEEPROM.jpg diff --git a/buildroot/share/dwin/icons-6/043-ICON_ReadEEPROM.jpg b/buildroot/share/dwin/icons-7/043-ICON_ReadEEPROM.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/043-ICON_ReadEEPROM.jpg rename to buildroot/share/dwin/icons-7/043-ICON_ReadEEPROM.jpg diff --git a/buildroot/share/dwin/icons-6/044-ICON_ResumeEEPROM.jpg b/buildroot/share/dwin/icons-7/044-ICON_ResetEEPROM.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/044-ICON_ResumeEEPROM.jpg rename to buildroot/share/dwin/icons-7/044-ICON_ResetEEPROM.jpg diff --git a/buildroot/share/dwin/icons-6/045-ICON_Info.jpg b/buildroot/share/dwin/icons-7/045-ICON_Info.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/045-ICON_Info.jpg rename to buildroot/share/dwin/icons-7/045-ICON_Info.jpg diff --git a/buildroot/share/dwin/icons-6/046-ICON_SetEndTemp.jpg b/buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/046-ICON_SetEndTemp.jpg rename to buildroot/share/dwin/icons-7/046-ICON_SetEndTemp.jpg diff --git a/buildroot/share/dwin/icons-6/047-ICON_SetBedTemp.jpg b/buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/047-ICON_SetBedTemp.jpg rename to buildroot/share/dwin/icons-7/047-ICON_SetBedTemp.jpg diff --git a/buildroot/share/dwin/icons-6/048-ICON_FanSpeed.jpg b/buildroot/share/dwin/icons-7/048-ICON_FanSpeed.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/048-ICON_FanSpeed.jpg rename to buildroot/share/dwin/icons-7/048-ICON_FanSpeed.jpg diff --git a/buildroot/share/dwin/icons-6/049-ICON_SetPLAPreheat.jpg b/buildroot/share/dwin/icons-7/049-ICON_SetPLAPreheat.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/049-ICON_SetPLAPreheat.jpg rename to buildroot/share/dwin/icons-7/049-ICON_SetPLAPreheat.jpg diff --git a/buildroot/share/dwin/icons-6/050-ICON_SetABSPreheat.jpg b/buildroot/share/dwin/icons-7/050-ICON_SetABSPreheat.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/050-ICON_SetABSPreheat.jpg rename to buildroot/share/dwin/icons-7/050-ICON_SetABSPreheat.jpg diff --git a/buildroot/share/dwin/icons-6/051-ICON_MaxSpeed.jpg b/buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/051-ICON_MaxSpeed.jpg rename to buildroot/share/dwin/icons-7/051-ICON_MaxSpeed.jpg diff --git a/buildroot/share/dwin/icons-6/052-ICON_MaxAccelerated.jpg b/buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/052-ICON_MaxAccelerated.jpg rename to buildroot/share/dwin/icons-7/052-ICON_MaxAccelerated.jpg diff --git a/buildroot/share/dwin/icons-6/053-ICON_MaxJerk.jpg b/buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/053-ICON_MaxJerk.jpg rename to buildroot/share/dwin/icons-7/053-ICON_MaxJerk.jpg diff --git a/buildroot/share/dwin/icons-6/054-ICON_Step.jpg b/buildroot/share/dwin/icons-7/054-ICON_Step.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/054-ICON_Step.jpg rename to buildroot/share/dwin/icons-7/054-ICON_Step.jpg diff --git a/buildroot/share/dwin/icons-6/055-ICON_PrintSize.jpg b/buildroot/share/dwin/icons-7/055-ICON_PrintSize.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/055-ICON_PrintSize.jpg rename to buildroot/share/dwin/icons-7/055-ICON_PrintSize.jpg diff --git a/buildroot/share/dwin/icons-6/056-ICON_Version.jpg b/buildroot/share/dwin/icons-7/056-ICON_Version.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/056-ICON_Version.jpg rename to buildroot/share/dwin/icons-7/056-ICON_Version.jpg diff --git a/buildroot/share/dwin/icons-6/057-ICON_Contact.jpg b/buildroot/share/dwin/icons-7/057-ICON_Contact.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/057-ICON_Contact.jpg rename to buildroot/share/dwin/icons-7/057-ICON_Contact.jpg diff --git a/buildroot/share/dwin/icons-6/058-ICON_StockConfiguraton.jpg b/buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/058-ICON_StockConfiguraton.jpg rename to buildroot/share/dwin/icons-7/058-ICON_StockConfiguraton.jpg diff --git a/buildroot/share/dwin/icons-6/059-ICON_MaxSpeedX.jpg b/buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/059-ICON_MaxSpeedX.jpg rename to buildroot/share/dwin/icons-7/059-ICON_MaxSpeedX.jpg diff --git a/buildroot/share/dwin/icons-6/060-ICON_MaxSpeedY.jpg b/buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/060-ICON_MaxSpeedY.jpg rename to buildroot/share/dwin/icons-7/060-ICON_MaxSpeedY.jpg diff --git a/buildroot/share/dwin/icons-6/061-ICON_MaxSpeedZ.jpg b/buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/061-ICON_MaxSpeedZ.jpg rename to buildroot/share/dwin/icons-7/061-ICON_MaxSpeedZ.jpg diff --git a/buildroot/share/dwin/icons-6/062-ICON_MaxSpeedE.jpg b/buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/062-ICON_MaxSpeedE.jpg rename to buildroot/share/dwin/icons-7/062-ICON_MaxSpeedE.jpg diff --git a/buildroot/share/dwin/icons-6/063-ICON_MaxAccX.jpg b/buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/063-ICON_MaxAccX.jpg rename to buildroot/share/dwin/icons-7/063-ICON_MaxAccX.jpg diff --git a/buildroot/share/dwin/icons-6/064-ICON_MaxAccY.jpg b/buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/064-ICON_MaxAccY.jpg rename to buildroot/share/dwin/icons-7/064-ICON_MaxAccY.jpg diff --git a/buildroot/share/dwin/icons-6/065-ICON_MaxAccZ.jpg b/buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/065-ICON_MaxAccZ.jpg rename to buildroot/share/dwin/icons-7/065-ICON_MaxAccZ.jpg diff --git a/buildroot/share/dwin/icons-6/066-ICON_MaxAccE.jpg b/buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/066-ICON_MaxAccE.jpg rename to buildroot/share/dwin/icons-7/066-ICON_MaxAccE.jpg diff --git a/buildroot/share/dwin/icons-6/067-ICON_MaxSpeedJerkX.jpg b/buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/067-ICON_MaxSpeedJerkX.jpg rename to buildroot/share/dwin/icons-7/067-ICON_MaxSpeedJerkX.jpg diff --git a/buildroot/share/dwin/icons-6/068-ICON_MaxSpeedJerkY.jpg b/buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/068-ICON_MaxSpeedJerkY.jpg rename to buildroot/share/dwin/icons-7/068-ICON_MaxSpeedJerkY.jpg diff --git a/buildroot/share/dwin/icons-6/069-ICON_MaxSpeedJerkZ.jpg b/buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/069-ICON_MaxSpeedJerkZ.jpg rename to buildroot/share/dwin/icons-7/069-ICON_MaxSpeedJerkZ.jpg diff --git a/buildroot/share/dwin/icons-6/070-ICON_MaxSpeedJerkE.jpg b/buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/070-ICON_MaxSpeedJerkE.jpg rename to buildroot/share/dwin/icons-7/070-ICON_MaxSpeedJerkE.jpg diff --git a/buildroot/share/dwin/icons-6/071-ICON_StepX.jpg b/buildroot/share/dwin/icons-7/071-ICON_StepX.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/071-ICON_StepX.jpg rename to buildroot/share/dwin/icons-7/071-ICON_StepX.jpg diff --git a/buildroot/share/dwin/icons-6/072-ICON_StepY.jpg b/buildroot/share/dwin/icons-7/072-ICON_StepY.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/072-ICON_StepY.jpg rename to buildroot/share/dwin/icons-7/072-ICON_StepY.jpg diff --git a/buildroot/share/dwin/icons-6/073-ICON_StepZ.jpg b/buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/073-ICON_StepZ.jpg rename to buildroot/share/dwin/icons-7/073-ICON_StepZ.jpg diff --git a/buildroot/share/dwin/icons-6/074-ICON_StepE.jpg b/buildroot/share/dwin/icons-7/074-ICON_StepE.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/074-ICON_StepE.jpg rename to buildroot/share/dwin/icons-7/074-ICON_StepE.jpg diff --git a/buildroot/share/dwin/icons-6/075-ICON_Setspeed.jpg b/buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/075-ICON_Setspeed.jpg rename to buildroot/share/dwin/icons-7/075-ICON_Setspeed.jpg diff --git a/buildroot/share/dwin/icons-6/076-ICON_SetZOffset.jpg b/buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/076-ICON_SetZOffset.jpg rename to buildroot/share/dwin/icons-7/076-ICON_SetZOffset.jpg diff --git a/buildroot/share/dwin/icons-6/077-ICON_Rectangle.jpg b/buildroot/share/dwin/icons-7/077-ICON_Rectangle.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/077-ICON_Rectangle.jpg rename to buildroot/share/dwin/icons-7/077-ICON_Rectangle.jpg diff --git a/buildroot/share/dwin/icons-6/078-ICON_BLTouch.jpg b/buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/078-ICON_BLTouch.jpg rename to buildroot/share/dwin/icons-7/078-ICON_BLTouch.jpg diff --git a/buildroot/share/dwin/icons-6/079-ICON_TempTooLow.jpg b/buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/079-ICON_TempTooLow.jpg rename to buildroot/share/dwin/icons-7/079-ICON_TempTooLow.jpg diff --git a/buildroot/share/dwin/icons-6/080-ICON_AutoLeveling.jpg b/buildroot/share/dwin/icons-7/080-ICON_AutoLeveling.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/080-ICON_AutoLeveling.jpg rename to buildroot/share/dwin/icons-7/080-ICON_AutoLeveling.jpg diff --git a/buildroot/share/dwin/icons-6/081-ICON_TempTooHigh.jpg b/buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/081-ICON_TempTooHigh.jpg rename to buildroot/share/dwin/icons-7/081-ICON_TempTooHigh.jpg diff --git a/buildroot/share/dwin/icons-6/082-ICON_NoTips_C.jpg b/buildroot/share/dwin/icons-7/082-ICON_NoTips_C.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/082-ICON_NoTips_C.jpg rename to buildroot/share/dwin/icons-7/082-ICON_NoTips_C.jpg diff --git a/buildroot/share/dwin/icons-6/083-ICON_NoTips_E.jpg b/buildroot/share/dwin/icons-7/083-ICON_NoTips_E.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/083-ICON_NoTips_E.jpg rename to buildroot/share/dwin/icons-7/083-ICON_NoTips_E.jpg diff --git a/buildroot/share/dwin/icons-6/084-ICON_Continue_C.jpg b/buildroot/share/dwin/icons-7/084-ICON_Continue_C.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/084-ICON_Continue_C.jpg rename to buildroot/share/dwin/icons-7/084-ICON_Continue_C.jpg diff --git a/buildroot/share/dwin/icons-6/085-ICON_Continue_E.jpg b/buildroot/share/dwin/icons-7/085-ICON_Continue_E.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/085-ICON_Continue_E.jpg rename to buildroot/share/dwin/icons-7/085-ICON_Continue_E.jpg diff --git a/buildroot/share/dwin/icons-6/086-ICON_Cancel_C.jpg b/buildroot/share/dwin/icons-7/086-ICON_Cancel_C.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/086-ICON_Cancel_C.jpg rename to buildroot/share/dwin/icons-7/086-ICON_Cancel_C.jpg diff --git a/buildroot/share/dwin/icons-6/087-ICON_Cancel_E.jpg b/buildroot/share/dwin/icons-7/087-ICON_Cancel_E.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/087-ICON_Cancel_E.jpg rename to buildroot/share/dwin/icons-7/087-ICON_Cancel_E.jpg diff --git a/buildroot/share/dwin/icons-6/088-ICON_Confirm_C.jpg b/buildroot/share/dwin/icons-7/088-ICON_Confirm_C.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/088-ICON_Confirm_C.jpg rename to buildroot/share/dwin/icons-7/088-ICON_Confirm_C.jpg diff --git a/buildroot/share/dwin/icons-6/089-ICON_Confirm_E.jpg b/buildroot/share/dwin/icons-7/089-ICON_Confirm_E.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/089-ICON_Confirm_E.jpg rename to buildroot/share/dwin/icons-7/089-ICON_Confirm_E.jpg diff --git a/buildroot/share/dwin/icons-6/090-ICON_Info_0.jpg b/buildroot/share/dwin/icons-7/090-ICON_Info_0.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/090-ICON_Info_0.jpg rename to buildroot/share/dwin/icons-7/090-ICON_Info_0.jpg diff --git a/buildroot/share/dwin/icons-6/091-ICON_Info_1.jpg b/buildroot/share/dwin/icons-7/091-ICON_Info_1.jpg similarity index 100% rename from buildroot/share/dwin/icons-6/091-ICON_Info_1.jpg rename to buildroot/share/dwin/icons-7/091-ICON_Info_1.jpg diff --git a/buildroot/share/dwin/make_jpgs.sh b/buildroot/share/dwin/make_jpgs.sh index 0acace7388df..c114757a0622 100755 --- a/buildroot/share/dwin/make_jpgs.sh +++ b/buildroot/share/dwin/make_jpgs.sh @@ -1,31 +1,31 @@ #!/usr/bin/env bash -mkdir -p icons-3 +mkdir -p icons-4 -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/hotend_off.svg ./icons-3/001-ICON_HotendOff.jpg -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/hotend_on.svg ./icons-3/002-ICON_HotendOn.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/hotend_off.svg ./icons-4/001-ICON_HotendOff.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/hotend_on.svg ./icons-4/002-ICON_HotendOn.jpg -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_off.svg ./icons-3/003-ICON_BedOff.jpg -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_on.svg ./icons-3/004-ICON_BedOn.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_off.svg ./icons-4/003-ICON_BedOff.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_on.svg ./icons-4/004-ICON_BedOn.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/fan.svg ./icons-3/005-ICON_Fan0.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 22.5 ./icons-svg/fan.svg ./icons-3/006-ICON_Fan1.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 45 ./icons-svg/fan.svg ./icons-3/007-ICON_Fan2.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 67.5 ./icons-svg/fan.svg ./icons-3/008-ICON_Fan3.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/fan.svg ./icons-4/005-ICON_Fan0.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 22.5 ./icons-svg/fan.svg ./icons-4/006-ICON_Fan1.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 45 ./icons-svg/fan.svg ./icons-4/007-ICON_Fan2.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 -distort SRT 67.5 ./icons-svg/fan.svg ./icons-4/008-ICON_Fan3.jpg -convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/halted.svg ./icons-3/009-ICON_Halted.jpg -convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/question.svg ./icons-3/010-ICON_Question.jpg -convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/alert.svg ./icons-3/011-ICON_Alert.jpg +convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/halted.svg ./icons-4/009-ICON_Halted.jpg +convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/question.svg ./icons-4/010-ICON_Question.jpg +convert -size 96x96 -background "#333e44" -quality 100 -sampling-factor 4:4:4 ./icons-svg/alert.svg ./icons-4/011-ICON_Alert.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/rotate_cw.svg ./icons-3/012-ICON_RotateCW.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/rotate_ccw.svg ./icons-3/013-ICON_RotateCCW.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/up_arrow.svg ./icons-3/014-ICON_UpArrow.jpg -convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/down_arrow.svg ./icons-3/015-ICON_DownArrow.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/rotate_cw.svg ./icons-4/012-ICON_RotateCW.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/rotate_ccw.svg ./icons-4/013-ICON_RotateCCW.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/up_arrow.svg ./icons-4/014-ICON_UpArrow.jpg +convert -size 48x48 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/down_arrow.svg ./icons-4/015-ICON_DownArrow.jpg -convert -size 48x8 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bedline.svg ./icons-3/016-ICON_Bedline.jpg +convert -size 48x8 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bedline.svg ./icons-4/016-ICON_Bedline.jpg -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_leveled_off.svg ./icons-3/017-ICON_BedLeveledOff.jpg -convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_leveled_on.svg ./icons-3/018-ICON_BedLeveledOn.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_leveled_off.svg ./icons-4/017-ICON_BedLeveledOff.jpg +convert -size 48x36 -background "#080808" -quality 100 -sampling-factor 4:4:4 ./icons-svg/bed_leveled_on.svg ./icons-4/018-ICON_BedLeveledOn.jpg -rm 3.ICO -./bin/makeIco.py icons-3 3.ICO +rm -f 4.ICO +./bin/makeIco.py icons-4 4.ICO From b44e68e2ab5be3804d67eb646ebd567c2ffaee84 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 25 Dec 2023 00:21:58 +0000 Subject: [PATCH 30/73] [cron] Bump distribution date (2023-12-25) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a2f0cc81abaa..a1a04872f69e 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-24" +//#define STRING_DISTRIBUTION_DATE "2023-12-25" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 3fd20c352542..8be02e09ae85 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-24" + #define STRING_DISTRIBUTION_DATE "2023-12-25" #endif /** From d9a388bab86381843691af939dd023c6d534cf50 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Dec 2023 21:31:54 -0600 Subject: [PATCH 31/73] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20some=20serial=20char?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/mstring.h | 2 +- Marlin/src/feature/runout.h | 2 +- Marlin/src/module/temperature.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/core/mstring.h b/Marlin/src/core/mstring.h index 0ea53fef1b48..7662f0f1a6ec 100644 --- a/Marlin/src/core/mstring.h +++ b/Marlin/src/core/mstring.h @@ -98,7 +98,7 @@ class MString { void debug(FSTR_P const f) { #if ENABLED(MSTRING_DEBUG) - SERIAL_ECHOLN(f, ':', uintptr_t(str), ' ', length(), ' ', str); + SERIAL_ECHOLN(f, AS_CHAR(':'), uintptr_t(str), AS_CHAR(' '), length(), AS_CHAR(' '), str); #endif } diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 847413d25ad6..43c034020ad3 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -159,7 +159,7 @@ class TFilamentMonitor : public FilamentMonitorBase { if (ran_out) { #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) SERIAL_ECHOPGM("Runout Sensors: "); - for (uint8_t i = 0; i < 8; ++i) SERIAL_ECHO('0' + char(runout_flags[i])); + for (uint8_t i = 0; i < 8; ++i) SERIAL_CHAR('0' + char(runout_flags[i])); SERIAL_ECHOLNPGM(" -> ", extruder, " RUN OUT"); #endif diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index afde7d3b3497..d3aa37c6abd6 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1487,7 +1487,7 @@ void Temperature::_temp_error( OPTCODE(HAS_TEMP_CHAMBER, case H_CHAMBER: SERIAL_ECHOPGM(STR_HEATER_CHAMBER); break) OPTCODE(HAS_TEMP_BED, case H_BED: SERIAL_ECHOPGM(STR_HEATER_BED); break) default: - if (real_heater_id >= 0) SERIAL_ECHO('E', real_heater_id); + if (real_heater_id >= 0) SERIAL_ECHO(AS_CHAR('E'), real_heater_id); } #if ENABLED(ERR_INCLUDE_TEMP) SERIAL_ECHOLNPGM(STR_DETECTED_TEMP_B, deg, STR_DETECTED_TEMP_E); From 89fdfcfaf9df44b0782d3ef900aa28531d777058 Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Sun, 24 Dec 2023 19:37:20 -0800 Subject: [PATCH 32/73] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20MARKFORGED=5FINVERSE?= =?UTF-8?q?=20typos=20(#26558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #26516 --- Marlin/src/module/stepper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 8dda2eec4001..9c1668619ba9 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -3361,12 +3361,12 @@ void Stepper::endstop_triggered(const AxisEnum axis) { ) * double(0.5) #elif ENABLED(MARKFORGED_XY) axis == CORE_AXIS_1 - ? count_position[CORE_AXIS_1] ENABLED(MARKFORGED_INVERSE, +, -) count_position[CORE_AXIS_2] + ? count_position[CORE_AXIS_1] TERN(MARKFORGED_INVERSE, +, -) count_position[CORE_AXIS_2] : count_position[CORE_AXIS_2] #elif ENABLED(MARKFORGED_YX) axis == CORE_AXIS_1 ? count_position[CORE_AXIS_1] - : count_position[CORE_AXIS_2] ENABLED(MARKFORGED_INVERSE, +, -) count_position[CORE_AXIS_1] + : count_position[CORE_AXIS_2] TERN(MARKFORGED_INVERSE, +, -) count_position[CORE_AXIS_1] #else // !IS_CORE count_position[axis] #endif From bb557e5195a6177bc7386fce0176274aede60b64 Mon Sep 17 00:00:00 2001 From: Dennis <16547088+soligen2010@users.noreply.github.com> Date: Sun, 24 Dec 2023 22:40:20 -0500 Subject: [PATCH 33/73] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20string=20buffer=20wa?= =?UTF-8?q?rning=20(#26550)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/core/mstring.h | 2 +- Marlin/src/core/types.h | 4 +-- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 6 ++-- .../lcd/dogm/status_screen_lite_ST7920.cpp | 31 +++++++++---------- Marlin/src/lcd/marlinui.cpp | 10 ++++-- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Marlin/src/core/mstring.h b/Marlin/src/core/mstring.h index 7662f0f1a6ec..819c1ab74f6f 100644 --- a/Marlin/src/core/mstring.h +++ b/Marlin/src/core/mstring.h @@ -136,7 +136,7 @@ class MString { MString& setn(FSTR_P const f, int len) { return setn_P(FTOP(f), len); } // set(repchr_t('-', 10)) - MString& set(const repchr_t &s) { int c = _MIN(s.count, SIZE); memset(str, s.asc, c); str[c] = '\0'; debug(F("")); return *this; } + MString& set(const repchr_t &s) { int c = _MIN(s.count, SIZE); if (c >= 0) { if (c > 0) memset(str, s.asc, c); str[c] = '\0'; } debug(F("repchr_t")); return *this; } // set(spaces_t(10)) MString& set(const spaces_t &s) { repchr_t r(' ', s.count); return set(r); } diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index bcbf2f07aa45..74a60fa4087b 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -309,10 +309,10 @@ typedef struct WFloat { float value; char width; char prec; typedef struct PFloat { float value; char prec; PFloat(float v, char p) : value(v), prec(p) {} } p_float_t; -typedef struct RepChr { char asc; uint8_t count; +typedef struct RepChr { char asc; int8_t count; RepChr(char a, uint8_t c) : asc(a), count(c) {} } repchr_t; -typedef struct Spaces { uint8_t count; +typedef struct Spaces { int8_t count; Spaces(uint8_t c) : count(c) {} } spaces_t; diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index ad9e38266162..e294d9c3df9b 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -479,16 +479,16 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const // Prepare strings for progress display #if ANY(HAS_EXTRA_PROGRESS, HAS_PRINT_PROGRESS) static MarlinUI::progress_t progress = 0; - static MString<12> progressString; + static MString<13> progressString; #endif #if HAS_EXTRA_PROGRESS #if HAS_TIME_DISPLAY static void prepare_time_string(const duration_t &time, char prefix) { - char str[10]; + char str[13]; const uint8_t time_len = time.toDigital(str, time.value >= 60*60*24L); // 5 to 8 chars - progressString.set(prefix, ':', spaces_t(10 - time_len), str); // 2 to 5 spaces + progressString.set(prefix, ':', spaces_t(10 - time_len), str); // 2 to 5 spaces } #endif #if ENABLED(SHOW_PROGRESS_PERCENT) diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 2039d9963581..4eb031e5385a 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -662,39 +662,36 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { // Process progress strings #if HAS_PRINT_PROGRESS - static char screenstr[8]; + static MString<8> screenstr; #if HAS_TIME_DISPLAY char * ST7920_Lite_Status_Screen::prepare_time_string(const duration_t &time, char prefix) { - static char str[6]; - memset(&screenstr, ' ', 8); // fill with spaces to avoid artifacts, not doing right-justification to save cycles - screenstr[0] = prefix; - TERN_(HOTENDS == 1, screenstr[1] = 0x07;) // add bullet • separator when there is space - int str_length = time.toDigital(str); - memcpy(&screenstr[TERN(HOTENDS == 1, 2, 1)], str, str_length); //memcpy because we can't have terminator - return screenstr; + static char time_str[6]; + (void)time.toDigital(time_str); // Up to 5 chars + screenstr = prefix; + if (HOTENDS == 1) screenstr += char(0x07); // Add bullet • separator when there is space + screenstr += time_str; + screenstr += Spaces(3); + return &screenstr; } #endif void ST7920_Lite_Status_Screen::draw_progress_string(uint8_t addr, const char *str) { set_ddram_address(addr); begin_data(); - write_str(str, TERN(HOTENDS == 1, 8, 6)); + write_str(str, HOTENDS == 1 ? 8 : 6); } - #define PPOS (DDRAM_LINE_3 + TERN(HOTENDS == 1, 4, 5)) // progress string position, in 16-bit words + constexpr uint8_t PPOS = (DDRAM_LINE_3 + (HOTENDS == 1 ? 4 : 5)); // Progress string position, in 16-bit words #if ENABLED(SHOW_PROGRESS_PERCENT) void MarlinUI::drawPercent() { lightUI.drawPercent(); } void ST7920_Lite_Status_Screen::drawPercent() { - #define LSHIFT TERN(HOTENDS == 1, 0, 1) const uint8_t progress = ui.get_progress_percent(); - memset(&screenstr, ' ', 8); // fill with spaces to avoid artifacts - if (progress){ - memcpy(&screenstr[2 - LSHIFT], \ - TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui8tostr3rj(progress)), \ - TERN(PRINT_PROGRESS_SHOW_DECIMALS, 4, 3)); - screenstr[(TERN(PRINT_PROGRESS_SHOW_DECIMALS, 6, 5) - LSHIFT)] = '%'; + if (progress) { + screenstr += Spaces(1 + (HOTENDS == 1)); + screenstr += TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(ui.get_progress_permyriad()), ui8tostr3rj(progress)); + screenstr += "% "; draw_progress_string(PPOS, screenstr); } } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 60fb298dfcde..4c5dec47616c 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1035,9 +1035,13 @@ void MarlinUI::init() { uint8_t abs_diff = ABS(encoderDiff); #if ENCODER_PULSES_PER_STEP > 1 - static int8_t lastEncoderDiff; - TERN_(HAS_TOUCH_SLEEP, if (lastEncoderDiff != encoderDiff) wakeup_screen()); - lastEncoderDiff = encoderDiff; + #if HAS_TOUCH_SLEEP + static int8_t lastEncoderDiff; + if (lastEncoderDiff != encoderDiff) { + wakeup_screen(); + lastEncoderDiff = encoderDiff; + } + #endif #endif const bool encoderPastThreshold = (abs_diff >= epps); From dbf81f40de4b47b2374c6f7f229e01b504e4eb7f Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 26 Dec 2023 00:20:41 +0000 Subject: [PATCH 34/73] [cron] Bump distribution date (2023-12-26) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index a1a04872f69e..2d207e80dc8c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-25" +//#define STRING_DISTRIBUTION_DATE "2023-12-26" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 8be02e09ae85..7f25f5fe3ad5 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-25" + #define STRING_DISTRIBUTION_DATE "2023-12-26" #endif /** From 76030239283577ba1baca705e07182bb34345b64 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Dec 2023 20:58:38 -0600 Subject: [PATCH 35/73] =?UTF-8?q?=F0=9F=94=A8=20Apply=20signature.py=20hel?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../share/PlatformIO/scripts/signature.py | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/signature.py b/buildroot/share/PlatformIO/scripts/signature.py index bfe7ab4a7394..2d024c366287 100755 --- a/buildroot/share/PlatformIO/scripts/signature.py +++ b/buildroot/share/PlatformIO/scripts/signature.py @@ -8,32 +8,32 @@ from datetime import datetime from pathlib import Path -''' -Return all enabled #define items from a given C header file in a dictionary. -A "#define" in a multi-line comment could produce a false positive if it's not -preceded by a non-space character (like * in a multi-line comment). - -Output: -Each entry is a dictionary with a 'name' and a 'section' key. We end up with: - { MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... } - -The 'name' key might get dropped as redundant, but it's useful for debugging. - -Because the option names are the keys, only the last occurrence is retained. -Use the Schema class for a more complete list of options, soon with full parsing. - -This list is used to filter what is actually a config-defined option versus -defines from elsewhere. - -While the Schema class parses the configurations on its own, this script will -get the preprocessor output and get the intersection of the enabled options from -our crude scraping method and the actual compiler output. -We end up with the actual configured state, -better than what the config files say. You can then use the -a decent reflection of all enabled options that (probably) came from -resulting config.ini to produce more exact configuration files. -''' def enabled_defines(filepath): + ''' + Return all enabled #define items from a given C header file in a dictionary. + A "#define" in a multi-line comment could produce a false positive if it's not + preceded by a non-space character (like * in a multi-line comment). + + Output: + Each entry is a dictionary with a 'name' and a 'section' key. We end up with: + { MOTHERBOARD: { name: "MOTHERBOARD", section: "hardware" }, ... } + + The 'name' key might get dropped as redundant, but it's useful for debugging. + + Because the option names are the keys, only the last occurrence is retained. + Use the Schema class for a more complete list of options, soon with full parsing. + + This list is used to filter what is actually a config-defined option versus + defines from elsewhere. + + While the Schema class parses the configurations on its own, this script will + get the preprocessor output and get the intersection of the enabled options from + our crude scraping method and the actual compiler output. + We end up with the actual configured state, + better than what the config files say. You can then use the + a decent reflection of all enabled options that (probably) came from + resulting config.ini to produce more exact configuration files. + ''' outdict = {} section = "user" spatt = re.compile(r".*@section +([-a-zA-Z0-9_\s]+)$") # must match @section ... @@ -74,12 +74,12 @@ def compress_file(filepath, storedname, outpath): with zipfile.ZipFile(outpath, 'w', compression=zipfile.ZIP_BZIP2, compresslevel=9) as zipf: zipf.write(filepath, arcname=storedname, compress_type=zipfile.ZIP_BZIP2, compresslevel=9) -''' -Compute the build signature by extracting all configuration settings and -building a unique reversible signature that can be included in the binary. -The signature can be reversed to get a 1:1 equivalent configuration file. -''' def compute_build_signature(env): + ''' + Compute the build signature by extracting all configuration settings and + building a unique reversible signature that can be included in the binary. + The signature can be reversed to get a 1:1 equivalent configuration file. + ''' if 'BUILD_SIGNATURE' in env: return env.Append(BUILD_SIGNATURE=1) From 06b9e400423c0e03ff1abac0c294661e44f5b93f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:43:06 -0800 Subject: [PATCH 36/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Use?= =?UTF-8?q?=20MAX31865=20flag=20(#26574)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h | 6 +++--- Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_PRO_V1_common.h | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h index dd8812fe2af9..72a6db73354e 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_OCTOPUS_PRO_V1_0.h @@ -26,15 +26,15 @@ // // Temperature Sensors // -#if TEMP_SENSOR_0 == -5 +#define TEMP_0_PIN PF4 // TH0 + +#if TEMP_SENSOR_0_IS_MAX31865 #define TEMP_0_CS_PIN PF8 // Max31865 CS #define TEMP_0_SCK_PIN PA5 #define TEMP_0_MISO_PIN PA6 #define TEMP_0_MOSI_PIN PA7 #define SOFTWARE_SPI // Max31865 and LCD SD share a set of SPIs, Set SD to softwareSPI for Max31865 #define FORCE_SOFT_SPI -#else - #define TEMP_0_PIN PF4 // TH0 #endif #if !defined(Z_MIN_PROBE_PIN) && DISABLED(BLTOUCH) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_PRO_V1_common.h b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_PRO_V1_common.h index 82216dec170f..43b3d6852237 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_PRO_V1_common.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_OCTOPUS_PRO_V1_common.h @@ -214,19 +214,18 @@ // Temperature Sensors // #define TEMP_BED_PIN PF3 // TB +#define TEMP_0_PIN PF4 // TH0 #define TEMP_1_PIN PF5 // TH1 #define TEMP_2_PIN PF6 // TH2 #define TEMP_3_PIN PF7 // TH3 -#if TEMP_SENSOR_0 == -5 +#if TEMP_SENSOR_0_IS_MAX31865 #define TEMP_0_CS_PIN PF8 // Max31865 CS #define TEMP_0_SCK_PIN PA5 #define TEMP_0_MISO_PIN PA6 #define TEMP_0_MOSI_PIN PA7 #define SOFTWARE_SPI // Max31865 and LCD SD share a set of SPIs, Set SD to softwareSPI for Max31865 #define FORCE_SOFT_SPI -#else - #define TEMP_0_PIN PF4 // TH0 #endif // From c485f513d70acc838b7a1554c955fdaf5ef3df7f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:45:42 -0800 Subject: [PATCH 37/73] =?UTF-8?q?=E2=9C=A8=20BigTreeTech=20Kraken=20V1.0?= =?UTF-8?q?=20(STM32H723ZG)=20(#26565)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bigtreetech <38851044+bigtreetech@users.noreply.github.com> --- Marlin/src/core/boards.h | 1 + Marlin/src/pins/pins.h | 2 + .../src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h | 674 +++++++++++++++++ .../PlatformIO/boards/marlin_STM32H723ZG.json | 61 ++ .../variants/MARLIN_H723ZG/PeripheralPins.c | 688 ++++++++++++++++++ .../variants/MARLIN_H723ZG/PinNamesVar.h | 117 +++ .../variants/MARLIN_H723ZG/ldscript.ld | 174 +++++ .../variant_MARLIN_STM32H723ZG.cpp | 317 ++++++++ .../variant_MARLIN_STM32H723ZG.h | 309 ++++++++ ini/stm32h7.ini | 7 + 10 files changed, 2350 insertions(+) create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h create mode 100644 buildroot/share/PlatformIO/boards/marlin_STM32H723ZG.json create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PeripheralPins.c create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PinNamesVar.h create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723ZG/ldscript.ld create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.cpp create mode 100644 buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 49570241e7fe..5730ecbd4f90 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -482,6 +482,7 @@ #define BOARD_BTT_OCTOPUS_MAX_EZ_V1_0 6008 // BigTreeTech Octopus Max EZ V1.0 (STM32H723ZE) #define BOARD_BTT_OCTOPUS_PRO_V1_0_1 6009 // BigTreeTech Octopus Pro v1.0.1 (STM32H723ZE) #define BOARD_BTT_OCTOPUS_PRO_V1_1 6010 // BigTreeTech Octopus Pro v1.1 (STM32H723ZE) +#define BOARD_BTT_KRAKEN_V1_0 6011 // BigTreeTech Kraken v1.0 (STM32H723ZG) // // Espressif ESP32 WiFi diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 0728f5899498..b881c849ebd8 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -841,6 +841,8 @@ #include "stm32h7/pins_BTT_OCTOPUS_PRO_V1_0_1.h" // STM32H7 env:STM32H723ZE_btt #elif MB(BTT_OCTOPUS_PRO_V1_1) #include "stm32h7/pins_BTT_OCTOPUS_PRO_V1_1.h" // STM32H7 env:STM32H723ZE_btt +#elif MB(BTT_KRAKEN_V1_0) + #include "stm32h7/pins_BTT_KRAKEN_V1_0.h" // STM32H7 env:STM32H723ZG_btt #elif MB(TEENSY41) #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 #elif MB(T41U5XBB) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h b/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h new file mode 100644 index 000000000000..ad24d902f92e --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_KRAKEN_V1_0.h @@ -0,0 +1,674 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +#include "env_validate.h" + +#define BOARD_INFO_NAME "BTT Kraken V1.0" +#define BOARD_WEBSITE_URL "github.com/bigtreetech/BIGTREETECH-Kraken" + +#define USES_DIAG_JUMPERS + +// +// EEPROM +// +#if ANY(NO_EEPROM_SELECTED, FLASH_EEPROM_EMULATION) + #undef NO_EEPROM_SELECTED + #ifndef FLASH_EEPROM_EMULATION + #define FLASH_EEPROM_EMULATION + #endif + #define EEPROM_PAGE_SIZE (0x800UL) // 2K + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE +#endif + +// Avoid conflict with TIMER_TONE +#define STEP_TIMER 8 + +// +// Servos +// +#define SERVO0_PIN PE9 // PROBE +#define SERVO1_PIN PE7 // MOTOR + +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PC15 // MIN1 +#define Y_DIAG_PIN PF0 // MIN2 +#define Z_DIAG_PIN PF1 // MIN3 +#define E0_DIAG_PIN PF2 // MIN4 +#define E1_DIAG_PIN PF3 // MIN5 +#define E2_DIAG_PIN PF4 // MIN6 +#define E3_DIAG_PIN PF10 // MIN7 +#define E4_DIAG_PIN PC0 // MIN8 + +// +// Limit Switches +// +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN + #if X_HOME_TO_MIN + #define X_MAX_PIN E0_DIAG_PIN // MIN4 + #else + #define X_MIN_PIN E0_DIAG_PIN // MIN4 + #endif +#elif NEEDS_X_MINMAX + #ifndef X_MIN_PIN + #define X_MIN_PIN X_DIAG_PIN // MIN1 + #endif + #ifndef X_MAX_PIN + #define X_MAX_PIN E0_DIAG_PIN // MIN4 + #endif +#else + #define X_STOP_PIN X_DIAG_PIN // MIN1 +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN + #if Y_HOME_TO_MIN + #define Y_MAX_PIN E1_DIAG_PIN // MIN5 + #else + #define Y_MIN_PIN E1_DIAG_PIN // MIN5 + #endif +#elif NEEDS_Y_MINMAX + #ifndef Y_MIN_PIN + #define Y_MIN_PIN Y_DIAG_PIN // MIN2 + #endif + #ifndef Y_MAX_PIN + #define Y_MAX_PIN E1_DIAG_PIN // MIN5 + #endif +#else + #define Y_STOP_PIN Y_DIAG_PIN // MIN2 +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN + #if Z_HOME_TO_MIN + #define Z_MAX_PIN E2_DIAG_PIN // MIN6 + #else + #define Z_MIN_PIN E2_DIAG_PIN // MIN6 + #endif +#elif NEEDS_Z_MINMAX + #ifndef Z_MIN_PIN + #define Z_MIN_PIN Z_DIAG_PIN // MIN3 + #endif + #ifndef Z_MAX_PIN + #define Z_MAX_PIN E2_DIAG_PIN // MIN6 + #endif +#else + #define Z_STOP_PIN Z_DIAG_PIN // MIN3 +#endif + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PG1 // PROBE (BLTouch, MicroProbe, etc.) + //#define Z_MIN_PROBE_PIN PD11 // IND-DET (Inductive probe) +#endif + +// +// Probe enable +// +#if ENABLED(PROBE_ENABLE_DISABLE) && !defined(PROBE_ENABLE_PIN) + #define PROBE_ENABLE_PIN SERVO0_PIN +#endif + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN E0_DIAG_PIN // MIN4 +#define FIL_RUNOUT2_PIN E1_DIAG_PIN // MIN5 +#define FIL_RUNOUT3_PIN E2_DIAG_PIN // MIN6 +#define FIL_RUNOUT4_PIN E3_DIAG_PIN // MIN7 +#define FIL_RUNOUT5_PIN E4_DIAG_PIN // MIN8 + +// +// Steppers +// +#define X_STEP_PIN PC14 // S1 (Motor 1) +#define X_DIR_PIN PC13 +#define X_ENABLE_PIN PE6 +#ifndef X_CS_PIN + #define X_CS_PIN PD6 +#endif + +#define Y_STEP_PIN PE5 // S2 (Motor 2) +#define Y_DIR_PIN PE4 +#define Y_ENABLE_PIN PE3 +#ifndef Y_CS_PIN + #define Y_CS_PIN PD5 +#endif + +#define Z_STEP_PIN PE2 // S3 (Motor 3) +#define Z_DIR_PIN PE1 +#define Z_ENABLE_PIN PE0 +#ifndef Z_CS_PIN + #define Z_CS_PIN PD4 +#endif + +#define E0_STEP_PIN PB9 // S4 (Motor 4) +#define E0_DIR_PIN PB8 +#define E0_ENABLE_PIN PB7 +#ifndef E0_CS_PIN + #define E0_CS_PIN PD3 +#endif + +#define E1_STEP_PIN PG9 // S5 (Motor 5) +#define E1_DIR_PIN PG10 +#define E1_ENABLE_PIN PG13 +#ifndef E1_CS_PIN + #define E1_CS_PIN PD2 +#endif + +#define E2_STEP_PIN PG11 // S6 (Motor 6) +#define E2_DIR_PIN PD7 +#define E2_ENABLE_PIN PG12 +#ifndef E2_CS_PIN + #define E2_CS_PIN PA15 +#endif + +#define E3_STEP_PIN PB4 // S7 (Motor 7) +#define E3_DIR_PIN PB3 +#define E3_ENABLE_PIN PB5 +#ifndef E3_CS_PIN + #define E3_CS_PIN PA9 +#endif + +#define E4_STEP_PIN PG15 // S8 (Motor 8) +#define E4_DIR_PIN PB6 +#define E4_ENABLE_PIN PG14 +#ifndef E4_CS_PIN + #define E4_CS_PIN PA10 +#endif + +// +// Integrated TMC2160 driver defaults +// +#if (HAS_X_AXIS && !AXIS_DRIVER_TYPE_X(TMC2160)) \ + || (HAS_Y_AXIS && !AXIS_DRIVER_TYPE_Y(TMC2160)) \ + || (NUM_Z_STEPPERS >= 1 && !AXIS_DRIVER_TYPE_Z(TMC2160)) \ + || (NUM_Z_STEPPERS >= 2 && !AXIS_DRIVER_TYPE_Z2(TMC2160)) \ + || (NUM_Z_STEPPERS >= 3 && !AXIS_DRIVER_TYPE_Z3(TMC2160)) \ + || (NUM_Z_STEPPERS >= 4 && !AXIS_DRIVER_TYPE_Z4(TMC2160)) \ + || (EXTRUDERS >= 1 && !AXIS_DRIVER_TYPE_E0(TMC2160)) \ + || (EXTRUDERS >= 2 && !AXIS_DRIVER_TYPE_E1(TMC2160)) \ + || (EXTRUDERS >= 3 && !AXIS_DRIVER_TYPE_E2(TMC2160)) \ + || (EXTRUDERS >= 4 && !AXIS_DRIVER_TYPE_E3(TMC2160)) \ + || (EXTRUDERS >= 5 && !AXIS_DRIVER_TYPE_E4(TMC2160)) + #error "All DRIVER TYPEs must be TMC2160 for BOARD_BTT_KRAKEN_V1_0." +#endif + +// RSENSE defaults +#if HAS_X_AXIS + static_assert(X_RSENSE == 0.022, "X_RSENSE (S1 / Motor 1) must be 0.022 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if HAS_Y_AXIS + static_assert(Y_RSENSE == 0.022, "Y_RSENSE (S2 / Motor 2) must be 0.022 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if NUM_Z_STEPPERS >= 1 + static_assert(Z_RSENSE == 0.022, "Z_RSENSE (S3 / Motor 3) must be 0.022 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if NUM_Z_STEPPERS >= 2 + static_assert(Z2_RSENSE == 0.075, "Z2_RSENSE (S5 / Motor 5) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if NUM_Z_STEPPERS >= 3 + static_assert(Z3_RSENSE == 0.075, "Z3_RSENSE (S6 / Motor 6) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if NUM_Z_STEPPERS >= 4 + static_assert(Z4_RSENSE == 0.075, "Z4_RSENSE (S7 / Motor 7) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if EXTRUDERS >= 1 + static_assert(E0_RSENSE == 0.022, "E0_RSENSE (S4 / Motor 4) must be 0.022 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if EXTRUDERS >= 2 + static_assert(E1_RSENSE == 0.075, "E1_RSENSE (S5 / Motor 5) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if EXTRUDERS >= 3 + static_assert(E2_RSENSE == 0.075, "E2_RSENSE (S6 / Motor 6) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if EXTRUDERS >= 4 + static_assert(E3_RSENSE == 0.075, "E3_RSENSE (S7 / Motor 7) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif +#if EXTRUDERS >= 5 + static_assert(E4_RSENSE == 0.075, "E4_RSENSE (S8 / Motor 8) must be 0.075 for BOARD_BTT_KRAKEN_V1_0."); +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN PB1 // TH0 +#define TEMP_1_PIN PC5 // TH1 +#define TEMP_2_PIN PC4 // TH2 +#define TEMP_3_PIN PA7 // TH3 +#define TEMP_BED_PIN PB0 // THB + +#if TEMP_SENSOR_0_IS_MAX31865 + #define TEMP_0_CS_PIN PC9 // 31865 (1) + #define TEMP_0_SCK_PIN PC10 + #define TEMP_0_MISO_PIN PC11 + #define TEMP_0_MOSI_PIN PC12 + #define SOFTWARE_SPI // MAX31865 and LCD SD share a set of SPIs, Set SD to software SPI + #define FORCE_SOFT_SPI +#endif +#if TEMP_SENSOR_1_IS_MAX31865 + #define TEMP_1_CS_PIN PA8 // 31865 (2) + #define TEMP_1_SCK_PIN PC10 + #define TEMP_1_MISO_PIN PC11 + #define TEMP_1_MOSI_PIN PC12 +#endif + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PF5 // BED-OUT +#define HEATER_0_PIN PF6 // HE0 +#define HEATER_1_PIN PF7 // HE1 +#define HEATER_2_PIN PF9 // HE2 +#define HEATER_3_PIN PF8 // HE3 + +#define FAN0_PIN PA0 // FAN0 (3 wire) +#define FAN1_PIN PA1 // FAN1 (3 wire) +#define FAN2_PIN PA2 // FAN2 (3 wire) +#define FAN3_PIN PA3 // FAN3 (3 wire) +#define FAN4_PIN PA4 // FAN4 (3 wire) +#define FAN5_PIN PA5 // FAN5 (3 wire) +#define FAN6_PIN PA6 // FAN6 (4 wire) +#define FAN7_PIN PE8 // FAN7 (4 wire) + +#ifndef E0_FAN_TACHO_PIN + //#define E0_FAN_TACHO_PIN PC1 // FAN6 +#endif +#ifndef E1_FAN_TACHO_PIN + //#define E1_FAN_TACHO_PIN PG0 // FAN7 +#endif + +// +// Power Supply Control +// +#ifndef PS_ON_PIN + #define PS_ON_PIN PD10 // PS-ON +#endif + +// +// Misc. Functions +// +#define LED_PIN PA14 + +#ifndef FILWIDTH_PIN + #define FILWIDTH_PIN PC2 +#endif +#ifndef FILWIDTH2_PIN + #define FILWIDTH2_PIN PC3 +#endif + +// +// SD Support +// +#ifndef SDCARD_CONNECTION + #if HAS_WIRED_LCD + #define SDCARD_CONNECTION LCD + #else + #define SDCARD_CONNECTION ONBOARD + #endif +#endif + +// +// Default pins for TMC software SPI +// This board only supports SW SPI for stepper drivers +// +#if HAS_TMC_SPI + #define TMC_USE_SW_SPI + #ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PC8 + #endif + #ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PC7 + #endif + #ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PC6 + #endif +#endif + +/** ------ ------ + * (BEEPER) PG5 | 1 2 | PG4 (BTN_ENC) (MISO) PE13 | 1 2 | PE12 (SCK) + * (LCD_EN) PG3 | 3 4 | PG2 (LCD_RS) (BTN_EN1) PG8 | 3 4 | PE11 (SD_SS) + * (LCD_D4) PD15 5 6 | PD14 (LCD_D5) (BTN_EN2) PG7 5 6 | PE14 (MOSI) + * (LCD_D6) PD13 | 7 8 | PD12 (LCD_D7) (SD_DETECT) PG6 | 7 8 | RESET + * GND | 9 10 | 5V GND | 9 10 | -- + * ------ ------ + * EXP1 EXP2 + */ +#define EXP1_01_PIN PG5 +#define EXP1_02_PIN PG4 +#define EXP1_03_PIN PG3 +#define EXP1_04_PIN PG2 +#define EXP1_05_PIN PD15 +#define EXP1_06_PIN PD14 +#define EXP1_07_PIN PD13 +#define EXP1_08_PIN PD12 + +#define EXP2_01_PIN PE13 +#define EXP2_02_PIN PE12 +#define EXP2_03_PIN PG8 +#define EXP2_04_PIN PE11 +#define EXP2_05_PIN PG7 +#define EXP2_06_PIN PE14 +#define EXP2_07_PIN PG6 +#define EXP2_08_PIN -1 + +// +// Onboard SD card +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 +// +#if SD_CONNECTION_IS(ONBOARD) + #ifndef SD_DETECT_STATE + #define SD_DETECT_STATE HIGH + #elif SD_DETECT_STATE == LOW + #error "BOARD_BTT_KRAKEN_V1_0 onboard SD requires SD_DETECT_STATE set to HIGH." + #endif + #define SDSS PB12 + #define SD_SS_PIN SDSS + #define SD_SCK_PIN PB13 + #define SD_MISO_PIN PB14 + #define SD_MOSI_PIN PB15 + #define SD_DETECT_PIN PE15 + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(LCD) + #define SDSS EXP2_04_PIN + #define SD_SS_PIN SDSS + #define SD_SCK_PIN EXP2_02_PIN + #define SD_MISO_PIN EXP2_01_PIN + #define SD_MOSI_PIN EXP2_06_PIN + #define SD_DETECT_PIN EXP2_07_PIN + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for BOARD_BTT_KRAKEN_V1_0." +#endif + +#if ENABLED(BTT_MOTOR_EXPANSION) + /** + * ------ ------ + * M3DIAG | 1 2 | M3RX M3STP | 1 2 | M3DIR + * M2DIAG | 3 4 | M2RX M2STP | 3 4 | M2DIR + * M1DIAG 5 6 | M1RX M1DIR 5 6 | M1STP + * M3EN | 7 8 | M2EN M1EN | 7 8 | -- + * GND | 9 10 | -- GND | 9 10 | -- + * ------ ------ + * EXP1 EXP2 + */ + + // M1 on Driver Expansion Module + #define E4_STEP_PIN EXP2_06_PIN + #define E4_DIR_PIN EXP2_05_PIN + #define E4_ENABLE_PIN EXP2_07_PIN + #define E4_DIAG_PIN EXP1_05_PIN + #define E4_CS_PIN EXP1_06_PIN + #if HAS_TMC_UART + #define E4_SERIAL_TX_PIN EXP1_06_PIN + #define E4_SERIAL_RX_PIN E4_SERIAL_TX_PIN + #endif + + // M2 on Driver Expansion Module + #define E5_STEP_PIN EXP2_03_PIN + #define E5_DIR_PIN EXP2_04_PIN + #define E5_ENABLE_PIN EXP1_08_PIN + #define E5_DIAG_PIN EXP1_03_PIN + #define E5_CS_PIN EXP1_04_PIN + #if HAS_TMC_UART + #define E5_SERIAL_TX_PIN EXP1_04_PIN + #define E5_SERIAL_RX_PIN E5_SERIAL_TX_PIN + #endif + + // M3 on Driver Expansion Module + #define E6_STEP_PIN EXP2_01_PIN + #define E6_DIR_PIN EXP2_02_PIN + #define E6_ENABLE_PIN EXP1_07_PIN + #define E6_DIAG_PIN EXP1_01_PIN + #define E6_CS_PIN EXP1_02_PIN + #if HAS_TMC_UART + #define E6_SERIAL_TX_PIN EXP1_02_PIN + #define E6_SERIAL_RX_PIN E6_SERIAL_TX_PIN + #endif + +#endif // BTT_MOTOR_EXPANSION + +// +// LCDs and Controllers +// +#if IS_TFTGLCD_PANEL + + #if ENABLED(TFTGLCD_PANEL_SPI) + #define TFTGLCD_CS EXP2_03_PIN + #endif + +#elif HAS_DWIN_E3V2 || IS_DWIN_MARLINUI + /** + * ------ ------ --- + * | 1 2 | | 1 2 | 1 | + * | 3 4 | RX | 3 4 | TX | 2 | RX + * ENT 5 6 | BEEP ENT 5 6 | BEEP | 3 | TX + * B | 7 8 | A B | 7 8 | A | 4 | + * GND | 9 10 | VCC GND | 9 10 | VCC 5 | + * ------ ------ --- + * EXP1 DWIN TFT + * + * DWIN pins are labeled as printed on DWIN PCB. GND, VCC, A, B, ENT & BEEP can be connected in the same + * orientation as the existing plug/DWIN to EXP1. TX/RX need to be connected to the TFT port, with TX->RX, RX->TX. + */ + + #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING + #error "CAUTION! Ender-3 V2 display requires a custom cable. See 'pins_BTT_OCTOPUS_V1_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #endif + + #define BEEPER_PIN EXP1_06_PIN + #define BTN_EN1 EXP1_08_PIN + #define BTN_EN2 EXP1_07_PIN + #define BTN_ENC EXP1_05_PIN + +#elif HAS_WIRED_LCD + + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN + + #if ENABLED(CR10_STOCKDISPLAY) + + #define LCD_PINS_RS EXP1_07_PIN + + #define BTN_EN1 EXP1_03_PIN + #define BTN_EN2 EXP1_05_PIN + + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN + + #else + + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. + #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN EXP1_06_PIN + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN EXP1_07_PIN + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN EXP1_08_PIN + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN EXP1_06_PIN + #endif + #endif // !FYSETC_MINI_12864 + + #if IS_ULTIPANEL + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + #define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder + #endif + + #endif + + #endif +#endif // HAS_WIRED_LCD + +// Alter timing for graphical display +#if IS_U8GLIB_ST7920 + #define BOARD_ST7920_DELAY_1 120 + #define BOARD_ST7920_DELAY_2 80 + #define BOARD_ST7920_DELAY_3 580 +#endif + +#if HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI + + #define TFT_SCK_PIN EXP2_02_PIN + #define TFT_MISO_PIN EXP2_01_PIN + #define TFT_MOSI_PIN EXP2_06_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #ifndef TFT_WIDTH + #define TFT_WIDTH 480 + #endif + #ifndef TFT_HEIGHT + #define TFT_HEIGHT 320 + #endif + + #if ENABLED(BTT_TFT35_SPI_V1_0) + + /** + * ------ ------ + * BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK + * T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS + * T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI + * PENIRQ | 7 8 | F_CS RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | NC + * ------ ------ + * EXP1 EXP2 + * + * 480x320, 3.5", SPI Display with Rotary Encoder. + * Stock Display for the BIQU B1 SE Series. + * Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf + */ + #define TFT_CS_PIN EXP2_04_PIN + #define TFT_DC_PIN EXP2_07_PIN + #define TFT_A0_PIN TFT_DC_PIN + + #define TOUCH_CS_PIN EXP1_04_PIN + #define TOUCH_SCK_PIN EXP1_05_PIN + #define TOUCH_MISO_PIN EXP1_06_PIN + #define TOUCH_MOSI_PIN EXP1_03_PIN + #define TOUCH_INT_PIN EXP1_07_PIN + + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 17540 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y -11388 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X -21 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 337 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + + #elif ENABLED(MKS_TS35_V2_0) + + /** ------ ------ + * BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK + * TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS + * TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI + * SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET + * GND | 9 10 | VCC GND | 9 10 | VCC + * ------ ------ + * EXP1 EXP2 + */ + #define TFT_CS_PIN EXP1_07_PIN // SPI1_CS + #define TFT_DC_PIN EXP1_08_PIN // SPI1_RS + #define TFT_A0_PIN TFT_DC_PIN + + #define TFT_RESET_PIN EXP1_04_PIN + + #define LCD_BACKLIGHT_PIN EXP1_03_PIN + #define TFT_BACKLIGHT_PIN LCD_BACKLIGHT_PIN + + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 + + #define TOUCH_CS_PIN EXP1_05_PIN // SPI1_NSS + #define TOUCH_SCK_PIN EXP2_02_PIN // SPI1_SCK + #define TOUCH_MISO_PIN EXP2_01_PIN // SPI1_MISO + #define TOUCH_MOSI_PIN EXP2_06_PIN // SPI1_MOSI + + #define LCD_READ_ID 0xD3 + #define LCD_USE_DMA_SPI + + #define TFT_BUFFER_WORDS 14400 + + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X -17253 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 11579 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 514 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y -24 + #endif + #ifndef TOUCH_ORIENTATION + #define TOUCH_ORIENTATION TOUCH_LANDSCAPE + #endif + + #endif + +#endif + +// +// NeoPixel LED +// +#if DISABLED(FYSETC_MINI_12864_2_1) && !defined(NEOPIXEL_PIN) + #define NEOPIXEL_PIN PF12 // RGB1 +#endif +#ifndef NEOPIXEL2_PIN + #define NEOPIXEL2_PIN PF11 // RGB2 +#endif diff --git a/buildroot/share/PlatformIO/boards/marlin_STM32H723ZG.json b/buildroot/share/PlatformIO/boards/marlin_STM32H723ZG.json new file mode 100644 index 000000000000..28698389c3b8 --- /dev/null +++ b/buildroot/share/PlatformIO/boards/marlin_STM32H723ZG.json @@ -0,0 +1,61 @@ +{ + "build": { + "core": "stm32", + "cpu": "cortex-m7", + "extra_flags": "-DSTM32H7xx -DSTM32H723xx", + "f_cpu": "550000000L", + "mcu": "stm32h723zgt6", + "product_line": "STM32H723xx", + "variant": "MARLIN_H723ZG" + }, + "connectivity": [ + "can", + "ethernet" + ], + "debug": { + "jlink_device": "STM32H723ZG", + "openocd_target": "stm32h7x", + "svd_path": "STM32H7x3.svd", + "tools": { + "stlink": { + "server": { + "arguments": [ + "-f", + "scripts/interface/stlink.cfg", + "-c", + "transport select hla_swd", + "-f", + "scripts/target/stm32h7x.cfg", + "-c", + "reset_config none" + ], + "executable": "bin/openocd", + "package": "tool-openocd" + } + } + } + }, + "frameworks": [ + "arduino", + "stm32cube" + ], + "name": "STM32H723ZG (564k RAM. 1024k Flash)", + "upload": { + "disable_flushing": false, + "maximum_ram_size": 577536, + "maximum_size": 1048576, + "protocol": "stlink", + "protocols": [ + "stlink", + "dfu", + "jlink", + "cmsis-dap" + ], + "offset_address": "0x8020000", + "require_upload_port": true, + "use_1200bps_touch": false, + "wait_for_upload_port": false + }, + "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h723zg.html", + "vendor": "ST" +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PeripheralPins.c new file mode 100644 index 000000000000..70048173e787 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PeripheralPins.c @@ -0,0 +1,688 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +/* + * Automatically generated from STM32H723ZETx.xml, STM32H723ZGTx.xml + * STM32H733ZGTx.xml + * CubeMX DB release 6.0.30 + */ +#if !defined(CUSTOM_PERIPHERAL_PINS) +#include "Arduino.h" +#include "PeripheralPins.h" + +/* ===== + * Notes: + * - The pins mentioned Px_y_ALTz are alternative possibilities which use other + * HW peripheral instances. You can use them the same way as any other "normal" + * pin (i.e. analogWrite(PA7_ALT1, 128);). + * + * - Commented lines are alternative possibilities which are not used per default. + * If you change them, you will have to know what you do + * ===== + */ + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +WEAK const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 + {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 + {PA_2_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC2_INP14 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 + {PA_3_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC2_INP15 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 + {PA_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 + {PA_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 + {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 + {PA_6_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 + {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 + {PA_7_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 + {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 + {PB_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 + {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 + {PB_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 + {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 + {PC_0_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 + {PC_0_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_INP10 + {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 + {PC_1_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 + {PC_1_ALT2, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC3_INP11 + {PC_2_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC3_INP0 + {PC_3_C, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC3_INP1 + {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 + {PC_4_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 + {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 + {PC_5_ALT1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 + {PF_3, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC3_INP5 + {PF_4, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC3_INP9 + {PF_5, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC3_INP4 + {PF_6, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC3_INP8 + {PF_7, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC3_INP3 + {PF_8, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC3_INP7 + {PF_9, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC3_INP2 + {PF_10, ADC3, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC3_INP6 + {PF_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2 + {PF_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_INP6 + {PF_13, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_INP2 + {PF_14, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC2_INP6 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +WEAK const PinMap PinMap_DAC[] = { + {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1 + {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SDA[] = { + {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_7_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_9_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_9, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PC_9_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PC_10, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_13, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {PF_0, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PF_0_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PF_15, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +WEAK const PinMap PinMap_I2C_SCL[] = { + {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, + {PA_8_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_6_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, + {PB_8_ALT1, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, + {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PC_11, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C5)}, + {PD_12, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {PF_1, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)}, + {PF_1_ALT1, I2C5, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C5)}, + {PF_14, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)}, + {NC, NP, 0} +}; +#endif + +//*** TIM *** + +#ifdef HAL_TIM_MODULE_ENABLED +WEAK const PinMap PinMap_TIM[] = { + {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_0_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PA_1_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 + {PA_1_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PA_2_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 + {PA_2_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PA_3_ALT1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 + {PA_3_ALT2, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PA_5_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PA_6_ALT1, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PA_7, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PA_7_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PA_7_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N + {PA_7_ALT3, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PA_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PA_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 + {PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_0_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PB_0_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_1_ALT1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PB_1_ALT2, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 + {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PB_6_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PB_7_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PB_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PB_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 + {PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PB_14_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N + {PB_14_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 1, 0)}, // TIM12_CH1 + {PB_15, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PB_15_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N + {PB_15_ALT2, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 2, 0)}, // TIM12_CH2 + {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 + {PC_6_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 + {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 + {PC_7_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 + {PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 + {PC_8_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 + {PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 + {PC_9_ALT1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 + {PC_12, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM15, 1, 0)}, // TIM15_CH1 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 + {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + {PE_4, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N + {PE_5, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 + {PE_6, TIM15, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2 + {PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 + {PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 + {PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 + {PF_0, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PF_1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PF_2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {PF_3, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 4, 0)}, // TIM23_CH4 + {PF_6, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1 + {PF_6_ALT1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PF_7, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1 + {PF_7_ALT1, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + {PF_8_ALT1, TIM16, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N + {PF_8_ALT2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + {PF_9_ALT1, TIM17, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N + {PF_9_ALT2, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 4, 0)}, // TIM23_CH4 + {PF_11, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 1, 0)}, // TIM24_CH1 + {PF_12, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 2, 0)}, // TIM24_CH2 + {PF_13, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 3, 0)}, // TIM24_CH3 + {PF_14, TIM24, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_TIM24, 4, 0)}, // TIM24_CH4 + {PG_12, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 1, 0)}, // TIM23_CH1 + {PG_13, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 2, 0)}, // TIM23_CH2 + {PG_14, TIM23, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF13_TIM23, 3, 0)}, // TIM23_CH3 + {NC, NP, 0} +}; +#endif + +//*** UART *** + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_TX[] = { + {PA_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_9, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_9_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_12, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PA_15, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_4, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_6_ALT1, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_6_ALT2, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_9, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_10, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_13, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_14, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_6, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_10, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_10_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_5, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_8, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_15, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_1, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_3, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_USART10)}, + {PE_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_1, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PG_12, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PG_14, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RX[] = { + {PA_1, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PA_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_10_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, + {PB_3, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, + {PB_5, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_7, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, + {PB_7_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_8, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_12, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, + {PB_15, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, + {PC_7, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PC_11, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_11_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PD_2, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_6, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_9, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PE_0, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_2, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PE_7, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_6, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PG_9, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_11, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_RTS[] = { + {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_12_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PA_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_14_ALT1, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PC_8, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_4, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_12, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_13, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_15, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_8, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_8, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_12, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_14, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +WEAK const PinMap PinMap_UART_CTS[] = { + {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PA_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, + {PA_11_ALT1, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, + {PB_0, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PB_13, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PB_15, UART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, + {PC_9, UART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)}, + {PD_0, UART9, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART9)}, + {PD_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, + {PD_11, USART3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, + {PD_14, UART8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, + {PE_10, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PF_9, UART7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)}, + {PG_13, USART10, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART10)}, + {PG_13_ALT1, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {PG_15, USART6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_7_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_2, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_5_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)}, + {PB_5_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_1, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_3_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PD_6, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)}, + {PD_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PE_6, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_9, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PF_11, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_14, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_6_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_2_C, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PE_5, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_8, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_9, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PG_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SCLK[] = { + {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_5_ALT1, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PB_3_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PC_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PD_3, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_2, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_7, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PG_13, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +WEAK const PinMap PinMap_SPI_SSEL[] = { + {PA_0, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_4_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_4_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, + {PA_11, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {PA_15_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, + {PA_15_ALT2, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI6)}, + {PB_4, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)}, + {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PE_4, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)}, + {PF_6, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)}, + {PG_8, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, + {PG_10, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, + {NC, NP, 0} +}; +#endif + +//*** FDCAN *** + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_RD[] = { + {PA_11, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_5, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_8, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_12, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_0, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_12, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {PF_6, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {PG_10, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_FDCAN_MODULE_ENABLED +WEAK const PinMap PinMap_CAN_TD[] = { + {PA_12, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_6, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PB_9, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PB_13, FDCAN2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, + {PD_1, FDCAN1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, + {PD_13, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_FDCAN3)}, + {PF_7, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {PG_9, FDCAN3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF2_FDCAN3)}, + {NC, NP, 0} +}; +#endif + +//*** ETHERNET *** + +#ifdef HAL_ETH_MODULE_ENABLED +WEAK const PinMap PinMap_Ethernet[] = { + {PA_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS + {PA_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK + {PA_1_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_CLK + {PA_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO + {PA_3, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL + {PA_7, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV + {PA_7_ALT1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_DV + {PA_9, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_0, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2 + {PB_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3 + {PB_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_ER + {PB_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PB_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER + {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PC_1, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC + {PC_2_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2 + {PC_3_C, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK + {PC_4, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0 + {PC_5, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1 + {PE_2, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3 + {PG_8, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT + {PG_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN + {PG_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {PG_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0 + {PG_14, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1 + {NC, NP, 0} +}; +#endif + +//*** OCTOSPI *** + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA0[] = { + {PA_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PB_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PC_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PD_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {PF_0, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO0 + {PF_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA1[] = { + {PB_0, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PC_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PD_12, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {PF_1, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO1 + {PF_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA2[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PA_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PB_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PE_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {PF_2, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO2 + {PF_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA3[] = { + {PA_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PA_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PD_13, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {PF_3, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO3 + {PF_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA4[] = { + {PC_1, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PD_4, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PE_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO4 + {PG_0, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO4 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA5[] = { + {PC_2_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PD_5, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PE_8, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO5 + {PG_1, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO5 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA6[] = { + {PC_3_C, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PD_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PE_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PG_9, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO6 + {PG_10, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO6 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_DATA7[] = { + {PD_7, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PE_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {PG_11, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO7 + {PG_14, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO7 + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SCLK[] = { + {PA_3, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PB_2, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {PF_4, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P2)}, // OCTOSPIM_P2_CLK + {PF_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK + {NC, NP, 0} +}; +#endif + +#ifdef HAL_OSPI_MODULE_ENABLED +WEAK const PinMap PinMap_OCTOSPI_SSEL[] = { + {PB_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PB_10, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PC_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PE_11, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PG_6, OCTOSPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS + {PG_12, OCTOSPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P2)}, // OCTOSPIM_P2_NCS + {NC, NP, 0} +}; +#endif + +//*** USB *** + +#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED) +WEAK const PinMap PinMap_USB_OTG_HS[] = { +#ifdef USE_USB_HS_IN_FS + {PA_8, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_SOF + {PA_9, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS + {PA_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ID + {PA_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DM + {PA_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // USB_OTG_HS_DP +#else + {PA_3, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D0 + {PA_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_CK + {PB_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D1 + {PB_1, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D2 + {PB_5, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D7 + {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D3 + {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D4 + {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D5 + {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_D6 + {PC_0, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_STP + {PC_2_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_DIR + {PC_3_C, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_HS)}, // USB_OTG_HS_ULPI_NXT +#endif /* USE_USB_HS_IN_FS */ + {NC, NP, 0} +}; +#endif + +//*** SD *** + +#ifdef HAL_SD_MODULE_ENABLED +WEAK const PinMap PinMap_SD[] = { + {PA_0, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CMD + {PB_3, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D2 + {PB_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D3 + {PB_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CKIN + {PB_8_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D4 + {PB_8_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D4 + {PB_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF7_SDMMC1)}, // SDMMC1_CDIR + {PB_9_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D5 + {PB_9_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D5 + {PB_13, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PB_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D0 + {PB_15, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_SDMMC2)}, // SDMMC2_D1 + {PC_1, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_SDMMC2)}, // SDMMC2_CK + {PC_4, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_SDMMC2)}, // SDMMC2_CKIN + {PC_6, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D0DIR + {PC_6_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D6 + {PC_6_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PC_7, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF8_SDMMC1)}, // SDMMC1_D123DIR + {PC_7_ALT1, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D7 + {PC_7_ALT2, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {PC_8, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D0 + {PC_9, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D1 + {PC_10, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D2 + {PC_11, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_SDMMC1)}, // SDMMC1_D3 + {PC_12, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CK + {PD_2, SDMMC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF12_SDMMC1)}, // SDMMC1_CMD + {PD_6, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CK + {PD_7, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_SDMMC2)}, // SDMMC2_CMD + {PG_9, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_SDMMC2)}, // SDMMC2_D0 + {PG_10, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_SDMMC2)}, // SDMMC2_D1 + {PG_11, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D2 + {PG_12, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D3 + {PG_13, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D6 + {PG_14, SDMMC2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_SDMMC2)}, // SDMMC2_D7 + {NC, NP, 0} +}; +#endif + +#endif /* !CUSTOM_PERIPHERAL_PINS */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PinNamesVar.h new file mode 100644 index 000000000000..ad9d80a62518 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/PinNamesVar.h @@ -0,0 +1,117 @@ +/* Dual pad pin name */ +PC_2_C = PC_2 | PDUAL, +PC_3_C = PC_3 | PDUAL, + +/* Alternate pin name */ +PA_0_ALT1 = PA_0 | ALT1, +PA_1_ALT1 = PA_1 | ALT1, +PA_1_ALT2 = PA_1 | ALT2, +PA_2_ALT1 = PA_2 | ALT1, +PA_2_ALT2 = PA_2 | ALT2, +PA_3_ALT1 = PA_3 | ALT1, +PA_3_ALT2 = PA_3 | ALT2, +PA_4_ALT1 = PA_4 | ALT1, +PA_4_ALT2 = PA_4 | ALT2, +PA_5_ALT1 = PA_5 | ALT1, +PA_6_ALT1 = PA_6 | ALT1, +PA_7_ALT1 = PA_7 | ALT1, +PA_7_ALT2 = PA_7 | ALT2, +PA_7_ALT3 = PA_7 | ALT3, +PA_8_ALT1 = PA_8 | ALT1, +PA_9_ALT1 = PA_9 | ALT1, +PA_10_ALT1 = PA_10 | ALT1, +PA_11_ALT1 = PA_11 | ALT1, +PA_12_ALT1 = PA_12 | ALT1, +PA_15_ALT1 = PA_15 | ALT1, +PA_15_ALT2 = PA_15 | ALT2, +PB_0_ALT1 = PB_0 | ALT1, +PB_0_ALT2 = PB_0 | ALT2, +PB_1_ALT1 = PB_1 | ALT1, +PB_1_ALT2 = PB_1 | ALT2, +PB_3_ALT1 = PB_3 | ALT1, +PB_3_ALT2 = PB_3 | ALT2, +PB_4_ALT1 = PB_4 | ALT1, +PB_4_ALT2 = PB_4 | ALT2, +PB_5_ALT1 = PB_5 | ALT1, +PB_5_ALT2 = PB_5 | ALT2, +PB_6_ALT1 = PB_6 | ALT1, +PB_6_ALT2 = PB_6 | ALT2, +PB_7_ALT1 = PB_7 | ALT1, +PB_8_ALT1 = PB_8 | ALT1, +PB_8_ALT2 = PB_8 | ALT2, +PB_9_ALT1 = PB_9 | ALT1, +PB_9_ALT2 = PB_9 | ALT2, +PB_14_ALT1 = PB_14 | ALT1, +PB_14_ALT2 = PB_14 | ALT2, +PB_15_ALT1 = PB_15 | ALT1, +PB_15_ALT2 = PB_15 | ALT2, +PC_0_ALT1 = PC_0 | ALT1, +PC_0_ALT2 = PC_0 | ALT2, +PC_1_ALT1 = PC_1 | ALT1, +PC_1_ALT2 = PC_1 | ALT2, +PC_4_ALT1 = PC_4 | ALT1, +PC_5_ALT1 = PC_5 | ALT1, +PC_6_ALT1 = PC_6 | ALT1, +PC_6_ALT2 = PC_6 | ALT2, +PC_7_ALT1 = PC_7 | ALT1, +PC_7_ALT2 = PC_7 | ALT2, +PC_8_ALT1 = PC_8 | ALT1, +PC_9_ALT1 = PC_9 | ALT1, +PC_10_ALT1 = PC_10 | ALT1, +PC_11_ALT1 = PC_11 | ALT1, +PF_0_ALT1 = PF_0 | ALT1, +PF_1_ALT1 = PF_1 | ALT1, +PF_6_ALT1 = PF_6 | ALT1, +PF_7_ALT1 = PF_7 | ALT1, +PF_8_ALT1 = PF_8 | ALT1, +PF_8_ALT2 = PF_8 | ALT2, +PF_9_ALT1 = PF_9 | ALT1, +PF_9_ALT2 = PF_9 | ALT2, +PG_13_ALT1 = PG_13 | ALT1, + +/* SYS_WKUP */ +#ifdef PWR_WAKEUP_PIN1 + SYS_WKUP1 = PA_0, +#endif +#ifdef PWR_WAKEUP_PIN2 + SYS_WKUP2 = PA_2, +#endif +#ifdef PWR_WAKEUP_PIN3 + SYS_WKUP3 = NC, +#endif +#ifdef PWR_WAKEUP_PIN4 + SYS_WKUP4 = PC_13, +#endif +#ifdef PWR_WAKEUP_PIN5 + SYS_WKUP5 = NC, +#endif +#ifdef PWR_WAKEUP_PIN6 + SYS_WKUP6 = PC_1, +#endif +#ifdef PWR_WAKEUP_PIN7 + SYS_WKUP7 = NC, +#endif +#ifdef PWR_WAKEUP_PIN8 + SYS_WKUP8 = NC, +#endif + +/* USB */ +#ifdef USBCON + USB_OTG_HS_DM = PA_11, + USB_OTG_HS_DP = PA_12, + USB_OTG_HS_ID = PA_10, + USB_OTG_HS_SOF = PA_8, + USB_OTG_HS_ULPI_CK = PA_5, + USB_OTG_HS_ULPI_D0 = PA_3, + USB_OTG_HS_ULPI_D1 = PB_0, + USB_OTG_HS_ULPI_D2 = PB_1, + USB_OTG_HS_ULPI_D3 = PB_10, + USB_OTG_HS_ULPI_D4 = PB_11, + USB_OTG_HS_ULPI_D5 = PB_12, + USB_OTG_HS_ULPI_D6 = PB_13, + USB_OTG_HS_ULPI_D7 = PB_5, + USB_OTG_HS_ULPI_DIR = PC_2_C, + USB_OTG_HS_ULPI_NXT = PC_3_C, + USB_OTG_HS_ULPI_STP = PC_0, + USB_OTG_HS_VBUS = PA_9, +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/ldscript.ld new file mode 100644 index 000000000000..63228610336b --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/ldscript.ld @@ -0,0 +1,174 @@ +/* +****************************************************************************** +** +** File : LinkerScript.ld +** +** Author : STM32CubeIDE +** +** Abstract : Linker script for STM32H7 series +** 512Kbytes FLASH and 560Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed as is, without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +** Copyright (c) 2022 STMicroelectronics. +** All rights reserved. +** +** This software is licensed under terms that can be found in the LICENSE file +** in the root directory of this software component. +** If no LICENSE file comes with this software, it is provided AS-IS. +** +**************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200 ; /* required amount of heap */ +_Min_Stack_Size = 0x400 ; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ + ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K + DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET + RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K + RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K + RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM_D1 AT> FLASH + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM_D1 + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM_D1 + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.cpp new file mode 100644 index 000000000000..4506cf5ce6b5 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.cpp @@ -0,0 +1,317 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#if defined(STM32H723xx) +#include "pins_arduino.h" + +// Digital PinName array +const PinName digitalPin[] = { + PA_0, // D0/A0 + PA_1, // D1/A1 + PA_2, // D2/A2 + PA_3, // D3/A3 + PA_4, // D4/A4 + PA_5, // D5/A5 + PA_6, // D6/A6 + PA_7, // D7/A7 + PA_8, // D8 + PA_9, // D9 + PA_10, // D10 + PA_11, // D11 + PA_12, // D12 + PA_13, // D13 + PA_14, // D14 + PA_15, // D15 + PB_0, // D16/A8 + PB_1, // D17/A9 + PB_2, // D18 + PB_3, // D19 + PB_4, // D20 + PB_5, // D21 + PB_6, // D22 + PB_7, // D23 + PB_8, // D24 + PB_9, // D25 + PB_10, // D26 + PB_11, // D27 + PB_12, // D28 + PB_13, // D29 + PB_14, // D30 + PB_15, // D31 + PC_0, // D32/A10 + PC_1, // D33/A11 + PC_4, // D34/A12 + PC_5, // D35/A13 + PC_6, // D36 + PC_7, // D37 + PC_8, // D38 + PC_9, // D39 + PC_10, // D40 + PC_11, // D41 + PC_12, // D42 + PC_13, // D43 + PC_14, // D44 + PC_15, // D45 + PD_0, // D46 + PD_1, // D47 + PD_2, // D48 + PD_3, // D49 + PD_4, // D50 + PD_5, // D51 + PD_6, // D52 + PD_7, // D53 + PD_8, // D54 + PD_9, // D55 + PD_10, // D56 + PD_11, // D57 + PD_12, // D58 + PD_13, // D59 + PD_14, // D60 + PD_15, // D61 + PE_0, // D62 + PE_1, // D63 + PE_2, // D64 + PE_3, // D65 + PE_4, // D66 + PE_5, // D67 + PE_6, // D68 + PE_7, // D69 + PE_8, // D70 + PE_9, // D71 + PE_10, // D72 + PE_11, // D73 + PE_12, // D74 + PE_13, // D75 + PE_14, // D76 + PE_15, // D77 + PF_0, // D78 + PF_1, // D79 + PF_2, // D80 + PF_3, // D81/A14 + PF_4, // D82/A15 + PF_5, // D83/A16 + PF_6, // D84/A17 + PF_7, // D85/A18 + PF_8, // D86/A19 + PF_9, // D87/A20 + PF_10, // D88/A21 + PF_11, // D89/A22 + PF_12, // D90/A23 + PF_13, // D91/A24 + PF_14, // D92/A25 + PF_15, // D93 + PG_0, // D94 + PG_1, // D95 + PG_2, // D96 + PG_3, // D97 + PG_4, // D98 + PG_5, // D99 + PG_6, // D100 + PG_7, // D101 + PG_8, // D102 + PG_9, // D103 + PG_10, // D104 + PG_11, // D105 + PG_12, // D106 + PG_13, // D107 + PG_14, // D108 + PG_15, // D109 + PH_0, // D110 + PH_1, // D111 + PC_2_C, // D112/A26 + PC_3_C // D113/A27 +}; + +// Analog (Ax) pin number array +const uint32_t analogInputPin[] = { + 0, // A0, PA0 + 1, // A1, PA1 + 2, // A2, PA2 + 3, // A3, PA3 + 4, // A4, PA4 + 5, // A5, PA5 + 6, // A6, PA6 + 7, // A7, PA7 + 16, // A8, PB0 + 17, // A9, PB1 + 32, // A10, PC0 + 33, // A11, PC1 + 34, // A12, PC4 + 35, // A13, PC5 + 81, // A14, PF3 + 82, // A15, PF4 + 83, // A16, PF5 + 84, // A17, PF6 + 85, // A18, PF7 + 86, // A19, PF8 + 87, // A20, PF9 + 88, // A21, PF10 + 89, // A22, PF11 + 90, // A23, PF12 + 91, // A24, PF13 + 92, // A25, PF14 + 112, // A26, PC2_C + 113 // A27, PC3_C +}; + +void MPU_Config(void) +{ + MPU_Region_InitTypeDef MPU_InitStruct = {0}; + + /* Disables the MPU */ + HAL_MPU_Disable(); + + /** Initializes and configures the Region and the memory to be protected + */ + MPU_InitStruct.Enable = MPU_REGION_ENABLE; + MPU_InitStruct.Number = MPU_REGION_NUMBER0; + MPU_InitStruct.BaseAddress = 0x0; + MPU_InitStruct.Size = MPU_REGION_SIZE_4GB; + MPU_InitStruct.SubRegionDisable = 0x87; + MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; + MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; + MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; + MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; + MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; + MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; + + HAL_MPU_ConfigRegion(&MPU_InitStruct); + /* Enables the MPU */ + HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); + +} + +/* + * @brief System Clock Configuration + * @param None + * @retval None + */ +WEAK void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {}; + + MPU_Config(); + + /** Supply configuration update enable + */ + HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); + /** Configure the main internal regulator output voltage + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0); + + while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; // 48Mhz for USB + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 5; // 25Mhz / 5 = 5Mhz + RCC_OscInitStruct.PLL.PLLN = 110; // 25Mhz / 5 * 110 = 550Mhz + RCC_OscInitStruct.PLL.PLLP = 1; // 550Mhz / 1 = 550Mhz + RCC_OscInitStruct.PLL.PLLQ = 10; // 550Mhz / 10 = 55Mhz + RCC_OscInitStruct.PLL.PLLR = 10; // unused + RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; + RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; + RCC_OscInitStruct.PLL.PLLFRACN = 0; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 + |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2; + RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2; + RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2; + RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2; + RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4) != HAL_OK) + { + Error_Handler(); + } + + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB + | RCC_PERIPHCLK_SDMMC | RCC_PERIPHCLK_ADC + | RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART16 + | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_I2C123 + | RCC_PERIPHCLK_I2C4 | RCC_PERIPHCLK_SPI123 + | RCC_PERIPHCLK_SPI45 | RCC_PERIPHCLK_SPI6; + + /* HSI48 used for USB 48 Mhz */ + /* PLL1 qclk also used for FMC, SDMMC, RNG, SAI */ + /* PLL2 pclk is needed for adc max 80 Mhz (p,q,r same) */ + /* PLL2 pclk also used for LP timers 2,3,4,5, SPI 1,2,3 */ + /* PLL2 qclk is needed for uart, can, spi4,5,6 80 Mhz */ + /* PLL3 r clk is needed for i2c 80 Mhz (p,q,r same) */ + PeriphClkInitStruct.PLL2.PLL2M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL2.PLL2N = 96; // N MUL 96 + PeriphClkInitStruct.PLL2.PLL2P = 2; // P div 2 + PeriphClkInitStruct.PLL2.PLL2Q = 2; // Q div 2 + PeriphClkInitStruct.PLL2.PLL2R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0; + PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOMEDIUM; + PeriphClkInitStruct.PLL2.PLL2FRACN = 0; + PeriphClkInitStruct.PLL3.PLL3M = 15; // M DIV 15 vco 25 / 15 ~ 1.667 Mhz + PeriphClkInitStruct.PLL3.PLL3N = 96; // N MUL 96 + PeriphClkInitStruct.PLL3.PLL3P = 2; // P div 2 + PeriphClkInitStruct.PLL3.PLL3Q = 2; // Q div 2 + PeriphClkInitStruct.PLL3.PLL3R = 2; // R div 2 + // RCC_PLL1VCIRANGE_0 Clock range frequency between 1 and 2 MHz + PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_0; + PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOMEDIUM; + PeriphClkInitStruct.PLL3.PLL3FRACN = 0; + // ADC from PLL2 pclk + PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2; + // USB from HSI48 + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + // SDMMC from PLL1 qclk + PeriphClkInitStruct.SdmmcClockSelection = 0; + //PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL; + // LPUART from PLL2 qclk + PeriphClkInitStruct.Lpuart1ClockSelection = 0; + //PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2; + // USART from PLL2 qclk + PeriphClkInitStruct.Usart234578ClockSelection = 0; + //PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2; + // I2C123 from PLL3 rclk + PeriphClkInitStruct.I2c123ClockSelection = RCC_I2C123CLKSOURCE_PLL3; + // I2C4 from PLL3 rclk + PeriphClkInitStruct.I2c4ClockSelection = 0; + //PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PLL3; + // SPI123 from PLL2 pclk + PeriphClkInitStruct.Spi123ClockSelection = RCC_SPI123CLKSOURCE_PLL2; + // SPI45 from PLL2 qclk + PeriphClkInitStruct.Spi45ClockSelection = 0; + //PeriphClkInitStruct.Spi45ClockSelection = RCC_SPI45CLKSOURCE_PLL2; + // SPI6 from PLL2 qclk + PeriphClkInitStruct.Spi6ClockSelection = 0; + //PeriphClkInitStruct.Spi6ClockSelection = RCC_SPI6CLKSOURCE_PLL2; + + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + Error_Handler(); + } +} + +#endif /* ARDUINO_GENERIC_* */ diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.h b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.h new file mode 100644 index 000000000000..1b518f01cfa4 --- /dev/null +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZG/variant_MARLIN_STM32H723ZG.h @@ -0,0 +1,309 @@ +/* + ******************************************************************************* + * Copyright (c) 2020-2021, STMicroelectronics + * All rights reserved. + * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ******************************************************************************* + */ +#pragma once + +/*---------------------------------------------------------------------------- + * STM32 pins number + *----------------------------------------------------------------------------*/ +#define PA0 PIN_A0 +#define PA1 PIN_A1 +#define PA2 PIN_A2 +#define PA3 PIN_A3 +#define PA4 PIN_A4 +#define PA5 PIN_A5 +#define PA6 PIN_A6 +#define PA7 PIN_A7 +#define PA8 8 +#define PA9 9 +#define PA10 10 +#define PA11 11 +#define PA12 12 +#define PA13 13 +#define PA14 14 +#define PA15 15 +#define PB0 PIN_A8 +#define PB1 PIN_A9 +#define PB2 18 +#define PB3 19 +#define PB4 20 +#define PB5 21 +#define PB6 22 +#define PB7 23 +#define PB8 24 +#define PB9 25 +#define PB10 26 +#define PB11 27 +#define PB12 28 +#define PB13 29 +#define PB14 30 +#define PB15 31 +#define PC0 PIN_A10 +#define PC1 PIN_A11 +#define PC4 PIN_A12 +#define PC5 PIN_A13 +#define PC6 36 +#define PC7 37 +#define PC8 38 +#define PC9 39 +#define PC10 40 +#define PC11 41 +#define PC12 42 +#define PC13 43 +#define PC14 44 +#define PC15 45 +#define PD0 46 +#define PD1 47 +#define PD2 48 +#define PD3 49 +#define PD4 50 +#define PD5 51 +#define PD6 52 +#define PD7 53 +#define PD8 54 +#define PD9 55 +#define PD10 56 +#define PD11 57 +#define PD12 58 +#define PD13 59 +#define PD14 60 +#define PD15 61 +#define PE0 62 +#define PE1 63 +#define PE2 64 +#define PE3 65 +#define PE4 66 +#define PE5 67 +#define PE6 68 +#define PE7 69 +#define PE8 70 +#define PE9 71 +#define PE10 72 +#define PE11 73 +#define PE12 74 +#define PE13 75 +#define PE14 76 +#define PE15 77 +#define PF0 78 +#define PF1 79 +#define PF2 80 +#define PF3 PIN_A14 +#define PF4 PIN_A15 +#define PF5 PIN_A16 +#define PF6 PIN_A17 +#define PF7 PIN_A18 +#define PF8 PIN_A19 +#define PF9 PIN_A20 +#define PF10 PIN_A21 +#define PF11 PIN_A22 +#define PF12 PIN_A23 +#define PF13 PIN_A24 +#define PF14 PIN_A25 +#define PF15 93 +#define PG0 94 +#define PG1 95 +#define PG2 96 +#define PG3 97 +#define PG4 98 +#define PG5 99 +#define PG6 100 +#define PG7 101 +#define PG8 102 +#define PG9 103 +#define PG10 104 +#define PG11 105 +#define PG12 106 +#define PG13 107 +#define PG14 108 +#define PG15 109 +#define PH0 110 +#define PH1 111 +#define PC2_C PIN_A26 +#define PC3_C PIN_A27 + +// Alternate pins number +#define PA0_ALT1 (PA0 | ALT1) +#define PA1_ALT1 (PA1 | ALT1) +#define PA1_ALT2 (PA1 | ALT2) +#define PA2_ALT1 (PA2 | ALT1) +#define PA2_ALT2 (PA2 | ALT2) +#define PA3_ALT1 (PA3 | ALT1) +#define PA3_ALT2 (PA3 | ALT2) +#define PA4_ALT1 (PA4 | ALT1) +#define PA4_ALT2 (PA4 | ALT2) +#define PA5_ALT1 (PA5 | ALT1) +#define PA6_ALT1 (PA6 | ALT1) +#define PA7_ALT1 (PA7 | ALT1) +#define PA7_ALT2 (PA7 | ALT2) +#define PA7_ALT3 (PA7 | ALT3) +#define PA8_ALT1 (PA8 | ALT1) +#define PA9_ALT1 (PA9 | ALT1) +#define PA10_ALT1 (PA10 | ALT1) +#define PA11_ALT1 (PA11 | ALT1) +#define PA12_ALT1 (PA12 | ALT1) +#define PA15_ALT1 (PA15 | ALT1) +#define PA15_ALT2 (PA15 | ALT2) +#define PB0_ALT1 (PB0 | ALT1) +#define PB0_ALT2 (PB0 | ALT2) +#define PB1_ALT1 (PB1 | ALT1) +#define PB1_ALT2 (PB1 | ALT2) +#define PB3_ALT1 (PB3 | ALT1) +#define PB3_ALT2 (PB3 | ALT2) +#define PB4_ALT1 (PB4 | ALT1) +#define PB4_ALT2 (PB4 | ALT2) +#define PB5_ALT1 (PB5 | ALT1) +#define PB5_ALT2 (PB5 | ALT2) +#define PB6_ALT1 (PB6 | ALT1) +#define PB6_ALT2 (PB6 | ALT2) +#define PB7_ALT1 (PB7 | ALT1) +#define PB8_ALT1 (PB8 | ALT1) +#define PB8_ALT2 (PB8 | ALT2) +#define PB9_ALT1 (PB9 | ALT1) +#define PB9_ALT2 (PB9 | ALT2) +#define PB14_ALT1 (PB14 | ALT1) +#define PB14_ALT2 (PB14 | ALT2) +#define PB15_ALT1 (PB15 | ALT1) +#define PB15_ALT2 (PB15 | ALT2) +#define PC0_ALT1 (PC0 | ALT1) +#define PC0_ALT2 (PC0 | ALT2) +#define PC1_ALT1 (PC1 | ALT1) +#define PC1_ALT2 (PC1 | ALT2) +#define PC4_ALT1 (PC4 | ALT1) +#define PC5_ALT1 (PC5 | ALT1) +#define PC6_ALT1 (PC6 | ALT1) +#define PC6_ALT2 (PC6 | ALT2) +#define PC7_ALT1 (PC7 | ALT1) +#define PC7_ALT2 (PC7 | ALT2) +#define PC8_ALT1 (PC8 | ALT1) +#define PC9_ALT1 (PC9 | ALT1) +#define PC10_ALT1 (PC10 | ALT1) +#define PC11_ALT1 (PC11 | ALT1) +#define PF0_ALT1 (PF0 | ALT1) +#define PF1_ALT1 (PF1 | ALT1) +#define PF6_ALT1 (PF6 | ALT1) +#define PF7_ALT1 (PF7 | ALT1) +#define PF8_ALT1 (PF8 | ALT1) +#define PF8_ALT2 (PF8 | ALT2) +#define PF9_ALT1 (PF9 | ALT1) +#define PF9_ALT2 (PF9 | ALT2) +#define PG13_ALT1 (PG13 | ALT1) + +#define NUM_DIGITAL_PINS 114 +#define NUM_DUALPAD_PINS 2 +#define NUM_ANALOG_INPUTS 28 +#define NUM_ANALOG_FIRST PA0 + +// On-board LED pin number +#ifndef LED_BUILTIN + #define LED_BUILTIN PNUM_NOT_DEFINED +#endif + +// On-board user button +#ifndef USER_BTN + #define USER_BTN PNUM_NOT_DEFINED +#endif + +// SPI definitions +#ifndef PIN_SPI_SS + #define PIN_SPI_SS PA4 +#endif +#ifndef PIN_SPI_SS1 + #define PIN_SPI_SS1 PA15 +#endif +#ifndef PIN_SPI_SS2 + #define PIN_SPI_SS2 PG10 +#endif +#ifndef PIN_SPI_SS3 + #define PIN_SPI_SS3 PNUM_NOT_DEFINED +#endif +#ifndef PIN_SPI_MOSI + #define PIN_SPI_MOSI PA7 +#endif +#ifndef PIN_SPI_MISO + #define PIN_SPI_MISO PA6 +#endif +#ifndef PIN_SPI_SCK + #define PIN_SPI_SCK PA5 +#endif + +// I2C definitions +#ifndef PIN_WIRE_SDA + #define PIN_WIRE_SDA PB7 +#endif +#ifndef PIN_WIRE_SCL + #define PIN_WIRE_SCL PB6 +#endif + +// Timer Definitions +// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin +#ifndef TIMER_TONE + #define TIMER_TONE TIM6 +#endif +#ifndef TIMER_SERVO + #define TIMER_SERVO TIM7 +#endif + +// UART Definitions +#ifndef SERIAL_UART_INSTANCE + #define SERIAL_UART_INSTANCE 4 +#endif + +// Default pin used for generic 'Serial' instance +// Mandatory for Firmata +#ifndef PIN_SERIAL_RX + #define PIN_SERIAL_RX PA1 +#endif +#ifndef PIN_SERIAL_TX + #define PIN_SERIAL_TX PA0 +#endif + +// Extra HAL modules +#if !defined(HAL_DAC_MODULE_DISABLED) + #define HAL_DAC_MODULE_ENABLED +#endif +#if !defined(HAL_ETH_MODULE_DISABLED) + #define HAL_ETH_MODULE_ENABLED +#endif +#if !defined(HAL_OSPI_MODULE_DISABLED) + #define HAL_OSPI_MODULE_ENABLED +#endif +#if !defined(HAL_SD_MODULE_DISABLED) + #define HAL_SD_MODULE_ENABLED +#endif + +/*---------------------------------------------------------------------------- + * Arduino objects - C++ only + *----------------------------------------------------------------------------*/ + +#ifdef __cplusplus + // These serial port names are intended to allow libraries and architecture-neutral + // sketches to automatically default to the correct port name for a particular type + // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, + // the first hardware serial port whose RX/TX pins are not dedicated to another use. + // + // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor + // + // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial + // + // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library + // + // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. + // + // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX + // pins are NOT connected to anything by default. + #ifndef SERIAL_PORT_MONITOR + #define SERIAL_PORT_MONITOR Serial + #endif + #ifndef SERIAL_PORT_HARDWARE + #define SERIAL_PORT_HARDWARE Serial + #endif +#endif diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index cdc2a29c8002..0a66f6d91e57 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -130,3 +130,10 @@ debug_tool = cmsis-dap [env:STM32H723ZE_btt] extends = STM32H723Zx_btt board = marlin_STM32H723ZE + +# +# BigTreeTech Kraken V1.0 (STM32H723ZGT6 ARM Cortex-M7) +# +[env:STM32H723ZG_btt] +extends = STM32H723Zx_btt +board = marlin_STM32H723ZG From bd36644d85bef0ff02f701203365ce16c5db3dc0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 26 Dec 2023 17:52:46 -0600 Subject: [PATCH 38/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Move?= =?UTF-8?q?=20U8G=20defines=20to=20HALs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/AVR/u8g/LCD_defines.h | 29 +++++ Marlin/src/HAL/DUE/u8g/LCD_defines.h | 34 ++++++ .../u8g_com_HAL_DUE_shared_hw_spi.cpp | 0 .../u8g_com_HAL_DUE_st7920_sw_spi.cpp | 0 .../{dogm => u8g}/u8g_com_HAL_DUE_sw_spi.cpp | 0 .../u8g_com_HAL_DUE_sw_spi_shared.cpp | 0 .../u8g_com_HAL_DUE_sw_spi_shared.h | 0 Marlin/src/HAL/ESP32/inc/Conditionals_LCD.h | 4 + Marlin/src/HAL/ESP32/u8g/LCD_defines.h | 29 +++++ Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp | 8 +- Marlin/src/HAL/HC32/u8g/LCD_defines.h | 26 ++++ Marlin/src/HAL/LINUX/u8g/LCD_defines.h | 26 ++++ Marlin/src/HAL/LPC1768/Servo.h | 1 - Marlin/src/HAL/LPC1768/u8g/LCD_defines.h | 33 +++--- .../u8g/u8g_com_HAL_LPC1768_hw_spi.cpp | 1 - .../u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 1 - .../u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp | 1 - .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 8 +- Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h | 20 +--- .../NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp | 4 +- Marlin/src/HAL/SAMD21/u8g/LCD_defines.h | 14 +-- Marlin/src/HAL/SAMD51/u8g/LCD_defines.h | 29 +++++ Marlin/src/HAL/STM32/u8g/LCD_defines.h | 32 +++++ .../STM32F1/dogm/u8g_com_stm32duino_swspi.cpp | 8 +- Marlin/src/HAL/STM32F1/u8g/LCD_defines.h | 34 ++++++ Marlin/src/HAL/TEENSY31_32/u8g/LCD_defines.h | 26 ++++ Marlin/src/HAL/TEENSY35_36/u8g/LCD_defines.h | 26 ++++ Marlin/src/HAL/TEENSY40_41/u8g/LCD_defines.h | 26 ++++ Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 112 +++--------------- .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 8 +- 30 files changed, 376 insertions(+), 164 deletions(-) create mode 100644 Marlin/src/HAL/AVR/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/DUE/u8g/LCD_defines.h rename Marlin/src/HAL/DUE/{dogm => u8g}/u8g_com_HAL_DUE_shared_hw_spi.cpp (100%) rename Marlin/src/HAL/DUE/{dogm => u8g}/u8g_com_HAL_DUE_st7920_sw_spi.cpp (100%) rename Marlin/src/HAL/DUE/{dogm => u8g}/u8g_com_HAL_DUE_sw_spi.cpp (100%) rename Marlin/src/HAL/DUE/{dogm => u8g}/u8g_com_HAL_DUE_sw_spi_shared.cpp (100%) rename Marlin/src/HAL/DUE/{dogm => u8g}/u8g_com_HAL_DUE_sw_spi_shared.h (100%) create mode 100644 Marlin/src/HAL/ESP32/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/HC32/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/LINUX/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/SAMD51/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/STM32/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/STM32F1/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/TEENSY31_32/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/TEENSY35_36/u8g/LCD_defines.h create mode 100644 Marlin/src/HAL/TEENSY40_41/u8g/LCD_defines.h diff --git a/Marlin/src/HAL/AVR/u8g/LCD_defines.h b/Marlin/src/HAL/AVR/u8g/LCD_defines.h new file mode 100644 index 000000000000..91858c0dbf5c --- /dev/null +++ b/Marlin/src/HAL/AVR/u8g/LCD_defines.h @@ -0,0 +1,29 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * AVR LCD-specific defines + */ + +uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn diff --git a/Marlin/src/HAL/DUE/u8g/LCD_defines.h b/Marlin/src/HAL/DUE/u8g/LCD_defines.h new file mode 100644 index 000000000000..e85f13514f6c --- /dev/null +++ b/Marlin/src/HAL/DUE/u8g/LCD_defines.h @@ -0,0 +1,34 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * DUE (SAM3X8E) LCD-specific defines + */ + +uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + +#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn +#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn +#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_shared_hw_spi.cpp b/Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_shared_hw_spi.cpp similarity index 100% rename from Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_shared_hw_spi.cpp rename to Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_shared_hw_spi.cpp diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_st7920_sw_spi.cpp similarity index 100% rename from Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_st7920_sw_spi.cpp rename to Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_st7920_sw_spi.cpp diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi.cpp b/Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi.cpp similarity index 100% rename from Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi.cpp rename to Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi.cpp diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp b/Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi_shared.cpp similarity index 100% rename from Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.cpp rename to Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi_shared.cpp diff --git a/Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.h b/Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi_shared.h similarity index 100% rename from Marlin/src/HAL/DUE/dogm/u8g_com_HAL_DUE_sw_spi_shared.h rename to Marlin/src/HAL/DUE/u8g/u8g_com_HAL_DUE_sw_spi_shared.h diff --git a/Marlin/src/HAL/ESP32/inc/Conditionals_LCD.h b/Marlin/src/HAL/ESP32/inc/Conditionals_LCD.h index 5f1c4b16019d..07d2efe0bdbd 100644 --- a/Marlin/src/HAL/ESP32/inc/Conditionals_LCD.h +++ b/Marlin/src/HAL/ESP32/inc/Conditionals_LCD.h @@ -20,3 +20,7 @@ * */ #pragma once + +#if ANY(MKS_MINI_12864, FYSETC_MINI_12864_2_1) + #define U8G_HW_SPI_ESP32 1 +#endif diff --git a/Marlin/src/HAL/ESP32/u8g/LCD_defines.h b/Marlin/src/HAL/ESP32/u8g/LCD_defines.h new file mode 100644 index 000000000000..3696d60d7ca3 --- /dev/null +++ b/Marlin/src/HAL/ESP32/u8g/LCD_defines.h @@ -0,0 +1,29 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * ESP32 LCD-specific defines + */ + +uint8_t u8g_esp32_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +#define U8G_COM_HAL_HW_SPI_FN u8g_esp32_hw_spi_fn diff --git a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp index 012604dbfb8b..a4c1980adc73 100644 --- a/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp +++ b/Marlin/src/HAL/ESP32/u8g_esp32_spi.cpp @@ -25,7 +25,7 @@ #include "../../inc/MarlinConfig.h" -#if ANY(MKS_MINI_12864, FYSETC_MINI_12864_2_1) +#if U8G_HW_SPI_ESP32 #include #include "../shared/HAL_SPI.h" @@ -41,7 +41,6 @@ static SPISettings spiConfig; - #ifndef LCD_SPI_SPEED #ifdef SD_SPI_SPEED #define LCD_SPI_SPEED SD_SPI_SPEED // Assume SPI speed shared with SD @@ -50,7 +49,7 @@ static SPISettings spiConfig; #endif #endif -uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { +uint8_t u8g_esp32_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT #if ENABLED(PAUSE_LCD_FOR_BUSY_SD) @@ -101,6 +100,5 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt return 1; } -#endif // MKS_MINI_12864 || FYSETC_MINI_12864_2_1 - +#endif // U8G_HW_SPI_ESP32 #endif // ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HC32/u8g/LCD_defines.h b/Marlin/src/HAL/HC32/u8g/LCD_defines.h new file mode 100644 index 000000000000..8dc94bca7f3f --- /dev/null +++ b/Marlin/src/HAL/HC32/u8g/LCD_defines.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * HC32 LCD-specific defines + */ diff --git a/Marlin/src/HAL/LINUX/u8g/LCD_defines.h b/Marlin/src/HAL/LINUX/u8g/LCD_defines.h new file mode 100644 index 000000000000..6caa0240cad0 --- /dev/null +++ b/Marlin/src/HAL/LINUX/u8g/LCD_defines.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * Linux LCD-specific defines + */ diff --git a/Marlin/src/HAL/LPC1768/Servo.h b/Marlin/src/HAL/LPC1768/Servo.h index f02f503a67da..221001c9483c 100644 --- a/Marlin/src/HAL/LPC1768/Servo.h +++ b/Marlin/src/HAL/LPC1768/Servo.h @@ -39,7 +39,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#pragma once /** * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - diff --git a/Marlin/src/HAL/LPC1768/u8g/LCD_defines.h b/Marlin/src/HAL/LPC1768/u8g/LCD_defines.h index d2260037b6a7..5b58f1223ab5 100644 --- a/Marlin/src/HAL/LPC1768/u8g/LCD_defines.h +++ b/Marlin/src/HAL/LPC1768/u8g/LCD_defines.h @@ -25,25 +25,22 @@ * LPC1768 LCD-specific defines */ -// The following are optional depending on the platform. +#ifndef U8G_HAL_LINKS -// definitions of HAL specific com and device drivers. -uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn // See U8glib-HAL +#else -// connect U8g com generic com names to the desired driver -#define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn // use LPC1768 specific hardware SPI routine -#define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn // use LPC1768 specific software SPI routine -#define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn -#define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn -#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn + uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -// let these default for now -#define U8G_COM_PARALLEL u8g_com_null_fn -#define U8G_COM_T6963 u8g_com_null_fn -#define U8G_COM_FAST_PARALLEL u8g_com_null_fn -#define U8G_COM_UC_I2C u8g_com_null_fn + #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn + #define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_LPC1768_hw_spi_fn + #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn + #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn + #define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn + +#endif diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp index 0118f92847de..406fc4840c21 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -125,5 +125,4 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, } #endif // HAS_MARLINUI_U8GLIB - #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index bf76eaf0f491..3dea365ac7b8 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -194,5 +194,4 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v } #endif // HAS_MARLINUI_U8GLIB - #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp index ce7b33801931..c029dc068013 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_st7920_hw_spi.cpp @@ -134,5 +134,4 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar } #endif // HAS_MARLINUI_U8GLIB - #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index f6ed7b0e7e8a..4edd0d38861e 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -131,7 +131,7 @@ uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck static uint8_t SPI_speed = 0; -static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { +static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); #else @@ -176,13 +176,13 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, break; case U8G_COM_MSG_WRITE_BYTE: - u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val); + u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val); break; case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { - u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++); + u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++); arg_val--; } } @@ -191,7 +191,7 @@ uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { - u8g_sw_spi_HAL_LPC1768_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr)); + u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr)); ptr++; arg_val--; } diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h index 2a50eddcd407..63701ca334ed 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h @@ -21,22 +21,14 @@ */ #pragma once +/** + * Native/Simulator LCD-specific defines + */ + void usleep(uint64_t microsec); -// The following are optional depending on the platform. -// definitions of HAL specific com and device drivers. uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); -// connect U8g com generic com names to the desired driver -#define U8G_COM_SW_SPI u8g_com_sw_spi_fn -#define U8G_COM_ST7920_SW_SPI u8g_com_ST7920_sw_spi_fn - -// let these default for now -#define U8G_COM_HW_SPI u8g_com_null_fn -#define U8G_COM_ST7920_HW_SPI u8g_com_null_fn -#define U8G_COM_SSD_I2C u8g_com_null_fn -#define U8G_COM_PARALLEL u8g_com_null_fn -#define U8G_COM_T6963 u8g_com_null_fn -#define U8G_COM_FAST_PARALLEL u8g_com_null_fn -#define U8G_COM_UC_I2C u8g_com_null_fn +#define U8G_COM_HAL_SW_SPI_FN u8g_com_sw_spi_fn +#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_ST7920_sw_spi_fn diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp index a3254774bfdf..46f2798afaa6 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/u8g_com_st7920_sw_spi.cpp @@ -100,6 +100,7 @@ static void u8g_com_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) { swSpiTransfer(val & 0x0F0, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); swSpiTransfer(val << 4, SPI_speed, SCK_pin_ST7920_HAL, -1, MOSI_pin_ST7920_HAL_HAL); } + #ifdef __cplusplus extern "C" { #endif @@ -128,7 +129,7 @@ uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void break; case U8G_COM_MSG_RESET: - if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val); + if (U8G_PIN_NONE != u8g->pin_list[U8G_PI_RESET]) u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val); break; case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ @@ -163,6 +164,7 @@ uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void } return 1; } + #ifdef __cplusplus } #endif diff --git a/Marlin/src/HAL/SAMD21/u8g/LCD_defines.h b/Marlin/src/HAL/SAMD21/u8g/LCD_defines.h index fa98725d2262..d6fe93117bd7 100644 --- a/Marlin/src/HAL/SAMD21/u8g/LCD_defines.h +++ b/Marlin/src/HAL/SAMD21/u8g/LCD_defines.h @@ -19,23 +19,11 @@ * along with this program. If not, see . * */ - -/** - * SAMD21 HAL developed by Bart Meijer (brupje) - * Based on SAMD51 HAL by Giuliano Zaro (AKA GMagician) - */ #pragma once /** * SAMD21 LCD-specific defines */ -// The following are optional depending on the platform. - -// definitions of HAL specific com and device drivers. -uint8_t u8g_com_samd21_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - -// connect U8g com generic com names to the desired driver -#define U8G_COM_HW_SPI u8g_com_samd21_st7920_hw_spi_fn // use SAMD21 specific hardware SPI routine -#define U8G_COM_ST7920_HW_SPI u8g_com_samd21_st7920_hw_spi_fn +#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd21_st7920_hw_spi_fn diff --git a/Marlin/src/HAL/SAMD51/u8g/LCD_defines.h b/Marlin/src/HAL/SAMD51/u8g/LCD_defines.h new file mode 100644 index 000000000000..658a2c0fc1c5 --- /dev/null +++ b/Marlin/src/HAL/SAMD51/u8g/LCD_defines.h @@ -0,0 +1,29 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * SAMD51 LCD-specific defines + */ + +#define U8G_COM_HAL_HW_SPI_FN u8g_com_samd51_hw_spi_fn // See U8glib-HAL +#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd51_st7920_hw_spi_fn // See U8glib-HAL diff --git a/Marlin/src/HAL/STM32/u8g/LCD_defines.h b/Marlin/src/HAL/STM32/u8g/LCD_defines.h new file mode 100644 index 000000000000..35f1674d69dc --- /dev/null +++ b/Marlin/src/HAL/STM32/u8g/LCD_defines.h @@ -0,0 +1,32 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * STM32 LCD-specific defines + */ + +uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL +uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL + +#define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn +#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn diff --git a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp index c57350aa2efd..fc421897c4ec 100644 --- a/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp +++ b/Marlin/src/HAL/STM32F1/dogm/u8g_com_stm32duino_swspi.cpp @@ -88,7 +88,7 @@ static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, c return b; } -static void u8g_sw_spi_HAL_STM32F1_shift_out(uint8_t val) { +static void u8g_sw_spi_shift_out(uint8_t val) { #if ENABLED(FYSETC_MINI_12864) swSpiTransfer_mode_3(val, SPI_speed); #else @@ -139,13 +139,13 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, break; case U8G_COM_MSG_WRITE_BYTE: - u8g_sw_spi_HAL_STM32F1_shift_out(arg_val); + u8g_sw_spi_shift_out(arg_val); break; case U8G_COM_MSG_WRITE_SEQ: { uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { - u8g_sw_spi_HAL_STM32F1_shift_out(*ptr++); + u8g_sw_spi_shift_out(*ptr++); arg_val--; } } break; @@ -153,7 +153,7 @@ uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, case U8G_COM_MSG_WRITE_SEQ_P: { uint8_t *ptr = (uint8_t *)arg_ptr; while (arg_val > 0) { - u8g_sw_spi_HAL_STM32F1_shift_out(u8g_pgm_read(ptr)); + u8g_sw_spi_shift_out(u8g_pgm_read(ptr)); ptr++; arg_val--; } diff --git a/Marlin/src/HAL/STM32F1/u8g/LCD_defines.h b/Marlin/src/HAL/STM32F1/u8g/LCD_defines.h new file mode 100644 index 000000000000..4bd461cb39d2 --- /dev/null +++ b/Marlin/src/HAL/STM32F1/u8g/LCD_defines.h @@ -0,0 +1,34 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * STM32F1 (Maple) LCD-specific defines + */ + +uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); // See U8glib-HAL + +#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn +#define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn // See U8glib-HAL +#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn // See U8glib-HAL +#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn // See U8glib-HAL diff --git a/Marlin/src/HAL/TEENSY31_32/u8g/LCD_defines.h b/Marlin/src/HAL/TEENSY31_32/u8g/LCD_defines.h new file mode 100644 index 000000000000..a13e7e837f25 --- /dev/null +++ b/Marlin/src/HAL/TEENSY31_32/u8g/LCD_defines.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * Teensy 3.1/3.2 LCD-specific defines + */ diff --git a/Marlin/src/HAL/TEENSY35_36/u8g/LCD_defines.h b/Marlin/src/HAL/TEENSY35_36/u8g/LCD_defines.h new file mode 100644 index 000000000000..511085781cca --- /dev/null +++ b/Marlin/src/HAL/TEENSY35_36/u8g/LCD_defines.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * Teensy 3.5/3.6 LCD-specific defines + */ diff --git a/Marlin/src/HAL/TEENSY40_41/u8g/LCD_defines.h b/Marlin/src/HAL/TEENSY40_41/u8g/LCD_defines.h new file mode 100644 index 000000000000..349f8c039913 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/u8g/LCD_defines.h @@ -0,0 +1,26 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +/** + * Teensy 4.0/4.1 LCD-specific defines + */ diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 6df641315895..a70e2b7b8b66 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -21,117 +21,35 @@ */ #pragma once -// Use this file to select the com driver for device drivers that are NOT in the U8G library +/** + * Assign custom or standard U8G device drivers + */ #include -#ifndef U8G_HAL_LINKS // Defined by LPC1768/9 environments in platform.ini - - #ifdef __SAM3X8E__ - - uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn - #define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn - - #elif defined(__SAMD51__) - - #define U8G_COM_HAL_HW_SPI_FN u8g_com_samd51_hw_spi_fn - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd51_st7920_hw_spi_fn - - #elif defined(__SAMD21__) - - uint8_t u8g_com_samd21_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_samd21_st7920_hw_spi_fn - - #elif defined(__STM32F1__) - - uint8_t u8g_com_HAL_STM32F1_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_STM32F1_sw_spi_fn - #define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_std_sw_spi_fn - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_stm32duino_hw_spi_fn - - #elif defined(ARDUINO_ARCH_STM32) - - uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_stm32duino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_std_sw_spi_fn - #define U8G_COM_HAL_HW_SPI_FN u8g_com_stm32duino_hw_spi_fn - - #elif defined(ESP32) +#include HAL_PATH(../.., u8g/LCD_defines.h) - uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_HW_SPI_FN u8g_eps_hw_spi_fn - - #elif defined(__AVR__) - - uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn - - #endif - - #ifndef U8G_COM_HAL_SW_SPI_FN - #define U8G_COM_HAL_SW_SPI_FN u8g_com_arduino_std_sw_spi_fn - #endif - #ifndef U8G_COM_HAL_HW_SPI_FN - #define U8G_COM_HAL_HW_SPI_FN u8g_com_arduino_hw_spi_fn - #endif - #ifndef U8G_COM_ST7920_HAL_SW_SPI - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_arduino_st7920_spi_fn - #endif - #ifndef U8G_COM_ST7920_HAL_HW_SPI - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn - #endif - - // This can't be invoked from the current platformio.ini - #ifdef TARGET_LPC1768 - uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #endif - - #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn - -#elif defined(TARGET_LPC1768) - - uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn - #define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_LPC1768_hw_spi_fn - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn - #define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn - -#elif defined(__PLAT_NATIVE_SIM__) - uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_SW_SPI_FN u8g_com_sw_spi_fn - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_ST7920_sw_spi_fn +#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT + uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + #define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn #endif +// U8G_HAL_LINKS is defined for LPC1768/9 and Native envs by -DU8G_HAL_LINKS in platform.ini #ifndef U8G_COM_HAL_SW_SPI_FN - #define U8G_COM_HAL_SW_SPI_FN u8g_com_null_fn + #define U8G_COM_HAL_SW_SPI_FN TERN(U8G_HAL_LINKS, u8g_com_null_fn, u8g_com_arduino_std_sw_spi_fn) #endif #ifndef U8G_COM_HAL_HW_SPI_FN - #define U8G_COM_HAL_HW_SPI_FN u8g_com_null_fn + #define U8G_COM_HAL_HW_SPI_FN TERN(U8G_HAL_LINKS, u8g_com_null_fn, u8g_com_arduino_hw_spi_fn) #endif #ifndef U8G_COM_ST7920_HAL_SW_SPI - #define U8G_COM_ST7920_HAL_SW_SPI u8g_com_null_fn + #define U8G_COM_ST7920_HAL_SW_SPI TERN(U8G_HAL_LINKS, u8g_com_null_fn, u8g_com_arduino_st7920_spi_fn) #endif #ifndef U8G_COM_ST7920_HAL_HW_SPI - #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_null_fn + #define U8G_COM_ST7920_HAL_HW_SPI TERN(U8G_HAL_LINKS, u8g_com_null_fn, u8g_com_arduino_st7920_hw_spi_fn) #endif #ifndef U8G_COM_SSD_I2C_HAL - #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn + #define U8G_COM_SSD_I2C_HAL TERN(U8G_HAL_LINKS, u8g_com_null_fn, u8g_com_arduino_ssd_i2c_fn) #endif -#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT - uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn -#else - #define U8G_COM_HAL_TFT_FN u8g_com_null_fn +#ifndef U8G_COM_HAL_TFT_FN + #define U8G_COM_HAL_TFT_FN u8g_com_null_fn #endif diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp index e844eee25183..11cd7b14ba55 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -20,12 +20,12 @@ * */ -// NOTE - the HAL version of the rrd device uses a generic ST7920 device. See the -// file u8g_dev_st7920_128x64_HAL.cpp for the HAL version. +// NOTE - the HAL version of the rrd device uses a generic ST7920 device. +// See u8g_dev_st7920_128x64_HAL.cpp for the HAL version. #include "../../inc/MarlinConfigPre.h" -#if !defined(U8G_HAL_LINKS) && ANY(__AVR__, ARDUINO_ARCH_STM32, ARDUINO_ARCH_ESP32) +#if ANY(__AVR__, ARDUINO_ARCH_STM32, ARDUINO_ARCH_ESP32) #include "../../inc/MarlinConfig.h" @@ -193,4 +193,4 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8 #endif #endif // IS_U8GLIB_ST7920 -#endif // !U8G_HAL_LINKS && (__AVR__ || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_ESP32) +#endif // __AVR__ || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_ESP32 From 38406634107fe90c4be452858d17eed541129b09 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 27 Dec 2023 00:28:24 +0000 Subject: [PATCH 39/73] [cron] Bump distribution date (2023-12-27) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 2d207e80dc8c..3694a91972c5 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-26" +//#define STRING_DISTRIBUTION_DATE "2023-12-27" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 7f25f5fe3ad5..cef0c4cd8fb8 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-26" + #define STRING_DISTRIBUTION_DATE "2023-12-27" #endif /** From 858954baad45b0edb31429a2b50a5fff9c4067fe Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Dec 2023 00:13:26 -0600 Subject: [PATCH 40/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Updat?= =?UTF-8?q?e=20Uncrustify=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/uncrust | 3 +- .../share/extras/{header.h => file_header.h} | 2 +- buildroot/share/extras/func_header.h | 5 + buildroot/share/extras/uncrustify.cfg | 3723 ++++++++++++++++- 4 files changed, 3649 insertions(+), 84 deletions(-) rename buildroot/share/extras/{header.h => file_header.h} (92%) create mode 100644 buildroot/share/extras/func_header.h diff --git a/buildroot/bin/uncrust b/buildroot/bin/uncrust index 7898f73c8c77..7c894174b8b5 100755 --- a/buildroot/bin/uncrust +++ b/buildroot/bin/uncrust @@ -4,9 +4,10 @@ # TMPDIR=`mktemp -d` +HERE=`dirname "$0"` # Reformat a single file to tmp/ -if uncrustify -l CPP -c ./buildroot/share/extras/uncrustify.cfg -f "$1" >$TMPDIR/uncrustify.out ; then +if uncrustify -l CPP -c "$HERE/../share/extras/uncrustify.cfg" -f "$1" >$TMPDIR/uncrustify.out ; then cp "$TMPDIR/uncrustify.out" "$1" ; # Replace the original file else echo "Something went wrong with uncrustify." diff --git a/buildroot/share/extras/header.h b/buildroot/share/extras/file_header.h similarity index 92% rename from buildroot/share/extras/header.h rename to buildroot/share/extras/file_header.h index e40471dface9..0c868aebb36f 100644 --- a/buildroot/share/extras/header.h +++ b/buildroot/share/extras/file_header.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/buildroot/share/extras/func_header.h b/buildroot/share/extras/func_header.h new file mode 100644 index 000000000000..bc1eff10d573 --- /dev/null +++ b/buildroot/share/extras/func_header.h @@ -0,0 +1,5 @@ +/** + * $(function) : Description pending + * + * $(javaparam) + */ diff --git a/buildroot/share/extras/uncrustify.cfg b/buildroot/share/extras/uncrustify.cfg index 82044f8c7b9a..f332d2daf416 100644 --- a/buildroot/share/extras/uncrustify.cfg +++ b/buildroot/share/extras/uncrustify.cfg @@ -1,84 +1,3643 @@ # # Uncrustify Configuration File -# File Created With UncrustifyX 0.4.3 (252) -# -align_assign_span = 1 -cmt_cpp_to_c = false -cmt_indent_multi = false -cmt_insert_file_header = "./header.h" -cmt_reflow_mode = 1 -cmt_sp_after_star_cont = 1 -cmt_sp_before_star_cont = 1 -cmt_star_cont = true -eat_blanks_after_open_brace = false -eat_blanks_before_close_brace = false -indent_align_assign = false -indent_case_brace = 0 -indent_columns = 2 -indent_cpp_lambda_body = false -indent_func_call_param = true -indent_func_def_param = true -indent_switch_case = 2 -indent_with_tabs = 0 -input_tab_size = 2 -mod_add_long_ifdef_else_comment = 40 -mod_add_long_ifdef_endif_comment = 40 -mod_full_brace_do = false -mod_full_brace_for = false -mod_full_brace_if = false -mod_full_brace_if_chain = 1 -mod_full_brace_while = false -mod_remove_extra_semicolon = true -newlines = lf -nl_after_brace_close = true -nl_after_brace_open = true -nl_assign_leave_one_liners = true -nl_brace_else = add -nl_class_leave_one_liners = true -nl_create_for_one_liner = true -nl_create_if_one_liner = false -nl_create_while_one_liner = true -nl_else_brace = remove -nl_end_of_file = add -nl_enum_brace = remove -nl_enum_leave_one_liners = true -nl_fdef_brace = remove -nl_for_brace = remove -nl_func_leave_one_liners = true -nl_getset_leave_one_liners = true -nl_if_brace = remove -nl_if_leave_one_liners = true -nl_multi_line_sparen_close = add -nl_squeeze_ifdef = false -nl_struct_brace = remove -nl_switch_brace = remove -nl_union_brace = remove -pp_define_at_level = true -pp_if_indent_code = true -pp_indent = add -pp_indent_at_level = true -pp_indent_count = 2 -pp_indent_if = 0 -sp_after_comma = add -sp_after_semi = add -sp_after_sparen = add -sp_arith = add -sp_assign = add -sp_assign_default = remove -sp_before_comma = remove -sp_before_sparen = add -sp_bool = add -sp_brace_else = add -sp_cmt_cpp_start = add -sp_compare = add -sp_cond_colon = add -sp_cond_question = add -sp_else_brace = add -sp_endif_cmt = true -sp_fparen_brace = add -sp_func_call_paren = remove -sp_func_proto_paren = remove -sp_inside_sparen = remove -sp_inside_square = remove -sp_paren_brace = add -sp_paren_paren = remove +# Created with Uncrustify 0.77.1_f +# + +# +# General options +# + +# The type of line endings. +# +# Default: auto +newlines = lf # lf/crlf/cr/auto + +# The original size of tabs in the input. +# +# Default: 8 +input_tab_size = 2 # unsigned number + +# The size of tabs in the output (only used if align_with_tabs=true). +# +# Default: 8 +output_tab_size = 8 # unsigned number + +# The ASCII value of the string escape char, usually 92 (\) or (Pawn) 94 (^). +# +# Default: 92 +string_escape_char = 92 # unsigned number + +# Alternate string escape char (usually only used for Pawn). +# Only works right before the quote char. +string_escape_char2 = 0 # unsigned number + +# Replace tab characters found in string literals with the escape sequence \t +# instead. +string_replace_tab_chars = false # true/false + +# Allow interpreting '>=' and '>>=' as part of a template in code like +# 'void f(list>=val);'. If true, 'assert(x<0 && y>=3)' will be broken. +# Improvements to template detection may make this option obsolete. +tok_split_gte = false # true/false + +# Disable formatting of NL_CONT ('\\n') ended lines (e.g. multi-line macros). +disable_processing_nl_cont = false # true/false + +# Specify the marker used in comments to disable processing of part of the +# file. +# +# Default: *INDENT-OFF* +disable_processing_cmt = " *INDENT-OFF*" # string + +# Specify the marker used in comments to (re)enable processing in a file. +# +# Default: *INDENT-ON* +enable_processing_cmt = " *INDENT-ON*" # string + +# Enable parsing of digraphs. +enable_digraphs = false # true/false + +# Option to allow both disable_processing_cmt and enable_processing_cmt +# strings, if specified, to be interpreted as ECMAScript regular expressions. +# If true, a regex search will be performed within comments according to the +# specified patterns in order to disable/enable processing. +processing_cmt_as_regex = false # true/false + +# Add or remove the UTF-8 BOM (recommend 'remove'). +utf8_bom = ignore # ignore/add/remove/force/not_defined + +# If the file contains bytes with values between 128 and 255, but is not +# UTF-8, then output as UTF-8. +utf8_byte = false # true/false + +# Force the output encoding to UTF-8. +utf8_force = false # true/false + +# +# Spacing options +# + +# Add or remove space around non-assignment symbolic operators ('+', '/', '%', +# '<<', and so forth). +sp_arith = add # ignore/add/remove/force/not_defined + +# Add or remove space around arithmetic operators '+' and '-'. +# +# Overrides sp_arith. +sp_arith_additive = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around assignment operator '=', '+=', etc. +sp_assign = add # ignore/add/remove/force/not_defined + +# Add or remove space around '=' in C++11 lambda capture specifications. +# +# Overrides sp_assign. +sp_cpp_lambda_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the capture specification of a C++11 lambda when +# an argument list is present, as in '[] (int x){ ... }'. +sp_cpp_lambda_square_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the capture specification of a C++11 lambda with +# no argument list is present, as in '[] { ... }'. +sp_cpp_lambda_square_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the opening parenthesis and before the closing +# parenthesis of a argument list of a C++11 lambda, as in +# '[]( int x ){ ... }'. +sp_cpp_lambda_argument_list = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the argument list of a C++11 lambda, as in +# '[](int x) { ... }'. +sp_cpp_lambda_paren_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a lambda body and its call operator of an +# immediately invoked lambda, as in '[]( ... ){ ... } ( ... )'. +sp_cpp_lambda_fparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around assignment operator '=' in a prototype. +# +# If set to ignore, use sp_assign. +sp_assign_default = remove # ignore/add/remove/force/not_defined + +# Add or remove space before assignment operator '=', '+=', etc. +# +# Overrides sp_assign. +sp_before_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after assignment operator '=', '+=', etc. +# +# Overrides sp_assign. +sp_after_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space in 'enum {'. +# +# Default: add +sp_enum_brace = add # ignore/add/remove/force/not_defined + +# Add or remove space in 'NS_ENUM ('. +sp_enum_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around assignment '=' in enum. +sp_enum_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before assignment '=' in enum. +# +# Overrides sp_enum_assign. +sp_enum_before_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after assignment '=' in enum. +# +# Overrides sp_enum_assign. +sp_enum_after_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around assignment ':' in enum. +sp_enum_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around preprocessor '##' concatenation operator. +# +# Default: add +sp_pp_concat = add # ignore/add/remove/force/not_defined + +# Add or remove space after preprocessor '#' stringify operator. +# Also affects the '#@' charizing operator. +sp_pp_stringify = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before preprocessor '#' stringify operator +# as in '#define x(y) L#y'. +sp_before_pp_stringify = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around boolean operators '&&' and '||'. +sp_bool = add # ignore/add/remove/force/not_defined + +# Add or remove space around compare operator '<', '>', '==', etc. +sp_compare = add # ignore/add/remove/force/not_defined + +# Add or remove space inside '(' and ')'. +sp_inside_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between nested parentheses, i.e. '((' vs. ') )'. +sp_paren_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. +sp_cparen_oparen = ignore # ignore/add/remove/force/not_defined + +# Whether to balance spaces inside nested parentheses. +sp_balance_nested_parens = false # true/false + +# Add or remove space between ')' and '{'. +sp_paren_brace = add # ignore/add/remove/force/not_defined + +# Add or remove space between nested braces, i.e. '{{' vs. '{ {'. +sp_brace_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before pointer star '*'. +sp_before_ptr_star = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before pointer star '*' that isn't followed by a +# variable name. If set to ignore, sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a qualifier and a pointer star '*' that isn't +# followed by a variable name, as in '(char const *)'. If set to ignore, +# sp_before_ptr_star is used instead. +sp_qualifier_unnamed_ptr_star = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between pointer stars '*', as in 'int ***a;'. +sp_between_ptr_star = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after pointer star '*', if followed by a word. +# +# Overrides sp_type_func. +sp_after_ptr_star = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after pointer caret '^', if followed by a word. +sp_after_ptr_block_caret = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after pointer star '*', if followed by a qualifier. +sp_after_ptr_star_qualifier = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after a pointer star '*', if followed by a function +# prototype or function definition. +# +# Overrides sp_after_ptr_star and sp_type_func. +sp_after_ptr_star_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after a pointer star '*' in the trailing return of a +# function prototype or function definition. +sp_after_ptr_star_trailing = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the pointer star '*' and the name of the variable +# in a function pointer definition. +sp_ptr_star_func_var = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the pointer star '*' and the name of the type +# in a function pointer type definition. +sp_ptr_star_func_type = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after a pointer star '*', if followed by an open +# parenthesis, as in 'void* (*)()'. +sp_ptr_star_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a pointer star '*', if followed by a function +# prototype or function definition. If set to ignore, sp_before_ptr_star is +# used instead. +sp_before_ptr_star_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a qualifier and a pointer star '*' followed by +# the name of the function in a function prototype or definition, as in +# 'char const *foo()`. If set to ignore, sp_before_ptr_star is used instead. +sp_qualifier_ptr_star_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a pointer star '*' in the trailing return of a +# function prototype or function definition. +sp_before_ptr_star_trailing = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a qualifier and a pointer star '*' in the +# trailing return of a function prototype or function definition, as in +# 'auto foo() -> char const *'. +sp_qualifier_ptr_star_trailing = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a reference sign '&'. +sp_before_byref = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a reference sign '&' that isn't followed by a +# variable name. If set to ignore, sp_before_byref is used instead. +sp_before_unnamed_byref = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after reference sign '&', if followed by a word. +# +# Overrides sp_type_func. +sp_after_byref = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after a reference sign '&', if followed by a function +# prototype or function definition. +# +# Overrides sp_after_byref and sp_type_func. +sp_after_byref_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a reference sign '&', if followed by a function +# prototype or function definition. +sp_before_byref_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after a reference sign '&', if followed by an open +# parenthesis, as in 'char& (*)()'. +sp_byref_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between type and word. In cases where total removal of +# whitespace would be a syntax error, a value of 'remove' is treated the same +# as 'force'. +# +# This also affects some other instances of space following a type that are +# not covered by other options; for example, between the return type and +# parenthesis of a function type template argument, between the type and +# parenthesis of an array parameter, or between 'decltype(...)' and the +# following word. +# +# Default: force +sp_after_type = force # ignore/add/remove/force/not_defined + +# Add or remove space between 'decltype(...)' and word, +# brace or function call. +sp_after_decltype = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space before the parenthesis in the D constructs +# 'template Foo(' and 'class Foo('. +sp_before_template_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'template' and '<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before '<'. +sp_before_angle = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside '<' and '>'. +sp_inside_angle = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside '<>'. +sp_inside_angle_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '>' and ':'. +sp_angle_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after '>'. +sp_after_angle = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '>' and '(' as found in 'new List(foo);'. +sp_angle_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '>' and '()' as found in 'new List();'. +sp_angle_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '>' and a word as in 'List m;' or +# 'template static ...'. +sp_angle_word = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '>' and '>' in '>>' (template stuff). +# +# Default: add +sp_angle_shift = add # ignore/add/remove/force/not_defined + +# (C++11) Permit removal of the space between '>>' in 'foo >'. Note +# that sp_angle_shift cannot remove the space without this option. +sp_permit_cpp11_shift = false # true/false + +# Add or remove space before '(' of control statements ('if', 'for', 'switch', +# 'while', etc.). +sp_before_sparen = add # ignore/add/remove/force/not_defined + +# Add or remove space inside '(' and ')' of control statements other than +# 'for'. +sp_inside_sparen = remove # ignore/add/remove/force/not_defined + +# Add or remove space after '(' of control statements other than 'for'. +# +# Overrides sp_inside_sparen. +sp_inside_sparen_open = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before ')' of control statements other than 'for'. +# +# Overrides sp_inside_sparen. +sp_inside_sparen_close = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside '(' and ')' of 'for' statements. +sp_inside_for = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after '(' of 'for' statements. +# +# Overrides sp_inside_for. +sp_inside_for_open = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before ')' of 'for' statements. +# +# Overrides sp_inside_for. +sp_inside_for_close = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '((' or '))' of control statements. +sp_sparen_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after ')' of control statements. +sp_after_sparen = add # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and '{' of control statements. +sp_sparen_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'do' and '{'. +sp_do_brace_open = force # ignore/add/remove/force/not_defined + +# Add or remove space between '}' and 'while'. +sp_brace_close_while = force # ignore/add/remove/force/not_defined + +# Add or remove space between 'while' and '('. Overrides sp_before_sparen. +sp_while_paren_open = force # ignore/add/remove/force/not_defined + +# (D) Add or remove space between 'invariant' and '('. +sp_invariant_paren = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space after the ')' in 'invariant (C) c'. +sp_after_invariant_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before empty statement ';' on 'if', 'for' and 'while'. +sp_special_semi = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before ';'. +# +# Default: remove +sp_before_semi = remove # ignore/add/remove/force/not_defined + +# Add or remove space before ';' in non-empty 'for' statements. +sp_before_semi_for = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a semicolon of an empty left part of a for +# statement, as in 'for ( ; ; )'. +sp_before_semi_for_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the semicolons of an empty middle part of a for +# statement, as in 'for ( ; ; )'. +sp_between_semi_for_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after ';', except when followed by a comment. +# +# Default: add +sp_after_semi = add # ignore/add/remove/force/not_defined + +# Add or remove space after ';' in non-empty 'for' statements. +# +# Default: force +sp_after_semi_for = force # ignore/add/remove/force/not_defined + +# Add or remove space after the final semicolon of an empty part of a for +# statement, as in 'for ( ; ; )'. +sp_after_semi_for_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before '[' (except '[]'). +sp_before_square = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before '[' for a variable definition. +# +# Default: remove +sp_before_vardef_square = remove # ignore/add/remove/force/not_defined + +# Add or remove space before '[' for asm block. +sp_before_square_asm_block = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before '[]'. +sp_before_squares = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before C++17 structured bindings. +sp_cpp_before_struct_binding = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside a non-empty '[' and ']'. +sp_inside_square = remove # ignore/add/remove/force/not_defined + +# Add or remove space inside '[]'. +sp_inside_square_empty = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space inside a non-empty Objective-C boxed array '@[' and +# ']'. If set to ignore, sp_inside_square is used. +sp_inside_square_oc_array = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after ',', i.e. 'a,b' vs. 'a, b'. +sp_after_comma = add # ignore/add/remove/force/not_defined + +# Add or remove space before ',', i.e. 'a,b' vs. 'a ,b'. +# +# Default: remove +sp_before_comma = remove # ignore/add/remove/force/not_defined + +# (C#, Vala) Add or remove space between ',' and ']' in multidimensional array type +# like 'int[,,]'. +sp_after_mdatype_commas = ignore # ignore/add/remove/force/not_defined + +# (C#, Vala) Add or remove space between '[' and ',' in multidimensional array type +# like 'int[,,]'. +sp_before_mdatype_commas = ignore # ignore/add/remove/force/not_defined + +# (C#, Vala) Add or remove space between ',' in multidimensional array type +# like 'int[,,]'. +sp_between_mdatype_commas = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between an open parenthesis and comma, +# i.e. '(,' vs. '( ,'. +# +# Default: force +sp_paren_comma = force # ignore/add/remove/force/not_defined + +# Add or remove space between a type and ':'. +sp_type_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the variadic '...' when preceded by a +# non-punctuator. +# The value REMOVE will be overridden with FORCE +sp_after_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before the variadic '...' when preceded by a +# non-punctuator. +# The value REMOVE will be overridden with FORCE +sp_before_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a type and '...'. +sp_type_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a '*' and '...'. +sp_ptr_type_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and '...'. +sp_paren_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '&&' and '...'. +sp_byref_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and a qualifier such as 'const'. +sp_paren_qualifier = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and 'noexcept'. +sp_paren_noexcept = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after class ':'. +sp_after_class_colon = add # ignore/add/remove/force/not_defined + +# Add or remove space before class ':'. +sp_before_class_colon = add # ignore/add/remove/force/not_defined + +# Add or remove space after class constructor ':'. +# +# Default: add +sp_after_constr_colon = add # ignore/add/remove/force/not_defined + +# Add or remove space before class constructor ':'. +# +# Default: add +sp_before_constr_colon = add # ignore/add/remove/force/not_defined + +# Add or remove space before case ':'. +# +# Default: remove +sp_before_case_colon = remove # ignore/add/remove/force/not_defined + +# Add or remove space between 'operator' and operator sign. +sp_after_operator = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the operator symbol and the open parenthesis, as +# in 'operator ++('. +sp_after_operator_sym = ignore # ignore/add/remove/force/not_defined + +# Overrides sp_after_operator_sym when the operator has no arguments, as in +# 'operator *()'. +sp_after_operator_sym_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after C/D cast, i.e. 'cast(int)a' vs. 'cast(int) a' or +# '(int)a' vs. '(int) a'. +sp_after_cast = ignore # ignore/add/remove/force/not_defined + +# Add or remove spaces inside cast parentheses. +sp_inside_paren_cast = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the type and open parenthesis in a C++ cast, +# i.e. 'int(exp)' vs. 'int (exp)'. +sp_cpp_cast_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'sizeof' and '('. +sp_sizeof_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'sizeof' and '...'. +sp_sizeof_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'sizeof...' and '('. +sp_sizeof_ellipsis_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '...' and a parameter pack. +sp_ellipsis_parameter_pack = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a parameter pack and '...'. +sp_parameter_pack_ellipsis = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'decltype' and '('. +sp_decltype_paren = ignore # ignore/add/remove/force/not_defined + +# (Pawn) Add or remove space after the tag keyword. +sp_after_tag = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside enum '{' and '}'. +sp_inside_braces_enum = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside struct/union '{' and '}'. +sp_inside_braces_struct = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space inside Objective-C boxed dictionary '{' and '}' +sp_inside_braces_oc_dict = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after open brace in an unnamed temporary +# direct-list-initialization +# if statement is a brace_init_lst +# works only if sp_brace_brace is set to ignore. +sp_after_type_brace_init_lst_open = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before close brace in an unnamed temporary +# direct-list-initialization +# if statement is a brace_init_lst +# works only if sp_brace_brace is set to ignore. +sp_before_type_brace_init_lst_close = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside an unnamed temporary direct-list-initialization +# if statement is a brace_init_lst +# works only if sp_brace_brace is set to ignore +# works only if sp_before_type_brace_init_lst_close is set to ignore. +sp_inside_type_brace_init_lst = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside '{' and '}'. +sp_inside_braces = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside '{}'. +sp_inside_braces_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around trailing return operator '->'. +sp_trailing_return = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between return type and function name. A minimum of 1 +# is forced except for pointer return types. +sp_type_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between type and open brace of an unnamed temporary +# direct-list-initialization. +sp_type_brace_init_lst = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '(' on function declaration. +sp_func_proto_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '()' on function declaration +# without parameters. +sp_func_proto_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '(' with a typedef specifier. +sp_func_type_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between alias name and '(' of a non-pointer function type typedef. +sp_func_def_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '()' on function definition +# without parameters. +sp_func_def_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside empty function '()'. +# Overrides sp_after_angle unless use_sp_after_angle_always is set to true. +sp_inside_fparens = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside function '(' and ')'. +sp_inside_fparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside user functor '(' and ')'. +sp_func_call_user_inside_rparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside empty functor '()'. +# Overrides sp_after_angle unless use_sp_after_angle_always is set to true. +sp_inside_rparens = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside functor '(' and ')'. +sp_inside_rparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside the first parentheses in a function type, as in +# 'void (*x)(...)'. +sp_inside_tparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the ')' and '(' in a function type, as in +# 'void (*x)(...)'. +sp_after_tparen_close = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ']' and '(' when part of a function call. +sp_square_fparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and '{' of function. +sp_fparen_brace = force # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and '{' of a function call in object +# initialization. +# +# Overrides sp_fparen_brace. +sp_fparen_brace_initializer = ignore # ignore/add/remove/force/not_defined + +# (Java) Add or remove space between ')' and '{{' of double brace initializer. +sp_fparen_dbrace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '(' on function calls. +sp_func_call_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between function name and '()' on function calls without +# parameters. If set to ignore (the default), sp_func_call_paren is used. +sp_func_call_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between the user function name and '(' on function +# calls. You need to set a keyword to be a user function in the config file, +# like: +# set func_call_user tr _ i18n +sp_func_call_user_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside user function '(' and ')'. +sp_func_call_user_inside_fparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between nested parentheses with user functions, +# i.e. '((' vs. '( ('. +sp_func_call_user_paren_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a constructor/destructor and the open +# parenthesis. +sp_func_class_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between a constructor without parameters or destructor +# and '()'. +sp_func_class_paren_empty = remove # ignore/add/remove/force/not_defined + +# Add or remove space after 'return'. +# +# Default: force +sp_return = force # ignore/add/remove/force/not_defined + +# Add or remove space between 'return' and '('. +sp_return_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'return' and '{'. +sp_return_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '__attribute__' and '('. +sp_attribute_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'defined' and '(' in '#if defined (FOO)'. +sp_defined_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'throw' and '(' in 'throw (something)'. +sp_throw_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'throw' and anything other than '(' as in +# '@throw [...];'. +sp_after_throw = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'catch' and '(' in 'catch (something) { }'. +# If set to ignore, sp_before_sparen is used. +sp_catch_paren = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between '@catch' and '(' +# in '@catch (something) { }'. If set to ignore, sp_catch_paren is used. +sp_oc_catch_paren = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before Objective-C protocol list +# as in '@protocol Protocol' or '@interface MyClass : NSObject'. +sp_before_oc_proto_list = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between class name and '(' +# in '@interface className(categoryName):BaseClass' +sp_oc_classname_paren = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space between 'version' and '(' +# in 'version (something) { }'. If set to ignore, sp_before_sparen is used. +sp_version_paren = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space between 'scope' and '(' +# in 'scope (something) { }'. If set to ignore, sp_before_sparen is used. +sp_scope_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'super' and '(' in 'super (something)'. +# +# Default: remove +sp_super_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between 'this' and '(' in 'this (something)'. +# +# Default: remove +sp_this_paren = remove # ignore/add/remove/force/not_defined + +# Add or remove space between a macro name and its definition. +sp_macro = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a macro function ')' and its definition. +sp_macro_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'else' and '{' if on the same line. +sp_else_brace = add # ignore/add/remove/force/not_defined + +# Add or remove space between '}' and 'else' if on the same line. +sp_brace_else = force # ignore/add/remove/force/not_defined + +# Add or remove space between '}' and the name of a typedef on the same line. +sp_brace_typedef = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before the '{' of a 'catch' statement, if the '{' and +# 'catch' are on the same line, as in 'catch (decl) {'. +sp_catch_brace = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before the '{' of a '@catch' statement, if the '{' +# and '@catch' are on the same line, as in '@catch (decl) {'. +# If set to ignore, sp_catch_brace is used. +sp_oc_catch_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '}' and 'catch' if on the same line. +sp_brace_catch = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between '}' and '@catch' if on the same line. +# If set to ignore, sp_brace_catch is used. +sp_oc_brace_catch = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'finally' and '{' if on the same line. +sp_finally_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between '}' and 'finally' if on the same line. +sp_brace_finally = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'try' and '{' if on the same line. +sp_try_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between get/set and '{' if on the same line. +sp_getset_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a variable and '{' for C++ uniform +# initialization. +sp_word_brace_init_lst = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between a variable and '{' for a namespace. +# +# Default: add +sp_word_brace_ns = add # ignore/add/remove/force/not_defined + +# Add or remove space before the '::' operator. +sp_before_dc = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the '::' operator. +sp_after_dc = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove around the D named array initializer ':' operator. +sp_d_array_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the '!' (not) unary operator. +# +# Default: remove +sp_not = remove # ignore/add/remove/force/not_defined + +# Add or remove space between two '!' (not) unary operators. +# If set to ignore, sp_not will be used. +sp_not_not = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the '~' (invert) unary operator. +# +# Default: remove +sp_inv = remove # ignore/add/remove/force/not_defined + +# Add or remove space after the '&' (address-of) unary operator. This does not +# affect the spacing after a '&' that is part of a type. +# +# Default: remove +sp_addr = remove # ignore/add/remove/force/not_defined + +# Add or remove space around the '.' or '->' operators. +# +# Default: remove +sp_member = remove # ignore/add/remove/force/not_defined + +# Add or remove space after the '*' (dereference) unary operator. This does +# not affect the spacing after a '*' that is part of a type. +# +# Default: remove +sp_deref = remove # ignore/add/remove/force/not_defined + +# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. +# +# Default: remove +sp_sign = remove # ignore/add/remove/force/not_defined + +# Add or remove space between '++' and '--' the word to which it is being +# applied, as in '(--x)' or 'y++;'. +# +# Default: remove +sp_incdec = remove # ignore/add/remove/force/not_defined + +# Add or remove space before a backslash-newline at the end of a line. +# +# Default: add +sp_before_nl_cont = add # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the scope '+' or '-', as in '-(void) foo;' +# or '+(int) bar;'. +sp_after_oc_scope = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the colon in message specs, +# i.e. '-(int) f:(int) x;' vs. '-(int) f: (int) x;'. +sp_after_oc_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before the colon in message specs, +# i.e. '-(int) f: (int) x;' vs. '-(int) f : (int) x;'. +sp_before_oc_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};'. +sp_after_oc_dict_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before the colon in immutable dictionary expression +# 'NSDictionary *test = @{@"foo" :@"bar"};'. +sp_before_oc_dict_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the colon in message specs, +# i.e. '[object setValue:1];' vs. '[object setValue: 1];'. +sp_after_send_oc_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before the colon in message specs, +# i.e. '[object setValue:1];' vs. '[object setValue :1];'. +sp_before_send_oc_colon = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the (type) in message specs, +# i.e. '-(int)f: (int) x;' vs. '-(int)f: (int)x;'. +sp_after_oc_type = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after the first (type) in message specs, +# i.e. '-(int) f:(int)x;' vs. '-(int)f:(int)x;'. +sp_after_oc_return_type = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between '@selector' and '(', +# i.e. '@selector(msgName)' vs. '@selector (msgName)'. +# Also applies to '@protocol()' constructs. +sp_after_oc_at_sel = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between '@selector(x)' and the following word, +# i.e. '@selector(foo) a:' vs. '@selector(foo)a:'. +sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space inside '@selector' parentheses, +# i.e. '@selector(foo)' vs. '@selector( foo )'. +# Also applies to '@protocol()' constructs. +sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space before a block pointer caret, +# i.e. '^int (int arg){...}' vs. ' ^int (int arg){...}'. +sp_before_oc_block_caret = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after a block pointer caret, +# i.e. '^int (int arg){...}' vs. '^ int (int arg){...}'. +sp_after_oc_block_caret = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between the receiver and selector in a message, +# as in '[receiver selector ...]'. +sp_after_oc_msg_receiver = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space after '@property'. +sp_after_oc_property = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove space between '@synchronized' and the open parenthesis, +# i.e. '@synchronized(foo)' vs. '@synchronized (foo)'. +sp_after_oc_synchronized = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around the ':' in 'b ? t : f'. +sp_cond_colon = add # ignore/add/remove/force/not_defined + +# Add or remove space before the ':' in 'b ? t : f'. +# +# Overrides sp_cond_colon. +sp_cond_colon_before = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the ':' in 'b ? t : f'. +# +# Overrides sp_cond_colon. +sp_cond_colon_after = ignore # ignore/add/remove/force/not_defined + +# Add or remove space around the '?' in 'b ? t : f'. +sp_cond_question = add # ignore/add/remove/force/not_defined + +# Add or remove space before the '?' in 'b ? t : f'. +# +# Overrides sp_cond_question. +sp_cond_question_before = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the '?' in 'b ? t : f'. +# +# Overrides sp_cond_question. +sp_cond_question_after = ignore # ignore/add/remove/force/not_defined + +# In the abbreviated ternary form '(a ?: b)', add or remove space between '?' +# and ':'. +# +# Overrides all other sp_cond_* options. +sp_cond_ternary_short = ignore # ignore/add/remove/force/not_defined + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make +# sense here. +sp_case_label = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space around the D '..' operator. +sp_range = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after ':' in a Java/C++11 range-based 'for', +# as in 'for (Type var : expr)'. +sp_after_for_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before ':' in a Java/C++11 range-based 'for', +# as in 'for (Type var : expr)'. +sp_before_for_colon = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove space between 'extern' and '(' as in 'extern (C)'. +sp_extern_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the opening of a C++ comment, as in '// A'. +sp_cmt_cpp_start = add # ignore/add/remove/force/not_defined + +# remove space after the '//' and the pvs command '-V1234', +# only works with sp_cmt_cpp_start set to add or force. +sp_cmt_cpp_pvs = false # true/false + +# remove space after the '//' and the command 'lint', +# only works with sp_cmt_cpp_start set to add or force. +sp_cmt_cpp_lint = false # true/false + +# Add or remove space in a C++ region marker comment, as in '// BEGIN'. +# A region marker is defined as a comment which is not preceded by other text +# (i.e. the comment is the first non-whitespace on the line), and which starts +# with either 'BEGIN' or 'END'. +# +# Overrides sp_cmt_cpp_start. +sp_cmt_cpp_region = ignore # ignore/add/remove/force/not_defined + +# If true, space added with sp_cmt_cpp_start will be added after Doxygen +# sequences like '///', '///<', '//!' and '//!<'. +sp_cmt_cpp_doxygen = force # true/false + +# If true, space added with sp_cmt_cpp_start will be added after Qt translator +# or meta-data comments like '//:', '//=', and '//~'. +sp_cmt_cpp_qttr = false # true/false + +# Add or remove space between #else or #endif and a trailing comment. +sp_endif_cmt = add # ignore/add/remove/force/not_defined + +# Add or remove space after 'new', 'delete' and 'delete[]'. +sp_after_new = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between 'new' and '(' in 'new()'. +sp_between_new_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space between ')' and type in 'new(foo) BAR'. +sp_after_newop_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space inside parentheses of the new operator +# as in 'new(foo) BAR'. +sp_inside_newop_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after the open parenthesis of the new operator, +# as in 'new(foo) BAR'. +# +# Overrides sp_inside_newop_paren. +sp_inside_newop_paren_open = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before the close parenthesis of the new operator, +# as in 'new(foo) BAR'. +# +# Overrides sp_inside_newop_paren. +sp_inside_newop_paren_close = ignore # ignore/add/remove/force/not_defined + +# Add or remove space before a trailing comment. +sp_before_tr_cmt = ignore # ignore/add/remove/force/not_defined + +# Number of spaces before a trailing comment. +sp_num_before_tr_cmt = 0 # unsigned number + +# Add or remove space before an embedded comment. +# +# Default: force +sp_before_emb_cmt = force # ignore/add/remove/force/not_defined + +# Number of spaces before an embedded comment. +# +# Default: 1 +sp_num_before_emb_cmt = 1 # unsigned number + +# Add or remove space after an embedded comment. +# +# Default: force +sp_after_emb_cmt = force # ignore/add/remove/force/not_defined + +# Number of spaces after an embedded comment. +# +# Default: 1 +sp_num_after_emb_cmt = 1 # unsigned number + +# (Java) Add or remove space between an annotation and the open parenthesis. +sp_annotation_paren = ignore # ignore/add/remove/force/not_defined + +# If true, vbrace tokens are dropped to the previous token and skipped. +sp_skip_vbrace_tokens = false # true/false + +# Add or remove space after 'noexcept'. +sp_after_noexcept = ignore # ignore/add/remove/force/not_defined + +# Add or remove space after '_'. +sp_vala_after_translation = ignore # ignore/add/remove/force/not_defined + +# If true, a is inserted after #define. +force_tab_after_define = false # true/false + +# +# Indenting options +# + +# The number of columns to indent per level. Usually 2, 3, 4, or 8. +# +# Default: 8 +indent_columns = 2 # unsigned number + +# Whether to ignore indent for the first continuation line. Subsequent +# continuation lines will still be indented to match the first. +indent_ignore_first_continue = false # true/false + +# The continuation indent. If non-zero, this overrides the indent of '(', '[' +# and '=' continuation indents. Negative values are OK; negative value is +# absolute and not increased for each '(' or '[' level. +# +# For FreeBSD, this is set to 4. +# Requires indent_ignore_first_continue=false. +indent_continue = 0 # number + +# The continuation indent, only for class header line(s). If non-zero, this +# overrides the indent of 'class' continuation indents. +# Requires indent_ignore_first_continue=false. +indent_continue_class_head = 0 # unsigned number + +# Whether to indent empty lines (i.e. lines which contain only spaces before +# the newline character). +indent_single_newlines = false # true/false + +# The continuation indent for func_*_param if they are true. If non-zero, this +# overrides the indent. +indent_param = 0 # unsigned number + +# How to use tabs when indenting code. +# +# 0: Spaces only +# 1: Indent with tabs to brace level, align with spaces (default) +# 2: Indent and align with tabs, using spaces when not on a tabstop +# +# Default: 1 +indent_with_tabs = 0 # unsigned number + +# Whether to indent comments that are not at a brace level with tabs on a +# tabstop. Requires indent_with_tabs=2. If false, will use spaces. +indent_cmt_with_tabs = false # true/false + +# Whether to indent strings broken by '\' so that they line up. +indent_align_string = false # true/false + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=true. +indent_xml_string = 0 # unsigned number + +# Spaces to indent '{' from level. +indent_brace = 0 # unsigned number + +# Whether braces are indented to the body level. +indent_braces = false # true/false + +# Whether to disable indenting function braces if indent_braces=true. +indent_braces_no_func = false # true/false + +# Whether to disable indenting class braces if indent_braces=true. +indent_braces_no_class = false # true/false + +# Whether to disable indenting struct braces if indent_braces=true. +indent_braces_no_struct = false # true/false + +# Whether to indent based on the size of the brace parent, +# i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # true/false + +# Whether to indent based on the open parenthesis instead of the open brace +# in '({\n'. +indent_paren_open_brace = false # true/false + +# (C#) Whether to indent the brace of a C# delegate by another level. +indent_cs_delegate_brace = false # true/false + +# (C#) Whether to indent a C# delegate (to handle delegates with no brace) by +# another level. +indent_cs_delegate_body = false # true/false + +# Whether to indent the body of a 'namespace'. +indent_namespace = false # true/false + +# Whether to indent only the first namespace, and not any nested namespaces. +# Requires indent_namespace=true. +indent_namespace_single_indent = false # true/false + +# The number of spaces to indent a namespace block. +# If set to zero, use the value indent_columns +indent_namespace_level = 0 # unsigned number + +# If the body of the namespace is longer than this number, it won't be +# indented. Requires indent_namespace=true. 0 means no limit. +indent_namespace_limit = 0 # unsigned number + +# Whether to indent only in inner namespaces (nested in other namespaces). +# Requires indent_namespace=true. +indent_namespace_inner_only = false # true/false + +# Whether the 'extern "C"' body is indented. +indent_extern = false # true/false + +# Whether the 'class' body is indented. +indent_class = true # true/false + +# Whether to ignore indent for the leading base class colon. +indent_ignore_before_class_colon = false # true/false + +# Additional indent before the leading base class colon. +# Negative values decrease indent down to the first column. +# Requires indent_ignore_before_class_colon=false and a newline break before +# the colon (see pos_class_colon and nl_class_colon) +indent_before_class_colon = 0 # number + +# Whether to indent the stuff after a leading base class colon. +indent_class_colon = false # true/false + +# Whether to indent based on a class colon instead of the stuff after the +# colon. Requires indent_class_colon=true. +indent_class_on_colon = false # true/false + +# Whether to ignore indent for a leading class initializer colon. +indent_ignore_before_constr_colon = false # true/false + +# Whether to indent the stuff after a leading class initializer colon. +indent_constr_colon = false # true/false + +# Virtual indent from the ':' for leading member initializers. +# +# Default: 2 +indent_ctor_init_leading = 2 # unsigned number + +# Virtual indent from the ':' for following member initializers. +# +# Default: 2 +indent_ctor_init_following = 2 # unsigned number + +# Additional indent for constructor initializer list. +# Negative values decrease indent down to the first column. +indent_ctor_init = 0 # number + +# Whether to indent 'if' following 'else' as a new block under the 'else'. +# If false, 'else\nif' is treated as 'else if' for indenting purposes. +indent_else_if = false # true/false + +# Amount to indent variable declarations after a open brace. +# +# <0: Relative +# >=0: Absolute +indent_var_def_blk = 0 # number + +# Whether to indent continued variable declarations instead of aligning. +indent_var_def_cont = false # true/false + +# How to indent continued shift expressions ('<<' and '>>'). +# Set align_left_shift=false when using this. +# 0: Align shift operators instead of indenting them (default) +# 1: Indent by one level +# -1: Preserve original indentation +indent_shift = 0 # number + +# Whether to force indentation of function definitions to start in column 1. +indent_func_def_force_col1 = false # true/false + +# Whether to indent continued function call parameters one indent level, +# rather than aligning parameters under the open parenthesis. +indent_func_call_param = true # true/false + +# Whether to indent continued function definition parameters one indent level, +# rather than aligning parameters under the open parenthesis. +indent_func_def_param = true # true/false + +# for function definitions, only if indent_func_def_param is false +# Allows to align params when appropriate and indent them when not +# behave as if it was true if paren position is more than this value +# if paren position is more than the option value +indent_func_def_param_paren_pos_threshold = 0 # unsigned number + +# Whether to indent continued function call prototype one indent level, +# rather than aligning parameters under the open parenthesis. +indent_func_proto_param = false # true/false + +# Whether to indent continued function call declaration one indent level, +# rather than aligning parameters under the open parenthesis. +indent_func_class_param = false # true/false + +# Whether to indent continued class variable constructors one indent level, +# rather than aligning parameters under the open parenthesis. +indent_func_ctor_var_param = false # true/false + +# Whether to indent continued template parameter list one indent level, +# rather than aligning parameters under the open parenthesis. +indent_template_param = false # true/false + +# Double the indent for indent_func_xxx_param options. +# Use both values of the options indent_columns and indent_param. +indent_func_param_double = false # true/false + +# Indentation column for standalone 'const' qualifier on a function +# prototype. +indent_func_const = 0 # unsigned number + +# Indentation column for standalone 'throw' qualifier on a function +# prototype. +indent_func_throw = 0 # unsigned number + +# How to indent within a macro followed by a brace on the same line +# This allows reducing the indent in macros that have (for example) +# `do { ... } while (0)` blocks bracketing them. +# +# true: add an indent for the brace on the same line as the macro +# false: do not add an indent for the brace on the same line as the macro +# +# Default: true +indent_macro_brace = true # true/false + +# The number of spaces to indent a continued '->' or '.'. +# Usually set to 0, 1, or indent_columns. +indent_member = 0 # unsigned number + +# Whether lines broken at '.' or '->' should be indented by a single indent. +# The indent_member option will not be effective if this is set to true. +indent_member_single = false # true/false + +# Spaces to indent single line ('//') comments on lines before code. +indent_single_line_comments_before = 0 # unsigned number + +# Spaces to indent single line ('//') comments on lines after code. +indent_single_line_comments_after = 0 # unsigned number + +# When opening a paren for a control statement (if, for, while, etc), increase +# the indent level by this value. Negative values decrease the indent level. +indent_sparen_extra = 0 # number + +# Whether to indent trailing single line ('//') comments relative to the code +# instead of trying to keep the same absolute column. +indent_relative_single_line_comments = false # true/false + +# Spaces to indent 'case' from 'switch'. Usually 0 or indent_columns. +# It might be wise to choose the same value for the option indent_case_brace. +indent_switch_case = 2 # unsigned number + +# Spaces to indent the body of a 'switch' before any 'case'. +# Usually the same as indent_columns or indent_switch_case. +indent_switch_body = 0 # unsigned number + +# Whether to ignore indent for '{' following 'case'. +indent_ignore_case_brace = false # true/false + +# Spaces to indent '{' from 'case'. By default, the brace will appear under +# the 'c' in case. Usually set to 0 or indent_columns. Negative values are OK. +# It might be wise to choose the same value for the option indent_switch_case. +indent_case_brace = 0 # number + +# indent 'break' with 'case' from 'switch'. +indent_switch_break_with_case = false # true/false + +# Whether to indent preprocessor statements inside of switch statements. +# +# Default: true +indent_switch_pp = true # true/false + +# Spaces to shift the 'case' line, without affecting any other lines. +# Usually 0. +indent_case_shift = 0 # unsigned number + +# Whether to align comments before 'case' with the 'case'. +# +# Default: true +indent_case_comment = true # true/false + +# Whether to indent comments not found in first column. +# +# Default: true +indent_comment = true # true/false + +# Whether to indent comments found in first column. +indent_col1_comment = true # true/false + +# Whether to indent multi string literal in first column. +indent_col1_multi_string_literal = false # true/false + +# Align comments on adjacent lines that are this many columns apart or less. +# +# Default: 3 +indent_comment_align_thresh = 3 # unsigned number + +# Whether to ignore indent for goto labels. +indent_ignore_label = false # true/false + +# How to indent goto labels. Requires indent_ignore_label=false. +# +# >0: Absolute column where 1 is the leftmost column +# <=0: Subtract from brace indent +# +# Default: 1 +indent_label = 1 # number + +# How to indent access specifiers that are followed by a +# colon. +# +# >0: Absolute column where 1 is the leftmost column +# <=0: Subtract from brace indent +# +# Default: 1 +indent_access_spec = 1 # number + +# Whether to indent the code after an access specifier by one level. +# If true, this option forces 'indent_access_spec=0'. +indent_access_spec_body = false # true/false + +# If an open parenthesis is followed by a newline, whether to indent the next +# line so that it lines up after the open parenthesis (not recommended). +indent_paren_nl = false # true/false + +# How to indent a close parenthesis after a newline. +# +# 0: Indent to body level (default) +# 1: Align under the open parenthesis +# 2: Indent to the brace level +# -1: Preserve original indentation +indent_paren_close = 0 # number + +# Whether to indent the open parenthesis of a function definition, +# if the parenthesis is on its own line. +indent_paren_after_func_def = false # true/false + +# Whether to indent the open parenthesis of a function declaration, +# if the parenthesis is on its own line. +indent_paren_after_func_decl = false # true/false + +# Whether to indent the open parenthesis of a function call, +# if the parenthesis is on its own line. +indent_paren_after_func_call = false # true/false + +# How to indent a comma when inside braces. +# 0: Indent by one level (default) +# 1: Align under the open brace +# -1: Preserve original indentation +indent_comma_brace = 0 # number + +# How to indent a comma when inside parentheses. +# 0: Indent by one level (default) +# 1: Align under the open parenthesis +# -1: Preserve original indentation +indent_comma_paren = 0 # number + +# How to indent a Boolean operator when inside parentheses. +# 0: Indent by one level (default) +# 1: Align under the open parenthesis +# -1: Preserve original indentation +indent_bool_paren = 0 # number + +# Whether to ignore the indentation of a Boolean operator when outside +# parentheses. +indent_ignore_bool = false # true/false + +# Whether to ignore the indentation of an arithmetic operator. +indent_ignore_arith = false # true/false + +# Whether to indent a semicolon when inside a for parenthesis. +# If true, aligns under the open for parenthesis. +indent_semicolon_for_paren = false # true/false + +# Whether to ignore the indentation of a semicolon outside of a 'for' +# statement. +indent_ignore_semicolon = false # true/false + +# Whether to align the first expression to following ones +# if indent_bool_paren=1. +indent_first_bool_expr = false # true/false + +# Whether to align the first expression to following ones +# if indent_semicolon_for_paren=true. +indent_first_for_expr = false # true/false + +# If an open square is followed by a newline, whether to indent the next line +# so that it lines up after the open square (not recommended). +indent_square_nl = false # true/false + +# (ESQL/C) Whether to preserve the relative indent of 'EXEC SQL' bodies. +indent_preserve_sql = false # true/false + +# Whether to ignore the indentation of an assignment operator. +indent_ignore_assign = false # true/false + +# Whether to align continued statements at the '='. If false or if the '=' is +# followed by a newline, the next line is indent one tab. +# +# Default: true +indent_align_assign = false # true/false + +# If true, the indentation of the chunks after a '=' sequence will be set at +# LHS token indentation column before '='. +indent_off_after_assign = false # true/false + +# Whether to align continued statements at the '('. If false or the '(' is +# followed by a newline, the next line indent is one tab. +# +# Default: true +indent_align_paren = true # true/false + +# (OC) Whether to indent Objective-C code inside message selectors. +indent_oc_inside_msg_sel = false # true/false + +# (OC) Whether to indent Objective-C blocks at brace level instead of usual +# rules. +indent_oc_block = false # true/false + +# (OC) Indent for Objective-C blocks in a message relative to the parameter +# name. +# +# =0: Use indent_oc_block rules +# >0: Use specified number of spaces to indent +indent_oc_block_msg = 0 # unsigned number + +# (OC) Minimum indent for subsequent parameters +indent_oc_msg_colon = 0 # unsigned number + +# (OC) Whether to prioritize aligning with initial colon (and stripping spaces +# from lines, if necessary). +# +# Default: true +indent_oc_msg_prioritize_first_colon = true # true/false + +# (OC) Whether to indent blocks the way that Xcode does by default +# (from the keyword if the parameter is on its own line; otherwise, from the +# previous indentation level). Requires indent_oc_block_msg=true. +indent_oc_block_msg_xcode_style = false # true/false + +# (OC) Whether to indent blocks from where the brace is, relative to a +# message keyword. Requires indent_oc_block_msg=true. +indent_oc_block_msg_from_keyword = false # true/false + +# (OC) Whether to indent blocks from where the brace is, relative to a message +# colon. Requires indent_oc_block_msg=true. +indent_oc_block_msg_from_colon = false # true/false + +# (OC) Whether to indent blocks from where the block caret is. +# Requires indent_oc_block_msg=true. +indent_oc_block_msg_from_caret = false # true/false + +# (OC) Whether to indent blocks from where the brace caret is. +# Requires indent_oc_block_msg=true. +indent_oc_block_msg_from_brace = false # true/false + +# When indenting after virtual brace open and newline add further spaces to +# reach this minimum indent. +indent_min_vbrace_open = 0 # unsigned number + +# Whether to add further spaces after regular indent to reach next tabstop +# when indenting after virtual brace open and newline. +indent_vbrace_open_on_tabstop = false # true/false + +# How to indent after a brace followed by another token (not a newline). +# true: indent all contained lines to match the token +# false: indent all contained lines to match the brace +# +# Default: true +indent_token_after_brace = true # true/false + +# Whether to indent the body of a C++11 lambda. +indent_cpp_lambda_body = false # true/false + +# How to indent compound literals that are being returned. +# true: add both the indent from return & the compound literal open brace +# (i.e. 2 indent levels) +# false: only indent 1 level, don't add the indent for the open brace, only +# add the indent for the return. +# +# Default: true +indent_compound_literal_return = true # true/false + +# (C#) Whether to indent a 'using' block if no braces are used. +# +# Default: true +indent_using_block = true # true/false + +# How to indent the continuation of ternary operator. +# +# 0: Off (default) +# 1: When the `if_false` is a continuation, indent it under the `if_true` branch +# 2: When the `:` is a continuation, indent it under `?` +indent_ternary_operator = 0 # unsigned number + +# Whether to indent the statements inside ternary operator. +indent_inside_ternary_operator = false # true/false + +# If true, the indentation of the chunks after a `return` sequence will be set at return indentation column. +indent_off_after_return = false # true/false + +# If true, the indentation of the chunks after a `return new` sequence will be set at return indentation column. +indent_off_after_return_new = false # true/false + +# If true, the tokens after return are indented with regular single indentation. By default (false) the indentation is after the return token. +indent_single_after_return = false # true/false + +# Whether to ignore indent and alignment for 'asm' blocks (i.e. assume they +# have their own indentation). +indent_ignore_asm_block = false # true/false + +# Don't indent the close parenthesis of a function definition, +# if the parenthesis is on its own line. +donot_indent_func_def_close_paren = false # true/false + +# +# Newline adding and removing options +# + +# Whether to collapse empty blocks between '{' and '}' except for functions. +# Use nl_collapse_empty_body_functions to specify how empty function braces +# should be formatted. +nl_collapse_empty_body = false # true/false + +# Whether to collapse empty blocks between '{' and '}' for functions only. +# If true, overrides nl_inside_empty_func. +nl_collapse_empty_body_functions = false # true/false + +# Don't split one-line braced assignments, as in 'foo_t f = { 1, 2 };'. +nl_assign_leave_one_liners = true # true/false + +# Don't split one-line braced statements inside a 'class xx { }' body. +nl_class_leave_one_liners = true # true/false + +# Don't split one-line enums, as in 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = true # true/false + +# Don't split one-line get or set functions. +nl_getset_leave_one_liners = true # true/false + +# (C#) Don't split one-line property get or set functions. +nl_cs_property_leave_one_liners = false # true/false + +# Don't split one-line function definitions, as in 'int foo() { return 0; }'. +# might modify nl_func_type_name +nl_func_leave_one_liners = true # true/false + +# Don't split one-line C++11 lambdas, as in '[]() { return 0; }'. +nl_cpp_lambda_leave_one_liners = false # true/false + +# Don't split one-line if/else statements, as in 'if(...) b++;'. +nl_if_leave_one_liners = true # true/false + +# Don't split one-line while statements, as in 'while(...) b++;'. +nl_while_leave_one_liners = false # true/false + +# Don't split one-line do statements, as in 'do { b++; } while(...);'. +nl_do_leave_one_liners = true # true/false + +# Don't split one-line for statements, as in 'for(...) b++;'. +nl_for_leave_one_liners = false # true/false + +# (OC) Don't split one-line Objective-C messages. +nl_oc_msg_leave_one_liner = false # true/false + +# (OC) Add or remove newline between method declaration and '{'. +nl_oc_mdef_brace = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove newline between Objective-C block signature and '{'. +nl_oc_block_brace = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove blank line before '@interface' statement. +nl_oc_before_interface = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove blank line before '@implementation' statement. +nl_oc_before_implementation = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove blank line before '@end' statement. +nl_oc_before_end = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove newline between '@interface' and '{'. +nl_oc_interface_brace = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove newline between '@implementation' and '{'. +nl_oc_implementation_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newlines at the start of the file. +nl_start_of_file = ignore # ignore/add/remove/force/not_defined + +# The minimum number of newlines at the start of the file (only used if +# nl_start_of_file is 'add' or 'force'). +nl_start_of_file_min = 0 # unsigned number + +# Add or remove newline at the end of the file. +nl_end_of_file = add # ignore/add/remove/force/not_defined + +# The minimum number of newlines at the end of the file (only used if +# nl_end_of_file is 'add' or 'force'). +nl_end_of_file_min = 0 # unsigned number + +# Add or remove newline between '=' and '{'. +nl_assign_brace = remove # ignore/add/remove/force/not_defined + +# (D) Add or remove newline between '=' and '['. +nl_assign_square = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between '[]' and '{'. +nl_tsquare_brace = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove newline after '= ['. Will also affect the newline before +# the ']'. +nl_after_square_assign = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between a function call's ')' and '{', as in +# 'list_for_each(item, &list) { }'. +nl_fcall_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'enum' and '{'. +nl_enum_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between 'enum' and 'class'. +nl_enum_class = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'enum class' and the identifier. +nl_enum_class_identifier = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'enum class' type and ':'. +nl_enum_identifier_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'enum class identifier :' and type. +nl_enum_colon_type = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'struct and '{'. +nl_struct_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between 'union' and '{'. +nl_union_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between 'if' and '{'. +nl_if_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and 'else'. +nl_brace_else = add # ignore/add/remove/force/not_defined + +# Add or remove newline between 'else if' and '{'. If set to ignore, +# nl_if_brace is used instead. +nl_elseif_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'else' and '{'. +nl_else_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between 'else' and 'if'. +nl_else_if = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline before '{' opening brace +nl_before_opening_brace_func_class_def = remove # ignore/add/remove/force/not_defined + +# Add or remove newline before 'if'/'else if' closing parenthesis. +nl_before_if_closing_paren = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and 'finally'. +nl_brace_finally = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'finally' and '{'. +nl_finally_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'try' and '{'. +nl_try_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between get/set and '{'. +nl_getset_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'for' and '{'. +nl_for_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline before the '{' of a 'catch' statement, as in +# 'catch (decl) {'. +nl_catch_brace = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove newline before the '{' of a '@catch' statement, as in +# '@catch (decl) {'. If set to ignore, nl_catch_brace is used. +nl_oc_catch_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and 'catch'. +nl_brace_catch = ignore # ignore/add/remove/force/not_defined + +# (OC) Add or remove newline between '}' and '@catch'. If set to ignore, +# nl_brace_catch is used. +nl_oc_brace_catch = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and ']'. +nl_brace_square = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and ')' in a function invocation. +nl_brace_fparen = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'while' and '{'. +nl_while_brace = remove # ignore/add/remove/force/not_defined + +# (D) Add or remove newline between 'scope (x)' and '{'. +nl_scope_brace = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove newline between 'unittest' and '{'. +nl_unittest_brace = ignore # ignore/add/remove/force/not_defined + +# (D) Add or remove newline between 'version (x)' and '{'. +nl_version_brace = ignore # ignore/add/remove/force/not_defined + +# (C#) Add or remove newline between 'using' and '{'. +nl_using_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between two open or close braces. Due to general +# newline/brace handling, REMOVE may not work. +nl_brace_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'do' and '{'. +nl_do_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between '}' and 'while' of 'do' statement. +nl_brace_while = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'switch' and '{'. +nl_switch_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between 'synchronized' and '{'. +nl_synchronized_brace = ignore # ignore/add/remove/force/not_defined + +# Add a newline between ')' and '{' if the ')' is on a different line than the +# if/for/etc. +# +# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch and +# nl_catch_brace. +nl_multi_line_cond = false # true/false + +# Add a newline after '(' if an if/for/while/switch condition spans multiple +# lines +nl_multi_line_sparen_open = ignore # ignore/add/remove/force/not_defined + +# Add a newline before ')' if an if/for/while/switch condition spans multiple +# lines. Overrides nl_before_if_closing_paren if both are specified. +nl_multi_line_sparen_close = add # ignore/add/remove/force/not_defined + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = false # true/false + +# Whether to add a newline before 'case', and a blank line before a 'case' +# statement that follows a ';' or '}'. +nl_before_case = false # true/false + +# Whether to add a newline after a 'case' statement. +nl_after_case = false # true/false + +# Add or remove newline between a case ':' and '{'. +# +# Overrides nl_after_case. +nl_case_colon_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between ')' and 'throw'. +nl_before_throw = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'namespace' and '{'. +nl_namespace_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template class. +nl_template_class = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template class declaration. +# +# Overrides nl_template_class. +nl_template_class_decl = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<>' of a specialized class declaration. +# +# Overrides nl_template_class_decl. +nl_template_class_decl_special = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template class definition. +# +# Overrides nl_template_class. +nl_template_class_def = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<>' of a specialized class definition. +# +# Overrides nl_template_class_def. +nl_template_class_def_special = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template function. +nl_template_func = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template function +# declaration. +# +# Overrides nl_template_func. +nl_template_func_decl = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<>' of a specialized function +# declaration. +# +# Overrides nl_template_func_decl. +nl_template_func_decl_special = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template function +# definition. +# +# Overrides nl_template_func. +nl_template_func_def = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<>' of a specialized function +# definition. +# +# Overrides nl_template_func_def. +nl_template_func_def_special = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after 'template<...>' of a template variable. +nl_template_var = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'template<...>' and 'using' of a templated +# type alias. +nl_template_using = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'class' and '{'. +nl_class_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline before or after (depending on pos_class_comma, +# may not be IGNORE) each',' in the base class list. +nl_class_init_args = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after each ',' in the constructor member +# initialization. Related to nl_constr_colon, pos_constr_colon and +# pos_constr_comma. +nl_constr_init_args = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline before first element, after comma, and after last +# element, in 'enum'. +nl_enum_own_lines = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between return type and function name in a function +# definition. +# might be modified by nl_func_leave_one_liners +nl_func_type_name = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between return type and function name inside a class +# definition. If set to ignore, nl_func_type_name or nl_func_proto_type_name +# is used instead. +nl_func_type_name_class = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between class specification and '::' +# in 'void A::f() { }'. Only appears in separate member implementation (does +# not appear with in-line implementation). +nl_func_class_scope = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between function scope and name, as in +# 'void A :: f() { }'. +nl_func_scope_name = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between return type and function name in a prototype. +nl_func_proto_type_name = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between a function name and the opening '(' in the +# declaration. +nl_func_paren = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_paren for functions with no parameters. +nl_func_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between a function name and the opening '(' in the +# definition. +nl_func_def_paren = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_def_paren for functions with no parameters. +nl_func_def_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between a function name and the opening '(' in the +# call. +nl_func_call_paren = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_call_paren for functions with no parameters. +nl_func_call_paren_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after '(' in a function declaration. +nl_func_decl_start = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after '(' in a function definition. +nl_func_def_start = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_decl_start when there is only one parameter. +nl_func_decl_start_single = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_def_start when there is only one parameter. +nl_func_def_start_single = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after '(' in a function declaration if '(' and ')' +# are in different lines. If false, nl_func_decl_start is used instead. +nl_func_decl_start_multi_line = false # true/false + +# Whether to add a newline after '(' in a function definition if '(' and ')' +# are in different lines. If false, nl_func_def_start is used instead. +nl_func_def_start_multi_line = false # true/false + +# Add or remove newline after each ',' in a function declaration. +nl_func_decl_args = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after each ',' in a function definition. +nl_func_def_args = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline after each ',' in a function call. +nl_func_call_args = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after each ',' in a function declaration if '(' +# and ')' are in different lines. If false, nl_func_decl_args is used instead. +nl_func_decl_args_multi_line = false # true/false + +# Whether to add a newline after each ',' in a function definition if '(' +# and ')' are in different lines. If false, nl_func_def_args is used instead. +nl_func_def_args_multi_line = false # true/false + +# Add or remove newline before the ')' in a function declaration. +nl_func_decl_end = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline before the ')' in a function definition. +nl_func_def_end = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_decl_end when there is only one parameter. +nl_func_decl_end_single = ignore # ignore/add/remove/force/not_defined + +# Overrides nl_func_def_end when there is only one parameter. +nl_func_def_end_single = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline before ')' in a function declaration if '(' and ')' +# are in different lines. If false, nl_func_decl_end is used instead. +nl_func_decl_end_multi_line = false # true/false + +# Whether to add a newline before ')' in a function definition if '(' and ')' +# are in different lines. If false, nl_func_def_end is used instead. +nl_func_def_end_multi_line = false # true/false + +# Add or remove newline between '()' in a function declaration. +nl_func_decl_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '()' in a function definition. +nl_func_def_empty = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between '()' in a function call. +nl_func_call_empty = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after '(' in a function call, +# has preference over nl_func_call_start_multi_line. +nl_func_call_start = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline before ')' in a function call. +nl_func_call_end = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after '(' in a function call if '(' and ')' are in +# different lines. +nl_func_call_start_multi_line = false # true/false + +# Whether to add a newline after each ',' in a function call if '(' and ')' +# are in different lines. +nl_func_call_args_multi_line = false # true/false + +# Whether to add a newline before ')' in a function call if '(' and ')' are in +# different lines. +nl_func_call_end_multi_line = false # true/false + +# Whether to respect nl_func_call_XXX option in case of closure args. +nl_func_call_args_multi_line_ignore_closures = false # true/false + +# Whether to add a newline after '<' of a template parameter list. +nl_template_start = false # true/false + +# Whether to add a newline after each ',' in a template parameter list. +nl_template_args = false # true/false + +# Whether to add a newline before '>' of a template parameter list. +nl_template_end = false # true/false + +# (OC) Whether to put each Objective-C message parameter on a separate line. +# See nl_oc_msg_leave_one_liner. +nl_oc_msg_args = false # true/false + +# (OC) Minimum number of Objective-C message parameters before applying nl_oc_msg_args. +nl_oc_msg_args_min_params = 0 # unsigned number + +# (OC) Max code width of Objective-C message before applying nl_oc_msg_args. +nl_oc_msg_args_max_code_width = 0 # unsigned number + +# Add or remove newline between function signature and '{'. +nl_fdef_brace = remove # ignore/add/remove/force/not_defined + +# Add or remove newline between function signature and '{', +# if signature ends with ')'. Overrides nl_fdef_brace. +nl_fdef_brace_cond = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between C++11 lambda signature and '{'. +nl_cpp_ldef_brace = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'return' and the return expression. +nl_return_expr = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline between 'throw' and the throw expression. +nl_throw_expr = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after semicolons, except in 'for' statements. +nl_after_semicolon = false # true/false + +# (Java) Add or remove newline between the ')' and '{{' of the double brace +# initializer. +nl_paren_dbrace_open = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after the type in an unnamed temporary +# direct-list-initialization, better: +# before a direct-list-initialization. +nl_type_brace_init_lst = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline after the open brace in an unnamed temporary +# direct-list-initialization. +nl_type_brace_init_lst_open = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline before the close brace in an unnamed temporary +# direct-list-initialization. +nl_type_brace_init_lst_close = ignore # ignore/add/remove/force/not_defined + +# Whether to add a newline before '{'. +nl_before_brace_open = false # true/false + +# Whether to add a newline after '{'. +nl_after_brace_open = true # true/false + +# Whether to add a newline between the open brace and a trailing single-line +# comment. Requires nl_after_brace_open=true. +nl_after_brace_open_cmt = false # true/false + +# Whether to add a newline after a virtual brace open with a non-empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = false # true/false + +# Whether to add a newline after a virtual brace open with an empty body. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open_empty = false # true/false + +# Whether to add a newline after '}'. Does not apply if followed by a +# necessary ';'. +nl_after_brace_close = true # true/false + +# Whether to add a newline after a virtual brace close, +# as in 'if (foo) a++; return;'. +nl_after_vbrace_close = false # true/false + +# Add or remove newline between the close brace and identifier, +# as in 'struct { int a; } b;'. Affects enumerations, unions and +# structures. If set to ignore, uses nl_after_brace_close. +nl_brace_struct_var = ignore # ignore/add/remove/force/not_defined + +# Whether to alter newlines in '#define' macros. +nl_define_macro = false # true/false + +# Whether to alter newlines between consecutive parenthesis closes. The number +# of closing parentheses in a line will depend on respective open parenthesis +# lines. +nl_squeeze_paren_close = false # true/false + +# Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and +# '#endif'. Does not affect top-level #ifdefs. +nl_squeeze_ifdef = false # true/false + +# Makes the nl_squeeze_ifdef option affect the top-level #ifdefs as well. +nl_squeeze_ifdef_top_level = false # true/false + +# Add or remove blank line before 'if'. +nl_before_if = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'if' statement. Add/Force work only if the +# next token is not a closing brace. +nl_after_if = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line before 'for'. +nl_before_for = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'for' statement. +nl_after_for = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line before 'while'. +nl_before_while = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'while' statement. +nl_after_while = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line before 'switch'. +nl_before_switch = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'switch' statement. +nl_after_switch = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line before 'synchronized'. +nl_before_synchronized = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'synchronized' statement. +nl_after_synchronized = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line before 'do'. +nl_before_do = ignore # ignore/add/remove/force/not_defined + +# Add or remove blank line after 'do/while' statement. +nl_after_do = ignore # ignore/add/remove/force/not_defined + +# Ignore nl_before_{if,for,switch,do,synchronized} if the control +# statement is immediately after a case statement. +# if nl_before_{if,for,switch,do} is set to remove, this option +# does nothing. +nl_before_ignore_after_case = false # true/false + +# Whether to put a blank line before 'return' statements, unless after an open +# brace. +nl_before_return = false # true/false + +# Whether to put a blank line after 'return' statements, unless followed by a +# close brace. +nl_after_return = false # true/false + +# Whether to put a blank line before a member '.' or '->' operators. +nl_before_member = ignore # ignore/add/remove/force/not_defined + +# (Java) Whether to put a blank line after a member '.' or '->' operators. +nl_after_member = ignore # ignore/add/remove/force/not_defined + +# Whether to double-space commented-entries in 'struct'/'union'/'enum'. +nl_ds_struct_enum_cmt = false # true/false + +# Whether to force a newline before '}' of a 'struct'/'union'/'enum'. +# (Lower priority than eat_blanks_before_close_brace.) +nl_ds_struct_enum_close_brace = false # true/false + +# Add or remove newline before or after (depending on pos_class_colon) a class +# colon, as in 'class Foo : public Bar'. +nl_class_colon = ignore # ignore/add/remove/force/not_defined + +# Add or remove newline around a class constructor colon. The exact position +# depends on nl_constr_init_args, pos_constr_colon and pos_constr_comma. +nl_constr_colon = ignore # ignore/add/remove/force/not_defined + +# Whether to collapse a two-line namespace, like 'namespace foo\n{ decl; }' +# into a single line. If true, prevents other brace newline rules from turning +# such code into four lines. If true, it also preserves one-liner namespaces. +nl_namespace_two_to_one_liner = false # true/false + +# Whether to remove a newline in simple unbraced if statements, turning them +# into one-liners, as in 'if(b)\n i++;' => 'if(b) i++;'. +nl_create_if_one_liner = false # true/false + +# Whether to remove a newline in simple unbraced for statements, turning them +# into one-liners, as in 'for (...)\n stmt;' => 'for (...) stmt;'. +nl_create_for_one_liner = true # true/false + +# Whether to remove a newline in simple unbraced while statements, turning +# them into one-liners, as in 'while (expr)\n stmt;' => 'while (expr) stmt;'. +nl_create_while_one_liner = true # true/false + +# Whether to collapse a function definition whose body (not counting braces) +# is only one line so that the entire definition (prototype, braces, body) is +# a single line. +nl_create_func_def_one_liner = false # true/false + +# Whether to split one-line simple list definitions into three lines by +# adding newlines, as in 'int a[12] = { 0 };'. +nl_create_list_one_liner = false # true/false + +# Whether to split one-line simple unbraced if statements into two lines by +# adding a newline, as in 'if(b) i++;'. +nl_split_if_one_liner = false # true/false + +# Whether to split one-line simple unbraced for statements into two lines by +# adding a newline, as in 'for (...) stmt;'. +nl_split_for_one_liner = false # true/false + +# Whether to split one-line simple unbraced while statements into two lines by +# adding a newline, as in 'while (expr) stmt;'. +nl_split_while_one_liner = false # true/false + +# Don't add a newline before a cpp-comment in a parameter list of a function +# call. +donot_add_nl_before_cpp_comment = false # true/false + +# +# Blank line options +# + +# The maximum number of consecutive newlines (3 = 2 blank lines). +nl_max = 0 # unsigned number + +# The maximum number of consecutive newlines in a function. +nl_max_blank_in_func = 0 # unsigned number + +# The number of newlines inside an empty function body. +# This option overrides eat_blanks_after_open_brace and +# eat_blanks_before_close_brace, but is ignored when +# nl_collapse_empty_body_functions=true +nl_inside_empty_func = 0 # unsigned number + +# The number of newlines before a function prototype. +nl_before_func_body_proto = 0 # unsigned number + +# The number of newlines before a multi-line function definition. Where +# applicable, this option is overridden with eat_blanks_after_open_brace=true +nl_before_func_body_def = 0 # unsigned number + +# The number of newlines before a class constructor/destructor prototype. +nl_before_func_class_proto = 0 # unsigned number + +# The number of newlines before a class constructor/destructor definition. +nl_before_func_class_def = 0 # unsigned number + +# The number of newlines after a function prototype. +nl_after_func_proto = 0 # unsigned number + +# The number of newlines after a function prototype, if not followed by +# another function prototype. +nl_after_func_proto_group = 0 # unsigned number + +# The number of newlines after a class constructor/destructor prototype. +nl_after_func_class_proto = 0 # unsigned number + +# The number of newlines after a class constructor/destructor prototype, +# if not followed by another constructor/destructor prototype. +nl_after_func_class_proto_group = 0 # unsigned number + +# Whether one-line method definitions inside a class body should be treated +# as if they were prototypes for the purposes of adding newlines. +# +# Requires nl_class_leave_one_liners=true. Overrides nl_before_func_body_def +# and nl_before_func_class_def for one-liners. +nl_class_leave_one_liner_groups = false # true/false + +# The number of newlines after '}' of a multi-line function body. +nl_after_func_body = 0 # unsigned number + +# The number of newlines after '}' of a multi-line function body in a class +# declaration. Also affects class constructors/destructors. +# +# Overrides nl_after_func_body. +nl_after_func_body_class = 0 # unsigned number + +# The number of newlines after '}' of a single line function body. Also +# affects class constructors/destructors. +# +# Overrides nl_after_func_body and nl_after_func_body_class. +nl_after_func_body_one_liner = 0 # unsigned number + +# The number of newlines before a block of typedefs. If nl_after_access_spec +# is non-zero, that option takes precedence. +# +# 0: No change (default). +nl_typedef_blk_start = 0 # unsigned number + +# The number of newlines after a block of typedefs. +# +# 0: No change (default). +nl_typedef_blk_end = 0 # unsigned number + +# The maximum number of consecutive newlines within a block of typedefs. +# +# 0: No change (default). +nl_typedef_blk_in = 0 # unsigned number + +# The minimum number of blank lines after a block of variable definitions +# at the top of a function body. If any preprocessor directives appear +# between the opening brace of the function and the variable block, then +# it is considered as not at the top of the function.Newlines are added +# before trailing preprocessor directives, if any exist. +# +# 0: No change (default). +nl_var_def_blk_end_func_top = 0 # unsigned number + +# The minimum number of empty newlines before a block of variable definitions +# not at the top of a function body. If nl_after_access_spec is non-zero, +# that option takes precedence. Newlines are not added at the top of the +# file or just after an opening brace. Newlines are added above any +# preprocessor directives before the block. +# +# 0: No change (default). +nl_var_def_blk_start = 0 # unsigned number + +# The minimum number of empty newlines after a block of variable definitions +# not at the top of a function body. Newlines are not added if the block +# is at the bottom of the file or just before a preprocessor directive. +# +# 0: No change (default). +nl_var_def_blk_end = 0 # unsigned number + +# The maximum number of consecutive newlines within a block of variable +# definitions. +# +# 0: No change (default). +nl_var_def_blk_in = 0 # unsigned number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 0 # unsigned number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 0 # unsigned number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # unsigned number + +# Whether to force a newline after a multi-line comment. +nl_after_multiline_comment = false # true/false + +# Whether to force a newline after a label's colon. +nl_after_label_colon = false # true/false + +# The number of newlines before a struct definition. +nl_before_struct = 0 # unsigned number + +# The number of newlines after '}' or ';' of a struct/enum/union definition. +nl_after_struct = 0 # unsigned number + +# The number of newlines before a class definition. +nl_before_class = 0 # unsigned number + +# The number of newlines after '}' or ';' of a class definition. +nl_after_class = 2 # unsigned number + +# The number of newlines before a namespace. +nl_before_namespace = 0 # unsigned number + +# The number of newlines after '{' of a namespace. This also adds newlines +# before the matching '}'. +# +# 0: Apply eat_blanks_after_open_brace or eat_blanks_before_close_brace if +# applicable, otherwise no change. +# +# Overrides eat_blanks_after_open_brace and eat_blanks_before_close_brace. +nl_inside_namespace = 0 # unsigned number + +# The number of newlines after '}' of a namespace. +nl_after_namespace = 0 # unsigned number + +# The number of newlines before an access specifier label. This also includes +# the Qt-specific 'signals:' and 'slots:'. Will not change the newline count +# if after a brace open. +# +# 0: No change (default). +nl_before_access_spec = 0 # unsigned number + +# The number of newlines after an access specifier label. This also includes +# the Qt-specific 'signals:' and 'slots:'. Will not change the newline count +# if after a brace open. +# +# 0: No change (default). +# +# Overrides nl_typedef_blk_start and nl_var_def_blk_start. +nl_after_access_spec = 0 # unsigned number + +# The number of newlines between a function definition and the function +# comment, as in '// comment\n void foo() {...}'. +# +# 0: No change (default). +nl_comment_func_def = 0 # unsigned number + +# The number of newlines after a try-catch-finally block that isn't followed +# by a brace close. +# +# 0: No change (default). +nl_after_try_catch_finally = 0 # unsigned number + +# (C#) The number of newlines before and after a property, indexer or event +# declaration. +# +# 0: No change (default). +nl_around_cs_property = 0 # unsigned number + +# (C#) The number of newlines between the get/set/add/remove handlers. +# +# 0: No change (default). +nl_between_get_set = 0 # unsigned number + +# (C#) Add or remove newline between property and the '{'. +nl_property_brace = ignore # ignore/add/remove/force/not_defined + +# Whether to remove blank lines after '{'. +eat_blanks_after_open_brace = false # true/false + +# Whether to remove blank lines before '}'. +eat_blanks_before_close_brace = false # true/false + +# How aggressively to remove extra newlines not in preprocessor. +# +# 0: No change (default) +# 1: Remove most newlines not handled by other config +# 2: Remove all newlines and reformat completely by config +nl_remove_extra_newlines = 0 # unsigned number + +# (Java) Add or remove newline after an annotation statement. Only affects +# annotations that are after a newline. +nl_after_annotation = ignore # ignore/add/remove/force/not_defined + +# (Java) Add or remove newline between two annotations. +nl_between_annotation = ignore # ignore/add/remove/force/not_defined + +# The number of newlines before a whole-file #ifdef. +# +# 0: No change (default). +nl_before_whole_file_ifdef = 0 # unsigned number + +# The number of newlines after a whole-file #ifdef. +# +# 0: No change (default). +nl_after_whole_file_ifdef = 0 # unsigned number + +# The number of newlines before a whole-file #endif. +# +# 0: No change (default). +nl_before_whole_file_endif = 0 # unsigned number + +# The number of newlines after a whole-file #endif. +# +# 0: No change (default). +nl_after_whole_file_endif = 0 # unsigned number + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions. +pos_arith = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of assignment in wrapped expressions. Do not affect '=' +# followed by '{'. +pos_assign = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of Boolean operators in wrapped expressions. +pos_bool = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of comparison operators in wrapped expressions. +pos_compare = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of conditional operators, as in the '?' and ':' of +# 'expr ? stmt : stmt', in wrapped expressions. +pos_conditional = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of the comma in wrapped expressions. +pos_comma = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of the comma in enum entries. +pos_enum_comma = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of the comma in the base class list if there is more than one +# line. Affects nl_class_init_args. +pos_class_comma = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of the comma in the constructor initialization list. +# Related to nl_constr_colon, nl_constr_init_args and pos_constr_colon. +pos_constr_comma = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of trailing/leading class colon, between class and base class +# list. Affects nl_class_colon. +pos_class_colon = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of colons between constructor and member initialization. +# Related to nl_constr_colon, nl_constr_init_args and pos_constr_comma. +pos_constr_colon = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# The position of shift operators in wrapped expressions. +pos_shift = ignore # ignore/break/force/lead/trail/join/lead_break/lead_force/trail_break/trail_force + +# +# Line splitting options +# + +# Try to limit code width to N columns. +code_width = 0 # unsigned number + +# Whether to fully split long 'for' statements at semi-colons. +ls_for_split_full = false # true/false + +# Whether to fully split long function prototypes/calls at commas. +# The option ls_code_width has priority over the option ls_func_split_full. +ls_func_split_full = false # true/false + +# Whether to split lines as close to code_width as possible and ignore some +# groupings. +# The option ls_code_width has priority over the option ls_func_split_full. +ls_code_width = false # true/false + +# +# Code alignment options (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs. +align_keep_tabs = false # true/false + +# Whether to use tabs for aligning. +align_with_tabs = false # true/false + +# Whether to bump out to the next tab when aligning. +align_on_tabstop = false # true/false + +# Whether to right-align numbers. +align_number_right = false # true/false + +# Whether to keep whitespace not required for alignment. +align_keep_extra_space = false # true/false + +# Whether to align variable definitions in prototypes and functions. +align_func_params = false # true/false + +# The span for aligning parameter definitions in function on parameter name. +# +# 0: Don't align (default). +align_func_params_span = 0 # unsigned number + +# The threshold for aligning function parameter definitions. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_func_params_thresh = 0 # number + +# The gap for aligning function parameter definitions. +align_func_params_gap = 0 # unsigned number + +# The span for aligning constructor value. +# +# 0: Don't align (default). +align_constr_value_span = 0 # unsigned number + +# The threshold for aligning constructor value. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_constr_value_thresh = 0 # number + +# The gap for aligning constructor value. +align_constr_value_gap = 0 # unsigned number + +# Whether to align parameters in single-line functions that have the same +# name. The function names must already be aligned with each other. +align_same_func_call_params = false # true/false + +# The span for aligning function-call parameters for single line functions. +# +# 0: Don't align (default). +align_same_func_call_params_span = 0 # unsigned number + +# The threshold for aligning function-call parameters for single line +# functions. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_same_func_call_params_thresh = 0 # number + +# The span for aligning variable definitions. +# +# 0: Don't align (default). +align_var_def_span = 0 # unsigned number + +# How to consider (or treat) the '*' in the alignment of variable definitions. +# +# 0: Part of the type 'void * foo;' (default) +# 1: Part of the variable 'void *foo;' +# 2: Dangling 'void *foo;' +# Dangling: the '*' will not be taken into account when aligning. +align_var_def_star_style = 1 # unsigned number + +# How to consider (or treat) the '&' in the alignment of variable definitions. +# +# 0: Part of the type 'long & foo;' (default) +# 1: Part of the variable 'long &foo;' +# 2: Dangling 'long &foo;' +# Dangling: the '&' will not be taken into account when aligning. +align_var_def_amp_style = 0 # unsigned number + +# The threshold for aligning variable definitions. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_var_def_thresh = 0 # number + +# The gap for aligning variable definitions. +align_var_def_gap = 0 # unsigned number + +# Whether to align the colon in struct bit fields. +align_var_def_colon = false # true/false + +# The gap for aligning the colon in struct bit fields. +align_var_def_colon_gap = 0 # unsigned number + +# Whether to align any attribute after the variable name. +align_var_def_attribute = false # true/false + +# Whether to align inline struct/enum/union variable definitions. +align_var_def_inline = false # true/false + +# The span for aligning on '=' in assignments. +# +# 0: Don't align (default). +align_assign_span = 0 # unsigned number + +# The span for aligning on '=' in function prototype modifier. +# +# 0: Don't align (default). +align_assign_func_proto_span = 0 # unsigned number + +# The threshold for aligning on '=' in assignments. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_assign_thresh = 0 # number + +# Whether to align on the left most assignment when multiple +# definitions are found on the same line. +# Depends on 'align_assign_span' and 'align_assign_thresh' settings. +align_assign_on_multi_var_defs = false # true/false + +# The span for aligning on '{' in braced init list. +# +# 0: Don't align (default). +align_braced_init_list_span = 0 # unsigned number + +# The threshold for aligning on '{' in braced init list. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_braced_init_list_thresh = 0 # number + +# How to apply align_assign_span to function declaration "assignments", i.e. +# 'virtual void foo() = 0' or '~foo() = {default|delete}'. +# +# 0: Align with other assignments (default) +# 1: Align with each other, ignoring regular assignments +# 2: Don't align +align_assign_decl_func = 0 # unsigned number + +# The span for aligning on '=' in enums. +# +# 0: Don't align (default). +align_enum_equ_span = 0 # unsigned number + +# The threshold for aligning on '=' in enums. +# Use a negative number for absolute thresholds. +# +# 0: no limit (default). +align_enum_equ_thresh = 0 # number + +# The span for aligning class member definitions. +# +# 0: Don't align (default). +align_var_class_span = 0 # unsigned number + +# The threshold for aligning class member definitions. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_var_class_thresh = 0 # number + +# The gap for aligning class member definitions. +align_var_class_gap = 0 # unsigned number + +# The span for aligning struct/union member definitions. +# +# 0: Don't align (default). +align_var_struct_span = 0 # unsigned number + +# The threshold for aligning struct/union member definitions. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions. +align_var_struct_gap = 0 # unsigned number + +# The span for aligning struct initializer values. +# +# 0: Don't align (default). +align_struct_init_span = 0 # unsigned number + +# The span for aligning single-line typedefs. +# +# 0: Don't align (default). +align_typedef_span = 0 # unsigned number + +# The minimum space between the type and the synonym of a typedef. +align_typedef_gap = 0 # unsigned number + +# How to align typedef'd functions with other typedefs. +# +# 0: Don't mix them at all (default) +# 1: Align the open parenthesis with the types +# 2: Align the function type name with the other type names +align_typedef_func = 0 # unsigned number + +# How to consider (or treat) the '*' in the alignment of typedefs. +# +# 0: Part of the typedef type, 'typedef int * pint;' (default) +# 1: Part of type name: 'typedef int *pint;' +# 2: Dangling: 'typedef int *pint;' +# Dangling: the '*' will not be taken into account when aligning. +align_typedef_star_style = 1 # unsigned number + +# How to consider (or treat) the '&' in the alignment of typedefs. +# +# 0: Part of the typedef type, 'typedef int & intref;' (default) +# 1: Part of type name: 'typedef int &intref;' +# 2: Dangling: 'typedef int &intref;' +# Dangling: the '&' will not be taken into account when aligning. +align_typedef_amp_style = 0 # unsigned number + +# The span for aligning comments that end lines. +# +# 0: Don't align (default). +align_right_cmt_span = 0 # unsigned number + +# Minimum number of columns between preceding text and a trailing comment in +# order for the comment to qualify for being aligned. Must be non-zero to have +# an effect. +align_right_cmt_gap = 0 # unsigned number + +# If aligning comments, whether to mix with comments after '}' and #endif with +# less than three spaces before the comment. +align_right_cmt_mix = false # true/false + +# Whether to only align trailing comments that are at the same brace level. +align_right_cmt_same_level = false # true/false + +# Minimum column at which to align trailing comments. Comments which are +# aligned beyond this column, but which can be aligned in a lesser column, +# may be "pulled in". +# +# 0: Ignore (default). +align_right_cmt_at_col = 0 # unsigned number + +# The span for aligning function prototypes. +# +# 0: Don't align (default). +align_func_proto_span = 0 # unsigned number + +# How to consider (or treat) the '*' in the alignment of function prototypes. +# +# 0: Part of the type 'void * foo();' (default) +# 1: Part of the function 'void *foo();' +# 2: Dangling 'void *foo();' +# Dangling: the '*' will not be taken into account when aligning. +align_func_proto_star_style = 0 # unsigned number + +# How to consider (or treat) the '&' in the alignment of function prototypes. +# +# 0: Part of the type 'long & foo();' (default) +# 1: Part of the function 'long &foo();' +# 2: Dangling 'long &foo();' +# Dangling: the '&' will not be taken into account when aligning. +align_func_proto_amp_style = 0 # unsigned number + +# The threshold for aligning function prototypes. +# Use a negative number for absolute thresholds. +# +# 0: No limit (default). +align_func_proto_thresh = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # unsigned number + +# Whether to align function prototypes on the 'operator' keyword instead of +# what follows. +align_on_operator = false # true/false + +# Whether to mix aligning prototype and variable declarations. If true, +# align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # true/false + +# Whether to align single-line functions with function prototypes. +# Uses align_func_proto_span. +align_single_line_func = false # true/false + +# Whether to align the open brace of single-line functions. +# Requires align_single_line_func=true. Uses align_func_proto_span. +align_single_line_brace = false # true/false + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # unsigned number + +# (OC) The span for aligning Objective-C message specifications. +# +# 0: Don't align (default). +align_oc_msg_spec_span = 0 # unsigned number + +# Whether and how to align backslashes that split a macro onto multiple lines. +# This will not work right if the macro contains a multi-line comment. +# +# 0: Do nothing (default) +# 1: Align the backslashes in the column at the end of the longest line +# 2: Align with the backslash that is farthest to the left, or, if that +# backslash is farther left than the end of the longest line, at the end of +# the longest line +# 3: Align with the backslash that is farthest to the right +align_nl_cont = 0 # unsigned number + +# Whether to align macro functions and variables together. +align_pp_define_together = true # true/false + +# The span for aligning on '#define' bodies. +# +# =0: Don't align (default) +# >0: Number of lines (including comments) between blocks +align_pp_define_span = 0 # unsigned number + +# The minimum space between label and value of a preprocessor define. +align_pp_define_gap = 0 # unsigned number + +# Whether to align lines that start with '<<' with previous '<<'. +# +# Default: true +align_left_shift = true # true/false + +# Whether to align comma-separated statements following '<<' (as used to +# initialize Eigen matrices). +align_eigen_comma_init = false # true/false + +# Whether to align text after 'asm volatile ()' colons. +align_asm_colon = false # true/false + +# (OC) Span for aligning parameters in an Objective-C message call +# on the ':'. +# +# 0: Don't align. +align_oc_msg_colon_span = 0 # unsigned number + +# (OC) Whether to always align with the first parameter, even if it is too +# short. +align_oc_msg_colon_first = false # true/false + +# (OC) Whether to align parameters in an Objective-C '+' or '-' declaration +# on the ':'. +align_oc_decl_colon = false # true/false + +# (OC) Whether to not align parameters in an Objectve-C message call if first +# colon is not on next line of the message call (the same way Xcode does +# alignment) +align_oc_msg_colon_xcode_like = false # true/false + +# +# Comment modification options +# + +# Try to wrap comments at N columns. +cmt_width = 0 # unsigned number + +# How to reflow comments. +# +# 0: No reflowing (apart from the line wrapping due to cmt_width) (default) +# 1: No touching at all +# 2: Full reflow (enable cmt_indent_multi for indent with line wrapping due to cmt_width) +cmt_reflow_mode = 1 # unsigned number + +# Path to a file that contains regular expressions describing patterns for +# which the end of one line and the beginning of the next will be folded into +# the same sentence or paragraph during full comment reflow. The regular +# expressions are described using ECMAScript syntax. The syntax for this +# specification is as follows, where "..." indicates the custom regular +# expression and "n" indicates the nth end_of_prev_line_regex and +# beg_of_next_line_regex regular expression pair: +# +# end_of_prev_line_regex[1] = "...$" +# beg_of_next_line_regex[1] = "^..." +# end_of_prev_line_regex[2] = "...$" +# beg_of_next_line_regex[2] = "^..." +# . +# . +# . +# end_of_prev_line_regex[n] = "...$" +# beg_of_next_line_regex[n] = "^..." +# +# Note that use of this option overrides the default reflow fold regular +# expressions, which are internally defined as follows: +# +# end_of_prev_line_regex[1] = "[\w,\]\)]$" +# beg_of_next_line_regex[1] = "^[\w,\[\(]" +# end_of_prev_line_regex[2] = "\.$" +# beg_of_next_line_regex[2] = "^[A-Z]" +cmt_reflow_fold_regex_file = "" # string + +# Whether to indent wrapped lines to the start of the encompassing paragraph +# during full comment reflow (cmt_reflow_mode = 2). Overrides the value +# specified by cmt_sp_after_star_cont. +# +# Note that cmt_align_doxygen_javadoc_tags overrides this option for +# paragraphs associated with javadoc tags +cmt_reflow_indent_to_paragraph_start = false # true/false + +# Whether to convert all tabs to spaces in comments. If false, tabs in +# comments are left alone, unless used for indenting. +cmt_convert_tab_to_spaces = true # true/false + +# Whether to apply changes to multi-line comments, including cmt_width, +# keyword substitution and leading chars. +# +# Default: true +cmt_indent_multi = false # true/false + +# Whether to align doxygen javadoc-style tags ('@param', '@return', etc.) +# and corresponding fields such that groups of consecutive block tags, +# parameter names, and descriptions align with one another. Overrides that +# which is specified by the cmt_sp_after_star_cont. If cmt_width > 0, it may +# be necessary to enable cmt_indent_multi and set cmt_reflow_mode = 2 +# in order to achieve the desired alignment for line-wrapping. +cmt_align_doxygen_javadoc_tags = false # true/false + +# The number of spaces to insert after the star and before doxygen +# javadoc-style tags (@param, @return, etc). Requires enabling +# cmt_align_doxygen_javadoc_tags. Overrides that which is specified by the +# cmt_sp_after_star_cont. +# +# Default: 1 +cmt_sp_before_doxygen_javadoc_tags = 1 # unsigned number + +# Whether to change trailing, single-line c-comments into cpp-comments. +cmt_trailing_single_line_c_to_cpp = true # true/false + +# Whether to group c-comments that look like they are in a block. +cmt_c_group = false # true/false + +# Whether to put an empty '/*' on the first line of the combined c-comment. +cmt_c_nl_start = true # true/false + +# Whether to add a newline before the closing '*/' of the combined c-comment. +cmt_c_nl_end = false # true/false + +# Whether to change cpp-comments into c-comments. +cmt_cpp_to_c = false # true/false + +# Whether to group cpp-comments that look like they are in a block. Only +# meaningful if cmt_cpp_to_c=true. +cmt_cpp_group = false # true/false + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +# when converting to a c-comment. +# +# Requires cmt_cpp_to_c=true and cmt_cpp_group=true. +cmt_cpp_nl_start = false # true/false + +# Whether to add a newline before the closing '*/' of the combined cpp-comment +# when converting to a c-comment. +# +# Requires cmt_cpp_to_c=true and cmt_cpp_group=true. +cmt_cpp_nl_end = false # true/false + +# Whether to put a star on subsequent comment lines. +cmt_star_cont = true # true/false + +# The number of spaces to insert at the start of subsequent comment lines. +cmt_sp_before_star_cont = 1 # unsigned number + +# The number of spaces to insert after the star on subsequent comment lines. +cmt_sp_after_star_cont = 1 # unsigned number + +# For multi-line comments with a '*' lead, remove leading spaces if the first +# and last lines of the comment are the same length. +# +# Default: true +cmt_multi_check_last = true # true/false + +# For multi-line comments with a '*' lead, remove leading spaces if the first +# and last lines of the comment are the same length AND if the length is +# bigger as the first_len minimum. +# +# Default: 4 +cmt_multi_first_len_minimum = 4 # unsigned number + +# Path to a file that contains text to insert at the beginning of a file if +# the file doesn't start with a C/C++ comment. If the inserted text contains +# '$(filename)', that will be replaced with the current file's name. +cmt_insert_file_header = "./buildroot/share/extras/file_header.h" # string + +# Path to a file that contains text to insert at the end of a file if the +# file doesn't end with a C/C++ comment. If the inserted text contains +# '$(filename)', that will be replaced with the current file's name. +cmt_insert_file_footer = "" # string + +# Path to a file that contains text to insert before a function definition if +# the function isn't preceded by a C/C++ comment. If the inserted text +# contains '$(function)', '$(javaparam)' or '$(fclass)', these will be +# replaced with, respectively, the name of the function, the javadoc '@param' +# and '@return' stuff, or the name of the class to which the member function +# belongs. +cmt_insert_func_header = "" # string + +# Path to a file that contains text to insert before a class if the class +# isn't preceded by a C/C++ comment. If the inserted text contains '$(class)', +# that will be replaced with the class name. +cmt_insert_class_header = "" # string + +# Path to a file that contains text to insert before an Objective-C message +# specification, if the method isn't preceded by a C/C++ comment. If the +# inserted text contains '$(message)' or '$(javaparam)', these will be +# replaced with, respectively, the name of the function, or the javadoc +# '@param' and '@return' stuff. +cmt_insert_oc_msg_header = "" # string + +# Whether a comment should be inserted if a preprocessor is encountered when +# stepping backwards from a function name. +# +# Applies to cmt_insert_oc_msg_header, cmt_insert_func_header and +# cmt_insert_class_header. +cmt_insert_before_preproc = false # true/false + +# Whether a comment should be inserted if a function is declared inline to a +# class definition. +# +# Applies to cmt_insert_func_header. +# +# Default: true +cmt_insert_before_inlines = true # true/false + +# Whether a comment should be inserted if the function is a class constructor +# or destructor. +# +# Applies to cmt_insert_func_header. +cmt_insert_before_ctor_dtor = false # true/false + +# +# Code modifying options (non-whitespace) +# + +# Add or remove braces on a single-line 'do' statement. +mod_full_brace_do = ignore # ignore/add/remove/force/not_defined + +# Add or remove braces on a single-line 'for' statement. +mod_full_brace_for = ignore # ignore/add/remove/force/not_defined + +# (Pawn) Add or remove braces on a single-line function definition. +mod_full_brace_function = ignore # ignore/add/remove/force/not_defined + +# Add or remove braces on a single-line 'if' statement. Braces will not be +# removed if the braced statement contains an 'else'. +mod_full_brace_if = ignore # ignore/add/remove/force/not_defined + +# Whether to enforce that all blocks of an 'if'/'else if'/'else' chain either +# have, or do not have, braces. Overrides mod_full_brace_if. +# +# 0: Don't override mod_full_brace_if +# 1: Add braces to all blocks if any block needs braces and remove braces if +# they can be removed from all blocks +# 2: Add braces to all blocks if any block already has braces, regardless of +# whether it needs them +# 3: Add braces to all blocks if any block needs braces and remove braces if +# they can be removed from all blocks, except if all blocks have braces +# despite none needing them +mod_full_brace_if_chain = 1 # unsigned number + +# Whether to add braces to all blocks of an 'if'/'else if'/'else' chain. +# If true, mod_full_brace_if_chain will only remove braces from an 'if' that +# does not have an 'else if' or 'else'. +mod_full_brace_if_chain_only = false # true/false + +# Add or remove braces on single-line 'while' statement. +mod_full_brace_while = ignore # ignore/add/remove/force/not_defined + +# Add or remove braces on single-line 'using ()' statement. +mod_full_brace_using = ignore # ignore/add/remove/force/not_defined + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # unsigned number + +# Whether to prevent removal of braces from 'if'/'for'/'while'/etc. blocks +# which span multiple lines. +# +# Affects: +# mod_full_brace_for +# mod_full_brace_if +# mod_full_brace_if_chain +# mod_full_brace_if_chain_only +# mod_full_brace_while +# mod_full_brace_using +# +# Does not affect: +# mod_full_brace_do +# mod_full_brace_function +mod_full_brace_nl_block_rem_mlcond = false # true/false + +# Add or remove unnecessary parentheses on 'return' statement. +mod_paren_on_return = ignore # ignore/add/remove/force/not_defined + +# Add or remove unnecessary parentheses on 'throw' statement. +mod_paren_on_throw = ignore # ignore/add/remove/force/not_defined + +# (Pawn) Whether to change optional semicolons to real semicolons. +mod_pawn_semicolon = false # true/false + +# Whether to fully parenthesize Boolean expressions in 'while' and 'if' +# statement, as in 'if (a && b > c)' => 'if (a && (b > c))'. +mod_full_paren_if_bool = false # true/false + +# Whether to fully parenthesize Boolean expressions after '=' +# statement, as in 'x = a && b > c;' => 'x = (a && (b > c));'. +mod_full_paren_assign_bool = false # true/false + +# Whether to fully parenthesize Boolean expressions after '=' +# statement, as in 'return a && b > c;' => 'return (a && (b > c));'. +mod_full_paren_return_bool = false # true/false + +# Whether to remove superfluous semicolons. +mod_remove_extra_semicolon = true # true/false + +# Whether to remove duplicate include. +mod_remove_duplicate_include = false # true/false + +# the following options (mod_XX_closebrace_comment) use different comment, +# depending of the setting of the next option. +# false: Use the c comment (default) +# true : Use the cpp comment +mod_add_force_c_closebrace_comment = false # true/false + +# If a function body exceeds the specified number of newlines and doesn't have +# a comment after the close brace, a comment will be added. +mod_add_long_function_closebrace_comment = 0 # unsigned number + +# If a namespace body exceeds the specified number of newlines and doesn't +# have a comment after the close brace, a comment will be added. +mod_add_long_namespace_closebrace_comment = 0 # unsigned number + +# If a class body exceeds the specified number of newlines and doesn't have a +# comment after the close brace, a comment will be added. +mod_add_long_class_closebrace_comment = 0 # unsigned number + +# If a switch body exceeds the specified number of newlines and doesn't have a +# comment after the close brace, a comment will be added. +mod_add_long_switch_closebrace_comment = 0 # unsigned number + +# If an #ifdef body exceeds the specified number of newlines and doesn't have +# a comment after the #endif, a comment will be added. +mod_add_long_ifdef_endif_comment = 20 # unsigned number + +# If an #ifdef or #else body exceeds the specified number of newlines and +# doesn't have a comment after the #else, a comment will be added. +mod_add_long_ifdef_else_comment = 20 # unsigned number + +# Whether to take care of the case by the mod_sort_xx options. +mod_sort_case_sensitive = false # true/false + +# Whether to sort consecutive single-line 'import' statements. +mod_sort_import = false # true/false + +# (C#) Whether to sort consecutive single-line 'using' statements. +mod_sort_using = false # true/false + +# Whether to sort consecutive single-line '#include' statements (C/C++) and +# '#import' statements (Objective-C). Be aware that this has the potential to +# break your code if your includes/imports have ordering dependencies. +mod_sort_include = false # true/false + +# Whether to prioritize '#include' and '#import' statements that contain +# filename without extension when sorting is enabled. +mod_sort_incl_import_prioritize_filename = false # true/false + +# Whether to prioritize '#include' and '#import' statements that does not +# contain extensions when sorting is enabled. +mod_sort_incl_import_prioritize_extensionless = false # true/false + +# Whether to prioritize '#include' and '#import' statements that contain +# angle over quotes when sorting is enabled. +mod_sort_incl_import_prioritize_angle_over_quotes = false # true/false + +# Whether to ignore file extension in '#include' and '#import' statements +# for sorting comparison. +mod_sort_incl_import_ignore_extension = false # true/false + +# Whether to group '#include' and '#import' statements when sorting is enabled. +mod_sort_incl_import_grouping_enabled = false # true/false + +# Whether to move a 'break' that appears after a fully braced 'case' before +# the close brace, as in 'case X: { ... } break;' => 'case X: { ... break; }'. +mod_move_case_break = false # true/false + +# Whether to move a 'return' that appears after a fully braced 'case' before +# the close brace, as in 'case X: { ... } return;' => 'case X: { ... return; }'. +mod_move_case_return = false # true/false + +# Add or remove braces around a fully braced case statement. Will only remove +# braces if there are no variable declarations in the block. +mod_case_brace = ignore # ignore/add/remove/force/not_defined + +# Whether to remove a void 'return;' that appears as the last statement in a +# function. +mod_remove_empty_return = false # true/false + +# Add or remove the comma after the last value of an enumeration. +mod_enum_last_comma = ignore # ignore/add/remove/force/not_defined + +# Syntax to use for infinite loops. +# +# 0: Leave syntax alone (default) +# 1: Rewrite as `for(;;)` +# 2: Rewrite as `while(true)` +# 3: Rewrite as `do`...`while(true);` +# 4: Rewrite as `while(1)` +# 5: Rewrite as `do`...`while(1);` +# +# Infinite loops that do not already match one of these syntaxes are ignored. +# Other options that affect loop formatting will be applied after transforming +# the syntax. +mod_infinite_loop = 0 # unsigned number + +# Add or remove the 'int' keyword in 'int short'. +mod_int_short = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'short int'. +mod_short_int = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'int long'. +mod_int_long = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'long int'. +mod_long_int = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'int signed'. +mod_int_signed = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'signed int'. +mod_signed_int = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'int unsigned'. +mod_int_unsigned = ignore # ignore/add/remove/force/not_defined + +# Add or remove the 'int' keyword in 'unsigned int'. +mod_unsigned_int = ignore # ignore/add/remove/force/not_defined + +# If there is a situation where mod_int_* and mod_*_int would result in +# multiple int keywords, whether to keep the rightmost int (the default) or the +# leftmost int. +mod_int_prefer_int_on_left = false # true/false + +# (OC) Whether to organize the properties. If true, properties will be +# rearranged according to the mod_sort_oc_property_*_weight factors. +mod_sort_oc_properties = false # true/false + +# (OC) Weight of a class property modifier. +mod_sort_oc_property_class_weight = 0 # number + +# (OC) Weight of 'atomic' and 'nonatomic'. +mod_sort_oc_property_thread_safe_weight = 0 # number + +# (OC) Weight of 'readwrite' when organizing properties. +mod_sort_oc_property_readwrite_weight = 0 # number + +# (OC) Weight of a reference type specifier ('retain', 'copy', 'assign', +# 'weak', 'strong') when organizing properties. +mod_sort_oc_property_reference_weight = 0 # number + +# (OC) Weight of getter type ('getter=') when organizing properties. +mod_sort_oc_property_getter_weight = 0 # number + +# (OC) Weight of setter type ('setter=') when organizing properties. +mod_sort_oc_property_setter_weight = 0 # number + +# (OC) Weight of nullability type ('nullable', 'nonnull', 'null_unspecified', +# 'null_resettable') when organizing properties. +mod_sort_oc_property_nullability_weight = 0 # number + +# +# Preprocessor options +# + +# How to use tabs when indenting preprocessor code. +# +# -1: Use 'indent_with_tabs' setting (default) +# 0: Spaces only +# 1: Indent with tabs to brace level, align with spaces +# 2: Indent and align with tabs, using spaces when not on a tabstop +# +# Default: -1 +pp_indent_with_tabs = -1 # number + +# Add or remove indentation of preprocessor directives inside #if blocks +# at brace level 0 (file-level). +pp_indent = add # ignore/add/remove/force/not_defined + +# Whether to indent #if/#else/#endif at the brace level. If false, these are +# indented from column 1. +pp_indent_at_level = true # true/false + +# Whether to indent #if/#else/#endif at the parenthesis level if the brace +# level is 0. If false, these are indented from column 1. +pp_indent_at_level0 = false # true/false + +# Specifies the number of columns to indent preprocessors per level +# at brace level 0 (file-level). If pp_indent_at_level=false, also specifies +# the number of columns to indent preprocessors per level +# at brace level > 0 (function-level). +# +# Default: 1 +pp_indent_count = 2 # unsigned number + +# Add or remove space after # based on pp level of #if blocks. +pp_space_after = ignore # ignore/add/remove/force/not_defined + +# Sets the number of spaces per level added with pp_space_after. +pp_space_count = 0 # unsigned number + +# The indent for '#region' and '#endregion' in C# and '#pragma region' in +# C/C++. Negative values decrease indent down to the first column. +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion. +pp_region_indent_code = false # true/false + +# If pp_indent_at_level=true, sets the indent for #if, #else and #endif when +# not at file-level. Negative values decrease indent down to the first column. +# +# =0: Indent preprocessors using output_tab_size +# >0: Column at which all preprocessors will be indented +pp_indent_if = 0 # number + +# Whether to indent the code between #if, #else and #endif. +pp_if_indent_code = true # true/false + +# Whether to indent the body of an #if that encompasses all the code in the file. +pp_indent_in_guard = false # true/false + +# Whether to indent '#define' at the brace level. If false, these are +# indented from column 1. +pp_define_at_level = true # true/false + +# Whether to indent '#include' at the brace level. +pp_include_at_level = false # true/false + +# Whether to ignore the '#define' body while formatting. +pp_ignore_define_body = false # true/false + +# An offset value that controls the indentation of the body of a multiline #define. +# 'body' refers to all the lines of a multiline #define except the first line. +# Requires 'pp_ignore_define_body = false'. +# +# <0: Absolute column: the body indentation starts off at the specified column +# (ex. -3 ==> the body is indented starting from column 3) +# >=0: Relative to the column of the '#' of '#define' +# (ex. 3 ==> the body is indented starting 3 columns at the right of '#') +# +# Default: 8 +pp_multiline_define_body_indent = 8 # number + +# Whether to indent case statements between #if, #else, and #endif. +# Only applies to the indent of the preprocessor that the case statements +# directly inside of. +# +# Default: true +pp_indent_case = true # true/false + +# Whether to indent whole function definitions between #if, #else, and #endif. +# Only applies to the indent of the preprocessor that the function definition +# is directly inside of. +# +# Default: true +pp_indent_func_def = true # true/false + +# Whether to indent extern C blocks between #if, #else, and #endif. +# Only applies to the indent of the preprocessor that the extern block is +# directly inside of. +# +# Default: true +pp_indent_extern = true # true/false + +# How to indent braces directly inside #if, #else, and #endif. +# Requires pp_if_indent_code=true and only applies to the indent of the +# preprocessor that the braces are directly inside of. +# 0: No extra indent +# 1: Indent by one level +# -1: Preserve original indentation +# +# Default: 1 +pp_indent_brace = 1 # number + +# Whether to print warning messages for unbalanced #if and #else blocks. +# This will print a message in the following cases: +# - if an #ifdef block ends on a different indent level than +# where it started from. Example: +# +# #ifdef TEST +# int i; +# { +# int j; +# #endif +# +# - an #elif/#else block ends on a different indent level than +# the corresponding #ifdef block. Example: +# +# #ifdef TEST +# int i; +# #else +# } +# int j; +# #endif +pp_warn_unbalanced_if = false # true/false + +# +# Sort includes options +# + +# The regex for include category with priority 0. +include_category_0 = "" # string + +# The regex for include category with priority 1. +include_category_1 = "" # string + +# The regex for include category with priority 2. +include_category_2 = "" # string + +# +# Use or Do not Use options +# + +# true: indent_func_call_param will be used (default) +# false: indent_func_call_param will NOT be used +# +# Default: true +use_indent_func_call_param = true # true/false + +# The value of the indentation for a continuation line is calculated +# differently if the statement is: +# - a declaration: your case with QString fileName ... +# - an assignment: your case with pSettings = new QSettings( ... +# +# At the second case the indentation value might be used twice: +# - at the assignment +# - at the function call (if present) +# +# To prevent the double use of the indentation value, use this option with the +# value 'true'. +# +# true: indent_continue will be used only once +# false: indent_continue will be used every time (default) +# +# Requires indent_ignore_first_continue=false. +use_indent_continue_only_once = false # true/false + +# The indentation can be: +# - after the assignment, at the '[' character +# - at the beginning of the lambda body +# +# true: indentation will be at the beginning of the lambda body +# false: indentation will be after the assignment (default) +indent_cpp_lambda_only_once = false # true/false + +# Whether sp_after_angle takes precedence over sp_inside_fparen. This was the +# historic behavior, but is probably not the desired behavior, so this is off +# by default. +use_sp_after_angle_always = false # true/false + +# Whether to apply special formatting for Qt SIGNAL/SLOT macros. Essentially, +# this tries to format these so that they match Qt's normalized form (i.e. the +# result of QMetaObject::normalizedSignature), which can slightly improve the +# performance of the QObject::connect call, rather than how they would +# otherwise be formatted. +# +# See options_for_QT.cpp for details. +# +# Default: true +use_options_overriding_for_qt_macros = true # true/false + +# If true: the form feed character is removed from the list of whitespace +# characters. See https://en.cppreference.com/w/cpp/string/byte/isspace. +use_form_feed_no_more_as_whitespace_character = false # true/false + +# +# Warn levels - 1: error, 2: warning (default), 3: note +# + +# (C#) Warning is given if doing tab-to-\t replacement and we have found one +# in a C# verbatim string literal. +# +# Default: 2 +warn_level_tabs_found_in_verbatim_string_literals = 2 # unsigned number + +# Limit the number of loops. +# Used by uncrustify.cpp to exit from infinite loop. +# 0: no limit. +debug_max_number_of_loops = 0 # number + +# Set the number of the line to protocol; +# Used in the function prot_the_line if the 2. parameter is zero. +# 0: nothing protocol. +debug_line_number_to_protocol = 0 # number + +# Set the number of second(s) before terminating formatting the current file, +# 0: no timeout. +# only for linux +debug_timeout = 0 # number + +# Set the number of characters to be printed if the text is too long, +# 0: do not truncate. +debug_truncate = 0 # unsigned number + +# sort (or not) the tracking info. +# +# Default: true +debug_sort_the_tracks = true # true/false + +# decode (or not) the flags as a new line. +# only if the -p option is set. +debug_decode_the_flags = false # true/false + +# insert the number of the line at the beginning of each line +set_numbering_for_html_output = false # true/false + +# Meaning of the settings: +# Ignore - do not do any changes +# Add - makes sure there is 1 or more space/brace/newline/etc +# Force - makes sure there is exactly 1 space/brace/newline/etc, +# behaves like Add in some contexts +# Remove - removes space/brace/newline/etc +# +# +# - Token(s) can be treated as specific type(s) with the 'set' option: +# `set tokenType tokenString [tokenString...]` +# +# Example: +# `set BOOL __AND__ __OR__` +# +# tokenTypes are defined in src/token_enum.h, use them without the +# 'CT_' prefix: 'CT_BOOL' => 'BOOL' +# +# +# - Token(s) can be treated as type(s) with the 'type' option. +# `type tokenString [tokenString...]` +# +# Example: +# `type int c_uint_8 Rectangle` +# +# This can also be achieved with `set TYPE int c_uint_8 Rectangle` +# +# +# To embed whitespace in tokenStrings use the '\' escape character, or quote +# the tokenStrings. These quotes are supported: "'` +# +# +# - Support for the auto detection of languages through the file ending can be +# added using the 'file_ext' command. +# `file_ext langType langString [langString..]` +# +# Example: +# `file_ext CPP .ch .cxx .cpp.in` +# +# langTypes are defined in uncrusify_types.h in the lang_flag_e enum, use +# them without the 'LANG_' prefix: 'LANG_CPP' => 'CPP' +# +# +# - Custom macro-based indentation can be set up using 'macro-open', +# 'macro-else' and 'macro-close'. +# `(macro-open | macro-else | macro-close) tokenString` +# +# Example: +# `macro-open BEGIN_TEMPLATE_MESSAGE_MAP` +# `macro-open BEGIN_MESSAGE_MAP` +# `macro-close END_MESSAGE_MAP` +# +# +# option(s) with 'not default' value: 0 +# From 10d80eb89438b403a37b907b2c4d5995ee3bd023 Mon Sep 17 00:00:00 2001 From: Taylor Talkington Date: Wed, 27 Dec 2023 02:24:16 -0500 Subject: [PATCH 41/73] =?UTF-8?q?=F0=9F=93=9D=20Docs:=20Binary=20File=20Tr?= =?UTF-8?q?ansfer=20(BFT)=20Protocol=20(#26570)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/BinaryFileTransferProtocol.md | 234 +++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 docs/BinaryFileTransferProtocol.md diff --git a/docs/BinaryFileTransferProtocol.md b/docs/BinaryFileTransferProtocol.md new file mode 100644 index 000000000000..46c1bf9718cf --- /dev/null +++ b/docs/BinaryFileTransferProtocol.md @@ -0,0 +1,234 @@ +# Marlin Binary File Transfer (BFT) +Marlin is capable of transferring binary data to the internal storage (SD card) via serial when built with `BINARY_FILE_TRANSFER` enabled. The following is a description of the binary protocol that must be used to conduct transfers once the printer is in binary mode after running `M28 B1`. + +## Data Endianness +All data structures are **little-endian**! This means that when constructing the packets with multi-byte values, the lower bits are packed first. For example, each packet should start with a 16-bit start token with the value of `0xB5AD`. The data itself should start with a value of `0xAD` followed by `0xB5` etc. + +An example Connection SYNC packet, which is only a header and has no payload: +``` + S S P P P H + t y r a a e + a n o c y a + r c t k l d + t o e o e + c t a r + o d + l t C + y l S + p e + e n +---- -- - - ---- ---- +ADB5 00 0 1 0000 0103 +``` + +## Packet Header + +``` + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-------------------------------+---------------+-------+-------+ +| Start Token (0xB5AD) | Sync Number | Prot- | Pack- | +| | | ocol | et | +| | | ID | Type | ++-------------------------------+---------------+-------+-------+ +| Payload Length | Header Checksum | ++-------------------------------+-------------------------------+ +``` + +| Field | Width | Description | +|-----------------|---------|---| +| Start Token | 16 bits | Each packet must start with the 16-bit value `0xB5AD`. | +| Sync Number | 8 bits | Synchronization value, each packet after sync should increment this value by 1. | +| Protocol ID | 4 bits | Protocol ID. `0` for Connection Control, `1` for Transfer. See Below. | +| Packet Type | 4 bits | Packet Type ID. Depends on the Protocol ID, see below. | +| Payload Length | 16 bits | Length of payload data. If this value is greater than 0, a packet payload will follow the header. | +| Header Checksum | 16 bits | 16-bit Fletchers checksum of the header data excluding the Start Token | + +## Packet Payload +If the Payload Length field of the header is non-zero, payload data is expected to follow. + +``` + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-------------------------------+-------------------------------+ +| Payload Data ... | ++-------------------------------+-------------------------------+ +| ... | Packet Checksum | ++-------------------------------+-------------------------------+ +``` + +| Field | Width | Description | +|-----------------|------------------------|---| +| Payload Data | Payload Length bytes | Payload data. This should be no longer than the buffer length reported by the Connection SYNC operation. | +| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. | + +## Fletchers Checksum +Data packets require a checksum for the header and a checksum for the entire packet if the packet has a payload. In both cases the checksum does not include the first two bytes of the packet, the Start Token. + +A simple example implementation: +```c++ +uint16_t cs = 0; +for (size_t i = 2; i> 8) + cslow) % 255) << 8) | cslow; +} +``` + +## General Responses + +### ok +All packets **except** the SYNC Packet (see below) are acknowledged by an `ok` message. This acknowledgement only signifies the client has received the packet and that the header was well formed. An `ok` acknowledgement does not signify successful operation in cases where the client also sends detailed response messages (see details on packet types below). Most notably, with the current implementation the client will still respond `ok` when a client sends multiple packets with the same Sync Number, but will not send the proper response or any errors. + +**NOTE**: The `ok` acknowledgement is sent before any packet type specific output. The `SYNC` value should match the Sync Number of the last packet sent, and the next packet sent should use a Sync Number of this value + 1. + +Example: +``` +ok1 +``` + +### rs +In the case of a packet being sent out of order, where the Sync Number is not the previous Sync Number + 1, an `rs` message will be sent with the last Sync Number received. + +Example: +``` +rs1 +``` + +## Connection Control (`Protocol ID` 0) +`Protocol ID` 0 packets control the binary connection itself. There are only 2 types: + +| Packet Type | Name | Description | +|---|---|---| +| 1 | SYNC | Synchronize host and client and get connection info. | +| 2 | CLOSE | Close the binary connection and switch back to ASCII. | + +### SYNC Packet +A SYNC packet should be the first packet sent by a host after enabling binary mode. On success, a sync response will be sent. + +**Note**: This is the only packet that is not acknowledged with an `ok` response. + +Returns a sync response: +``` +ss,,.. +``` + +| Value | Description | +|---|---| +| SYNC | The current Sync Number, this should be used in the next packet sent and incremented by 1 for each packet sent after. | +| BUFFER_SIZE | The client buffer size. Packet Payload Length must not exceed this value. | +| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. | +| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. | +| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. | + +Example response: +``` +ss0,96,0.1.0 +``` + +### CLOSE Packet +A CLOSE packet should be the last packet sent by a host. On success, the client will switch back to ASCII mode. + +## Transfer Control (`Protocol ID` 1) +`Protocol ID` 1 packets control the file transfers performed over the connection: + +| Packet Type | Name | Description | +|---|---|---| +| 0 | QUERY | Query the client protocol details and compression parameters. | +| 1 | OPEN | Open a file for writing and begin accepting data to transfer. | +| 2 | CLOSE | Finish writing and close the current file. | +| 3 | WRITE | Write data to an open file. | +| 4 | ABORT | Abort file transfer. | + +### QUERY Packet +A QUERY packet should be the second packet sent by a host, after a SYNC packet. On success a query response will be sent in addition to an `ok` acknowledgement. + +Returns a query response: +``` +PFT:version:..:compression:(,) +``` + +| Value | Description | +|---|---| +| VERSION_MAJOR | The major version number of the client Marlin BFT protocol, e.g., `0`. | +| VERSION_MINOR | The minor version number of the client Marlin BFT protocol, e.g., `1`. | +| VERSION_PATCH | The patch version number of the client Marlin BFT protocol, e.g., `0`. | +| COMPRESSION_ALGO | Compression algorithm. Currently either `heatshrink` or `none` | +| COMPRESSION_PARAMS | Compression parameters, separated by commas. Currently, if `COMPRESSION_AGLO` is heatshrink, this will be the window size and lookahead size. | + +Example response: +``` +PFT:version:0.1.0:compression:heatshrink,8,4 +``` + +### OPEN Packet +Opens a file for writing. The filename and other options are specified in the Packet Payload. The filename can be a long filename if the firmware is compiled with support, however the entire Packet Payload must not be longer than the buffer length returned by the SYNC Packet. The filename value must include a null terminator. + +Payload: +``` + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++---------------+---------------+-------------------------------+ +| Dummy | Compression | Filename | ++---------------------------------------------------------------| +| ... | ++-------------------------------+-------------------------------+ +| ... | NULL (0x0) | Packet Checksum | ++-------------------------------+-------------------------------+ +``` + +| Field | Width | Description | +|-----------------|------------------------|---| +| Dummy | 8 bits | A boolean value indicating if this file transfer should be actually carried out or not. If `1`, the client will respond as if the file is opened and accept data transfer, but no data will be written. | +| Compression | 8 bits | A boolean value indicating if the data to be transferred will be compressed using the algorithm and parameters returned in the QUERY Packet. | +| Filename | ... | A filename including a null terminator byte. | +| Packet Checksum | 16 bits | 16-bit Fletchers checksum of the header and payload, including the Header Checksum, but excluding the Start Token. | + +Responses: + +| Response | Description | +|---|---| +| `PFT:success` | File opened and ready for write. | +| `PFT:fail` | The client couldn't open the file. | +| `PFT:busy` | The file is already open. | + +### CLOSE Packet +Closes the currently open file. + +Responses: + +| Response | Description | +|---|---| +| `PFT:success` | Buffer flushed and file closed. | +| `PFT:ioerror` | Client storage device failure. | +| `PFT:invalid` | No file open. | + +### WRITE Packet +Writes payload data to the currently open file. If the file was opened with Compression set to 1, the data will be decompressed first. Payload Length must not exceed the buffer size returned by the SYNC Packet. + +Responses: +On success, an `ok` response will be sent. On error, an `ok` response will be followed by an error response: + +| Response | Description | +|---|---| +| `PFT:ioerror` | Client storage device failure. | +| `PFT:invalid` | No file open. | + +### ABORT Packet +Closes the currently open file and remove it. + +Responses: + +| Response | Description | +|---|---| +| `PFT:success` | Transfer aborted, file removed. | + +## Typical Usage + +1. Send ASCII command `M28 B1` to initiate Binary Transfer mode. +2. Send Connection SYNC Packet, record Sync Number and Buffer Size. +3. Send Transfer QUERY Packet, using Sync Number from above. Record compression algorithm and parameters. +4. Send Transfer OPEN Packet, using last Sync Number + 1, filename and compression options. If error, send Connection CLOSE Packet and abort. +5. Send Transfer Write Packets, using last Sync Number + 1 with the file data. The Payload Length must not exceed the Buffer Size reported in step 2. On error, send a Transfer ABORT Packet, followed by a Connection CLOSE Packet and then abort transfer. +6. Send Transfer CLOSE Packet, using last Sync Number + 1. +7. Send Connection CLOSE Packet, using last Sync Number + 1. +8. Client is now in ASCII mode, transfer complete From 15f26b402123d087f62728e1f1763a2b96f8d21d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Dec 2023 01:25:51 -0600 Subject: [PATCH 42/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20AS=5F?= =?UTF-8?q?CHAR=20=3D>=20C=20(#26569)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp | 2 +- Marlin/src/HAL/shared/Delay.cpp | 2 +- Marlin/src/core/debug_section.h | 2 +- Marlin/src/core/mstring.h | 2 +- Marlin/src/core/serial.h | 2 +- Marlin/src/core/types.h | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 22 +++++++++--------- Marlin/src/feature/encoder_i2c.cpp | 8 +++---- Marlin/src/feature/encoder_i2c.h | 10 ++++---- Marlin/src/feature/max7219.cpp | 2 +- Marlin/src/feature/meatpack.cpp | 2 +- Marlin/src/feature/mixing.cpp | 6 ++--- Marlin/src/feature/runout.cpp | 2 +- Marlin/src/gcode/bedlevel/G35.cpp | 4 ++-- Marlin/src/gcode/calibrate/G33.cpp | 2 +- Marlin/src/gcode/calibrate/M48.cpp | 2 +- Marlin/src/gcode/calibrate/M666.cpp | 2 +- Marlin/src/gcode/config/M92.cpp | 2 +- Marlin/src/gcode/control/M605.cpp | 2 +- Marlin/src/gcode/feature/advance/M900.cpp | 2 +- Marlin/src/gcode/feature/ft_motion/M493.cpp | 20 ++++++++-------- Marlin/src/gcode/feature/pause/G61.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M569.cpp | 2 +- Marlin/src/gcode/feature/trinamic/M919.cpp | 2 +- Marlin/src/gcode/host/M360.cpp | 2 +- Marlin/src/gcode/parser.cpp | 2 +- Marlin/src/gcode/units/M149.cpp | 2 +- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 ++-- Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp | 4 ++-- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 8 +++---- Marlin/src/lcd/marlinui.cpp | 4 ++-- Marlin/src/module/motion.cpp | 24 ++++++++++---------- Marlin/src/module/temperature.cpp | 2 +- 33 files changed, 80 insertions(+), 80 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp index 5ebd437c1e15..4f1797dc6a7d 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp @@ -91,7 +91,7 @@ bool PersistentStore::access_finish() { static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) { #if ENABLED(DEBUG_SD_EEPROM_EMULATION) FSTR_P const rw_str = write ? F("write") : F("read"); - SERIAL_ECHOLN(AS_CHAR(' '), rw_str, F("_data("), pos, AS_CHAR(','), *value, AS_CHAR(','), size, F(", ...)")); + SERIAL_ECHOLN(C(' '), rw_str, F("_data("), pos, C(','), *value, C(','), size, F(", ...)")); if (total) SERIAL_ECHOLN(F(" f_"), rw_str, F("()="), s, F("\n size="), size, F("\n bytes_"), write ? F("written=") : F("read="), total); else diff --git a/Marlin/src/HAL/shared/Delay.cpp b/Marlin/src/HAL/shared/Delay.cpp index 31c3f4576539..fd52eb2c6a39 100644 --- a/Marlin/src/HAL/shared/Delay.cpp +++ b/Marlin/src/HAL/shared/Delay.cpp @@ -109,7 +109,7 @@ #if ENABLED(MARLIN_DEV_MODE) void dump_delay_accuracy_check() { auto report_call_time = [](FSTR_P const name, FSTR_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) { - SERIAL_ECHOLN(F("Calling "), name, F(" for "), cycles, AS_CHAR(' '), unit, F(" took: "), total, AS_CHAR(' '), unit); + SERIAL_ECHOLN(F("Calling "), name, F(" for "), cycles, C(' '), unit, F(" took: "), total, C(' '), unit); if (do_flush) SERIAL_FLUSHTX(); }; diff --git a/Marlin/src/core/debug_section.h b/Marlin/src/core/debug_section.h index eb3d12fdf54e..6319515b71e1 100644 --- a/Marlin/src/core/debug_section.h +++ b/Marlin/src/core/debug_section.h @@ -39,7 +39,7 @@ class SectionLog { void echo_msg(FSTR_P const fpre) { SERIAL_ECHO(fpre); - if (the_msg) SERIAL_ECHO(AS_CHAR(' '), the_msg); + if (the_msg) SERIAL_ECHO(C(' '), the_msg); SERIAL_CHAR(' '); print_xyz(xyz_pos_t(current_position)); } diff --git a/Marlin/src/core/mstring.h b/Marlin/src/core/mstring.h index 819c1ab74f6f..31e8c8c6e6ec 100644 --- a/Marlin/src/core/mstring.h +++ b/Marlin/src/core/mstring.h @@ -98,7 +98,7 @@ class MString { void debug(FSTR_P const f) { #if ENABLED(MSTRING_DEBUG) - SERIAL_ECHOLN(f, AS_CHAR(':'), uintptr_t(str), AS_CHAR(' '), length(), AS_CHAR(' '), str); + SERIAL_ECHOLN(f, C(':'), uintptr_t(str), C(' '), length(), C(' '), str); #endif } diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 721d27211b88..ff02ebedc2d7 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -148,7 +148,7 @@ template void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); } // Wrapper for ECHO commands to interpret a char void SERIAL_ECHO(serial_char_t x); -#define AS_DIGIT(C) AS_CHAR('0' + (C)) +#define AS_DIGIT(n) C('0' + (n)) // Print an integer with a numeric base such as PrintBase::Hex template void SERIAL_PRINT(T x, PrintBase y) { SERIAL_IMPL.print(x, y); } diff --git a/Marlin/src/core/types.h b/Marlin/src/core/types.h index 74a60fa4087b..3d1250346125 100644 --- a/Marlin/src/core/types.h +++ b/Marlin/src/core/types.h @@ -298,9 +298,9 @@ typedef IF 255)), uint16_t, uint8_t>::ty #define MMM_TO_MMS(MM_M) feedRate_t(static_cast(MM_M) / 60.0f) #define MMS_TO_MMM(MM_S) (static_cast(MM_S) * 60.0f) -// Packaged character for AS_CHAR macro and other usage +// Packaged character for C macro and other usage typedef struct SerialChar { char c; SerialChar(char n) : c(n) { } } serial_char_t; -#define AS_CHAR(C) serial_char_t(C) +#define C(c) serial_char_t(c) // Packaged types: float with precision and/or width; a repeated space/character typedef struct WFloat { float value; char width; char prec; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 3d0013b6d2da..c61a84894aec 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -465,7 +465,7 @@ void unified_bed_leveling::G29() { SERIAL_ECHOLNPGM("Mesh invalidated. Probing mesh."); } if (param.V_verbosity > 1) - SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, AS_CHAR(','), param.XY_pos.y, F(").\n")); + SERIAL_ECHOLN(F("Probing around ("), param.XY_pos.x, C(','), param.XY_pos.y, F(").\n")); probe_entire_mesh(param.XY_pos, parser.seen_test('T'), parser.seen_test('E'), parser.seen_test('U')); report_current_position(); @@ -1572,14 +1572,14 @@ void unified_bed_leveling::smart_fill_mesh() { if (DEBUGGING(LEVELING)) { #if ENABLED(UBL_TILT_ON_MESH_POINTS) const xy_pos_t oldLpos = oldRpos.asLogical(); - DEBUG_ECHO(F("Calculated point: ("), p_float_t(oldRpos.x, 7), AS_CHAR(','), p_float_t(oldRpos.y, 7), - F(") logical: ("), p_float_t(oldLpos.x, 7), AS_CHAR(','), p_float_t(oldLpos.y, 7), + DEBUG_ECHO(F("Calculated point: ("), p_float_t(oldRpos.x, 7), C(','), p_float_t(oldRpos.y, 7), + F(") logical: ("), p_float_t(oldLpos.x, 7), C(','), p_float_t(oldLpos.y, 7), F(")\nSelected mesh point: ") ); #endif const xy_pos_t lpos = rpos.asLogical(); - DEBUG_ECHO( AS_CHAR('('), p_float_t(rpos.x, 7), AS_CHAR(','), p_float_t(rpos.y, 7), - F(") logical: ("), p_float_t(lpos.x, 7), AS_CHAR(','), p_float_t(lpos.y, 7), + DEBUG_ECHO( C('('), p_float_t(rpos.x, 7), C(','), p_float_t(rpos.y, 7), + F(") logical: ("), p_float_t(lpos.x, 7), C(','), p_float_t(lpos.y, 7), F(") measured: "), p_float_t(measured_z, 7), F(" correction: "), p_float_t(zcorr, 7) ); @@ -1614,7 +1614,7 @@ void unified_bed_leveling::smart_fill_mesh() { vector_3 normal = vector_3(lsf_results.A, lsf_results.B, 1).get_normal(); if (param.V_verbosity > 2) - SERIAL_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']')); + SERIAL_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), C(','), p_float_t(normal.y, 7), C(','), p_float_t(normal.z, 7), C(']')); matrix_3x3 rotation = matrix_3x3::create_look_at(vector_3(lsf_results.A, lsf_results.B, 1)); @@ -1622,14 +1622,14 @@ void unified_bed_leveling::smart_fill_mesh() { float mx = get_mesh_x(i), my = get_mesh_y(j), mz = z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } @@ -1641,7 +1641,7 @@ void unified_bed_leveling::smart_fill_mesh() { rotation.debug(F("rotation matrix:\n")); DEBUG_ECHOLN(F("LSF Results A="), p_float_t(lsf_results.A, 7), F(" B="), p_float_t(lsf_results.B, 7), F(" D="), p_float_t(lsf_results.D, 7)); DEBUG_DELAY(55); - DEBUG_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), AS_CHAR(','), p_float_t(normal.y, 7), AS_CHAR(','), p_float_t(normal.z, 7), AS_CHAR(']')); + DEBUG_ECHOLN(F("bed plane normal = ["), p_float_t(normal.x, 7), C(','), p_float_t(normal.y, 7), C(','), p_float_t(normal.z, 7), C(']')); DEBUG_EOL(); /** @@ -1659,7 +1659,7 @@ void unified_bed_leveling::smart_fill_mesh() { }; auto debug_pt = [](const int num, const xy_pos_t &pos, const_float_t zadd) { d_from(); - DEBUG_ECHOLN(F("Point "), num, AS_CHAR(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6)); + DEBUG_ECHOLN(F("Point "), num, C(':'), p_float_t(normed(pos, zadd), 6), F(" Z error = "), p_float_t(zadd - get_z_correction(pos), 6)); }; debug_pt(1, probe_pt[0], normal.z * gotz[0]); debug_pt(2, probe_pt[1], normal.z * gotz[1]); @@ -1668,7 +1668,7 @@ void unified_bed_leveling::smart_fill_mesh() { constexpr xy_float_t safe_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT }; d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("0 : "), p_float_t(normed(safe_xy, 0), 6)); d_from(); DEBUG_ECHOLN(F("safe home with Z="), F("mesh value "), p_float_t(normed(safe_xy, get_z_correction(safe_xy)), 6)); - DEBUG_ECHO(F(" Z error = ("), Z_SAFE_HOMING_X_POINT, AS_CHAR(','), Z_SAFE_HOMING_Y_POINT, F(") = "), p_float_t(get_z_correction(safe_xy), 6)); + DEBUG_ECHO(F(" Z error = ("), Z_SAFE_HOMING_X_POINT, C(','), Z_SAFE_HOMING_Y_POINT, F(") = "), p_float_t(get_z_correction(safe_xy), 6)); #endif #endif } // DEBUGGING(LEVELING) diff --git a/Marlin/src/feature/encoder_i2c.cpp b/Marlin/src/feature/encoder_i2c.cpp index a367cea48dc6..5a0564ee71d1 100644 --- a/Marlin/src/feature/encoder_i2c.cpp +++ b/Marlin/src/feature/encoder_i2c.cpp @@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) { initialized = true; - SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis, addr = ", address); + SERIAL_ECHOLNPGM("Setting up encoder on ", C(AXIS_CHAR(encoderAxis)), " axis, addr = ", address); position = get_position(); } @@ -67,7 +67,7 @@ void I2CPositionEncoder::update() { /* if (trusted) { //commented out as part of the note below trusted = false; - SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again."); + SERIAL_ECHOLNPGM("Fault detected on ", C(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again."); } */ return; @@ -92,7 +92,7 @@ void I2CPositionEncoder::update() { if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) { trusted = true; - SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction."); + SERIAL_ECHOLNPGM("Untrusted encoder module on ", C(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction."); //the encoder likely lost its place when the error occurred, so we'll reset and use the printer's //idea of where it the axis is to re-initialize @@ -106,7 +106,7 @@ void I2CPositionEncoder::update() { SERIAL_ECHOLNPGM("Current position is ", pos); SERIAL_ECHOLNPGM("Position in encoder ticks is ", positionInTicks); SERIAL_ECHOLNPGM("New zero-offset of ", zeroOffset); - SERIAL_ECHOLN(F("New position reads as "), get_position(), AS_CHAR('('), mm_from_count(get_position()), AS_CHAR(')')); + SERIAL_ECHOLN(F("New position reads as "), get_position(), C('('), mm_from_count(get_position()), C(')')); #endif } #endif diff --git a/Marlin/src/feature/encoder_i2c.h b/Marlin/src/feature/encoder_i2c.h index 1ae05d1433b3..861a8e52d4d6 100644 --- a/Marlin/src/feature/encoder_i2c.h +++ b/Marlin/src/feature/encoder_i2c.h @@ -261,32 +261,32 @@ class I2CPositionEncodersMgr { static void report_error_count(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); - SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count()); + SERIAL_ECHOLNPGM("Error count on ", C(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count()); } static void reset_error_count(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_error_count(0); - SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis has been reset."); + SERIAL_ECHOLNPGM("Error count on ", C(AXIS_CHAR(axis)), " axis has been reset."); } static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_ec_enabled(enabled); - SERIAL_ECHOPGM("Error correction on ", AS_CHAR(AXIS_CHAR(axis))); + SERIAL_ECHOPGM("Error correction on ", C(AXIS_CHAR(axis))); SERIAL_ECHO_TERNARY(encoders[idx].get_ec_enabled(), " axis is ", "en", "dis", "abled.\n"); } static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) { CHECK_IDX(); encoders[idx].set_ec_threshold(newThreshold); - SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm."); + SERIAL_ECHOLNPGM("Error correct threshold for ", C(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm."); } static void get_ec_threshold(const int8_t idx, const AxisEnum axis) { CHECK_IDX(); const float threshold = encoders[idx].get_ec_threshold(); - SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", threshold, "mm."); + SERIAL_ECHOLNPGM("Error correct threshold for ", C(AXIS_CHAR(axis)), " axis is ", threshold, "mm."); } static int8_t idx_from_axis(const AxisEnum axis) { diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index f37c78dde575..12e4a539d3d5 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -136,7 +136,7 @@ uint8_t Max7219::suspended; // = 0; void Max7219::error(FSTR_P const func, const int32_t v1, const int32_t v2/*=-1*/) { #if ENABLED(MAX7219_ERRORS) - SERIAL_ECHO(F("??? Max7219::"), func, AS_CHAR('('), v1); + SERIAL_ECHO(F("??? Max7219::"), func, C('('), v1); if (v2 > 0) SERIAL_ECHOPGM(", ", v2); SERIAL_CHAR(')'); SERIAL_EOL(); diff --git a/Marlin/src/feature/meatpack.cpp b/Marlin/src/feature/meatpack.cpp index 5d2d112967df..fe3dabe8da53 100644 --- a/Marlin/src/feature/meatpack.cpp +++ b/Marlin/src/feature/meatpack.cpp @@ -140,7 +140,7 @@ void MeatPack::handle_output_char(const uint8_t c) { #if ENABLED(MP_DEBUG) if (chars_decoded < 1024) { ++chars_decoded; - DEBUG_ECHOLNPGM("RB: ", AS_CHAR(c)); + DEBUG_ECHOLNPGM("RB: ", C(c)); } #endif } diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 6cf59fdb56ff..4021393f18e6 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -60,7 +60,7 @@ void Mixer::normalize(const uint8_t tool_index) { } #ifdef MIXER_NORMALIZER_DEBUG SERIAL_ECHOPGM("Mixer: Old relation : [ "); - MIXER_STEPPER_LOOP(i) SERIAL_ECHO(collector[i] / csum, AS_CHAR(' ')); + MIXER_STEPPER_LOOP(i) SERIAL_ECHO(collector[i] / csum, C(' ')); SERIAL_ECHOLNPGM("]"); #endif @@ -72,12 +72,12 @@ void Mixer::normalize(const uint8_t tool_index) { csum = 0; SERIAL_ECHOPGM("Mixer: Normalize to : [ "); MIXER_STEPPER_LOOP(i) { - SERIAL_ECHO(uint16_t(color[tool_index][i]), AS_CHAR(' ')); + SERIAL_ECHO(uint16_t(color[tool_index][i]), C(' ')); csum += color[tool_index][i]; } SERIAL_ECHOLNPGM("]"); SERIAL_ECHOPGM("Mixer: New relation : [ "); - MIXER_STEPPER_LOOP(i) SERIAL_ECHO(p_float_t(uint16_t(color[tool_index][i]) / csum, 3), AS_CHAR(' ')); + MIXER_STEPPER_LOOP(i) SERIAL_ECHO(p_float_t(uint16_t(color[tool_index][i]) / csum, 3), C(' ')); SERIAL_ECHOLNPGM("]"); #endif diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 90d3d2fd652b..1d684c6b856a 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -135,7 +135,7 @@ void event_filament_runout(const uint8_t extruder) { if (run_runout_script) { #if MULTI_FILAMENT_SENSOR MString script; - script.setf(F(FILAMENT_RUNOUT_SCRIPT), AS_CHAR(tool)); + script.setf(F(FILAMENT_RUNOUT_SCRIPT), C(tool)); #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) SERIAL_ECHOLNPGM("Runout Command: ", &script); #endif diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 224dd2a0aa2d..8e11383166fb 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -100,7 +100,7 @@ void GcodeSuite::G35() { const float z_probed_height = probe.probe_at_point(tramming_points[i], PROBE_PT_RAISE); if (isnan(z_probed_height)) { SERIAL_ECHO( - F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'), + F("G35 failed at point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'), FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y ); err_break = true; @@ -109,7 +109,7 @@ void GcodeSuite::G35() { if (DEBUGGING(LEVELING)) { DEBUG_ECHOLN( - F("Probing point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), AS_CHAR(')'), + F("Probing point "), i + 1, F(" ("), FPSTR(pgm_read_ptr(&tramming_point_name[i])), C(')'), FPSTR(SP_X_STR), tramming_points[i].x, FPSTR(SP_Y_STR), tramming_points[i].y, FPSTR(SP_Z_STR), z_probed_height ); diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 0cddf484eb6b..d8f104bfceef 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -92,7 +92,7 @@ void ac_cleanup() { } void print_signed_float(FSTR_P const prefix, const_float_t f) { - SERIAL_ECHO(F(" "), prefix, AS_CHAR(':')); + SERIAL_ECHO(F(" "), prefix, C(':')); serial_offset(f); } diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index 9f285b8b8ae3..2d219a07c5fc 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -245,7 +245,7 @@ void GcodeSuite::M48() { sigma = SQRT(dev_sum / (n + 1)); if (verbose_level > 1) { - SERIAL_ECHO(n + 1, F(" of "), n_samples, F(": z: "), p_float_t(pz, 3), AS_CHAR(' ')); + SERIAL_ECHO(n + 1, F(" of "), n_samples, F(": z: "), p_float_t(pz, 3), C(' ')); dev_report(verbose_level > 2, mean, sigma, min, max); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/calibrate/M666.cpp b/Marlin/src/gcode/calibrate/M666.cpp index dbee73f3947b..143b6f249a4e 100644 --- a/Marlin/src/gcode/calibrate/M666.cpp +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -52,7 +52,7 @@ is_err = true; else { delta_endstop_adj[i] = v; - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("delta_endstop_adj[", AS_CHAR(AXIS_CHAR(i)), "] = ", v); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("delta_endstop_adj[", C(AXIS_CHAR(i)), "] = ", v); } } } diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 01b32118c825..09153c51fd49 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -82,7 +82,7 @@ void GcodeSuite::M92() { if (wanted) { const float best = uint16_t(wanted / z_full_step_mm) * z_full_step_mm; SERIAL_ECHOPGM(", best:[", best); - if (best != wanted) { SERIAL_ECHO(AS_CHAR(','), best + z_full_step_mm); } + if (best != wanted) { SERIAL_ECHO(C(','), best + z_full_step_mm); } SERIAL_CHAR(']'); } SERIAL_ECHOLNPGM(" }"); diff --git a/Marlin/src/gcode/control/M605.cpp b/Marlin/src/gcode/control/M605.cpp index 6bf99df4c27a..167cdae4a931 100644 --- a/Marlin/src/gcode/control/M605.cpp +++ b/Marlin/src/gcode/control/M605.cpp @@ -144,7 +144,7 @@ HOTEND_LOOP() { DEBUG_ECHOPGM_P(SP_T_STR, e); - LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", AS_CHAR(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]); + LOOP_NUM_AXES(a) DEBUG_ECHOPGM(" hotend_offset[", e, "].", C(AXIS_CHAR(a) | 0x20), "=", hotend_offset[e][a]); DEBUG_EOL(); } DEBUG_EOL(); diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index 28cc4f80472a..5fa9c04dbd2a 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -131,7 +131,7 @@ void GcodeSuite::M900() { SERIAL_ECHOLNPGM("Advance K=", planner.extruder_advance_K[0]); #else SERIAL_ECHOPGM("Advance K"); - EXTRUDER_LOOP() SERIAL_ECHO(AS_CHAR(' '), AS_CHAR('0' + e), AS_CHAR(':'), planner.extruder_advance_K[e]); + EXTRUDER_LOOP() SERIAL_ECHO(C(' '), C('0' + e), C(':'), planner.extruder_advance_K[e]); SERIAL_EOL(); #endif diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index fd95a3b7baf8..7f202be4138c 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -257,10 +257,10 @@ void GcodeSuite::M493() { flag.update_n = flag.reset_ft = flag.report_h = true; } else // Frequency out of range. - SERIAL_ECHOLNPGM("Invalid [", AS_CHAR('A'), "] frequency value."); + SERIAL_ECHOLNPGM("Invalid [", C('A'), "] frequency value."); } else // Mode doesn't use frequency. - SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('A'), "] frequency."); + SERIAL_ECHOLNPGM("Wrong mode for [", C('A'), "] frequency."); } #if HAS_DYNAMIC_FREQ @@ -271,7 +271,7 @@ void GcodeSuite::M493() { flag.report_h = true; } else - SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('F'), "] frequency scaling."); + SERIAL_ECHOLNPGM("Wrong mode for [", C('F'), "] frequency scaling."); } #endif @@ -284,7 +284,7 @@ void GcodeSuite::M493() { flag.update_n = flag.update_a = true; } else - SERIAL_ECHOLNPGM("Invalid X zeta [", AS_CHAR('I'), "] value."); // Zeta out of range. + SERIAL_ECHOLNPGM("Invalid X zeta [", C('I'), "] value."); // Zeta out of range. } else SERIAL_ECHOLNPGM("Wrong mode for zeta parameter."); @@ -299,7 +299,7 @@ void GcodeSuite::M493() { flag.update_a = true; } else - SERIAL_ECHOLNPGM("Invalid X vtol [", AS_CHAR('Q'), "] value."); // VTol out of range. + SERIAL_ECHOLNPGM("Invalid X vtol [", C('Q'), "] value."); // VTol out of range. } else SERIAL_ECHOLNPGM("Wrong mode for vtol parameter."); @@ -318,10 +318,10 @@ void GcodeSuite::M493() { flag.update_n = flag.reset_ft = flag.report_h = true; } else // Frequency out of range. - SERIAL_ECHOLNPGM("Invalid frequency [", AS_CHAR('B'), "] value."); + SERIAL_ECHOLNPGM("Invalid frequency [", C('B'), "] value."); } else // Mode doesn't use frequency. - SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('B'), "] frequency."); + SERIAL_ECHOLNPGM("Wrong mode for [", C('B'), "] frequency."); } #if HAS_DYNAMIC_FREQ @@ -332,7 +332,7 @@ void GcodeSuite::M493() { flag.report_h = true; } else - SERIAL_ECHOLNPGM("Wrong mode for [", AS_CHAR('H'), "] frequency scaling."); + SERIAL_ECHOLNPGM("Wrong mode for [", C('H'), "] frequency scaling."); } #endif @@ -345,7 +345,7 @@ void GcodeSuite::M493() { flag.update_n = flag.update_a = true; } else - SERIAL_ECHOLNPGM("Invalid Y zeta [", AS_CHAR('J'), "] value."); // Zeta Out of range + SERIAL_ECHOLNPGM("Invalid Y zeta [", C('J'), "] value."); // Zeta Out of range } else SERIAL_ECHOLNPGM("Wrong mode for zeta parameter."); @@ -360,7 +360,7 @@ void GcodeSuite::M493() { flag.update_a = true; } else - SERIAL_ECHOLNPGM("Invalid Y vtol [", AS_CHAR('R'), "] value."); // VTol out of range. + SERIAL_ECHOLNPGM("Invalid Y vtol [", C('R'), "] value."); // VTol out of range. } else SERIAL_ECHOLNPGM("Wrong mode for vtol parameter."); diff --git a/Marlin/src/gcode/feature/pause/G61.cpp b/Marlin/src/gcode/feature/pause/G61.cpp index 423632e72e0a..068e0b0e40ee 100644 --- a/Marlin/src/gcode/feature/pause/G61.cpp +++ b/Marlin/src/gcode/feature/pause/G61.cpp @@ -87,7 +87,7 @@ void GcodeSuite::G61() { destination[i] = parser.seen(AXIS_CHAR(i)) ? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i) : current_position[i]; - DEBUG_ECHO(AS_CHAR(' '), AS_CHAR(AXIS_CHAR(i)), p_float_t(destination[i], 2)); + DEBUG_ECHO(C(' '), C(AXIS_CHAR(i)), p_float_t(destination[i], 2)); } DEBUG_EOL(); // Move to the saved position diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 6f1af7b68155..b4e6a13c52a6 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -160,7 +160,7 @@ void GcodeSuite::M569_report(const bool forReplay/*=true*/) { auto say_M569 = [](const bool forReplay, FSTR_P const etc=nullptr, const bool eol=false) { if (!forReplay) SERIAL_ECHO_START(); SERIAL_ECHOPGM(" M569 S1"); - if (etc) SERIAL_ECHO(AS_CHAR(' '), etc); + if (etc) SERIAL_ECHO(C(' '), etc); if (eol) SERIAL_EOL(); }; diff --git a/Marlin/src/gcode/feature/trinamic/M919.cpp b/Marlin/src/gcode/feature/trinamic/M919.cpp index 0e9343f6999d..4ee004291d85 100644 --- a/Marlin/src/gcode/feature/trinamic/M919.cpp +++ b/Marlin/src/gcode/feature/trinamic/M919.cpp @@ -118,7 +118,7 @@ void GcodeSuite::M919() { // Get the chopper timing for the specified axis and index switch (i) { default: // A specified axis isn't Trinamic - SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(AXIS_CHAR(i)), " has no TMC drivers."); + SERIAL_ECHOLNPGM("?Axis ", C(AXIS_CHAR(i)), " has no TMC drivers."); break; #if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2) diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index 87aad88952f0..3986200e0809 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -37,7 +37,7 @@ static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8 SERIAL_ECHOPGM("Config:"); if (pref) SERIAL_ECHOPGM_P(pref); if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); } - SERIAL_ECHOPGM_P(name, AS_CHAR(':')); + SERIAL_ECHOPGM_P(name, C(':')); } static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) { config_prefix(name, pref, ind); diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 646e362517a3..16c3b2d9bd0b 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -339,7 +339,7 @@ void GCodeParser::parse(char *p) { #if ENABLED(DEBUG_GCODE_PARSER) if (debug) { - SERIAL_ECHOPGM("Got param ", AS_CHAR(param), " at index ", p - command_ptr - 1); + SERIAL_ECHOPGM("Got param ", C(param), " at index ", p - command_ptr - 1); if (has_val) SERIAL_ECHOPGM(" (has_val)"); } #endif diff --git a/Marlin/src/gcode/units/M149.cpp b/Marlin/src/gcode/units/M149.cpp index 43091b6710e7..bd9d8d486cb5 100644 --- a/Marlin/src/gcode/units/M149.cpp +++ b/Marlin/src/gcode/units/M149.cpp @@ -38,7 +38,7 @@ void GcodeSuite::M149() { void GcodeSuite::M149_report(const bool forReplay/*=true*/) { report_heading_etc(forReplay, F(STR_TEMPERATURE_UNITS)); - SERIAL_ECHOLN(F(" M149 "), AS_CHAR(parser.temp_units_code()), F(" ; Units in "), parser.temp_units_name()); + SERIAL_ECHOLN(F(" M149 "), C(parser.temp_units_code()), F(" ; Units in "), parser.temp_units_name()); } #endif // TEMPERATURE_UNITS_SUPPORT diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 847c4bfd088f..da6fda08d52d 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -294,14 +294,14 @@ class TextScroller { float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), AS_CHAR(']')); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), C(']')); DEBUG_DELAY(20); } diff --git a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp index 796c87e47e21..2e3f360ee726 100644 --- a/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp +++ b/Marlin/src/lcd/e3v2/proui/bedlevel_tools.cpp @@ -108,14 +108,14 @@ bool drawing_mesh = false; float mx = bedlevel.get_mesh_x(i), my = bedlevel.get_mesh_y(j), mz = bedlevel.z_values[i][j]; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); + DEBUG_ECHOLN(F("before rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } rotation.apply_rotation_xyz(mx, my, mz); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), AS_CHAR(','), p_float_t(my, 7), AS_CHAR(','), p_float_t(mz, 7), F("] ---> ")); + DEBUG_ECHOLN(F("after rotation = ["), p_float_t(mx, 7), C(','), p_float_t(my, 7), C(','), p_float_t(mz, 7), F("] ---> ")); DEBUG_DELAY(20); } diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index 4833ab96ab77..c29a2dd4044c 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -139,10 +139,10 @@ bool NextionTFT::readTFTCommand() { #if NEXDEBUG(N_SOME) uint8_t req = atoi(&nextion_command[1]); if (req > 7 && req != 20) - DEBUG_ECHOLNPGM( "> ", AS_CHAR(nextion_command[0]), - "\n> ", AS_CHAR(nextion_command[1]), - "\n> ", AS_CHAR(nextion_command[2]), - "\n> ", AS_CHAR(nextion_command[3]), + DEBUG_ECHOLNPGM( "> ", C(nextion_command[0]), + "\n> ", C(nextion_command[1]), + "\n> ", C(nextion_command[2]), + "\n> ", C(nextion_command[3]), "\nprinter_state:", printer_state); #endif } diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 4c5dec47616c..73094761822d 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -865,7 +865,7 @@ void MarlinUI::init() { TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder ); - //SERIAL_ECHOLNPGM("Add planner.move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " at FR ", fr_mm_s); + //SERIAL_ECHOLNPGM("Add planner.move with Axis ", C(AXIS_CHAR(axis)), " at FR ", fr_mm_s); axis = NO_AXIS_ENUM; @@ -882,7 +882,7 @@ void MarlinUI::init() { TERN_(MULTI_E_MANUAL, if (move_axis == E_AXIS) e_index = eindex); start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves axis = move_axis; - //SERIAL_ECHOLNPGM("Post Move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " soon."); + //SERIAL_ECHOLNPGM("Post Move with Axis ", C(AXIS_CHAR(axis)), " soon."); } #if ENABLED(AUTO_BED_LEVELING_UBL) diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 2259eedf41d4..8908c2fa734b 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -927,7 +927,7 @@ void restore_feedrate_and_scaling() { #endif if (DEBUGGING(LEVELING)) - SERIAL_ECHOLNPGM("Axis ", AS_CHAR(AXIS_CHAR(axis)), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]); + SERIAL_ECHOLNPGM("Axis ", C(AXIS_CHAR(axis)), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]); } /** @@ -1851,7 +1851,7 @@ void prepare_line_to_destination() { const feedRate_t home_fr_mm_s = fr_mm_s ?: homing_feedrate(axis); if (DEBUGGING(LEVELING)) { - DEBUG_ECHOPGM("...(", AS_CHAR(AXIS_CHAR(axis)), ", ", distance, ", "); + DEBUG_ECHOPGM("...(", C(AXIS_CHAR(axis)), ", ", distance, ", "); if (fr_mm_s) DEBUG_ECHO(fr_mm_s); else @@ -1941,12 +1941,12 @@ void prepare_line_to_destination() { * "trusted" position). */ void set_axis_never_homed(const AxisEnum axis) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_never_homed(", AS_CHAR(AXIS_CHAR(axis)), ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_never_homed(", C(AXIS_CHAR(axis)), ")"); set_axis_untrusted(axis); set_axis_unhomed(axis); - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< set_axis_never_homed(", AS_CHAR(AXIS_CHAR(axis)), ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< set_axis_never_homed(", C(AXIS_CHAR(axis)), ")"); TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis)); } @@ -2055,7 +2055,7 @@ void prepare_line_to_destination() { if (ABS(phaseDelta) * planner.mm_per_step[axis] / phasePerUStep < 0.05f) SERIAL_ECHOLNPGM("Selected home phase ", home_phase[axis], " too close to endstop trigger phase ", phaseCurrent, - ". Pick a different phase for ", AS_CHAR(AXIS_CHAR(axis))); + ". Pick a different phase for ", C(AXIS_CHAR(axis))); // Skip to next if target position is behind current. So it only moves away from endstop. if (phaseDelta < 0) phaseDelta += 1024; @@ -2066,7 +2066,7 @@ void prepare_line_to_destination() { // Optional debug messages if (DEBUGGING(LEVELING)) { DEBUG_ECHOLNPGM( - "Endstop ", AS_CHAR(AXIS_CHAR(axis)), " hit at Phase:", phaseCurrent, + "Endstop ", C(AXIS_CHAR(axis)), " hit at Phase:", phaseCurrent, " Delta:", phaseDelta, " Distance:", mmDelta ); } @@ -2100,7 +2100,7 @@ void prepare_line_to_destination() { if (true MAIN_AXIS_MAP(_ANDCANT)) return; #endif - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", C(AXIS_CHAR(axis)), ")"); const int axis_home_dir = TERN0(DUAL_X_CARRIAGE, axis == X_AXIS) ? TOOL_X_HOME_DIR(active_extruder) : home_dir(axis); @@ -2189,7 +2189,7 @@ void prepare_line_to_destination() { default: break; } if (TEST(endstops.state(), es)) { - SERIAL_ECHO_MSG("Bad ", AS_CHAR(AXIS_CHAR(axis)), " Endstop?"); + SERIAL_ECHO_MSG("Bad ", C(AXIS_CHAR(axis)), " Endstop?"); kill(GET_TEXT_F(MSG_KILL_HOMING_FAILED)); } #endif @@ -2409,7 +2409,7 @@ void prepare_line_to_destination() { if (axis == Z_AXIS) fwretract.current_hop = 0.0; #endif - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< homeaxis(", C(AXIS_CHAR(axis)), ")"); } // homeaxis() @@ -2434,7 +2434,7 @@ void prepare_line_to_destination() { * Callers must sync the planner position after calling this! */ void set_axis_is_at_home(const AxisEnum axis) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_is_at_home(", AS_CHAR(AXIS_CHAR(axis)), ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> set_axis_is_at_home(", C(AXIS_CHAR(axis)), ")"); set_axis_trusted(axis); set_axis_homed(axis); @@ -2481,10 +2481,10 @@ void set_axis_is_at_home(const AxisEnum axis) { if (DEBUGGING(LEVELING)) { #if HAS_HOME_OFFSET - DEBUG_ECHOLNPGM("> home_offset[", AS_CHAR(AXIS_CHAR(axis)), "] = ", home_offset[axis]); + DEBUG_ECHOLNPGM("> home_offset[", C(AXIS_CHAR(axis)), "] = ", home_offset[axis]); #endif DEBUG_POS("", current_position); - DEBUG_ECHOLNPGM("<<< set_axis_is_at_home(", AS_CHAR(AXIS_CHAR(axis)), ")"); + DEBUG_ECHOLNPGM("<<< set_axis_is_at_home(", C(AXIS_CHAR(axis)), ")"); } } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d3aa37c6abd6..5b4dcc83bc74 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1487,7 +1487,7 @@ void Temperature::_temp_error( OPTCODE(HAS_TEMP_CHAMBER, case H_CHAMBER: SERIAL_ECHOPGM(STR_HEATER_CHAMBER); break) OPTCODE(HAS_TEMP_BED, case H_BED: SERIAL_ECHOPGM(STR_HEATER_BED); break) default: - if (real_heater_id >= 0) SERIAL_ECHO(AS_CHAR('E'), real_heater_id); + if (real_heater_id >= 0) SERIAL_ECHO(C('E'), real_heater_id); } #if ENABLED(ERR_INCLUDE_TEMP) SERIAL_ECHOLNPGM(STR_DETECTED_TEMP_B, deg, STR_DETECTED_TEMP_E); From d903a5ef4363a1fb05d8e23381c9a62b9c0d6b42 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Dec 2023 01:27:43 -0600 Subject: [PATCH 43/73] =?UTF-8?q?=E2=9C=A8=20Initial=20support=20for=20HC3?= =?UTF-8?q?2=20U8G=20LCD=20(#26568)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Chris <52449218+shadow578@users.noreply.github.com> --- Marlin/src/HAL/HC32/inc/Conditionals_LCD.h | 4 + Marlin/src/HAL/HC32/u8g/LCD_defines.h | 3 + .../HAL/HC32/u8g/u8g_com_HAL_HC32_sw_spi.cpp | 163 ++++++++++++++++++ Marlin/src/pins/hc32f4/pins_AQUILA_101.h | 15 +- 4 files changed, 177 insertions(+), 8 deletions(-) create mode 100644 Marlin/src/HAL/HC32/u8g/u8g_com_HAL_HC32_sw_spi.cpp diff --git a/Marlin/src/HAL/HC32/inc/Conditionals_LCD.h b/Marlin/src/HAL/HC32/inc/Conditionals_LCD.h index 5f1a94e9203a..8266da4b2a49 100644 --- a/Marlin/src/HAL/HC32/inc/Conditionals_LCD.h +++ b/Marlin/src/HAL/HC32/inc/Conditionals_LCD.h @@ -20,3 +20,7 @@ * */ #pragma once + +#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI) + #define U8G_SW_SPI_HC32 1 +#endif diff --git a/Marlin/src/HAL/HC32/u8g/LCD_defines.h b/Marlin/src/HAL/HC32/u8g/LCD_defines.h index 8dc94bca7f3f..cb5a6812efd8 100644 --- a/Marlin/src/HAL/HC32/u8g/LCD_defines.h +++ b/Marlin/src/HAL/HC32/u8g/LCD_defines.h @@ -24,3 +24,6 @@ /** * HC32 LCD-specific defines */ + +uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); +#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_HC32_sw_spi_fn diff --git a/Marlin/src/HAL/HC32/u8g/u8g_com_HAL_HC32_sw_spi.cpp b/Marlin/src/HAL/HC32/u8g/u8g_com_HAL_HC32_sw_spi.cpp new file mode 100644 index 000000000000..9f360961942d --- /dev/null +++ b/Marlin/src/HAL/HC32/u8g/u8g_com_HAL_HC32_sw_spi.cpp @@ -0,0 +1,163 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +#ifdef ARDUINO_ARCH_HC32 + +#include "../../../inc/MarlinConfig.h" + +#if U8G_SW_SPI_HC32 + +#warning "Software SPI for U8Glib is experimental on HC32F460. Please share your experiences at https://github.com/shadow578/Marlin-H32/issues/35" + +#include +#include "../../shared/HAL_SPI.h" + +#ifndef LCD_SPI_SPEED + #define LCD_SPI_SPEED SPI_FULL_SPEED // Fastest + //#define LCD_SPI_SPEED SPI_QUARTER_SPEED // Slower +#endif + +static uint8_t SPI_speed = LCD_SPI_SPEED; + +static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) { + for (i = 0; i < 8; ++i) { + if (spi_speed == 0) { + WRITE(DOGLCD_MOSI, !!(b & 0x80)); + WRITE(DOGLCD_SCK, HIGH); + b <<= 1; + if (miso_pin >= 0 && READ(miso_pin)) b |= 1; + WRITE(DOGLCD_SCK, LOW); + } + else { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state); + for (j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1; ++j)) WRITE(DOGLCD_SCK, HIGH); + + b <<= 1; + if (miso_pin >= 0 && READ(miso_pin)) b |= 1; + + for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, LOW); + } + } + return b; +} + +static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) { + for (i = 0; i < 8; ++i) { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + if (spi_speed == 0) { + WRITE(DOGLCD_SCK, LOW); + WRITE(DOGLCD_MOSI, state); + WRITE(DOGLCD_MOSI, state); // need some setup time + WRITE(DOGLCD_SCK, HIGH); + } + else { + for (j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE(DOGLCD_SCK, LOW); + for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state); + for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, HIGH); + } + b <<= 1; + if (miso_pin >= 0 && READ(miso_pin)) b |= 1; + } + return b; +} + +static void u8g_sw_spi_shift_out(uint8_t val) { + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) + swSpiTransfer_mode_3(val, SPI_speed); + #else + swSpiTransfer_mode_0(val, SPI_speed); + #endif +} + +static uint8_t swSpiInit(const uint8_t spi_speed) { + #if PIN_EXISTS(LCD_RESET) + SET_OUTPUT(LCD_RESET_PIN); + #endif + SET_OUTPUT(DOGLCD_A0); + OUT_WRITE(DOGLCD_SCK, LOW); + OUT_WRITE(DOGLCD_MOSI, LOW); + OUT_WRITE(DOGLCD_CS, HIGH); + return spi_speed; +} + +uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { + switch (msg) { + case U8G_COM_MSG_INIT: + SPI_speed = swSpiInit(LCD_SPI_SPEED); + break; + + case U8G_COM_MSG_STOP: + break; + + case U8G_COM_MSG_RESET: + #if PIN_EXISTS(LCD_RESET) + WRITE(LCD_RESET_PIN, arg_val); + #endif + break; + + case U8G_COM_MSG_CHIP_SELECT: + #if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // This LCD SPI is running mode 3 while SD card is running mode 0 + if (arg_val) { // SCK idle state needs to be set to the proper idle state before + // the next chip select goes active + WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active + WRITE(DOGLCD_CS, LOW); + } + else { + WRITE(DOGLCD_CS, HIGH); + WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive + } + #else + WRITE(DOGLCD_CS, !arg_val); + #endif + break; + + case U8G_COM_MSG_WRITE_BYTE: + u8g_sw_spi_shift_out(arg_val); + break; + + case U8G_COM_MSG_WRITE_SEQ: { + uint8_t *ptr = (uint8_t *)arg_ptr; + while (arg_val > 0) { + u8g_sw_spi_shift_out(*ptr++); + arg_val--; + } + } break; + + case U8G_COM_MSG_WRITE_SEQ_P: { + uint8_t *ptr = (uint8_t *)arg_ptr; + while (arg_val > 0) { + u8g_sw_spi_shift_out(u8g_pgm_read(ptr)); + ptr++; + arg_val--; + } + } break; + + case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ + WRITE(DOGLCD_A0, arg_val); + break; + } + return 1; +} + +#endif // U8G_SW_SPI_HC32 +#endif // ARDUINO_ARCH_HC32 diff --git a/Marlin/src/pins/hc32f4/pins_AQUILA_101.h b/Marlin/src/pins/hc32f4/pins_AQUILA_101.h index 32268f4cf84e..2834d56c96e9 100644 --- a/Marlin/src/pins/hc32f4/pins_AQUILA_101.h +++ b/Marlin/src/pins/hc32f4/pins_AQUILA_101.h @@ -153,22 +153,21 @@ #define EXP1_08_PIN PB15 // EN1 #if ENABLED(CR10_STOCKDISPLAY) // LCD used for C2 -#undef LCD_SERIAL_PORT -#define LCD_SERIAL_PORT 1 - #define LCD_PINS_RS EXP1_07_PIN - #define LCD_PINS_EN EXP1_08_PIN - #define LCD_PINS_D4 EXP1_06_PIN + #ifndef HAS_PIN_27_BOARD + #define BEEPER_PIN EXP1_01_PIN + #endif #define BTN_ENC EXP1_02_PIN #define BTN_EN1 EXP1_03_PIN #define BTN_EN2 EXP1_05_PIN - #ifndef HAS_PIN_27_BOARD - #define BEEPER_PIN EXP1_01_PIN - #endif + #define LCD_PINS_RS EXP1_07_PIN + #define LCD_PINS_EN EXP1_08_PIN + #define LCD_PINS_D4 EXP1_06_PIN #elif ANY(HAS_DWIN_E3V2, IS_DWIN_MARLINUI) // LCD used for X2 + /** * Display pinout (display side, so RX/TX are swapped) * From 654e7a84ff79e49bcf43c940b08d094482b7b2ba Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Dec 2023 15:16:21 -0600 Subject: [PATCH 44/73] =?UTF-8?q?=F0=9F=A9=B9=20Minor=20MKS=20UI=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp index be6394514360..a10d0119f0e9 100644 --- a/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp @@ -542,7 +542,7 @@ void lv_encoder_pin_init() { #endif // HAS_ENCODER_ACTION -#if __PLAT_NATIVE_SIM__ +#ifdef __PLAT_NATIVE_SIM__ #include typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *); extern "C" void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb) {} From 9d324f7b1f58872cdac9068f0c53bff72f4012b3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 27 Dec 2023 15:16:58 -0600 Subject: [PATCH 45/73] =?UTF-8?q?=F0=9F=8E=A8=20Remove=20unused=20usleep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h | 2 -- Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h index 63701ca334ed..4a252772cbe0 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h @@ -25,8 +25,6 @@ * Native/Simulator LCD-specific defines */ -void usleep(uint64_t microsec); - uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp index 91b7e0f67f76..356652807983 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_pin_routines.cpp @@ -43,7 +43,6 @@ void u8g_SetPinOutput(uint8_t internal_pin_number) { SET_DIR_OUTPUT(internal_pin void u8g_SetPinInput(uint8_t internal_pin_number) { SET_DIR_INPUT(internal_pin_number); } void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status) { WRITE_PIN(pin, pin_status); } uint8_t u8g_GetPinLevel(uint8_t pin) { return READ_PIN(pin); } -void usleep(uint64_t microsec) { assert(false); /* why we here? */ } #ifdef __cplusplus } From cc641d796de55b61ea6ad531203cd4f63aaf7553 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 28 Dec 2023 00:21:10 +0000 Subject: [PATCH 46/73] [cron] Bump distribution date (2023-12-28) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 3694a91972c5..36f5ed14dc09 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-27" +//#define STRING_DISTRIBUTION_DATE "2023-12-28" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index cef0c4cd8fb8..e533fec596e5 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-27" + #define STRING_DISTRIBUTION_DATE "2023-12-28" #endif /** From 59d26e463a19f657c425e8e52ccf2552d978df7f Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 28 Dec 2023 15:38:19 -0800 Subject: [PATCH 47/73] =?UTF-8?q?=F0=9F=94=A8=20Newer=20Platform=20&=20Too?= =?UTF-8?q?lchain=20for=20STM32G0=20(#26585)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/stm32g0.ini | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ini/stm32g0.ini b/ini/stm32g0.ini index cf36541f3f50..8da5ab230fe1 100644 --- a/ini/stm32g0.ini +++ b/ini/stm32g0.ini @@ -31,13 +31,15 @@ build_flags = -DPIN_WIRE_SCL=PB3 -DPIN_WIRE_SDA=PB4 # [env:BTT_EBB42_V1_1_filament_extruder] extends = stm32_variant -platform = ststm32@~14.1.0 +platform = ststm32@17.1.0 platform_packages = framework-arduinoststm32@~4.20600.231001 - toolchain-gccarmnoneeabi@1.100301.220327 + toolchain-gccarmnoneeabi@1.120301.0 board = marlin_BTT_EBB42_V1_1 board_build.offset = 0x0000 board_upload.offset_address = 0x08000000 -build_flags = ${stm32_variant.build_flags} ${stm32g0_I2C2.build_flags} -flto +build_flags = ${stm32_variant.build_flags} ${stm32g0_I2C2.build_flags} + -flto + -Wl,--no-warn-rwx-segment debug_tool = stlink upload_protocol = dfu upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE" @@ -47,9 +49,9 @@ upload_command = dfu-util -a 0 -s 0x08000000:leave -D "$SOURCE" # [env:STM32G0B1RE_btt] extends = stm32_variant -platform = ststm32@~14.1.0 +platform = ststm32@17.1.0 platform_packages = framework-arduinoststm32@~4.20600.231001 - toolchain-gccarmnoneeabi@1.100301.220327 + toolchain-gccarmnoneeabi@1.120301.0 board = marlin_STM32G0B1RE board_build.offset = 0x2000 board_upload.offset_address = 0x08002000 @@ -58,6 +60,7 @@ build_flags = ${stm32_variant.build_flags} -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 -DSTEP_TIMER_IRQ_PRIO=0 + -Wl,--no-warn-rwx-segment upload_protocol = stlink debug_tool = stlink @@ -104,9 +107,9 @@ upload_protocol = custom # [env:STM32G0B1VE_btt] extends = stm32_variant -platform = ststm32@~14.1.0 +platform = ststm32@17.1.0 platform_packages = framework-arduinoststm32@~4.20600.231001 - toolchain-gccarmnoneeabi@1.100301.220327 + toolchain-gccarmnoneeabi@1.120301.0 board = marlin_STM32G0B1VE board_build.offset = 0x2000 board_upload.offset_address = 0x08002000 @@ -116,6 +119,7 @@ build_flags = ${stm32_variant.build_flags} -DSERIAL_RX_BUFFER_SIZE=1024 -DSERIAL_TX_BUFFER_SIZE=1024 -DTIMER_SERVO=TIM3 -DTIMER_TONE=TIM4 -DSTEP_TIMER_IRQ_PRIO=0 + -Wl,--no-warn-rwx-segment upload_protocol = stlink debug_tool = stlink From 88cf3cb1e0878ac09e988d2a873eb97f079e766a Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 28 Dec 2023 16:07:52 -0800 Subject: [PATCH 48/73] =?UTF-8?q?=F0=9F=93=8C=20Specify=20U8glib-HAL@0.5.4?= =?UTF-8?q?=20(#26582)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ini/features.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini/features.ini b/ini/features.ini index ed755f9ac001..a550783a38fd 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -40,7 +40,7 @@ USES_LIQUIDCRYSTAL_I2C = marcoschwartz/LiquidCrystal_I2C@1.1.4 USES_LIQUIDTWI2 = LiquidTWI2@1.2.7 HAS_LCDPRINT = build_src_filter=+ HAS_MARLINUI_HD44780 = build_src_filter=+ -HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@~0.5.2 +HAS_MARLINUI_U8GLIB = marlinfirmware/U8glib-HAL@0.5.4 build_src_filter=+ HAS_(FSMC|SPI|LTDC)_TFT = build_src_filter=+ HAS_LTDC_TFT = build_src_filter=+ From 4e23e52a895ded5ce0e96f054c16714cb758a982 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Fri, 29 Dec 2023 00:17:32 +0000 Subject: [PATCH 49/73] [cron] Bump distribution date (2023-12-29) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 36f5ed14dc09..fc90cdab0d08 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-28" +//#define STRING_DISTRIBUTION_DATE "2023-12-29" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index e533fec596e5..fa3e2d03640c 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-28" + #define STRING_DISTRIBUTION_DATE "2023-12-29" #endif /** From 1aeee2cd1f77c91b73daf1567f6ef94ab05fca3b Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:10:45 -0800 Subject: [PATCH 50/73] =?UTF-8?q?=F0=9F=94=A7=20TriGorilla=20Pro=20default?= =?UTF-8?q?=20to=20ONBOARD=5FSDIO=20(#26586)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index d6a5ef3c178b..451943a6f7ac 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -186,6 +186,12 @@ // SPI1(PA7) & SPI3(PB5) not available #define SPI_DEVICE 2 // Maple +// +// SD Card +// +#ifndef ONBOARD_SDIO + #define ONBOARD_SDIO +#endif #if ENABLED(ONBOARD_SDIO) #define SD_SCK_PIN PB13 // SPI2 ok #define SD_MISO_PIN PB14 // SPI2 ok From ba91fa09b7f16f788f441d6385d813cb64b5f508 Mon Sep 17 00:00:00 2001 From: narno2202 <130909513+narno2202@users.noreply.github.com> Date: Fri, 29 Dec 2023 05:41:34 +0100 Subject: [PATCH 51/73] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Optimize=20FT=5FMOTI?= =?UTF-8?q?ON=20(#26557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/ft_motion.cpp | 91 ++++++++++++++++----------------- Marlin/src/module/ft_motion.h | 5 +- Marlin/src/module/ft_types.h | 2 - 3 files changed, 46 insertions(+), 52 deletions(-) diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index 674b66f581cb..0e1ade69f0fb 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -46,9 +46,9 @@ FTMotion ftMotion; static_assert(FTM_DEFAULT_DYNFREQ_MODE != dynFreqMode_MASS_BASED, "dynFreqMode_MASS_BASED requires an X axis and an extruder."); #endif -//-----------------------------------------------------------------// +//----------------------------------------------------------------- // Variables. -//-----------------------------------------------------------------// +//----------------------------------------------------------------- // Public variables. @@ -61,10 +61,10 @@ uint32_t FTMotion::stepperCmdBuff_produceIdx = 0, // Index of next stepper comma bool FTMotion::sts_stepperBusy = false; // The stepper buffer has items and is in use. // Private variables. + // NOTE: These are sized for Ulendo FBS use. - xyze_trajectory_t FTMotion::traj; // = {0.0f} Storage for fixed-time-based trajectory. - xyze_trajectoryMod_t FTMotion::trajMod; // = {0.0f} Storage for modified fixed-time-based trajectory. - xyze_trajectoryWin_t FTMotion::trajWin; // = {0.0f} Storage for fixed time trajectory window. +xyze_trajectory_t FTMotion::traj; // = {0.0f} Storage for fixed-time-based trajectory. +xyze_trajectoryMod_t FTMotion::trajMod; // = {0.0f} Storage for fixed time trajectory window. bool FTMotion::blockProcRdy = false, // Indicates a block is ready to be processed. FTMotion::blockProcRdy_z1 = false, // Storage for the previous indicator. @@ -96,23 +96,23 @@ uint32_t FTMotion::N1, // Number of data points in the uint32_t FTMotion::max_intervals; // Total number of data points that will be generated from block. // Make vector variables. -uint32_t FTMotion::makeVector_idx = 0, // Index of fixed time trajectory generation of the overall block. - FTMotion::makeVector_idx_z1 = 0, // Storage for the previously calculated index above. - FTMotion::makeVector_batchIdx = 0; // Index of fixed time trajectory generation within the batch. +uint32_t FTMotion::makeVector_idx = 0, // Index of fixed time trajectory generation of the overall block. + FTMotion::makeVector_idx_z1 = 0, // Storage for the previously calculated index above. + FTMotion::makeVector_batchIdx = 0; // Index of fixed time trajectory generation within the batch. // Interpolation variables. -xyze_long_t FTMotion::steps = { 0 }; // Step count accumulator. +xyze_long_t FTMotion::steps = { 0 }; // Step count accumulator. -uint32_t FTMotion::interpIdx = 0, // Index of current data point being interpolated. - FTMotion::interpIdx_z1 = 0; // Storage for the previously calculated index above. +uint32_t FTMotion::interpIdx = 0, // Index of current data point being interpolated. + FTMotion::interpIdx_z1 = 0; // Storage for the previously calculated index above. // Shaping variables. #if HAS_X_AXIS FTMotion::shaping_t FTMotion::shaping = { 0, 0, - x:{ { 0.0f }, { 0.0f }, { 0 } }, // d_zi, Ai, Ni + x:{ { 0.0f }, { 0.0f }, { 0 } }, // d_zi, Ai, Ni #if HAS_Y_AXIS - y:{ { 0.0f }, { 0.0f }, { 0 } } // d_zi, Ai, Ni + y:{ { 0.0f }, { 0.0f }, { 0 } } // d_zi, Ai, Ni #endif }; #endif @@ -123,9 +123,9 @@ uint32_t FTMotion::interpIdx = 0, // Index of current data p float FTMotion::e_advanced_z1 = 0.0f; // (ms) Unit delay of advanced extruder position. #endif -//-----------------------------------------------------------------// +//----------------------------------------------------------------- // Function definitions. -//-----------------------------------------------------------------// +//----------------------------------------------------------------- // Public functions. @@ -186,8 +186,7 @@ void FTMotion::loop() { // Call Ulendo FBS here. #if ENABLED(FTM_UNIFIED_BWS) - trajMod = traj; // Copy the uncompensated vectors. - traj = trajWin; // Move the window to traj + trajMod = traj; // Move the window to traj #else // Copy the uncompensated vectors. #define TCOPY(A) memcpy(trajMod.A, traj.A, sizeof(trajMod.A)) @@ -199,7 +198,7 @@ void FTMotion::loop() { ); // Shift the time series back in the window - #define TSHIFT(A) memcpy(traj.A, trajWin.A, sizeof(trajWin.A)) + #define TSHIFT(A) memcpy(traj.A, &traj.A[FTM_BATCH_SIZE], (FTM_WINDOW_SIZE - FTM_BATCH_SIZE) * sizeof(traj.A[0])) LOGICAL_AXIS_CODE( TSHIFT(e), TSHIFT(x), TSHIFT(y), TSHIFT(z), @@ -215,12 +214,11 @@ void FTMotion::loop() { } // Interpolation. - while ( batchRdyForInterp - && ( stepperCmdBuffItems() < (FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME) ) - && ( interpIdx - interpIdx_z1 < (FTM_STEPS_PER_LOOP) ) + while (batchRdyForInterp + && (stepperCmdBuffItems() < (FTM_STEPPERCMD_BUFF_SIZE) - (FTM_STEPS_PER_UNIT_TIME)) + && (interpIdx - interpIdx_z1 < (FTM_STEPS_PER_LOOP)) ) { convertToSteps(interpIdx); - if (++interpIdx == TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, FTM_BATCH_SIZE)) { batchRdyForInterp = false; interpIdx = 0; @@ -443,7 +441,6 @@ void FTMotion::reset() { stepperCmdBuff_produceIdx = stepperCmdBuff_consumeIdx = 0; traj.reset(); - trajWin.reset(); blockProcRdy = blockProcRdy_z1 = blockProcDn = false; batchRdy = batchRdyForInterp = false; @@ -611,26 +608,26 @@ void FTMotion::makeVector() { } LOGICAL_AXIS_CODE( - trajWin.e[makeVector_batchIdx] = startPosn.e + ratio.e * dist, - trajWin.x[makeVector_batchIdx] = startPosn.x + ratio.x * dist, - trajWin.y[makeVector_batchIdx] = startPosn.y + ratio.y * dist, - trajWin.z[makeVector_batchIdx] = startPosn.z + ratio.z * dist, - trajWin.i[makeVector_batchIdx] = startPosn.i + ratio.i * dist, - trajWin.j[makeVector_batchIdx] = startPosn.j + ratio.j * dist, - trajWin.k[makeVector_batchIdx] = startPosn.k + ratio.k * dist, - trajWin.u[makeVector_batchIdx] = startPosn.u + ratio.u * dist, - trajWin.v[makeVector_batchIdx] = startPosn.v + ratio.v * dist, - trajWin.w[makeVector_batchIdx] = startPosn.w + ratio.w * dist + traj.e[makeVector_batchIdx] = startPosn.e + ratio.e * dist, + traj.x[makeVector_batchIdx] = startPosn.x + ratio.x * dist, + traj.y[makeVector_batchIdx] = startPosn.y + ratio.y * dist, + traj.z[makeVector_batchIdx] = startPosn.z + ratio.z * dist, + traj.i[makeVector_batchIdx] = startPosn.i + ratio.i * dist, + traj.j[makeVector_batchIdx] = startPosn.j + ratio.j * dist, + traj.k[makeVector_batchIdx] = startPosn.k + ratio.k * dist, + traj.u[makeVector_batchIdx] = startPosn.u + ratio.u * dist, + traj.v[makeVector_batchIdx] = startPosn.v + ratio.v * dist, + traj.w[makeVector_batchIdx] = startPosn.w + ratio.w * dist ); #if HAS_EXTRUDERS if (cfg.linearAdvEna) { - float dedt_adj = (trajWin.e[makeVector_batchIdx] - e_raw_z1) * (FTM_FS); + float dedt_adj = (traj.e[makeVector_batchIdx] - e_raw_z1) * (FTM_FS); if (ratio.e > 0.0f) dedt_adj += accel_k * cfg.linearAdvK; - e_raw_z1 = trajWin.e[makeVector_batchIdx]; + e_raw_z1 = traj.e[makeVector_batchIdx]; e_advanced_z1 += dedt_adj * (FTM_TS); - trajWin.e[makeVector_batchIdx] = e_advanced_z1; + traj.e[makeVector_batchIdx] = e_advanced_z1; } #endif @@ -640,9 +637,9 @@ void FTMotion::makeVector() { #if HAS_DYNAMIC_FREQ_MM case dynFreqMode_Z_BASED: - if (trajWin.z[makeVector_batchIdx] != 0.0f) { // Only update if Z changed. - const float xf = cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * trajWin.z[makeVector_batchIdx] - OPTARG(HAS_Y_AXIS, yf = cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * trajWin.z[makeVector_batchIdx]); + if (traj.z[makeVector_batchIdx] != 0.0f) { // Only update if Z changed. + const float xf = cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * traj.z[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, yf = cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * traj.z[makeVector_batchIdx]); updateShapingN(_MAX(xf, FTM_MIN_SHAPE_FREQ) OPTARG(HAS_Y_AXIS, _MAX(yf, FTM_MIN_SHAPE_FREQ))); } break; @@ -652,8 +649,8 @@ void FTMotion::makeVector() { case dynFreqMode_MASS_BASED: // Update constantly. The optimization done for Z value makes // less sense for E, as E is expected to constantly change. - updateShapingN( cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * trajWin.e[makeVector_batchIdx] - OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * trajWin.e[makeVector_batchIdx]) ); + updateShapingN( cfg.baseFreq[X_AXIS] + cfg.dynFreqK[X_AXIS] * traj.e[makeVector_batchIdx] + OPTARG(HAS_Y_AXIS, cfg.baseFreq[Y_AXIS] + cfg.dynFreqK[Y_AXIS] * traj.e[makeVector_batchIdx]) ); break; #endif @@ -663,18 +660,18 @@ void FTMotion::makeVector() { // Apply shaping if in mode. #if HAS_X_AXIS if (cfg.modeHasShaper()) { - shaping.x.d_zi[shaping.zi_idx] = trajWin.x[makeVector_batchIdx]; - trajWin.x[makeVector_batchIdx] *= shaping.x.Ai[0]; + shaping.x.d_zi[shaping.zi_idx] = traj.x[makeVector_batchIdx]; + traj.x[makeVector_batchIdx] *= shaping.x.Ai[0]; #if HAS_Y_AXIS - shaping.y.d_zi[shaping.zi_idx] = trajWin.y[makeVector_batchIdx]; - trajWin.y[makeVector_batchIdx] *= shaping.y.Ai[0]; + shaping.y.d_zi[shaping.zi_idx] = traj.y[makeVector_batchIdx]; + traj.y[makeVector_batchIdx] *= shaping.y.Ai[0]; #endif for (uint32_t i = 1U; i <= shaping.max_i; i++) { const uint32_t udiffx = shaping.zi_idx - shaping.x.Ni[i]; - trajWin.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx]; + traj.x[makeVector_batchIdx] += shaping.x.Ai[i] * shaping.x.d_zi[shaping.x.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffx : udiffx]; #if HAS_Y_AXIS const uint32_t udiffy = shaping.zi_idx - shaping.y.Ni[i]; - trajWin.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy]; + traj.y[makeVector_batchIdx] += shaping.y.Ai[i] * shaping.y.d_zi[shaping.y.Ni[i] > shaping.zi_idx ? (FTM_ZMAX) + udiffy : udiffy]; #endif } if (++shaping.zi_idx == (FTM_ZMAX)) shaping.zi_idx = 0; diff --git a/Marlin/src/module/ft_motion.h b/Marlin/src/module/ft_motion.h index f4a65fdd5e92..8c8098873f42 100644 --- a/Marlin/src/module/ft_motion.h +++ b/Marlin/src/module/ft_motion.h @@ -134,7 +134,6 @@ class FTMotion { static xyze_trajectory_t traj; static xyze_trajectoryMod_t trajMod; - static xyze_trajectoryWin_t trajWin; static bool blockProcRdy, blockProcRdy_z1, blockProcDn; static bool batchRdy, batchRdyForInterp; @@ -155,8 +154,8 @@ class FTMotion { static uint32_t max_intervals; static constexpr uint32_t _ftm_size = TERN(FTM_UNIFIED_BWS, FTM_BW_SIZE, FTM_BATCH_SIZE), - _ftm_wind = TERN(FTM_UNIFIED_BWS, 2, ceil((FTM_WINDOW_SIZE) / _ftm_size)), - shaper_intervals = _ftm_size * ceil((FTM_ZMAX) / _ftm_size), + _ftm_wind = TERN(FTM_UNIFIED_BWS, 2, CEIL((FTM_WINDOW_SIZE) / _ftm_size)), + shaper_intervals = _ftm_size * CEIL((FTM_ZMAX) / _ftm_size), min_max_intervals = _ftm_size * _ftm_wind; // Make vector variables. diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h index 06680488754f..e7bcf37ac688 100644 --- a/Marlin/src/module/ft_types.h +++ b/Marlin/src/module/ft_types.h @@ -49,11 +49,9 @@ enum dynFreqMode_t : uint8_t { #if ENABLED(FTM_UNIFIED_BWS) typedef struct XYZEarray xyze_trajectory_t; typedef struct XYZEarray xyze_trajectoryMod_t; - typedef struct XYZEarray xyze_trajectoryWin_t; #else typedef struct XYZEarray xyze_trajectory_t; typedef struct XYZEarray xyze_trajectoryMod_t; - typedef struct XYZEarray xyze_trajectoryWin_t; #endif enum { From 2d97f082e5e8de2973857cc9f88bafcb4a20e1ea Mon Sep 17 00:00:00 2001 From: Keith Bennett <13375512+thisiskeithb@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:50:52 -0800 Subject: [PATCH 52/73] =?UTF-8?q?=E2=9C=A8=20BigTreeTech=20Manta=20M8P=20V?= =?UTF-8?q?2.0=20(STM32H723ZE)=20(#26578)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/boards.h | 3 +- Marlin/src/inc/Warnings.cpp | 2 +- Marlin/src/pins/pins.h | 2 + .../pins/stm32h7/pins_BTT_MANTA_M8P_V2_0.h | 464 ++++++++++++++++++ .../variant_MARLIN_STM32H723ZE.cpp | 8 +- .../variant_MARLIN_STM32H723ZE.h | 6 +- ini/stm32h7.ini | 2 +- 7 files changed, 480 insertions(+), 7 deletions(-) create mode 100644 Marlin/src/pins/stm32h7/pins_BTT_MANTA_M8P_V2_0.h diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index 5730ecbd4f90..91141b23f99f 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -482,7 +482,8 @@ #define BOARD_BTT_OCTOPUS_MAX_EZ_V1_0 6008 // BigTreeTech Octopus Max EZ V1.0 (STM32H723ZE) #define BOARD_BTT_OCTOPUS_PRO_V1_0_1 6009 // BigTreeTech Octopus Pro v1.0.1 (STM32H723ZE) #define BOARD_BTT_OCTOPUS_PRO_V1_1 6010 // BigTreeTech Octopus Pro v1.1 (STM32H723ZE) -#define BOARD_BTT_KRAKEN_V1_0 6011 // BigTreeTech Kraken v1.0 (STM32H723ZG) +#define BOARD_BTT_MANTA_M8P_V2_0 6011 // BigTreeTech Manta M8P V2.0 (STM32H723ZE) +#define BOARD_BTT_KRAKEN_V1_0 6012 // BigTreeTech Kraken v1.0 (STM32H723ZG) // // Espressif ESP32 WiFi diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 7965336df7eb..d239e6a7d5cf 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -704,7 +704,7 @@ #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #warning "Your FYSETC Mini Panel works best with RGB_LED." #elif ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP) - #warning "Your FYSETC Mini Panel works best with LED_USER_PRESET_STARTUP." + #warning "Your FYSETC/MKS/BTT Mini Panel works best with LED_USER_PRESET_STARTUP." #endif #if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864) && ALL(PSU_CONTROL, HAS_COLOR_LEDS) && !LED_POWEROFF_TIMEOUT diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index b881c849ebd8..d162881993ef 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -841,6 +841,8 @@ #include "stm32h7/pins_BTT_OCTOPUS_PRO_V1_0_1.h" // STM32H7 env:STM32H723ZE_btt #elif MB(BTT_OCTOPUS_PRO_V1_1) #include "stm32h7/pins_BTT_OCTOPUS_PRO_V1_1.h" // STM32H7 env:STM32H723ZE_btt +#elif MB(BTT_MANTA_M8P_V2_0) + #include "stm32h7/pins_BTT_MANTA_M8P_V2_0.h" // STM32H7 env:STM32H723ZE_btt #elif MB(BTT_KRAKEN_V1_0) #include "stm32h7/pins_BTT_KRAKEN_V1_0.h" // STM32H7 env:STM32H723ZG_btt #elif MB(TEENSY41) diff --git a/Marlin/src/pins/stm32h7/pins_BTT_MANTA_M8P_V2_0.h b/Marlin/src/pins/stm32h7/pins_BTT_MANTA_M8P_V2_0.h new file mode 100644 index 000000000000..346cd1c3481f --- /dev/null +++ b/Marlin/src/pins/stm32h7/pins_BTT_MANTA_M8P_V2_0.h @@ -0,0 +1,464 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 + +#include "env_validate.h" + +#define BOARD_INFO_NAME "BTT Manta M8P V2.0" +#define BOARD_WEBSITE_URL "github.com/bigtreetech/Manta-M8P/tree/master/V2.0" + +#define USES_DIAG_JUMPERS + +// +// EEPROM +// +#if NO_EEPROM_SELECTED + #undef NO_EEPROM_SELECTED + #ifndef FLASH_EEPROM_EMULATION + #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation + #endif + #define EEPROM_PAGE_SIZE (0x800UL) // 2K + #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL) + #define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE +#endif + +// Avoid conflict with TIMER_TONE +#define STEP_TIMER 8 + +// +// Servos +// +#define SERVO0_PIN PD12 // PROBE + +// +// Trinamic Stallguard pins +// +#define X_DIAG_PIN PF4 // M1-STOP +#define Y_DIAG_PIN PF3 // M2-STOP +#define Z_DIAG_PIN PF2 // M3-STOP +#define E0_DIAG_PIN PF1 // M4-STOP +#define E1_DIAG_PIN PF0 // M5-STOP +#define E2_DIAG_PIN PC15 // M6-STOP +#define E3_DIAG_PIN -1 // No DIAG or STOP pin for M7 +#define E4_DIAG_PIN -1 // No DIAG or STOP pin for M8 + +// +// Limit Switches +// +#ifdef X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN // M1-STOP + #if X_HOME_TO_MIN + #define X_MAX_PIN E0_DIAG_PIN // M4-STOP + #else + #define X_MIN_PIN E0_DIAG_PIN // M4-STOP + #endif +#elif NEEDS_X_MINMAX + #ifndef X_MIN_PIN + #define X_MIN_PIN X_DIAG_PIN // M1-STOP + #endif + #ifndef X_MAX_PIN + #define X_MAX_PIN E0_DIAG_PIN // M4-STOP + #endif +#else + #define X_STOP_PIN X_DIAG_PIN // M1-STOP +#endif + +#ifdef Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN // M2-STOP + #if Y_HOME_TO_MIN + #define Y_MAX_PIN E1_DIAG_PIN // M5-STOP + #else + #define Y_MIN_PIN E1_DIAG_PIN // M5-STOP + #endif +#elif NEEDS_Y_MINMAX + #ifndef Y_MIN_PIN + #define Y_MIN_PIN Y_DIAG_PIN // M2-STOP + #endif + #ifndef Y_MAX_PIN + #define Y_MAX_PIN E1_DIAG_PIN // M5-STOP + #endif +#else + #define Y_STOP_PIN Y_DIAG_PIN // M2-STOP +#endif + +#ifdef Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN // M3-STOP + #if Z_HOME_TO_MIN + #define Z_MAX_PIN E2_DIAG_PIN // M6-STOP + #else + #define Z_MIN_PIN E2_DIAG_PIN // M6-STOP + #endif +#elif NEEDS_Z_MINMAX + #ifndef Z_MIN_PIN + #define Z_MIN_PIN Z_DIAG_PIN // M3-STOP + #endif + #ifndef Z_MAX_PIN + #define Z_MAX_PIN E2_DIAG_PIN // M6-STOP + #endif +#else + #define Z_STOP_PIN Z_DIAG_PIN // M3-STOP +#endif + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN PD13 // PROBE + //#define Z_MIN_PROBE_PIN PD8 // "FAN IND" - Shared inductive probe / fan connector +#endif + +// +// Probe enable +// +#if ENABLED(PROBE_ENABLE_DISABLE) && !defined(PROBE_ENABLE_PIN) + #define PROBE_ENABLE_PIN SERVO0_PIN +#endif + +// +// Filament Runout Sensor +// +#define FIL_RUNOUT_PIN E0_DIAG_PIN // M4-STOP +#define FIL_RUNOUT2_PIN E1_DIAG_PIN // M5-STOP +#define FIL_RUNOUT3_PIN E2_DIAG_PIN // M6-STOP + +// +// Steppers +// +#define X_STEP_PIN PE6 // MOTOR 1 +#define X_DIR_PIN PE5 +#define X_ENABLE_PIN PC14 +#ifndef X_CS_PIN + #define X_CS_PIN PC13 +#endif + +#define Y_STEP_PIN PE2 // MOTOR 2 +#define Y_DIR_PIN PE1 +#define Y_ENABLE_PIN PE4 +#ifndef Y_CS_PIN + #define Y_CS_PIN PE3 +#endif + +#define Z_STEP_PIN PB8 // MOTOR 3 +#define Z_DIR_PIN PB7 +#define Z_ENABLE_PIN PE0 +#ifndef Z_CS_PIN + #define Z_CS_PIN PB9 +#endif + +#define E0_STEP_PIN PB4 // MOTOR 4 +#define E0_DIR_PIN PB3 +#define E0_ENABLE_PIN PB6 +#ifndef E0_CS_PIN + #define E0_CS_PIN PB5 +#endif + +#define E1_STEP_PIN PG13 // MOTOR 5 +#define E1_DIR_PIN PG12 +#define E1_ENABLE_PIN PG15 +#ifndef E1_CS_PIN + #define E1_CS_PIN PG14 +#endif + +#define E2_STEP_PIN PG9 // MOTOR 6 +#define E2_DIR_PIN PD7 +#define E2_ENABLE_PIN PG11 +#ifndef E2_CS_PIN + #define E2_CS_PIN PG10 +#endif + +#define E3_STEP_PIN PD4 // MOTOR 7 +#define E3_DIR_PIN PD3 +#define E3_ENABLE_PIN PD6 +#ifndef E3_CS_PIN + #define E3_CS_PIN PD5 +#endif + +#define E4_STEP_PIN PC7 // MOTOR 8 +#define E4_DIR_PIN PC8 +#define E4_ENABLE_PIN PD2 +#ifndef E4_CS_PIN + #define E4_CS_PIN PC6 +#endif + +// +// Temperature Sensors +// +#define TEMP_0_PIN PB0 // TH0 +#define TEMP_1_PIN PC5 // TH1 +#define TEMP_2_PIN PC4 // TH2 +#define TEMP_3_PIN PA7 // TH3 +#define TEMP_BED_PIN PB1 // TB + +// +// Heaters / Fans +// +#define HEATER_BED_PIN PF5 // BED-OUT +#define HEATER_0_PIN PA0 // HE0 +#define HEATER_1_PIN PA1 // HE1 +#define HEATER_2_PIN PA3 // HE2 +#define HEATER_3_PIN PA5 // HE3 + +#define FAN0_PIN PF7 // FAN0 (2 wire) +#if ENABLED(FOURWIRES_FANS) + // Only FAN5 and FAN6 have tachometer pins, so swap them with FAN1 and FAN2 + #define FAN1_PIN PA6 // FAN5 (4 wire) + #define FAN2_PIN PA2 // FAN6 (4 wire) + #define FAN5_PIN PF9 // FAN1 (2 wire) + #define FAN6_PIN PF6 // FAN2 (2 wire) +#else + #define FAN1_PIN PF9 // FAN1 (2 wire) + #define FAN2_PIN PF6 // FAN2 (2 wire) + #define FAN5_PIN PA6 // FAN5 (4 wire) + #define FAN6_PIN PA2 // FAN6 (4 wire) +#endif +#define FAN3_PIN PF8 // FAN3 (2 wire) +#define FAN4_PIN PA4 // FAN4 (2 wire) +#define FAN7_PIN PE9 // MOTOR (3 wire) +//#define FAN8_PIN PB11 // "FAN IND" (3 wire) - Shared inductive probe / fan connector + +#if ENABLED(FOURWIRES_FANS) + #ifndef E0_FAN_TACHO_PIN + #define E0_FAN_TACHO_PIN PC2 // FAN5 (4 wire) + #endif + #ifndef E1_FAN_TACHO_PIN + #define E1_FAN_TACHO_PIN PC1 // FAN6 (4 wire) + #endif +#endif + +#ifndef CONTROLLER_FAN_PIN + #define CONTROLLER_FAN_PIN FAN7_PIN // MOTOR (3 wire) +#endif + +// +// Power Supply Control +// +#ifndef PS_ON_PIN + #define PS_ON_PIN PD14 // PS-ON +#endif + +// +// Misc. Functions +// +#define I2C_SDA_PIN PC9 // I2C +#define I2C_SCL_PIN PA8 // I2C + +#ifndef FILWIDTH_PIN + #define FILWIDTH_PIN PC0 // FWS +#endif +#ifndef FILWIDTH2_PIN + #define FILWIDTH2_PIN PF10 // FWS +#endif + +// +// SD Support +// +#ifndef SDCARD_CONNECTION + #if HAS_WIRED_LCD + #define SDCARD_CONNECTION LCD + #else + #define SDCARD_CONNECTION ONBOARD + #endif +#endif + +// +// Default pins for TMC software SPI +// +#if HAS_TMC_SPI + #define TMC_USE_SW_SPI + #ifndef TMC_SPI_MOSI + #define TMC_SPI_MOSI PG6 + #endif + #ifndef TMC_SPI_MISO + #define TMC_SPI_MISO PG7 + #endif + #ifndef TMC_SPI_SCK + #define TMC_SPI_SCK PG8 + #endif +#endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial1 + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + #define X_SERIAL_TX_PIN PC13 + #define X_SERIAL_RX_PIN X_SERIAL_TX_PIN + + #define Y_SERIAL_TX_PIN PE3 + #define Y_SERIAL_RX_PIN Y_SERIAL_TX_PIN + + #define Z_SERIAL_TX_PIN PB9 + #define Z_SERIAL_RX_PIN Z_SERIAL_TX_PIN + + #define Z2_SERIAL_TX_PIN PB5 + #define Z2_SERIAL_RX_PIN Z2_SERIAL_TX_PIN + + #define E0_SERIAL_TX_PIN PG14 + #define E0_SERIAL_RX_PIN E0_SERIAL_TX_PIN + + #define E1_SERIAL_TX_PIN PG10 + #define E1_SERIAL_RX_PIN E1_SERIAL_TX_PIN + + #define E2_SERIAL_TX_PIN PD5 + #define E2_SERIAL_RX_PIN E2_SERIAL_TX_PIN + + #define E3_SERIAL_TX_PIN PC6 + #define E3_SERIAL_RX_PIN E3_SERIAL_TX_PIN + + // Reduce baud rate to improve software serial reliability + #ifndef TMC_BAUD_RATE + #define TMC_BAUD_RATE 19200 + #endif + +#endif // HAS_TMC_UART + +/** + * 18-pin FPC Connector + * ---- + * (MISO) PE13 | 1 | + * (SCK) PE12 | 2 | + * (BTN_EN1) PE15 | 3 | + * (SD_SS) PE11 | 4 | + * (BTN_EN2) PE10 | 5 | + * (MOSI) PE14 | 6 | + * (SD_DETECT) PE8 | 7 | + * RESET | 8 | + * (BEEPER) PE7 | 9 | + * (BTN_ENC) PG1 | 10 | + * (LCD_EN) PG0 | 11 | + * (LCD_RS) PF15 | 12 | + * (LCD_D4) PF14 | 13 | + * (LCD_D5) PF13 | 14 | + * (LCD_D6) PF12 | 15 | + * (LCD_D7) PF11 | 16 | + * GND | 17 | + * 5V | 18 | + * ---- + * LCD + */ + +#define EXP1_01_PIN PE7 +#define EXP1_02_PIN PG1 +#define EXP1_03_PIN PG0 +#define EXP1_04_PIN PF15 +#define EXP1_05_PIN PF14 +#define EXP1_06_PIN PF13 +#define EXP1_07_PIN PF12 +#define EXP1_08_PIN PF11 + +#define EXP2_01_PIN PE13 +#define EXP2_02_PIN PE12 +#define EXP2_03_PIN PE15 +#define EXP2_04_PIN PE11 +#define EXP2_05_PIN PE10 +#define EXP2_06_PIN PE14 +#define EXP2_07_PIN PE8 +#define EXP2_08_PIN -1 + +// +// Onboard SD card +// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 +// +#if SD_CONNECTION_IS(ONBOARD) + #ifndef SD_DETECT_STATE + #define SD_DETECT_STATE HIGH + #elif SD_DETECT_STATE == LOW + #error "BOARD_BTT_MANTA_M8P_V2_0 onboard SD requires SD_DETECT_STATE set to HIGH." + #endif + #define SDSS PB12 + #define SD_SS_PIN SDSS + #define SD_SCK_PIN PB13 + #define SD_MISO_PIN PB14 + #define SD_MOSI_PIN PB15 + #define SD_DETECT_PIN -1 + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(LCD) + #define SDSS EXP2_04_PIN + #define SD_SS_PIN SDSS + #define SD_SCK_PIN EXP2_02_PIN + #define SD_MISO_PIN EXP2_01_PIN + #define SD_MOSI_PIN EXP2_06_PIN + #define SD_DETECT_PIN EXP2_07_PIN + #define SOFTWARE_SPI +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for BOARD_BTT_MANTA_M8P_V2_0." +#endif + +// +// LCDs and Controllers +// +#if ENABLED(BTT_MINI_12864) // BTT Mini 12864 V2.0 connected via 18-pin FPC cable + + #define BEEPER_PIN EXP1_01_PIN + #define BTN_ENC EXP1_02_PIN + #define LCD_PINS_RS EXP1_04_PIN + + #define BTN_EN1 EXP2_03_PIN + #define BTN_EN2 EXP2_05_PIN + + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + #define LCD_PINS_D5 EXP1_06_PIN + #define LCD_PINS_D6 EXP1_07_PIN + #define LCD_PINS_D7 EXP1_08_PIN + + #define DOGLCD_CS EXP1_03_PIN + #define DOGLCD_A0 EXP1_04_PIN + #define DOGLCD_SCK EXP2_02_PIN + #define DOGLCD_MOSI EXP2_06_PIN + + #define SOFTWARE_SPI + #define FORCE_SOFT_SPI // Use this if Hardware SPI causes display problems. + // Results in LCD Software SPI mode 3, SD Software SPI mode 0. + + //#define LCD_BACKLIGHT_PIN -1 + #define LCD_RESET_PIN EXP1_05_PIN // Must be high or open for LCD to operate normally. + #define NEOPIXEL_PIN EXP1_06_PIN + +#elif HAS_WIRED_LCD + #error "Only BTT_MINI_12864 (BTT Mini 12864 V2.0 with FPC cable) is currently supported on BOARD_BTT_MANTA_M8P_V2_0." +#endif + +// +// NeoPixel LED +// The BTT_MINI_12864 uses one of the EXP pins for NeoPixels +// +#if DISABLED(BTT_MINI_12864) && !defined(NEOPIXEL_PIN) + #define NEOPIXEL_PIN PD15 // RGB +#elif ENABLED(BTT_MINI_12864) && !defined(NEOPIXEL2_PIN) + // Allow dedicated RGB (NeoPixel) pin to be used for a NeoPixel strip + #define NEOPIXEL2_PIN PD15 // RGB +#endif diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp index 4506cf5ce6b5..a99a3cb609aa 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.cpp @@ -128,7 +128,9 @@ const PinName digitalPin[] = { PH_0, // D110 PH_1, // D111 PC_2_C, // D112/A26 - PC_3_C // D113/A27 + PC_3_C, // D113/A27 + PC_2, // D114/A28 + PC_3 // D115/A29 }; // Analog (Ax) pin number array @@ -160,7 +162,9 @@ const uint32_t analogInputPin[] = { 91, // A24, PF13 92, // A25, PF14 112, // A26, PC2_C - 113 // A27, PC3_C + 113, // A27, PC3_C + 114, // A28, PC2 + 115 // A29, PC3 }; void MPU_Config(void) diff --git a/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h index 1b518f01cfa4..c9c631412a04 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_H723ZE/variant_MARLIN_STM32H723ZE.h @@ -129,6 +129,8 @@ #define PH1 111 #define PC2_C PIN_A26 #define PC3_C PIN_A27 +#define PC2 PC2_C +#define PC3 PC3_C // Alternate pins number #define PA0_ALT1 (PA0 | ALT1) @@ -197,9 +199,9 @@ #define PF9_ALT2 (PF9 | ALT2) #define PG13_ALT1 (PG13 | ALT1) -#define NUM_DIGITAL_PINS 114 +#define NUM_DIGITAL_PINS 116 #define NUM_DUALPAD_PINS 2 -#define NUM_ANALOG_INPUTS 28 +#define NUM_ANALOG_INPUTS 30 #define NUM_ANALOG_FIRST PA0 // On-board LED pin number diff --git a/ini/stm32h7.ini b/ini/stm32h7.ini index 0a66f6d91e57..e5392464db70 100644 --- a/ini/stm32h7.ini +++ b/ini/stm32h7.ini @@ -125,7 +125,7 @@ upload_protocol = cmsis-dap debug_tool = cmsis-dap # -# BigTreeTech Octopus Pro V1.0.1/1.1 / Octopus Max EZ V1.0 (STM32H723ZET6 ARM Cortex-M7) +# BigTreeTech Octopus Pro V1.0.1/1.1 / Octopus Max EZ V1.0 / Manta M8P V2.0 (STM32H723ZET6 ARM Cortex-M7) # [env:STM32H723ZE_btt] extends = STM32H723Zx_btt From f605c045e3198c1c21dda75e5913ef192fc58580 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sat, 30 Dec 2023 00:20:29 +0000 Subject: [PATCH 53/73] [cron] Bump distribution date (2023-12-30) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index fc90cdab0d08..0daaa7204106 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-29" +//#define STRING_DISTRIBUTION_DATE "2023-12-30" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fa3e2d03640c..fd3516f915ca 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-29" + #define STRING_DISTRIBUTION_DATE "2023-12-30" #endif /** From e6f1b074df409cab5c231954ad542e0ffcf20f31 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 30 Dec 2023 05:01:48 -0600 Subject: [PATCH 54/73] =?UTF-8?q?=F0=9F=A9=B9=20Restore=20usleep=20for=20n?= =?UTF-8?q?ative=20/=20sim?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h index 4a252772cbe0..63701ca334ed 100644 --- a/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h +++ b/Marlin/src/HAL/NATIVE_SIM/u8g/LCD_defines.h @@ -25,6 +25,8 @@ * Native/Simulator LCD-specific defines */ +void usleep(uint64_t microsec); + uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); uint8_t u8g_com_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); From 06dc7f4f526833aaab37725e2e95e68030acb94e Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 31 Dec 2023 00:18:42 +1300 Subject: [PATCH 55/73] =?UTF-8?q?=F0=9F=94=A7=20Fix,=20extend=20FAN=20/=20?= =?UTF-8?q?AUTOFAN=20confict=20check=20(#26591)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/inc/SanityCheck.h | 28 +++++++++++++++---------- Marlin/src/pins/mega/pins_MALYAN_M180.h | 5 ++--- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2bde7f6f4542..9fb5b0e445f9 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1829,19 +1829,25 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #undef GOOD_AXIS_PINS /** - * Make sure auto fan pins don't conflict with the fan pin + * Make sure auto fan pins don't conflict with the first fan pin */ #if HAS_AUTO_FAN - #if HAS_FAN0 - #if PIN_EXISTS(E0_AUTO_FAN) && E0_AUTO_FAN_PIN == FAN0_PIN - #error "You cannot set E0_AUTO_FAN_PIN equal to FAN0_PIN." - #elif PIN_EXISTS(E1_AUTO_FAN) && E1_AUTO_FAN_PIN == FAN0_PIN - #error "You cannot set E1_AUTO_FAN_PIN equal to FAN0_PIN." - #elif PIN_EXISTS(E2_AUTO_FAN) && E2_AUTO_FAN_PIN == FAN0_PIN - #error "You cannot set E2_AUTO_FAN_PIN equal to FAN0_PIN." - #elif PIN_EXISTS(E3_AUTO_FAN) && E3_AUTO_FAN_PIN == FAN0_PIN - #error "You cannot set E3_AUTO_FAN_PIN equal to FAN0_PIN." - #endif + #if PINS_EXIST(E0_AUTO_FAN, FAN0) && E0_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E0_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E1_AUTO_FAN, FAN0) && E1_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E1_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E2_AUTO_FAN, FAN0) && E2_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E2_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E3_AUTO_FAN, FAN0) && E3_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E3_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E4_AUTO_FAN, FAN0) && E4_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E4_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E5_AUTO_FAN, FAN0) && E5_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E5_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E6_AUTO_FAN, FAN0) && E6_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E6_AUTO_FAN_PIN equal to FAN0_PIN." + #elif PINS_EXIST(E7_AUTO_FAN, FAN0) && E7_AUTO_FAN_PIN == FAN0_PIN + #error "You cannot set E7_AUTO_FAN_PIN equal to FAN0_PIN." #endif #endif diff --git a/Marlin/src/pins/mega/pins_MALYAN_M180.h b/Marlin/src/pins/mega/pins_MALYAN_M180.h index 4eb7928825cd..a4bc98a14706 100644 --- a/Marlin/src/pins/mega/pins_MALYAN_M180.h +++ b/Marlin/src/pins/mega/pins_MALYAN_M180.h @@ -96,7 +96,6 @@ #ifndef FAN0_PIN #define FAN0_PIN 7 // M106 Sxxx command supported and tested. M107 as well. #endif - -#ifndef FAN_PIN1 - #define FAN_PIN1 12 // Currently Unsupported by Marlin +#ifndef FAN1_PIN + #define FAN1_PIN 12 // Currently Unsupported by Marlin #endif From 2203505182e95544cebfc0f1e5b87b6f19f0610a Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Sun, 31 Dec 2023 00:23:28 +0000 Subject: [PATCH 56/73] [cron] Bump distribution date (2023-12-31) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 0daaa7204106..9609a5eaf187 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-30" +//#define STRING_DISTRIBUTION_DATE "2023-12-31" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index fd3516f915ca..f6455682bc28 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-30" + #define STRING_DISTRIBUTION_DATE "2023-12-31" #endif /** From 5d1ede08aa8a045463d4d33333fd90abead2871e Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:54:26 +1300 Subject: [PATCH 57/73] =?UTF-8?q?=E2=9C=A8=20CTC=5FA10S=5FA13=20(#26514)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 12 +-- Marlin/src/inc/Changes.h | 2 + Marlin/src/inc/Conditionals_LCD.h | 2 +- Marlin/src/inc/SanityCheck.h | 2 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h | 4 +- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 6 +- Marlin/src/pins/sanguino/pins_ANET_10.h | 114 +++++++++++++++----- 7 files changed, 102 insertions(+), 40 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e62637f6462a..fd2dbbb27398 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3029,14 +3029,14 @@ //#define ENDER2_STOCKDISPLAY // -// ANET and Tronxy Graphical Controller -// -// Anet 128x64 full graphics lcd with rotary encoder as used on Anet A6 -// A clone of the RepRapDiscount full graphics display but with -// different pins/wiring (see pins_ANET_10.h). Enable one of these. +// ANET and Tronxy 128×64 Full Graphics Controller as used on Anet A6 // //#define ANET_FULL_GRAPHICS_LCD -//#define ANET_FULL_GRAPHICS_LCD_ALT_WIRING + +// +// GUCOCO CTC 128×64 Full Graphics Controller as used on GUCOCO CTC A10S +// +//#define CTC_A10S_A13 // // AZSMZ 12864 LCD with SD diff --git a/Marlin/src/inc/Changes.h b/Marlin/src/inc/Changes.h index 693cb592e62c..25d3401579d4 100644 --- a/Marlin/src/inc/Changes.h +++ b/Marlin/src/inc/Changes.h @@ -671,6 +671,8 @@ #error "LARGE_MOVE_ITEMS is obsolete. Instead define MANUAL_MOVE_DISTANCE_MM and MANUAL_MOVE_DISTANCE_IN." #elif defined(SDIO_SUPPORT) #error "SDIO_SUPPORT is now ONBOARD_SDIO." +#elif defined(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) + #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING is now CTC_A10S_A13." #endif // L64xx stepper drivers have been removed diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 37d56d4f1e56..b501a556f8ec 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -779,7 +779,7 @@ #define LCD_ST7920_DELAY_2 125 #define LCD_ST7920_DELAY_3 125 -#elif ANY(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) +#elif ANY(ANET_FULL_GRAPHICS_LCD, CTC_A10S_A13) #define IS_RRD_FG_SC 1 #define LCD_ST7920_DELAY_1 150 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 9fb5b0e445f9..e5cba0310270 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2636,7 +2636,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L + COUNT_ENABLED(VIKI2, miniVIKI) \ + ENABLED(WYH_L12864) \ + COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \ - + COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, ANET_FULL_GRAPHICS_LCD_ALT_WIRING) \ + + COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, CTC_A10S_A13) \ + ENABLED(AZSMZ_12864) \ + ENABLED(BQ_LCD_SMART_CONTROLLER) \ + ENABLED(CARTESIO_UI) \ diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index 1cc555aafe08..35d9697ba4cc 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -221,8 +221,8 @@ #define EXP2_08_PIN -1 #if HAS_WIRED_LCD - #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) - #error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board." + #if ENABLED(CTC_A10S_A13) + #error "CTC_A10S_A13 only applies to the ANET 1.0 board." #elif ENABLED(ANET_FULL_GRAPHICS_LCD) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 51953324a3af..829e0edd60ca 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -289,9 +289,9 @@ #elif HAS_WIRED_LCD - #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) + #if ENABLED(CTC_A10S_A13) #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! ANET_FULL_GRAPHICS_LCD_ALT_WIRING requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #error "CAUTION! CTC_A10S_A13 requires wiring modifications. See 'pins_BTT_SKR_V1_4.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #endif /** @@ -300,7 +300,7 @@ * * !!! If you are unsure, ask for help! Your motherboard may be damaged in some circumstances !!! * - * The ANET_FULL_GRAPHICS_LCD_ALT_WIRING connector plug: + * The CTC_A10S_A13 connector plug: * * BEFORE AFTER * ------ ------ diff --git a/Marlin/src/pins/sanguino/pins_ANET_10.h b/Marlin/src/pins/sanguino/pins_ANET_10.h index e57cc9f6fa72..12afa2339386 100644 --- a/Marlin/src/pins/sanguino/pins_ANET_10.h +++ b/Marlin/src/pins/sanguino/pins_ANET_10.h @@ -158,28 +158,52 @@ #define SDSS 31 #define LED_PIN -1 +/** + * Connector pinouts + * + * ------ ------ ---- + * (SDA) D17 | 1 2 | (A1) D30 3V3 | 1 2 | D4 (SS) J3_RX |1 2| J3_TX + * (SCL) D16 | 3 4 | (A2) D29 GND | 3 4 | RESET (TXO) D9 |3 4| D8 (RX0) D8 + * D11 | 5 6 (A3) D28 (MOSI) D5 | 5 6 D7 (SCK) USB_RX |5 6| USB_TX + * D10 | 7 8 | (A4) D27 D10 5V | 7 8 | D6 (MISO) ---- + * 5V | 9 10 | GND J3_RX | 9 10 | J3_TX + * ------ ------ + * LCD J3 USB_BLE + */ + +#define EXP1_01_PIN 17 +#define EXP1_02_PIN 30 +#define EXP1_03_PIN 16 +#define EXP1_04_PIN 29 +#define EXP1_05_PIN 11 +#define EXP1_06_PIN 28 +#define EXP1_07_PIN 10 +#define EXP1_08_PIN 27 +#define EXP1_09_PIN -1 // 5V +#define EXP1_10_PIN -1 // GND + /** * LCD / Controller * * Only the following displays are supported: * ZONESTAR_LCD - * ANET_FULL_GRAPHICS_LCD(_ALT_WIRING)? + * CTC_A10S_A13G * REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER */ #if HAS_WIRED_LCD - #define LCD_SDSS 28 + #define LCD_SDSS EXP1_06_PIN #if HAS_ADC_BUTTONS - #define SERVO0_PIN 27 // free for BLTouch/3D-Touch - #define LCD_PINS_RS 28 - #define LCD_PINS_EN 29 - #define LCD_PINS_D4 10 - #define LCD_PINS_D5 11 - #define LCD_PINS_D6 16 - #define LCD_PINS_D7 17 + #define SERVO0_PIN EXP1_08_PIN // free for BLTouch/3D-Touch + #define LCD_PINS_RS EXP1_06_PIN + #define LCD_PINS_EN EXP1_04_PIN + #define LCD_PINS_D4 EXP1_07_PIN + #define LCD_PINS_D5 EXP1_05_PIN + #define LCD_PINS_D6 EXP1_03_PIN + #define LCD_PINS_D7 EXP1_01_PIN #define ADC_KEYPAD_PIN 1 #elif IS_RRD_FG_SC @@ -188,36 +212,72 @@ // display using an adapter board // https://go.aisler.net/benlye/anet-lcd-adapter/pcb // See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748 - #if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING) - #define SERVO0_PIN 30 - #define BEEPER_PIN 27 - #define LCD_PINS_RS 29 - #define LCD_PINS_EN 16 - #define LCD_PINS_D4 11 - #define BTN_EN1 28 - #define BTN_EN2 10 - #define BTN_ENC 17 + #if ENABLED(CTC_A10S_A13G) + + /** + * CTC_A10S_A13 pinout + * + * ------ + * GND | 1 2 | 5V + * BEEPER | 3 4 | BTN_EN2 + * BTN_EN1 5 6 | LCD_D4 + * LCD_RS | 7 8 | LCD_EN + * SERVO0 | 9 10 | BTN_ENC + * ------ + * LCD + */ + #define SERVO0_PIN EXP1_02_PIN + + #define BEEPER_PIN EXP1_08_PIN + + #define BTN_ENC EXP1_01_PIN + #define BTN_EN1 EXP1_06_PIN + #define BTN_EN2 EXP1_07_PIN + + #define LCD_PINS_RS EXP1_04_PIN + #define LCD_PINS_EN EXP1_03_PIN + #define LCD_PINS_D4 EXP1_05_PIN + #define BOARD_ST7920_DELAY_1 250 #define BOARD_ST7920_DELAY_2 250 #define BOARD_ST7920_DELAY_3 250 + #else - #define SERVO0_PIN 29 // free for BLTouch/3D-Touch - #define BEEPER_PIN 17 - #define LCD_PINS_RS 27 - #define LCD_PINS_EN 28 - #define LCD_PINS_D4 30 - #define BTN_EN1 11 - #define BTN_EN2 10 - #define BTN_ENC 16 + + /** + * ANET_FULL_GRAPHICS_LCD pinouts + * + * ------ ------ + * GND | 1 2 | 5V - | 1 2 | - + * LCD_RS | 3 4 | BTN_EN2 - | 3 4 | 5V + * LCD_EN 5 6 | BTN_EN1 - 5 6 | - + * SERVO0 | 7 8 | BTN_ENC RESET | 7 8 | GND + * LCD_D4 | 9 10 | BEEPER_PIN - | 9 10 | 3V3 + * ------ ------ + * LCD J3 + */ + #define SERVO0_PIN EXP1_04_PIN // Free for BLTouch/3D-Touch + + #define BEEPER_PIN EXP1_01_PIN + + #define BTN_ENC EXP1_03_PIN + #define BTN_EN1 EXP1_05_PIN + #define BTN_EN2 EXP1_07_PIN + + #define LCD_PINS_RS EXP1_08_PIN + #define LCD_PINS_EN EXP1_06_PIN + #define LCD_PINS_D4 EXP1_02_PIN + #define BOARD_ST7920_DELAY_1 125 #define BOARD_ST7920_DELAY_2 63 #define BOARD_ST7920_DELAY_3 125 + #endif #endif #else - #define SERVO0_PIN 27 + #define SERVO0_PIN EXP1_08_PIN #endif #ifndef FIL_RUNOUT_PIN From 95878df30d737fd08f337491f7e19332fe7ac5ac Mon Sep 17 00:00:00 2001 From: narno2202 <130909513+narno2202@users.noreply.github.com> Date: Sun, 31 Dec 2023 22:00:57 +0100 Subject: [PATCH 58/73] =?UTF-8?q?=F0=9F=90=9B=20Fix=20homing=20with=20FT?= =?UTF-8?q?=5FMOTION=20(#26595)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/ft_motion.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Marlin/src/module/ft_motion.cpp b/Marlin/src/module/ft_motion.cpp index 0e1ade69f0fb..ba1361f922b8 100644 --- a/Marlin/src/module/ft_motion.cpp +++ b/Marlin/src/module/ft_motion.cpp @@ -501,11 +501,13 @@ void FTMotion::loadBlockData(block_t * const current_block) { ratio = moveDist * oneOverLength; - /* Keep for comprehension const float spm = totalLength / current_block->step_event_count; // (steps/mm) Distance for each step - f_s = spm * current_block->initial_rate, // (steps/s) Start feedrate - f_e = spm * current_block->final_rate; // (steps/s) End feedrate + f_s = spm * current_block->initial_rate; // (steps/s) Start feedrate + + const float f_e = spm * current_block->final_rate; // (steps/s) End feedrate + + /* Keep for comprehension const float a = current_block->acceleration, // (mm/s^2) Same magnitude for acceleration or deceleration oneby2a = 1.0f / (2.0f * a), // (s/mm) Time to accelerate or decelerate one mm (i.e., oneby2a * 2 oneby2d = -oneby2a; // (s/mm) Time to accelerate or decelerate one mm (i.e., oneby2a * 2 @@ -527,10 +529,6 @@ void FTMotion::loadBlockData(block_t * const current_block) { T3 = (F_n - f_e) / a; // (s) Decel Time = difference in feedrate over acceleration */ - const float spm = totalLength / current_block->step_event_count, - f_s = spm * current_block->initial_rate, - f_e = spm * current_block->final_rate; - const float accel = current_block->acceleration, oneOverAccel = 1.0f / accel; From 13e82fa44a842e2d2f3569fb62131b206442ec4a Mon Sep 17 00:00:00 2001 From: nagubash <40751501+nagendras176@users.noreply.github.com> Date: Mon, 1 Jan 2024 02:33:04 +0530 Subject: [PATCH 59/73] =?UTF-8?q?=F0=9F=94=A8=20Fix=20formatting=20issue?= =?UTF-8?q?=20in=20Makefile=20(#26599)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b56f8e32056a..11e908ef8342 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CONTAINER_IMAGE := marlin-dev help: @echo "Tasks for local development:" - @echo "* format-pins: Reformat all pins files + @echo "* format-pins: Reformat all pins files" @echo "* tests-single-ci: Run a single test from inside the CI" @echo "* tests-single-local: Run a single test locally" @echo "* tests-single-local-docker: Run a single test locally, using docker" From 99c570212ddfd39a749b07419a3d3fb9213d7acd Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Mon, 1 Jan 2024 00:24:20 +0000 Subject: [PATCH 60/73] [cron] Bump distribution date (2024-01-01) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 9609a5eaf187..20442791431f 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2023-12-31" +//#define STRING_DISTRIBUTION_DATE "2024-01-01" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index f6455682bc28..1e97cfcb1941 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2023-12-31" + #define STRING_DISTRIBUTION_DATE "2024-01-01" #endif /** From 1d615717e80e4c39bfa49f34d9b8f3955d7f8d47 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 31 Dec 2023 03:30:53 -0600 Subject: [PATCH 61/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Pytho?= =?UTF-8?q?n=20version=20of=20pins=20formatting=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/scripts/pinsformat.py | 265 ++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100755 buildroot/share/scripts/pinsformat.py diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py new file mode 100755 index 000000000000..3a376ecc7e0f --- /dev/null +++ b/buildroot/share/scripts/pinsformat.py @@ -0,0 +1,265 @@ +#!/usr/bin/env python3 + +# +# Formatter script for pins_MYPINS.h files +# +# Usage: pinsformat.py [infile] [outfile] +# +# With no parameters convert STDIN to STDOUT +# + +import sys, re + +do_log = False +def logmsg(msg, line): + if do_log: print(msg, line) + +col_comment = 50 + +# String lpad / rpad +def lpad(astr, fill, c=None): + if not fill: return astr + if c == None: c = ' ' + need = fill - len(astr) + return astr if need <= 0 else (need * c) + astr + +def rpad(astr, fill, c=None): + if not fill: return astr + if c == None: c = ' ' + need = fill - len(astr) + return astr if need <= 0 else astr + (need * c) + +# Pin patterns +mpatt = [ r'-?\d{1,3}', r'P[A-I]\d+', r'P\d_\d+', r'Pin[A-Z]\d\b' ] +mstr = '|'.join(mpatt) +mexpr = [ re.compile(f'^{m}$') for m in mpatt ] + +# Corrsponding padding for each pattern +ppad = [ 3, 4, 5, 5 ] + +# Match a define line +definePatt = re.compile(rf'^\s*(//)?#define\s+[A-Z_][A-Z0-9_]+\s+({mstr})\s*(//.*)?$') + +def format_pins(argv): + src_file = 'stdin' + dst_file = None + + scnt = 0 + for arg in argv: + if arg == '-v': + do_log = True + elif scnt == 0: + # Get a source file if specified. Default destination is the same file + src_file = dst_file = arg + scnt += 1 + elif scnt == 1: + # Get destination file if specified + dst_file = arg + scnt += 1 + + # No text to process yet + file_text = '' + + if src_file == 'stdin': + # If no source file specified read from STDIN + file_text = sys.stdin.read() + else: + # Open the file src_file + with open(src_file, 'r') as rf: + file_text = rf.read() + + if len(file_text) == 0: + print('No text to process') + return + + # Read from file or STDIN until it terminates + filtered = process_text(file_text) + if dst_file: + with open(dst_file, 'w') as wf: + wf.write(filtered) + else: + print(filtered) + +# Find the pin pattern so non-pin defines can be skipped +def get_pin_pattern(txt): + r = '' + m = 0 + match_count = [ 0, 0, 0, 0 ] + + # Find the most common matching pattern + match_threshold = 5 + for line in txt.split('\n'): + r = definePatt.match(line) + if r == None: continue + ind = -1 + for p in mexpr: + ind += 1 + if not p.match(r[2]): continue + match_count[ind] += 1 + if match_count[ind] >= match_threshold: + return { 'match': mpatt[ind], 'pad':ppad[ind] } + return None + +def process_text(txt): + if len(txt) == 0: return '(no text)' + patt = get_pin_pattern(txt) + if patt == None: return txt + + pindefPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(' + patt['match'] + r')\s*(//.*)?$') + noPinPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(-1)\s*(//.*)?$') + skipPatt1 = re.compile(r'^(\s*(//)?#define)\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|FREQ|ITEM|MODULE|NAME|ONLY|PERIOD|RANGE|RATE|SERIAL|SIZE|SPI|STATE|STEP|TIMER))\s+(.+)\s*(//.*)?$') + skipPatt2 = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\s*(//.*)?$') + aliasPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([A-Z_][A-Z0-9_()]+)\s*(//.*)?$') + switchPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s*(//.*)?$') + undefPatt = re.compile(r'^(\s*(//)?#undef)\s+([A-Z_][A-Z0-9_]+)\s*(//.*)?$') + defPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([-_\w]+)\s*(//.*)?$') + condPatt = re.compile(r'^(\s*(//)?#(if|ifn?def|else|elif)(\s+\S+)*)\s+(//.*)$') + commPatt = re.compile(r'^\s{20,}(//.*)?$') + + col_value_lj = col_comment - patt['pad'] - 2 + col_value_rj = col_comment - 3 + + # + # #define SKIP_ME + # + def trySkip1(d): + if skipPatt1.match(d['line']) == None: return False + logmsg("skip:", d['line']) + return True + + # + # #define MY_PIN [pin] + # + def tryPindef(d): + line = d['line'] + r = pindefPatt.match(line) + if r == None: return False + logmsg("pin:", line) + pinnum = r[4] if r[4][0] == 'P' else lpad(r[4], patt['pad']) + line = r[1] + ' ' + r[3] + line = rpad(line, col_value_lj) + pinnum + if r[5]: line = rpad(line, col_comment) + r[5] + d['line'] = line + return True + + # + # #define MY_PIN -1 + # + def tryNoPin(d): + line = d['line'] + r = noPinPatt.match(line) + if r == None: return False + logmsg("pin -1:", line) + line = r[1] + ' ' + r[3] + line = rpad(line, col_value_lj) + '-1' + if r[5]: line = rpad(line, col_comment) + r[5] + d['line'] = line + return True + + # + # #define SKIP_ME_TOO + # + def trySkip2(d): + if skipPatt2.match( d['line']) == None: return False + logmsg("skip:", d['line']) + return True + + # + # #define ALIAS OTHER + # + def tryAlias(d): + line = d['line'] + r = aliasPatt.match(line) + if r == None: return False + logmsg("alias:", line) + line = f'{r[1]} {r[3]}' + line += lpad(r[4], col_value_rj + 1 - len(line)) + if r[5]: line = rpad(line, col_comment) + r[5] + d['line'] = line + return True + + # + # #define SWITCH + # + def trySwitch(d): + line = d['line'] + r = switchPatt.match(line) + if r == None: return False + logmsg("switch:", line) + line = f'{r[1]} {r[3]}' + if r[4]: line = rpad(line, col_comment) + r[4] + d['line'] = line + d['check_comment_next'] = True + return True + + # + # #define ... + # + def tryDef(d): + line = d['line'] + r = defPatt.match(line) + if r == None: return False + logmsg("def:", line) + line = f'{r[1]} {r[3]} ' + line += lpad(r[4], col_value_rj + 1 - len(line)) + if r[5]: line = rpad(line, col_comment - 1) + ' ' + r[5] + d['line'] = line + return True + + # + # #undef ... + # + def tryUndef(d): + line = d['line'] + r = undefPatt.match(line) + if r == None: return False + logmsg("undef:", line) + line = f'{r[1]} {r[3]}' + if r[4]: line = rpad(line, col_comment) + r[4] + d['line'] = line + return True + + # + # #if ... + # + def tryCond(d): + line = d['line'] + r = condPatt.match(line) + if r == None: return False + logmsg("cond:", line) + line = rpad(r[1], col_comment) + r[5] + d['line'] = line + d['check_comment_next'] = True + return True + + out = '' + wDict = { 'check_comment_next': False } + + # Transform each line and add it to the output + for line in txt.split('\n'): + wDict['line'] = line + if wDict['check_comment_next']: + r = commPatt.match(line) + wDict['check_comment_next'] = (r != None) + + if wDict['check_comment_next']: + # Comments in column 45 + line = rpad('', col_comment) + r[1] + + elif trySkip1(wDict): pass #define SKIP_ME + elif tryPindef(wDict): pass #define MY_PIN [pin] + elif tryNoPin(wDict): pass #define MY_PIN -1 + elif trySkip2(wDict): pass #define SKIP_ME_TOO + elif tryAlias(wDict): pass #define ALIAS OTHER + elif trySwitch(wDict): pass #define SWITCH + elif tryDef(wDict): pass #define ... + elif tryUndef(wDict): pass #undef ... + elif tryCond(wDict): pass #if ... + + out += wDict['line'] + '\n' + + return re.sub('\n\n$', '\n', re.sub(r'\n\n+', '\n\n', out)) + +# Python standard startup for command line with arguments +if __name__ == '__main__': + format_pins(sys.argv[1:]) From 3b6f1bff8b3fc31b1d82ea420b3b74a50f599692 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 1 Jan 2024 00:50:46 -0600 Subject: [PATCH 62/73] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Updat?= =?UTF-8?q?e=20pinsformat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/share/scripts/pinsformat.js | 30 +++++++++------ buildroot/share/scripts/pinsformat.py | 53 +++++++++++++++------------ 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/buildroot/share/scripts/pinsformat.js b/buildroot/share/scripts/pinsformat.js index 89e99b73bd8f..41bdfdab871a 100755 --- a/buildroot/share/scripts/pinsformat.js +++ b/buildroot/share/scripts/pinsformat.js @@ -10,6 +10,11 @@ const fs = require("fs"); +var do_log = false +function logmsg(msg, line='') { + if (do_log) console.log(msg, line); +} + // String lpad / rpad String.prototype.lpad = function(len, chr) { if (!len) return this; @@ -37,7 +42,7 @@ String.prototype.concat_with_space = function(str) { }; const mpatt = [ '-?\\d{1,3}', 'P[A-I]\\d+', 'P\\d_\\d+', 'Pin[A-Z]\\d\\b' ], - definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${mpatt[0]}|${mpatt[1]}|${mpatt[2]}|${mpatt[3]})\\s*(//.*)?$`, 'gm'), + definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${'|'.join(mpatt)})\\s*(//.*)?$`, 'gm'), ppad = [ 3, 4, 5, 5 ], col_comment = 50, col_value_rj = col_comment - 3; @@ -47,11 +52,11 @@ for (let m of mpatt) mexpr.push(new RegExp('^' + m + '$')); const argv = process.argv.slice(2), argc = argv.length; -var src_file = 0, src_name = 'STDIN', dst_file, do_log = false; +var src_file = 0, dst_file; if (argc > 0) { let ind = 0; if (argv[0] == '-v') { do_log = true; ind++; } - dst_file = src_file = src_name = argv[ind++]; + dst_file = src_file = argv[ind++]; if (ind < argc) dst_file = argv[ind]; } @@ -115,13 +120,13 @@ function process_text(txt) { // // #define SKIP_ME // - if (do_log) console.log("skip:", line); + logmsg("skip:", line); } else if ((r = pindefPatt.exec(line)) !== null) { // // #define MY_PIN [pin] // - if (do_log) console.log("pin:", line); + logmsg("pin:", line); const pinnum = r[4].charAt(0) == 'P' ? r[4] : r[4].lpad(patt.pad); line = r[1] + ' ' + r[3]; line = line.rpad(col_value_lj).concat_with_space(pinnum); @@ -131,7 +136,7 @@ function process_text(txt) { // // #define MY_PIN -1 // - if (do_log) console.log("pin -1:", line); + logmsg("pin -1:", line); line = r[1] + ' ' + r[3]; line = line.rpad(col_value_lj).concat_with_space('-1'); if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); @@ -139,14 +144,15 @@ function process_text(txt) { else if (skipPatt2.exec(line) !== null || skipPatt3.exec(line) !== null) { // // #define SKIP_ME + // #else, #endif // - if (do_log) console.log("skip:", line); + logmsg("skip:", line); } else if ((r = aliasPatt.exec(line)) !== null) { // // #define ALIAS OTHER // - if (do_log) console.log("alias:", line); + logmsg("alias:", line); line = r[1] + ' ' + r[3]; line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); if (r[5]) line = line.rpad(col_comment).concat_with_space(r[5]); @@ -155,7 +161,7 @@ function process_text(txt) { // // #define SWITCH // - if (do_log) console.log("switch:", line); + logmsg("switch:", line); line = r[1] + ' ' + r[3]; if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); check_comment_next = true; @@ -164,7 +170,7 @@ function process_text(txt) { // // #define ... // - if (do_log) console.log("def:", line); + logmsg("def:", line); line = r[1] + ' ' + r[3] + ' '; line = line.concat_with_space(r[4].lpad(col_value_rj + 1 - line.length)); if (r[5]) line = line.rpad(col_comment - 1) + ' ' + r[5]; @@ -173,7 +179,7 @@ function process_text(txt) { // // #undef ... // - if (do_log) console.log("undef:", line); + logmsg("undef:", line); line = r[1] + ' ' + r[3]; if (r[4]) line = line.rpad(col_comment).concat_with_space(r[4]); } @@ -181,7 +187,7 @@ function process_text(txt) { // // #if, #ifdef, #ifndef, #elif ... // - if (do_log) console.log("cond:", line); + logmsg("cond:", line); line = r[1].rpad(col_comment).concat_with_space(r[5]); check_comment_next = true; } diff --git a/buildroot/share/scripts/pinsformat.py b/buildroot/share/scripts/pinsformat.py index 3a376ecc7e0f..b49ae4931d09 100755 --- a/buildroot/share/scripts/pinsformat.py +++ b/buildroot/share/scripts/pinsformat.py @@ -17,15 +17,13 @@ def logmsg(msg, line): col_comment = 50 # String lpad / rpad -def lpad(astr, fill, c=None): +def lpad(astr, fill, c=' '): if not fill: return astr - if c == None: c = ' ' need = fill - len(astr) return astr if need <= 0 else (need * c) + astr -def rpad(astr, fill, c=None): +def rpad(astr, fill, c=' '): if not fill: return astr - if c == None: c = ' ' need = fill - len(astr) return astr if need <= 0 else astr + (need * c) @@ -64,9 +62,8 @@ def format_pins(argv): # If no source file specified read from STDIN file_text = sys.stdin.read() else: - # Open the file src_file - with open(src_file, 'r') as rf: - file_text = rf.read() + # Open and read the file src_file + with open(src_file, 'r') as rf: file_text = rf.read() if len(file_text) == 0: print('No text to process') @@ -75,8 +72,7 @@ def format_pins(argv): # Read from file or STDIN until it terminates filtered = process_text(file_text) if dst_file: - with open(dst_file, 'w') as wf: - wf.write(filtered) + with open(dst_file, 'w') as wf: wf.write(filtered) else: print(filtered) @@ -105,16 +101,18 @@ def process_text(txt): patt = get_pin_pattern(txt) if patt == None: return txt - pindefPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(' + patt['match'] + r')\s*(//.*)?$') - noPinPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(-1)\s*(//.*)?$') - skipPatt1 = re.compile(r'^(\s*(//)?#define)\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|FREQ|ITEM|MODULE|NAME|ONLY|PERIOD|RANGE|RATE|SERIAL|SIZE|SPI|STATE|STEP|TIMER))\s+(.+)\s*(//.*)?$') - skipPatt2 = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\s*(//.*)?$') - aliasPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([A-Z_][A-Z0-9_()]+)\s*(//.*)?$') + pmatch = patt['match'] + pindefPatt = re.compile(rf'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+({pmatch})\s*(//.*)?$') + noPinPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(-1)\s*(//.*)?$') + skipPatt1 = re.compile(r'^(\s*(//)?#define)\s+(AT90USB|USBCON|(BOARD|DAC|FLASH|HAS|IS|USE)_.+|.+_(ADDRESS|AVAILABLE|BAUDRATE|CLOCK|CONNECTION|DEFAULT|ERROR|EXTRUDERS|FREQ|ITEM|MKS_BASE_VERSION|MODULE|NAME|ONLY|ORIENTATION|PERIOD|RANGE|RATE|READ_RETRIES|SERIAL|SIZE|SPI|STATE|STEP|TIMER|VERSION))\s+(.+)\s*(//.*)?$') + skipPatt2 = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+(0x[0-9A-Fa-f]+|\d+|.+[a-z].+)\s*(//.*)?$') + skipPatt3 = re.compile(r'^\s*#e(lse|ndif)\b.*$') + aliasPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([A-Z_][A-Z0-9_()]+)\s*(//.*)?$') switchPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s*(//.*)?$') - undefPatt = re.compile(r'^(\s*(//)?#undef)\s+([A-Z_][A-Z0-9_]+)\s*(//.*)?$') - defPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([-_\w]+)\s*(//.*)?$') - condPatt = re.compile(r'^(\s*(//)?#(if|ifn?def|else|elif)(\s+\S+)*)\s+(//.*)$') - commPatt = re.compile(r'^\s{20,}(//.*)?$') + undefPatt = re.compile(r'^(\s*(//)?#undef)\s+([A-Z_][A-Z0-9_]+)\s*(//.*)?$') + defPatt = re.compile(r'^(\s*(//)?#define)\s+([A-Z_][A-Z0-9_]+)\s+([-_\w]+)\s*(//.*)?$') + condPatt = re.compile(r'^(\s*(//)?#(if|ifn?def|elif)(\s+\S+)*)\s+(//.*)$') + commPatt = re.compile(r'^\s{20,}(//.*)?$') col_value_lj = col_comment - patt['pad'] - 2 col_value_rj = col_comment - 3 @@ -136,7 +134,7 @@ def tryPindef(d): if r == None: return False logmsg("pin:", line) pinnum = r[4] if r[4][0] == 'P' else lpad(r[4], patt['pad']) - line = r[1] + ' ' + r[3] + line = f'{r[1]} {r[3]}' line = rpad(line, col_value_lj) + pinnum if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line @@ -150,7 +148,7 @@ def tryNoPin(d): r = noPinPatt.match(line) if r == None: return False logmsg("pin -1:", line) - line = r[1] + ' ' + r[3] + line = f'{r[1]} {r[3]}' line = rpad(line, col_value_lj) + '-1' if r[5]: line = rpad(line, col_comment) + r[5] d['line'] = line @@ -164,6 +162,14 @@ def trySkip2(d): logmsg("skip:", d['line']) return True + # + # #else|endif + # + def trySkip3(d): + if skipPatt3.match( d['line']) == None: return False + logmsg("skip:", d['line']) + return True + # # #define ALIAS OTHER # @@ -220,7 +226,7 @@ def tryUndef(d): return True # - # #if ... + # #if|ifdef|ifndef|elif ... # def tryCond(d): line = d['line'] @@ -243,18 +249,19 @@ def tryCond(d): wDict['check_comment_next'] = (r != None) if wDict['check_comment_next']: - # Comments in column 45 + # Comments in column 50 line = rpad('', col_comment) + r[1] elif trySkip1(wDict): pass #define SKIP_ME elif tryPindef(wDict): pass #define MY_PIN [pin] elif tryNoPin(wDict): pass #define MY_PIN -1 elif trySkip2(wDict): pass #define SKIP_ME_TOO + elif trySkip3(wDict): pass #else|endif elif tryAlias(wDict): pass #define ALIAS OTHER elif trySwitch(wDict): pass #define SWITCH elif tryDef(wDict): pass #define ... elif tryUndef(wDict): pass #undef ... - elif tryCond(wDict): pass #if ... + elif tryCond(wDict): pass #if|ifdef|ifndef|elif ... out += wDict['line'] + '\n' From f02fa6339f003a8a5074131b50e0905f102ee8e4 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Tue, 2 Jan 2024 00:21:06 +0000 Subject: [PATCH 63/73] [cron] Bump distribution date (2024-01-02) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 20442791431f..f910608ffe00 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2024-01-01" +//#define STRING_DISTRIBUTION_DATE "2024-01-02" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 1e97cfcb1941..eeb4aee587f3 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2024-01-01" + #define STRING_DISTRIBUTION_DATE "2024-01-02" #endif /** From 5b74e25108a47acad41d9a50560cd1fbae38040a Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:25:26 +1300 Subject: [PATCH 64/73] =?UTF-8?q?=F0=9F=94=A8=20BSD=20string=20workaround?= =?UTF-8?q?=20(#26532)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/HAL/LINUX/HAL.cpp | 46 ++++++++++++++++++ Marlin/src/HAL/LINUX/HAL.h | 14 ++++++ Marlin/src/HAL/LINUX/include/Arduino.h | 3 -- Marlin/src/HAL/NATIVE_SIM/HAL.cpp | 67 ++++++++++++++++++++++++++ Marlin/src/HAL/NATIVE_SIM/HAL.h | 10 ++++ Marlin/src/inc/Conditionals_post.h | 20 ++++---- ini/native.ini | 9 +++- 7 files changed, 154 insertions(+), 15 deletions(-) create mode 100644 Marlin/src/HAL/NATIVE_SIM/HAL.cpp diff --git a/Marlin/src/HAL/LINUX/HAL.cpp b/Marlin/src/HAL/LINUX/HAL.cpp index 6a767c76e7b7..a90819b6b0c1 100644 --- a/Marlin/src/HAL/LINUX/HAL.cpp +++ b/Marlin/src/HAL/LINUX/HAL.cpp @@ -19,6 +19,7 @@ * along with this program. If not, see . * */ + #ifdef __PLAT_LINUX__ #include "../../inc/MarlinConfig.h" @@ -57,4 +58,49 @@ uint16_t MarlinHAL::adc_value() { void MarlinHAL::reboot() { /* Reset the application state and GPIO */ } +// ------------------------ +// BSD String +// ------------------------ + +/** + * Copyright (c) 1998, 2015 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef HAS_LIBBSD + + /** + * Copy string src to buffer dst of size dsize. At most dsize-1 + * chars will be copied. Always NUL terminates (unless dsize == 0). + * Returns strlen(src); if retval >= dsize, truncation occurred. + */ + size_t MarlinHAL::_strlcpy(char *dst, const char *src, size_t dsize) { + const char *osrc = src; + size_t nleft = dsize; + + // Copy as many bytes as will fit. + if (nleft != 0) while (--nleft != 0) if ((*dst++ = *src++) == '\0') break; + + // Not enough room in dst, add NUL and traverse rest of src. + if (nleft == 0) { + if (dsize != 0) *dst = '\0'; // NUL-terminate dst + while (*src++) { /* nada */ } + } + + return (src - osrc - 1); // count does not include NUL + } + +#endif // HAS_LIBBSD + #endif // __PLAT_LINUX__ diff --git a/Marlin/src/HAL/LINUX/HAL.h b/Marlin/src/HAL/LINUX/HAL.h index e84516d4dca9..bb5fb73e0502 100644 --- a/Marlin/src/HAL/LINUX/HAL.h +++ b/Marlin/src/HAL/LINUX/HAL.h @@ -26,6 +26,11 @@ #include #include #include + +#ifdef HAS_LIBBSD + #include +#endif + #undef min #undef max #include @@ -162,4 +167,13 @@ class MarlinHAL { } static void set_pwm_frequency(const pin_t, int) {} + + #ifndef HAS_LIBBSD + /** + * Redirect missing strlcpy here + */ + static size_t _strlcpy(char *dst, const char *src, size_t dsize); + #define strlcpy hal._strlcpy + #endif + }; diff --git a/Marlin/src/HAL/LINUX/include/Arduino.h b/Marlin/src/HAL/LINUX/include/Arduino.h index 6e9c80ee07dc..f05aaed88083 100644 --- a/Marlin/src/HAL/LINUX/include/Arduino.h +++ b/Marlin/src/HAL/LINUX/include/Arduino.h @@ -28,9 +28,6 @@ #include -#define strlcpy(A, B, C) strncpy(A, B, (C) - 1) -#define strlcpy_P(A, B, C) strncpy_P(A, B, (C) - 1) - #define HIGH 0x01 #define LOW 0x00 diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.cpp b/Marlin/src/HAL/NATIVE_SIM/HAL.cpp new file mode 100644 index 000000000000..18c225fb3f15 --- /dev/null +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.cpp @@ -0,0 +1,67 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2023 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 . + * + */ + +/** + * Copyright (c) 1998, 2015 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef __PLAT_NATIVE_SIM__ + +#ifndef HAS_LIBBSD + + #include "HAL.h" + + /** + * Copy string src to buffer dst of size dsize. At most dsize-1 + * chars will be copied. Always NUL terminates (unless dsize == 0). + * Returns strlen(src); if retval >= dsize, truncation occurred. + */ + size_t MarlinHAL::_strlcpy(char *dst, const char *src, size_t dsize) { + const char *osrc = src; + size_t nleft = dsize; + + // Copy as many bytes as will fit. + if (nleft != 0) while (--nleft != 0) if ((*dst++ = *src++) == '\0') break; + + // Not enough room in dst, add NUL and traverse rest of src. + if (nleft == 0) { + if (dsize != 0) *dst = '\0'; // NUL-terminate dst + while (*src++) { /* nada */ } + } + + return (src - osrc - 1); // count does not include NUL + } + +#endif // HAS_LIBBSD +#endif // __PLAT_NATIVE_SIM__ diff --git a/Marlin/src/HAL/NATIVE_SIM/HAL.h b/Marlin/src/HAL/NATIVE_SIM/HAL.h index 8e88e5023026..f57e065a8e82 100644 --- a/Marlin/src/HAL/NATIVE_SIM/HAL.h +++ b/Marlin/src/HAL/NATIVE_SIM/HAL.h @@ -263,4 +263,14 @@ class MarlinHAL { analogWrite(pin, v); } + static void set_pwm_frequency(const pin_t, int) {} + + #ifndef HAS_LIBBSD + /** + * Redirect missing strlcpy here + */ + static size_t _strlcpy(char *dst, const char *src, size_t dsize); + #define strlcpy hal._strlcpy + #endif + }; diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index 04e96177b5d1..e87681684d42 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -30,6 +30,16 @@ // Extras for CI testing #endif +// Arduino IDE with Teensy Additions +#ifdef TEENSYDUINO + #undef max + #define max(a,b) ((a)>(b)?(a):(b)) + #undef min + #define min(a,b) ((a)<(b)?(a):(b)) + #undef NOT_A_PIN // Override Teensyduino legacy CapSense define work-around + #define NOT_A_PIN 0 // For PINS_DEBUGGING +#endif + // ADC #ifdef BOARD_ADC_VREF_MV #define ADC_VREF_MV BOARD_ADC_VREF_MV @@ -64,16 +74,6 @@ #undef OTA_FIRMWARE_UPDATE #endif -#ifdef TEENSYDUINO - #undef max - #define max(a,b) ((a)>(b)?(a):(b)) - #undef min - #define min(a,b) ((a)<(b)?(a):(b)) - - #undef NOT_A_PIN // Override Teensyduino legacy CapSense define work-around - #define NOT_A_PIN 0 // For PINS_DEBUGGING -#endif - /** * Axis lengths and center */ diff --git a/ini/native.ini b/ini/native.ini index 40511beb6fc2..86608ff3d71a 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -36,7 +36,8 @@ build_src_filter = ${common.default_src_filter} + [simulator_common] platform = native framework = -build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g +build_flags = ${common.build_flags} -std=gnu++17 -D__PLAT_NATIVE_SIM__ -DU8G_HAL_LINKS + -I/usr/include/SDL2 -IMarlin -IMarlin/src/HAL/NATIVE_SIM/u8g build_src_flags = -Wall -Wno-expansion-to-defined -Wno-deprecated-declarations -Wcast-align release_flags = -g0 -O3 -flto debug_build_flags = -fstack-protector-strong -g -g3 -ggdb @@ -99,6 +100,7 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} [simulator_macos] build_unflags = -lGL -fstack-protector-strong build_flags = + -DHAS_LIBBSD -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include/SDL2/ @@ -135,5 +137,8 @@ custom_gcc = g++ [env:simulator_windows] extends = simulator_common build_src_flags = ${simulator_common.build_src_flags} -fpermissive -build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp +build_flags = ${simulator_common.build_flags} ${simulator_common.debug_build_flags} + -IC:\\msys64\\mingw64\\include\\SDL2 -fno-stack-protector -Wl,-subsystem,windows + -ldl -lmingw32 -lSDL2main -lSDL2 -lSDL2_net -lopengl32 -lssp + -DHAS_LIBBSD build_type = debug From 7c159a20e538e42af5185c80c660c90c0377b909 Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Wed, 3 Jan 2024 00:21:14 +0000 Subject: [PATCH 65/73] [cron] Bump distribution date (2024-01-03) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index f910608ffe00..79c3ef62533c 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2024-01-02" +//#define STRING_DISTRIBUTION_DATE "2024-01-03" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index eeb4aee587f3..4007aaccef0f 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2024-01-02" + #define STRING_DISTRIBUTION_DATE "2024-01-03" #endif /** From 1ac6428c82aa72cc41c0c9f758659b71e7fce1cf Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:52:12 +1300 Subject: [PATCH 66/73] =?UTF-8?q?=F0=9F=94=AA=20Options=20to=20slim=20M111?= =?UTF-8?q?,=20remove=20M115=20(#26603)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration_adv.h | 12 ++++++++++++ Marlin/src/core/serial.h | 21 ++++++++------------ Marlin/src/gcode/control/M111.cpp | 32 ++++++++++++++++++------------- Marlin/src/gcode/gcode.cpp | 5 ++++- Marlin/src/gcode/gcode.h | 5 ++++- Marlin/src/gcode/host/M115.cpp | 7 ++++++- Marlin/src/inc/Warnings.cpp | 8 ++++++++ ini/features.ini | 1 + platformio.ini | 1 - 9 files changed, 62 insertions(+), 30 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 72aee115884d..d19fb1d5033d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3935,6 +3935,18 @@ //#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW +/** + * Enable M111 debug flags 1=ECHO, 2=INFO, 4=ERRORS (unimplemented). + * Disable to save some flash. Some hosts (Repetier Host) may rely on this feature. + */ +#define DEBUG_FLAGS_GCODE + +/** + * M115 - Report capabilites. Disable to save ~1150 bytes of flash. + * Some hosts (and serial TFT displays) rely on this feature. + */ +#define REPORT_CAPABILITIES_GCODE + /** * Enable this option for a leaner build of Marlin that removes * workspace offsets to slightly optimize performance. diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index ff02ebedc2d7..f9b73e6d2667 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -33,19 +33,14 @@ // enum MarlinDebugFlags : uint8_t { MARLIN_DEBUG_NONE = 0, - MARLIN_DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed - MARLIN_DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output - MARLIN_DEBUG_ERRORS = _BV(2), ///< Not implemented - MARLIN_DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands - MARLIN_DEBUG_COMMUNICATION = _BV(4), ///< Not implemented - #if ENABLED(DEBUG_LEVELING_FEATURE) - MARLIN_DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling - MARLIN_DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling - #else - MARLIN_DEBUG_LEVELING = 0, - MARLIN_DEBUG_MESH_ADJUST = 0, - #endif - MARLIN_DEBUG_ALL = 0xFF + MARLIN_DEBUG_ECHO = TERN0(DEBUG_FLAGS_GCODE, _BV(0)), //!< Echo commands in order as they are processed + MARLIN_DEBUG_INFO = TERN0(DEBUG_FLAGS_GCODE, _BV(1)), //!< Print messages for code that has debug output + MARLIN_DEBUG_ERRORS = TERN0(DEBUG_FLAGS_GCODE, _BV(2)), //!< Not implemented + MARLIN_DEBUG_DRYRUN = _BV(3), //!< Ignore temperature setting and E movement commands + MARLIN_DEBUG_COMMUNICATION = TERN0(DEBUG_FLAGS_GCODE, _BV(4)), //!< Not implemented + MARLIN_DEBUG_LEVELING = TERN0(DEBUG_LEVELING_FEATURE, _BV(5)), //!< Print detailed output for homing and leveling + MARLIN_DEBUG_MESH_ADJUST = TERN0(DEBUG_LEVELING_FEATURE, _BV(6)), //!< UBL bed leveling + MARLIN_DEBUG_ALL = MARLIN_DEBUG_ECHO|MARLIN_DEBUG_INFO|MARLIN_DEBUG_ERRORS|MARLIN_DEBUG_COMMUNICATION|MARLIN_DEBUG_LEVELING|MARLIN_DEBUG_MESH_ADJUST }; extern uint8_t marlin_debug_flags; diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 02f37f84974e..a8e549b69d22 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -20,6 +20,7 @@ * */ +#include "../../inc/MarlinConfig.h" #include "../gcode.h" /** @@ -27,18 +28,25 @@ */ void GcodeSuite::M111() { if (parser.seenval('S')) marlin_debug_flags = parser.value_byte(); - - static PGMSTR(str_debug_1, STR_DEBUG_ECHO); - static PGMSTR(str_debug_2, STR_DEBUG_INFO); - static PGMSTR(str_debug_4, STR_DEBUG_ERRORS); + #if ENABLED(DEBUG_FLAGS_GCODE) + static PGMSTR(str_debug_1, STR_DEBUG_ECHO); + static PGMSTR(str_debug_2, STR_DEBUG_INFO); + static PGMSTR(str_debug_4, STR_DEBUG_ERRORS); + #endif static PGMSTR(str_debug_8, STR_DEBUG_DRYRUN); - static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION); + #if ENABLED(DEBUG_FLAGS_GCODE) + static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION); + #endif #if ENABLED(DEBUG_LEVELING_FEATURE) static PGMSTR(str_debug_detail, STR_DEBUG_DETAIL); #endif static PGM_P const debug_strings[] PROGMEM = { - str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16, + TERN(DEBUG_FLAGS_GCODE, str_debug_1, nullptr), + TERN(DEBUG_FLAGS_GCODE, str_debug_2, nullptr), + TERN(DEBUG_FLAGS_GCODE, str_debug_4, nullptr), + str_debug_8, + TERN(DEBUG_FLAGS_GCODE, str_debug_16, nullptr), TERN_(DEBUG_LEVELING_FEATURE, str_debug_detail) }; @@ -47,31 +55,29 @@ void GcodeSuite::M111() { if (marlin_debug_flags) { uint8_t comma = 0; for (uint8_t i = 0; i < COUNT(debug_strings); ++i) { - if (TEST(marlin_debug_flags, i)) { + PGM_P const pstr = (PGM_P)pgm_read_ptr(&debug_strings[i]); + if (pstr && TEST(marlin_debug_flags, i)) { if (comma++) SERIAL_CHAR(','); - SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&debug_strings[i])); + SERIAL_ECHOPGM_P(pstr); } } } else { SERIAL_ECHOPGM(STR_DEBUG_OFF); - #if !defined(__AVR__) || !defined(USBCON) + #if !(defined(__AVR__) && defined(USBCON)) #if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS) SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns()); #endif - #if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS) SERIAL_ECHOPGM("\nFraming Errors: ", MYSERIAL1.framing_errors()); #endif - #if ENABLED(SERIAL_STATS_DROPPED_RX) SERIAL_ECHOPGM("\nDropped bytes: ", MYSERIAL1.dropped()); #endif - #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) SERIAL_ECHOPGM("\nMax RX Queue Size: ", MYSERIAL1.rxMaxEnqueued()); #endif - #endif // !__AVR__ || !USBCON + #endif // !(__AVR__ && USBCON) } SERIAL_EOL(); } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 6a0e8cb17142..4266136ef4c0 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -669,7 +669,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes case 114: M114(); break; // M114: Report current position - case 115: M115(); break; // M115: Report capabilities + + #if ENABLED(REPORT_CAPABILITIES_GCODE) + case 115: M115(); break; // M115: Report capabilities + #endif case 117: TERN_(HAS_STATUS_MESSAGE, M117()); break; // M117: Set LCD message text, if possible diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index fffd0d714bea..d5adf6c41567 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -760,7 +760,10 @@ class GcodeSuite { #endif static void M114(); - static void M115(); + + #if ENABLED(REPORT_CAPABILITIES_GCODE) + static void M115(); + #endif #if HAS_STATUS_MESSAGE static void M117(); diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 806e593fcb4a..ae8e6155077d 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -20,8 +20,11 @@ * */ -#include "../gcode.h" #include "../../inc/MarlinConfig.h" + +#if ENABLED(REPORT_CAPABILITIES_GCODE) + +#include "../gcode.h" #include "../queue.h" // for getting the command port #if ENABLED(M115_GEOMETRY_REPORT) @@ -271,3 +274,5 @@ void GcodeSuite::M115() { #endif // EXTENDED_CAPABILITIES_REPORT } + +#endif // REPORT_CAPABILITIES_GCODE diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index d239e6a7d5cf..8f260b237c94 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -42,6 +42,14 @@ #endif #endif +#if DISABLED(DEBUG_FLAGS_GCODE) + #warning "DEBUG_FLAGS_GCODE is recommended if you have space. Some hosts rely on it." +#endif + +#if DISABLED(REPORT_CAPABILITIES_GCODE) + #warning "REPORT_CAPABILITIES_GCODE is recommended if you have space. Some hosts rely on it." +#endif + #if ENABLED(LA_DEBUG) #warning "WARNING! Disable LA_DEBUG for the final build!" #endif diff --git a/ini/features.ini b/ini/features.ini index a550783a38fd..120d599dcabb 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -322,6 +322,7 @@ CNC_COORDINATE_SYSTEMS = build_src_filter=+ EXPECTED_PRINTER_CHECK = build_src_filter=+ HOST_KEEPALIVE_FEATURE = build_src_filter=+ +REPORT_CAPABILITIES_GCODE = build_src_filter=+ AUTO_REPORT_POSITION = build_src_filter=+ REPETIER_GCODE_M360 = build_src_filter=+ HAS_GCODE_M876 = build_src_filter=+ diff --git a/platformio.ini b/platformio.ini index 81f97e73b8c4..5249b790f2d0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -111,7 +111,6 @@ default_src_filter = + - - + + + - + + + + From 4a9e102c2ef96b75378195ad3b89cb1646ac4df4 Mon Sep 17 00:00:00 2001 From: I3DBeeTech <129617321+I3DBeeTech@users.noreply.github.com> Date: Wed, 3 Jan 2024 06:23:41 +0530 Subject: [PATCH 67/73] =?UTF-8?q?=F0=9F=93=BA=20I3DBEE=20TECH=20Beez=20Min?= =?UTF-8?q?i=2012864=20(#26596)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 5 +++++ Marlin/src/inc/Conditionals_LCD.h | 4 ++-- Marlin/src/inc/SanityCheck.h | 10 +++++----- Marlin/src/inc/Warnings.cpp | 6 +++--- Marlin/src/pins/esp32/pins_MKS_TINYBEE.h | 2 +- Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h | 6 +++--- Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h | 4 ++-- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index fd2dbbb27398..1b0e92923ef8 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -3015,6 +3015,11 @@ // //#define BTT_MINI_12864 +// +// BEEZ MINI 12864 is an alias for FYSETC_MINI_12864_2_1. Type A/B. NeoPixel RGB Backlight. +// +//#define BEEZ_MINI_12864 + // // Factory display for Creality CR-10 / CR-7 / Ender-3 // https://www.aliexpress.com/item/32833148327.html diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b501a556f8ec..a81c8639cf19 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -566,8 +566,8 @@ #define MKS_MINI_12864 #endif -// MKS_MINI_12864_V3 and BTT_MINI_12864 have identical pinouts to FYSETC_MINI_12864_2_1 -#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864) +// MKS_MINI_12864_V3 , BTT_MINI_12864 and BEEZ_MINI_12864 have identical pinouts to FYSETC_MINI_12864_2_1 +#if ANY(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864) #define FYSETC_MINI_12864_2_1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index e5cba0310270..d1c84665ede3 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2275,7 +2275,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif /** - * FYSETC/MKS/BTT Mini Panel Requirements + * FYSETC/MKS/BTT/BEEZ Mini Panel Requirements */ #if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) #ifndef NEO_RGB @@ -2283,9 +2283,9 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #define FAUX_RGB 1 #endif #if defined(NEOPIXEL_TYPE) && NEOPIXEL_TYPE != NEO_RGB - #error "Your FYSETC/MKS/BTT Mini Panel requires NEOPIXEL_TYPE to be NEO_RGB." + #error "Your FYSETC/MKS/BTT/BEEZ Mini Panel requires NEOPIXEL_TYPE to be NEO_RGB." #elif defined(NEOPIXEL_PIXELS) && NEOPIXEL_PIXELS < 3 - #error "Your FYSETC/MKS/BTT Mini Panel requires NEOPIXEL_PIXELS >= 3." + #error "Your FYSETC/MKS/BTT/BEEZ Mini Panel requires NEOPIXEL_PIXELS >= 3." #endif #if FAUX_RGB #undef NEO_RGB @@ -2618,8 +2618,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L + (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \ + (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \ + (ENABLED(MKS_MINI_12864) && NONE(MKS_LCD12864A, MKS_LCD12864B)) \ - + (ENABLED(FYSETC_MINI_12864_2_1) && NONE(MKS_MINI_12864_V3, BTT_MINI_12864)) \ - + COUNT_ENABLED(MKS_MINI_12864_V3, BTT_MINI_12864) \ + + (ENABLED(FYSETC_MINI_12864_2_1) && NONE(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864)) \ + + COUNT_ENABLED(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864) \ + (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \ + (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \ + (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \ diff --git a/Marlin/src/inc/Warnings.cpp b/Marlin/src/inc/Warnings.cpp index 8f260b237c94..384fe04c618a 100644 --- a/Marlin/src/inc/Warnings.cpp +++ b/Marlin/src/inc/Warnings.cpp @@ -703,16 +703,16 @@ #endif /** - * FYSETC/MKS/BTT Mini Panel backlighting + * FYSETC/MKS/BTT/BEEZ Mini Panel backlighting */ #if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864_2_1) && !ALL(NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, LED_COLOR_PRESETS) - #warning "Your FYSETC/MKS/BTT Mini Panel works best with NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, and LED_COLOR_PRESETS." + #warning "Your FYSETC/MKS/BTT/BEEZ Mini Panel works best with NEOPIXEL_LED, LED_CONTROL_MENU, LED_USER_PRESET_STARTUP, and LED_COLOR_PRESETS." #endif #if ANY(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) && DISABLED(RGB_LED) #warning "Your FYSETC Mini Panel works best with RGB_LED." #elif ANY(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1) && DISABLED(LED_USER_PRESET_STARTUP) - #warning "Your FYSETC/MKS/BTT Mini Panel works best with LED_USER_PRESET_STARTUP." + #warning "Your FYSETC/MKS/BTT/BEEZ Mini Panel works best with LED_USER_PRESET_STARTUP." #endif #if ANY(FYSETC_242_OLED_12864, FYSETC_MINI_12864) && ALL(PSU_CONTROL, HAS_COLOR_LEDS) && !LED_POWEROFF_TIMEOUT diff --git a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h index 60ed800ba690..43196bafa91b 100644 --- a/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h +++ b/Marlin/src/pins/esp32/pins_MKS_TINYBEE.h @@ -169,7 +169,7 @@ #define DOGLCD_A0 EXP1_07_PIN #define LCD_RESET_PIN -1 #elif ENABLED(FYSETC_MINI_12864_2_1) - // MKS_MINI_12864_V3, BTT_MINI_12864, FYSETC_MINI_12864_2_1 + // MKS_MINI_12864_V3, BTT_MINI_12864, FYSETC_MINI_12864_2_1, BEEZ_MINI_12864 #define DOGLCD_CS EXP1_03_PIN #define DOGLCD_A0 EXP1_04_PIN #define LCD_RESET_PIN EXP1_05_PIN diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index f752350cc6a9..b36ef2287aca 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -238,7 +238,7 @@ #endif /** - * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 display pinout + * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 / BEEZ_MINI_12864 display pinout * * Board Display * ------ ------ @@ -251,13 +251,13 @@ * EXP1 EXP1 * * - * ----- ------ + * --- ------ * | 1 | RST -- |10 9 | -- * | 2 | PA3 RX2 RESET_BTN | 8 7 | SD_DETECT * | 3 | PA2 TX2 LCD_MOSI | 6 5 EN2 * | 4 | GND -- | 4 3 | EN1 * | 5 | 5V LCD_SCK | 2 1 | -- - * ----- ------ + * --- ------ * TFT EXP2 * diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index 362cfca3074d..4ab1e15cdd63 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -275,11 +275,11 @@ #elif ENABLED(FYSETC_MINI_12864_2_1) #ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING - #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" + #error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 / BEEZ_MINI_12864 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)" #endif /** - * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 display pinout + * FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864 / BEEZ_MINI_12864 display pinout * * Board Display * ------ ------ From 6d407767e7692d66bc93a0012d71268770e4835c Mon Sep 17 00:00:00 2001 From: plampix Date: Wed, 3 Jan 2024 16:43:18 +0100 Subject: [PATCH 68/73] =?UTF-8?q?=F0=9F=94=A7=20CONFIGURE=5FFILAMENT=5FCHA?= =?UTF-8?q?NGE=20-=20Optional=20M603=20(#26613)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 4 ++-- Marlin/Configuration_adv.h | 3 ++- Marlin/src/feature/max7219.cpp | 2 +- Marlin/src/feature/pause.cpp | 4 +++- Marlin/src/feature/pause.h | 19 ++++++++++++++----- Marlin/src/gcode/feature/pause/M603.cpp | 6 +++--- Marlin/src/gcode/gcode.cpp | 4 +++- Marlin/src/lcd/e3v2/jyersui/dwin.cpp | 4 ++-- Marlin/src/lcd/e3v2/proui/dwin.cpp | 2 +- Marlin/src/lcd/extui/nextion/nextion_tft.cpp | 2 +- Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/module/settings.cpp | 18 ++++++------------ buildroot/tests/BIGTREE_GTR_V1_0 | 1 + ini/features.ini | 3 ++- 14 files changed, 42 insertions(+), 32 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 1b0e92923ef8..9acdc107ca8f 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2054,7 +2054,7 @@ /** * Enable detailed logging of G28, G29, M48, etc. * Turn on with the command 'M111 S32'. - * NOTE: Requires a lot of PROGMEM! + * NOTE: Requires a lot of flash! */ //#define DEBUG_LEVELING_FEATURE @@ -2343,7 +2343,7 @@ */ //#define EEPROM_SETTINGS // Persistent storage with M500 and M501 //#define DISABLE_M503 // Saves ~2700 bytes of flash. Disable for release! -#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM. +#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save flash. #define EEPROM_BOOT_SILENT // Keep M503 quiet and only give errors during first load #if ENABLED(EEPROM_SETTINGS) //#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors. diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d19fb1d5033d..10316ac9282b 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1342,7 +1342,7 @@ #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm #define CALIBRATION_NOZZLE_OUTER_DIAMETER 2.0 // mm - // Uncomment to enable reporting (required for "G425 V", but consumes PROGMEM). + // Uncomment to enable reporting (required for "G425 V", but consumes flash). //#define CALIBRATION_REPORTING // The true location and dimension the cube/bolt/washer on the bed. @@ -2929,6 +2929,7 @@ //#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu. //#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302) + #define CONFIGURE_FILAMENT_CHANGE // Add M603 G-code and menu items. Requires ~1.3K bytes of flash. #endif // @section tmc_smart diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index 12e4a539d3d5..6089b1a86e85 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -39,7 +39,7 @@ #if ENABLED(MAX7219_DEBUG) -#define MAX7219_ERRORS // Disable to save 406 bytes of Program Memory +#define MAX7219_ERRORS // Requires ~400 bytes of flash #include "max7219.h" diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index f098ad9c516e..8756c339e3c1 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -89,7 +89,9 @@ static xyze_pos_t resume_position; PauseMode pause_mode = PAUSE_MODE_PAUSE_PRINT; #endif -fil_change_settings_t fc_settings[EXTRUDERS]; +#if ENABLED(CONFIGURE_FILAMENT_CHANGE) + fil_change_settings_t fc_settings[EXTRUDERS]; +#endif #if HAS_MEDIA #include "../sd/cardreader.h" diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 45f62dc31029..304c8a611d13 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -26,10 +26,6 @@ * This may be combined with related G-codes if features are consolidated. */ -typedef struct { - float unload_length, load_length; -} fil_change_settings_t; - #include "../inc/MarlinConfigPre.h" #if ENABLED(ADVANCED_PAUSE_FEATURE) @@ -69,7 +65,20 @@ enum PauseMessage : char { extern PauseMode pause_mode; #endif -extern fil_change_settings_t fc_settings[EXTRUDERS]; +typedef struct FilamentChangeSettings { + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) + float load_length, unload_length; + #else + static constexpr float load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH, + unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH; + #endif +} fil_change_settings_t; + +#if ENABLED(CONFIGURE_FILAMENT_CHANGE) + extern fil_change_settings_t fc_settings[EXTRUDERS]; +#else + constexpr fil_change_settings_t fc_settings[EXTRUDERS]; +#endif extern uint8_t did_pause_print; diff --git a/Marlin/src/gcode/feature/pause/M603.cpp b/Marlin/src/gcode/feature/pause/M603.cpp index 0512a0d29b0b..2f24cc642136 100644 --- a/Marlin/src/gcode/feature/pause/M603.cpp +++ b/Marlin/src/gcode/feature/pause/M603.cpp @@ -20,9 +20,9 @@ * */ -#include "../../../inc/MarlinConfig.h" +#include "../../../inc/MarlinConfigPre.h" -#if ENABLED(ADVANCED_PAUSE_FEATURE) +#if ENABLED(CONFIGURE_FILAMENT_CHANGE) #include "../../gcode.h" #include "../../../feature/pause.h" @@ -80,4 +80,4 @@ void GcodeSuite::M603_report(const bool forReplay/*=true*/) { #endif } -#endif // ADVANCED_PAUSE_FEATURE +#endif // CONFIGURE_FILAMENT_CHANGE diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 4266136ef4c0..945da708b4e2 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -948,7 +948,9 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #if ENABLED(ADVANCED_PAUSE_FEATURE) case 600: M600(); break; // M600: Pause for Filament Change - case 603: M603(); break; // M603: Configure Filament Change + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) + case 603: M603(); break; // M603: Configure Filament Change + #endif #endif #if HAS_DUPLICATION_MODE diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index da6fda08d52d..296f46f68a32 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -2910,7 +2910,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra break; #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) case ADVANCED_LOAD: if (draw) { drawMenuItem(row, ICON_WriteEEPROM, F("Load Length")); @@ -2927,7 +2927,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra else modifyValue(fc_settings[0].unload_length, 0, EXTRUDE_MAXLENGTH, 1); break; - #endif // ADVANCED_PAUSE_FEATURE + #endif // CONFIGURE_FILAMENT_CHANGE #if ENABLED(PREVENT_COLD_EXTRUSION) case ADVANCED_COLD_EXTRUDE: diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 894102e8a3bb..5262dba385be 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -3302,7 +3302,7 @@ void drawFilSetMenu() { #if ENABLED(PREVENT_COLD_EXTRUSION) EDIT_ITEM(ICON_ExtrudeMinT, MSG_EXTRUDER_MIN_TEMP, onDrawPIntMenu, setExtMinT, &hmiData.extMinT); #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) EDIT_ITEM(ICON_FilLoad, MSG_FILAMENT_LOAD, onDrawPFloatMenu, setFilLoad, &fc_settings[0].load_length); EDIT_ITEM(ICON_FilUnload, MSG_FILAMENT_UNLOAD, onDrawPFloatMenu, setFilUnload, &fc_settings[0].unload_length); #endif diff --git a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp index c29a2dd4044c..04743286503f 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_tft.cpp @@ -323,7 +323,7 @@ void NextionTFT::panelInfo(uint8_t req) { SEND_PRINT_INFO("t8", getFilamentUsed_str); break; - case 28: // Filament laod/unload + case 28: // Filament load/unload #if ENABLED(ADVANCED_PAUSE_FEATURE) #define SEND_PAUSE_INFO(A, B) SEND_VALasTXT(A, fc_settings[getActiveTool()].B) #else diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 95d965bdf998..698687b96dcd 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -136,7 +136,7 @@ void menu_backlash(); } #endif - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) constexpr float extrude_maxlength = TERN(PREVENT_LENGTHY_EXTRUDE, EXTRUDE_MAXLENGTH, 999); EDIT_ITEM_FAST(float4, MSG_FILAMENT_UNLOAD, &fc_settings[active_extruder].unload_length, 0, extrude_maxlength); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index fa7beee94b84..387d86ba29bb 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -36,7 +36,7 @@ */ // Change EEPROM version if the structure changes -#define EEPROM_VERSION "V89" +#define EEPROM_VERSION "V90" #define EEPROM_OFFSET 100 // Check the integrity of data offsets. @@ -508,7 +508,7 @@ typedef struct SettingsDataStruct { // // ADVANCED_PAUSE_FEATURE // - #if HAS_EXTRUDERS + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) fil_change_settings_t fc_settings[EXTRUDERS]; // M603 T U L #endif @@ -1551,11 +1551,8 @@ void MarlinSettings::postprocess() { // // Advanced Pause filament load & unload lengths // - #if HAS_EXTRUDERS + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) { - #if DISABLED(ADVANCED_PAUSE_FEATURE) - const fil_change_settings_t fc_settings[EXTRUDERS] = { 0, 0 }; - #endif _FIELD_TEST(fc_settings); EEPROM_WRITE(fc_settings); } @@ -2626,11 +2623,8 @@ void MarlinSettings::postprocess() { // // Advanced Pause filament load & unload lengths // - #if HAS_EXTRUDERS + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) { - #if DISABLED(ADVANCED_PAUSE_FEATURE) - fil_change_settings_t fc_settings[EXTRUDERS]; - #endif _FIELD_TEST(fc_settings); EEPROM_READ(fc_settings); } @@ -3549,7 +3543,7 @@ void MarlinSettings::reset() { // // Advanced Pause filament load & unload lengths // - #if ENABLED(ADVANCED_PAUSE_FEATURE) + #if ENABLED(CONFIGURE_FILAMENT_CHANGE) EXTRUDER_LOOP() { fc_settings[e].unload_length = FILAMENT_CHANGE_UNLOAD_LENGTH; fc_settings[e].load_length = FILAMENT_CHANGE_FAST_LOAD_LENGTH; @@ -3924,7 +3918,7 @@ void MarlinSettings::reset() { // // Advanced Pause filament load & unload lengths // - TERN_(ADVANCED_PAUSE_FEATURE, gcode.M603_report(forReplay)); + TERN_(CONFIGURE_FILAMENT_CHANGE, gcode.M603_report(forReplay)); // // Tool-changing Parameters diff --git a/buildroot/tests/BIGTREE_GTR_V1_0 b/buildroot/tests/BIGTREE_GTR_V1_0 index 8f69f5b06912..62ca3c24f274 100755 --- a/buildroot/tests/BIGTREE_GTR_V1_0 +++ b/buildroot/tests/BIGTREE_GTR_V1_0 @@ -18,6 +18,7 @@ opt_set E0_AUTO_FAN_PIN PC10 E1_AUTO_FAN_PIN PC11 E2_AUTO_FAN_PIN PC12 NEOPIXEL_ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER BLTOUCH NEOPIXEL_LED Z_SAFE_HOMING NOZZLE_PARK_FEATURE ADVANCED_PAUSE_FEATURE \ FILAMENT_RUNOUT_SENSOR FIL_RUNOUT4_PULLUP FIL_RUNOUT8_PULLUP FILAMENT_CHANGE_RESUME_ON_INSERT PAUSE_REHEAT_FAST_RESUME \ LCD_BED_TRAMMING BED_TRAMMING_USE_PROBE +opt_disable CONFIGURE_FILAMENT_CHANGE exec_test $1 $2 "BigTreeTech GTR | 8 Extruders | Auto-Fan | Mixed TMC Drivers | Runout Sensors w/ distinct states" "$3" restore_configs diff --git a/ini/features.ini b/ini/features.ini index 120d599dcabb..f9822fa7a8a5 100644 --- a/ini/features.ini +++ b/ini/features.ini @@ -259,7 +259,8 @@ MIXING_EXTRUDER = build_src_filter=+ HAS_PRUSA_MMU2 = build_src_filter=+ + PASSWORD_FEATURE = build_src_filter=+ + -ADVANCED_PAUSE_FEATURE = build_src_filter=+ + + +ADVANCED_PAUSE_FEATURE = build_src_filter=+ + +CONFIGURE_FILAMENT_CHANGE = build_src_filter=+ PSU_CONTROL = build_src_filter=+ HAS_POWER_MONITOR = build_src_filter=+ + POWER_LOSS_RECOVERY = build_src_filter=+ + From 68b7802fc17cd4160fa3923897ab69dbea09f4ed Mon Sep 17 00:00:00 2001 From: narno2202 <130909513+narno2202@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:19:19 +0100 Subject: [PATCH 69/73] =?UTF-8?q?=F0=9F=93=9D=20Update=20M493=20(FT=5FMOTI?= =?UTF-8?q?ON)=20comments=20(#26620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/gcode/feature/ft_motion/M493.cpp | 43 ++++++++++++--------- Marlin/src/module/ft_types.h | 28 +++++++------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Marlin/src/gcode/feature/ft_motion/M493.cpp b/Marlin/src/gcode/feature/ft_motion/M493.cpp index 7f202be4138c..d374ca58c9f5 100644 --- a/Marlin/src/gcode/feature/ft_motion/M493.cpp +++ b/Marlin/src/gcode/feature/ft_motion/M493.cpp @@ -38,14 +38,14 @@ void say_shaping() { SERIAL_ECHOPGM(" with "); switch (ftMotion.cfg.mode) { default: break; - case ftMotionMode_ZV: SERIAL_ECHOPGM("ZV"); break; - case ftMotionMode_ZVD: SERIAL_ECHOPGM("ZVD"); break; - case ftMotionMode_ZVDD: SERIAL_ECHOPGM("ZVDD"); break; - case ftMotionMode_ZVDDD: SERIAL_ECHOPGM("ZVDDD"); break; - case ftMotionMode_EI: SERIAL_ECHOPGM("EI"); break; - case ftMotionMode_2HEI: SERIAL_ECHOPGM("2 Hump EI"); break; - case ftMotionMode_3HEI: SERIAL_ECHOPGM("3 Hump EI"); break; - case ftMotionMode_MZV: SERIAL_ECHOPGM("MZV"); break; + case ftMotionMode_ZV: SERIAL_ECHOPGM("ZV"); break; + case ftMotionMode_ZVD: SERIAL_ECHOPGM("ZVD"); break; + case ftMotionMode_ZVDD: SERIAL_ECHOPGM("ZVDD"); break; + case ftMotionMode_ZVDDD: SERIAL_ECHOPGM("ZVDDD"); break; + case ftMotionMode_EI: SERIAL_ECHOPGM("EI"); break; + case ftMotionMode_2HEI: SERIAL_ECHOPGM("2 Hump EI"); break; + case ftMotionMode_3HEI: SERIAL_ECHOPGM("3 Hump EI"); break; + case ftMotionMode_MZV: SERIAL_ECHOPGM("MZV"); break; //case ftMotionMode_DISCTF: SERIAL_ECHOPGM("discrete transfer functions"); break; //case ftMotionMode_ULENDO_FBS: SERIAL_ECHOPGM("Ulendo FBS."); return; } @@ -129,14 +129,17 @@ void GcodeSuite::M493_report(const bool forReplay/*=true*/) { * M493: Set Fixed-time Motion Control parameters * * S Set the motion / shaping mode. Shaping requires an X axis, at the minimum. - * 0: NORMAL - * 1: FIXED-TIME - * 10: ZV - * 11: ZVD - * 12: EI - * 13: 2HEI - * 14: 3HEI - * 15: MZV + * + * 0: Standard Motion + * 1: Fixed-Time Motion + * 10: ZV : Zero Vibration + * 11: ZVD : Zero Vibration and Derivative + * 12: ZVDD : Zero Vibration, Derivative, and Double Derivative + * 13: ZVDDD : Zero Vibration, Derivative, Double Derivative, and Triple Derivative + * 14: EI : Extra-Intensive + * 15: 2HEI : 2-Hump Extra-Intensive + * 16: 3HEI : 3-Hump Extra-Intensive + * 17: MZV : Mass-based Zero Vibration * * P Enable (1) or Disable (0) Linear Advance pressure control * @@ -147,11 +150,15 @@ void GcodeSuite::M493_report(const bool forReplay/*=true*/) { * 1: Z-based (Requires a Z axis) * 2: Mass-based (Requires X and E axes) * - * A Set static/base frequency for the X axis - * F Set frequency scaling for the X axis + * A Set static/base frequency for the X axis + * F Set frequency scaling for the X axis + * I 0.0 Set damping ratio for the X axis + * Q 0.00 Set the vibration tolerance for the X axis * * B Set static/base frequency for the Y axis * H Set frequency scaling for the Y axis + * J 0.0 Set damping ratio for the Y axis + * R 0.00 Set the vibration tolerance for the Y axis */ void GcodeSuite::M493() { struct { bool update_n:1, update_a:1, reset_ft:1, report_h:1; } flag = { false }; diff --git a/Marlin/src/module/ft_types.h b/Marlin/src/module/ft_types.h index e7bcf37ac688..b17c00974e76 100644 --- a/Marlin/src/module/ft_types.h +++ b/Marlin/src/module/ft_types.h @@ -24,24 +24,22 @@ #include "../core/types.h" typedef enum FXDTICtrlMode : uint8_t { - ftMotionMode_DISABLED = 0U, - ftMotionMode_ENABLED = 1U, - //ftMotionMode_ULENDO_FBS = 2U, - ftMotionMode_ZV = 10U, - ftMotionMode_ZVD = 11U, - ftMotionMode_ZVDD = 12U, - ftMotionMode_ZVDDD = 13U, - ftMotionMode_EI = 14U, - ftMotionMode_2HEI = 15U, - ftMotionMode_3HEI = 16U, - ftMotionMode_MZV = 17U, - //ftMotionMode_DISCTF = 20U + ftMotionMode_DISABLED = 0, // Standard Motion + ftMotionMode_ENABLED = 1, // Time-Based Motion + ftMotionMode_ZV = 10, // Zero Vibration + ftMotionMode_ZVD = 11, // Zero Vibration and Derivative + ftMotionMode_ZVDD = 12, // Zero Vibration, Derivative, and Double Derivative + ftMotionMode_ZVDDD = 13, // Zero Vibration, Derivative, Double Derivative, and Triple Derivative + ftMotionMode_EI = 14, // Extra-Intensive + ftMotionMode_2HEI = 15, // 2-Hump Extra-Intensive + ftMotionMode_3HEI = 16, // 3-Hump Extra-Intensive + ftMotionMode_MZV = 17 // Mass-based Zero Vibration } ftMotionMode_t; enum dynFreqMode_t : uint8_t { - dynFreqMode_DISABLED = 0U, - dynFreqMode_Z_BASED = 1U, - dynFreqMode_MASS_BASED = 2U + dynFreqMode_DISABLED = 0, + dynFreqMode_Z_BASED = 1, + dynFreqMode_MASS_BASED = 2 }; #define IS_EI_MODE(N) WITHIN(N, ftMotionMode_EI, ftMotionMode_3HEI) From be1dee7caf8197f10811574265714e78ca08ec83 Mon Sep 17 00:00:00 2001 From: Orel <37673727+0r31@users.noreply.github.com> Date: Wed, 3 Jan 2024 21:02:20 +0100 Subject: [PATCH 70/73] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20old=20#includ?= =?UTF-8?q?es=20(#26621)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/queue.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 9ce28f781cd8..db06af82f061 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -37,14 +37,6 @@ GCodeQueue queue; #include "../MarlinCore.h" #include "../core/bug_on.h" -#if ENABLED(PRINTER_EVENT_LEDS) - #include "../feature/leds/printer_event_leds.h" -#endif - -#if HAS_ETHERNET - #include "../feature/ethernet.h" -#endif - #if ENABLED(BINARY_FILE_TRANSFER) #include "../feature/binary_stream.h" #endif From f8771e9ad5d572f22ec89c199e81cd53106ffc5c Mon Sep 17 00:00:00 2001 From: thinkyhead Date: Thu, 4 Jan 2024 00:21:47 +0000 Subject: [PATCH 71/73] [cron] Bump distribution date (2024-01-04) --- Marlin/Version.h | 2 +- Marlin/src/inc/Version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Version.h b/Marlin/Version.h index 79c3ef62533c..1cdc982294ea 100644 --- a/Marlin/Version.h +++ b/Marlin/Version.h @@ -41,7 +41,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ -//#define STRING_DISTRIBUTION_DATE "2024-01-03" +//#define STRING_DISTRIBUTION_DATE "2024-01-04" /** * Defines a generic printer name to be output to the LCD after booting Marlin. diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 4007aaccef0f..2b250079f5cc 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2024-01-03" + #define STRING_DISTRIBUTION_DATE "2024-01-04" #endif /** From 54b7da18cbbbed49fee93f0f39b7093c527c25ea Mon Sep 17 00:00:00 2001 From: Taylor Talkington Date: Wed, 3 Jan 2024 21:45:50 -0500 Subject: [PATCH 72/73] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Bed=20PID=20Autotune?= =?UTF-8?q?=20output=20(#26606)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25928 --- Marlin/src/module/temperature.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 5b4dcc83bc74..3f55dde598f5 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -849,9 +849,9 @@ volatile bool Temperature::raw_temps_ready = false; #if ANY(PIDTEMPBED, PIDTEMPCHAMBER) FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR)); - say_default_(); SERIAL_ECHO(estring, F("Kp "), tune_pid.p); - say_default_(); SERIAL_ECHO(estring, F("Ki "), tune_pid.i); - say_default_(); SERIAL_ECHO(estring, F("Kd "), tune_pid.d); + say_default_(); SERIAL_ECHOLN(estring, F("Kp "), tune_pid.p); + say_default_(); SERIAL_ECHOLN(estring, F("Ki "), tune_pid.i); + say_default_(); SERIAL_ECHOLN(estring, F("Kd "), tune_pid.d); #else say_default_(); SERIAL_ECHOLNPGM("Kp ", tune_pid.p); say_default_(); SERIAL_ECHOLNPGM("Ki ", tune_pid.i); From 991f433ac1375cca0b8fcd76fcbacbe43b307ac3 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Wed, 3 Jan 2024 19:14:17 -0800 Subject: [PATCH 73/73] =?UTF-8?q?=F0=9F=90=9B=20Fix=20hangs=20in=20DUE=20n?= =?UTF-8?q?ative=20USB=20(#26572)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/HAL/DUE/usb/README.md | 29 ++++++++ Marlin/src/HAL/DUE/usb/uotghs_device_due.c | 79 +++++++++++++++++++--- buildroot/tests/DUE_archim | 1 + 3 files changed, 100 insertions(+), 9 deletions(-) create mode 100644 Marlin/src/HAL/DUE/usb/README.md diff --git a/Marlin/src/HAL/DUE/usb/README.md b/Marlin/src/HAL/DUE/usb/README.md new file mode 100644 index 000000000000..2548135aca07 --- /dev/null +++ b/Marlin/src/HAL/DUE/usb/README.md @@ -0,0 +1,29 @@ +# USB Files Source Documentation + +## Source + +We sourced the USB files in Marlin from the Atmel ASF (Advanced Software Framework). The framework provides a variety of examples which were utilized in this project. + +Atmel doesn't provide these files in a source repository but they can be extracted from ASF, which can be downloaded from Atmel. + +[Advanced Software Framework](https://www.microchip.com/en-us/tools-resources/develop/libraries/advanced-software-framework) + +## Modifications + +The files are mostly unmodified except for minor cosmetic changes but some more significant changes were needed. + +The changes that prompted the addition of this README file are listed below. Other changes may have been made prior to this. + +1. Modified `uotghs_device_due.c` to resolve race conditions that could leave interrupts asserted when freezing the peripheral clock, resulting in hangs and watchdog resets due to the ensuing interrupt storm. + +## Version Information + +We don't know the exact version of ASF used as the source. However, the copyright information in the files indicates they are from 2015. + +## Upgrade Considerations + +We looked at the ASF 3.52.0 files released in 2022 but saw no immediate benefits to justify an upgrade. It's important to note that the files in Marlin don't follow the same folder structure as the files in ASF, which complicates the process of comparing and applying updated files. + +When these files are updated it's important to carefully compare them to Marlin's versions so any improvements in the Marlin sources are brought forward. + +It would be best to make Marlin's directory structure align with ASF or at least document the source of each file to ease future updates. diff --git a/Marlin/src/HAL/DUE/usb/uotghs_device_due.c b/Marlin/src/HAL/DUE/usb/uotghs_device_due.c index c7e8f8d99135..5a988b7421d1 100644 --- a/Marlin/src/HAL/DUE/usb/uotghs_device_due.c +++ b/Marlin/src/HAL/DUE/usb/uotghs_device_due.c @@ -116,6 +116,23 @@ //#define dbg_print printf #define dbg_print(...) +// Marlin modification: Redefine the otg_freeze_clock and otg_unfreeze_clock macros +// to add memory barriers to ensure that any accesses to USB registers aren't re-ordered +// to occur while the clock is frozen. +#undef otg_freeze_clock +#undef otg_unfreeze_clock + +#define otg_freeze_clock() do { \ + __DSB(); \ + Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_FRZCLK); \ +} while (0) + +#define otg_unfreeze_clock() \ +do { \ + Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_FRZCLK); \ + __DSB(); \ +} while (0) + /** * \ingroup udd_group * \defgroup udd_udphs_group USB On-The-Go High-Speed Port for device mode (UOTGHS) @@ -611,6 +628,18 @@ ISR(UDD_USB_INT_FUN) // The wakeup interrupt is automatic acked when a suspend occur udd_disable_wake_up_interrupt(); udd_enable_suspend_interrupt(); + + // Marlin modification: The RESET, SOF, and MSOF interrupts were previously + // enabled in udd_attach, which caused a race condition where they could + // be raised and unclearable with the clock is frozen. They are now + // enabled here, after the clock has been unfrozen in response to the wake + // interrupt. + udd_enable_reset_interrupt(); + udd_enable_sof_interrupt(); +#ifdef USB_DEVICE_HS_SUPPORT + udd_enable_msof_interrupt(); +#endif + udd_sleep_mode(true); // Enter in IDLE mode #ifdef UDC_RESUME_EVENT UDC_RESUME_EVENT(); @@ -776,6 +805,27 @@ void udd_disable(void) cpu_irq_restore(flags); } +// Marlin modification: The original implementation did not use a memory +// barrier between disabling and clearing interrupts. This sometimes +// allowed interrupts to remain raised and unclearable after the clock +// was frozen. This helper was added to ensure that memory barriers +// are used consistently from all places where interrupts are disabled. +static void disable_and_ack_sync_interrupts() +{ + // Disable USB line events + udd_disable_reset_interrupt(); + udd_disable_sof_interrupt(); +#ifdef USB_DEVICE_HS_SUPPORT + udd_disable_msof_interrupt(); +#endif + __DSB(); + udd_ack_reset(); + udd_ack_sof(); +#ifdef USB_DEVICE_HS_SUPPORT + udd_ack_msof(); +#endif + __DSB(); +} void udd_attach(void) { @@ -796,17 +846,16 @@ void udd_attach(void) udd_attach_device(); // Enable USB line events - udd_enable_reset_interrupt(); udd_enable_suspend_interrupt(); udd_enable_wake_up_interrupt(); - udd_enable_sof_interrupt(); -#ifdef USB_DEVICE_HS_SUPPORT - udd_enable_msof_interrupt(); -#endif - // Reset following interrupts flag - udd_ack_reset(); - udd_ack_sof(); - udd_ack_msof(); + + // Marlin modification: The RESET, SOF, and MSOF interrupts were previously + // enabled here, which caused a race condition where they could be raised + // and unclearable with the clock is frozen. They are now enabled in the + // wake interrupt handler, after the clock has been unfrozen. They are now + // explicitly disabled here to ensure that they cannot be raised before + // the clock is frozen. + disable_and_ack_sync_interrupts(); // The first suspend interrupt must be forced // The first suspend interrupt is not detected else raise it @@ -824,6 +873,12 @@ void udd_detach(void) // Detach device from the bus udd_detach_device(); + + // Marlin modification: Added the explicit disabling of the RESET, SOF, and + // MSOF interrupts here, to ensure that they cannot be raised after the + // clock is frozen. + disable_and_ack_sync_interrupts(); + otg_freeze_clock(); udd_sleep_mode(false); } @@ -2043,6 +2098,12 @@ static bool udd_ep_interrupt(void) dbg_print("I "); udd_disable_in_send_interrupt(ep); // One bank is free then send a ZLP + + // Marlin modification: Add a barrier to ensure in_send is disabled + // before it is cleared. This was not an observed problem, but + // other interrupts were seen to misbehave without this barrier. + __DSB(); + udd_ack_in_send(ep); udd_ack_fifocon(ep); udd_ep_finish_job(ptr_job, false, ep); diff --git a/buildroot/tests/DUE_archim b/buildroot/tests/DUE_archim index f1711a8f3d70..8f9e6cbb81c7 100755 --- a/buildroot/tests/DUE_archim +++ b/buildroot/tests/DUE_archim @@ -16,6 +16,7 @@ exec_test $1 $2 "Archim 1 base configuration" "$3" # Test Archim 2 # use_example_configs UltiMachine/Archim2 +opt_enable USB_FLASH_DRIVE_SUPPORT exec_test $1 $2 "Archim 2 base configuration" "$3" restore_configs