自分の3Dプリンタに合わせMarlinの設定ファイルを変更してビルドする方法

タイトル

3Dプリンター用ファームウエア Marlin のビルドをします。Marlinをビルドするには使う3Dプリンタのハードウエアに合わせてコンフィギュレーションファイルを設定しなくてはなりません。
私が使っているTronxy XY-2 Pro TITANを例にMarlinの設定とビルド手順を紹介します。

3Dプリンタのファームウエアは3Dプリンタの動きを制御するプログラムです。モーターを動かす、ヒーターを加熱する、SDメモリーカードからファイルを読む、USB端子でシリアル通信をする、GCODEファイルを読み取ってモーターやヒーターを動かす などを行います。ファームウエアがなければ3Dプリンタは全く動きません。

3Dプリンタにはメーカー独自のファームウエアが搭載されているでしょう。メーカー独自の機能もファームウエアで実現されています。しかし、マイナーな機種だと使い方が分からなかったり、検索した方法が使えなかったりと困ることもあります。検索して何も情報が見つからない事もあります。
こんな時はファームウエアのデファクトスタンダードと言えるMarlinファームウエアに書き換えてしまうと良いでしょう。ネットで検索して見つかる設定はほぼMarlinファームウエアのものです。

ファームウエアは3Dプリンタを動かす脳みそです。脳みそは自分の体が犬なのか猫なのか蛇なのか蝉なのかミミズなのかを知りません。それはあなたが教えてあげなくてはなりません。犬だと思いこんでいる脳みそを蛇に入れてはいけません。
ファームウエアの書き換えに失敗すると3Dプリンタはまったく動かなくなります。正しい設定をしていないファームウエアを入れてしまうと3Dプリンタが予期しない動作をして怪我や事故を起こします。ヒーターが暴走すれば火災の危険もあります。
ここでは3Dプリンタのファームウエアの書き換え方法は紹介しません。自分が使う3Dプリンタ用にファームウエアを設定してビルドする方法だけ紹介します。
ファームウエアの書き換えはESP32などの組み込みマイコンボードで遊んで、ファームウエアを変えるとは何か?を理解してから挑戦しましょう。

ビルド環境

エディタはVisual Studio Codeを使います。
Visual Studio Code
VS Codeの拡張機能でMarlinをビルドする開発環境をインストールします。
拡張機能で"PlatformIO"を検索します。
PlatformIO

Marlinファームウエア

Marlinのホームページ
Marlin Firmware
ソースコード
Marlin 3D Printer Firmware
MarlinFirmware/Marlin
GitHubのRelesesから最新のMarlinソースコードをダウンロードします。ドキュメントフォルダなどにソースコードを展開します。
PlatformIOで展開したMarlinフォルダをプロジェクトとして開きます。

Marlinの設定

MarlinはC++で書かれています。
多くの3Dプリンタのハードウエアに対応するためにいろいろなプログラムを使うようになっています。あらゆるプリンタのプログラムを入れてしまうとプログラムがとても巨大になってしまいます。3Dプリンタのメモリーは1Mバイトも無いので入り切りません。そのため使う3Dプリンタが持っている機能だけ動かすプログラムだけにしてプログラムのサイズを最小にします。そのための設定ファイルを用意します。

Marlinの設定ファイルで設定する内容は、使う3Dプリンタの駆動形式、持っている機能の有効化、3Dプリンタに載っているICの種類、モーターの回転方向とヘッドの移動方向の対応、センサーの種類など、3Dプリンターのハードウエアに何を使っているかです。
多くの種類のハードウエアに対応しています。
大変そうに思えますが変更する設定ファイルは次の2つだけです。
configuration.h
configuration_adv.h
Marlinフォルダにあります。

configurationファイルの例

configurationファイルを設定するには3Dプリンタの回路やメカにどんな部品が使われているか正確に知らなくてはなりません。難しそうですね。
ですが業務用3Dプリンタ以外の3Dプリンタはメーカーが異なっていてもほとんどオープンソースハードウエアです。概ね使う部品もメカ構成も同じで異なっていても数種類しかありません。特殊な部品を使って情報が少ないとユーザーが離れて行ってしまうからです。Marlinプロジェクトでは精力的に新しい部品への対応をしているようです。
メジャーな3DプリンタならばMarlinのリポジトリにconfigurationファイルの例があります。
MarlinFirmware/Configurations
Pre-tested Configurations for Marlin Firmware.
config/examples/ にメーカー毎のサンプルがあります。最新機種は無いでしょう。
説明のリンクからダウンロードするか、リリースブランチを選択した後にダウンロードします。Marlinのバージョンに合わせるのを忘れずに。

私が使っているTronxyのディレクトリはありますがXY-2 Proのconfigurationファイルはありませんでした。
この記事公開時ごろのTronxyの機種ならばrhapsodyv氏がconfigurationファイルを公開してくれています。rhapsodyv氏 ありがとう!
rhapsodyv/Marlin
このconfigurationファイルでは XY-2 PRO、XY-3やX5SAなどの機種設定がコメント1行外すだけでできます。同じ機種でもロットにより使っている部品が違ったりするので少し調べる必要はあります。

最新のconfigurationファイルに合わせる

rhapsodyv氏のconfigurationファイルは少し古いバージョンのconfigurationファイルが元となっています。Marlinのバージョンが上がればconfigurationファイルも変更されて行きます。パラメーターが増えたりパラメーター名が変わったりします。まだ最新バージョンでも使えますが今後の事を考えてMarlinに添付されているconfigurationファイルを使って動くようにしてみます。
diffを使って変更しているパラメーターを抽出して最新版のconfigurationファイルを書き換えます。

結論:この記事公開時での私が使っているTRONXY TITAN用 Marlin 2.0.9.3 のconfiguration.hとconfiguration_adv.hファイルの変更点はこれです。
diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index a445720..725eca4 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -96,7 +96,7 @@
// Choose the name from boards.h that matches your setup
#ifndef MOTHERBOARD
-#define MOTHERBOARD BOARD_RAMPS_14_EFB
+#define MOTHERBOARD BOARD_CHITU3D_V6
#endif
/**
@@ -107,7 +107,7 @@
*
* :[-1, 0, 1, 2, 3, 4, 5, 6, 7]
*/
-#define SERIAL_PORT 0
+#define SERIAL_PORT 1
/**
* Serial Port Baud Rate
@@ -143,7 +143,7 @@
//#define BLUETOOTH
// Name displayed in the LCD "Ready" message and Info menu
-//#define CUSTOM_MACHINE_NAME "3D Printer"
+#define CUSTOM_MACHINE_NAME "Tronxy XY-2 PRO TITAN"
// Printer's unique ID, used by some programs to differentiate between machines.
// Choose your own or use a service like https://www.uuidgenerator.net/version4
@@ -512,7 +512,7 @@
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_6 0
#define TEMP_SENSOR_7 0
-#define TEMP_SENSOR_BED 0
+#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_PROBE 0
#define TEMP_SENSOR_CHAMBER 0
#define TEMP_SENSOR_COOLER 0
@@ -627,9 +627,9 @@
114.00, 114.00 \
}
#else
-#define DEFAULT_Kp 22.20
-#define DEFAULT_Ki 1.08
-#define DEFAULT_Kd 114.00
+#define DEFAULT_Kp 15.87
+#define DEFAULT_Ki 0.84
+#define DEFAULT_Kd 74.77
#endif
#endif // PIDTEMP
@@ -668,9 +668,9 @@
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
-#define DEFAULT_bedKp 10.00
-#define DEFAULT_bedKi .023
-#define DEFAULT_bedKd 305.4
+#define DEFAULT_bedKp 212.69
+#define DEFAULT_bedKi 35.14
+#define DEFAULT_bedKd 858.35
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED
@@ -818,7 +818,7 @@
//#define USE_KMAX_PLUG
// Enable pullup for all endstops to prevent a floating state
-#define ENDSTOPPULLUPS
+//#define ENDSTOPPULLUPS
#if DISABLED(ENDSTOPPULLUPS)
// Disable ENDSTOPPULLUPS to set pullups individually
//#define ENDSTOPPULLUP_XMIN
@@ -856,19 +856,19 @@
#endif
// Mechanical endstop with COM to ground and NC to Signal uses "false" here (most common setup).
-#define X_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define Y_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define Z_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define I_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define J_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define K_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define I_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define J_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define K_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
-#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
+#define X_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
+#define Y_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
+#define Z_MIN_ENDSTOP_INVERTING true // Set to true to invert the logic of the endstop.
+#define I_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define J_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define K_MIN_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define X_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define Y_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define Z_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define I_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define J_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define K_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
+#define Z_MIN_PROBE_ENDSTOP_INVERTING true // Set to true to invert the logic of the probe.
/**
* Stepper Drivers
@@ -888,9 +888,9 @@
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
*/
-#define X_DRIVER_TYPE A4988
-#define Y_DRIVER_TYPE A4988
-#define Z_DRIVER_TYPE A4988
+#define X_DRIVER_TYPE TMC2208_STANDALONE
+#define Y_DRIVER_TYPE TMC2208_STANDALONE
+#define Z_DRIVER_TYPE TMC2208_STANDALONE
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
@@ -899,7 +899,7 @@
//#define I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_DRIVER_TYPE A4988
-#define E0_DRIVER_TYPE A4988
+#define E0_DRIVER_TYPE TMC2208_STANDALONE
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
@@ -956,7 +956,7 @@
*/
#define DEFAULT_AXIS_STEPS_PER_UNIT \
{ \
- 80, 80, 400, 500 \
+ 160, 160, 800, 764 \
}
/**
@@ -985,7 +985,7 @@
*/
#define DEFAULT_MAX_ACCELERATION \
{ \
- 3000, 3000, 100, 10000 \
+ 8000, 8000, 100, 5000 \
}
//#define LIMITED_MAX_ACCEL_EDITING // Limit edit via M201 or LCD to DEFAULT_MAX_ACCELERATION * 2
@@ -1004,7 +1004,7 @@
* M204 R Retract Acceleration
* M204 T Travel Acceleration
*/
-#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E acceleration for printing moves
+#define DEFAULT_ACCELERATION 6000 // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
@@ -1036,7 +1036,7 @@
#endif
#endif
-#define DEFAULT_EJERK 5.0 // May be used by Linear Advance
+#define DEFAULT_EJERK 15.0 // May be used by Linear Advance
/**
* Junction Deviation Factor
@@ -1115,7 +1115,7 @@
* A Fix-Mounted Probe either doesn't deploy or needs manual deployment.
* (e.g., an inductive probe or a nozzle-based probe-switch.)
*/
-//#define FIX_MOUNTED_PROBE
+#define FIX_MOUNTED_PROBE
/**
* Use the nozzle as the probe, as with a conductive
@@ -1226,12 +1226,12 @@
*/
#define NOZZLE_TO_PROBE_OFFSET \
{ \
- 10, 10, 0 \
+ -35, -10, 0 \
}
// Most probes should stay away from the edges of the bed, but
// with NOZZLE_AS_PROBE this can be negative for a wider probing area.
-#define PROBING_MARGIN 10
+#define PROBING_MARGIN 20
// X and Y axis travel speed (mm/min) between probes
#define XY_PROBE_FEEDRATE (133 * 60)
@@ -1316,7 +1316,7 @@
#define Z_PROBE_OFFSET_RANGE_MAX 20
// Enable the M48 repeatability test to test probe accuracy
-//#define Z_MIN_PROBE_REPEATABILITY_TEST
+#define Z_MIN_PROBE_REPEATABILITY_TEST
// Before deploy/stow pause for user confirmation
//#define PAUSE_BEFORE_DEPLOY_STOW
@@ -1379,8 +1379,8 @@
// Invert the stepper direction. Change (or reverse the motor connector) if an axis goes the wrong way.
#define INVERT_X_DIR false
-#define INVERT_Y_DIR true
-#define INVERT_Z_DIR false
+#define INVERT_Y_DIR false
+#define INVERT_Z_DIR true
//#define INVERT_I_DIR false
//#define INVERT_J_DIR false
//#define INVERT_K_DIR false
@@ -1388,7 +1388,7 @@
// @section extruder
// For direct drive extruder v9 set to true, for geared extruder set to false.
-#define INVERT_E0_DIR false
+#define INVERT_E0_DIR true
#define INVERT_E1_DIR false
#define INVERT_E2_DIR false
#define INVERT_E3_DIR false
@@ -1409,8 +1409,8 @@
*/
//#define Z_IDLE_HEIGHT Z_HOME_POS
-//#define Z_HOMING_HEIGHT 4 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
-// Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.
+#define Z_HOMING_HEIGHT 10 // (mm) Minimal Z height before homing (G28) for Z clearance above the bed, clamps, ...
+ // Be sure to have this much clearance over your Z_MAX_POS to prevent grinding.
//#define Z_AFTER_HOMING 10 // (mm) Height to move to after homing Z
@@ -1426,8 +1426,8 @@
// @section machine
// The size of the printable area
-#define X_BED_SIZE 200
-#define Y_BED_SIZE 200
+#define X_BED_SIZE 255
+#define Y_BED_SIZE 255
// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS 0
@@ -1435,7 +1435,7 @@
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
-#define Z_MAX_POS 200
+#define Z_MAX_POS 245
//#define I_MIN_POS 0
//#define I_MAX_POS 50
//#define J_MIN_POS 0
@@ -1491,14 +1491,14 @@
* RAMPS-based boards use SERVO3_PIN for the first runout sensor.
* For other boards you may need to define FIL_RUNOUT_PIN, FIL_RUNOUT2_PIN, etc.
*/
-//#define FILAMENT_RUNOUT_SENSOR
+#define FILAMENT_RUNOUT_SENSOR
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define FIL_RUNOUT_ENABLED_DEFAULT true // Enable the sensor on startup. Override with M412 followed by M500.
#define NUM_RUNOUT_SENSORS 1 // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
-#define FIL_RUNOUT_STATE LOW // Pin state indicating that filament is NOT present.
-#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
-//#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
+#define FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.
+//#define FIL_RUNOUT_PULLUP // Use internal pullup for filament runout pins.
+#define FIL_RUNOUT_PULLDOWN // Use internal pulldown for filament runout pins.
//#define WATCH_ALL_RUNOUT_SENSORS // Execute runout script on any triggering sensor, not only for the active extruder.
// This is automatically enabled for MIXING_EXTRUDERs.
@@ -1538,7 +1538,7 @@
// Commands to execute on filament runout.
// With multiple runout sensors use the %c placeholder for the current tool in commands (e.g., "M600 T%c")
// NOTE: After 'M412 H1' the host handles filament runout and this script does not apply.
-#define FILAMENT_RUNOUT_SCRIPT "M600"
+#define FILAMENT_RUNOUT_SCRIPT "M25"
// After a runout is detected, continue printing this length of filament
// before executing the runout script. Useful for a sensor at the end of
@@ -1593,7 +1593,7 @@
*/
//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
-//#define AUTO_BED_LEVELING_BILINEAR
+#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING
@@ -1602,7 +1602,7 @@
* these options to restore the prior leveling state or to always enable
* leveling immediately after G28.
*/
-//#define RESTORE_LEVELING_AFTER_G28
+#define RESTORE_LEVELING_AFTER_G28
//#define ENABLE_LEVELING_AFTER_G28
/**
@@ -1660,7 +1660,7 @@
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
// Set the number of grid points per dimension.
-#define GRID_MAX_POINTS_X 3
+#define GRID_MAX_POINTS_X 5
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
// Probe along the Y axis, advancing X after each column
@@ -1670,7 +1670,7 @@
// Beyond the probed grid, continue the implied tilt?
// Default is to maintain the height of the nearest edge.
-//#define EXTRAPOLATE_BEYOND_GRID
+#define EXTRAPOLATE_BEYOND_GRID
//
// Experimental Subdivision of the grid by Catmull-Rom method.
@@ -1800,7 +1800,7 @@
* - Allows Z homing only when XY positions are known and trusted.
* - If stepper drivers sleep, XY homing may be required again before Z homing.
*/
-//#define Z_SAFE_HOMING
+#define Z_SAFE_HOMING
#if ENABLED(Z_SAFE_HOMING)
#define Z_SAFE_HOMING_X_POINT X_CENTER // X point for Z homing
@@ -1810,7 +1810,7 @@
// Homing speeds (mm/min)
#define HOMING_FEEDRATE_MM_M \
{ \
- (50 * 60), (50 * 60), (4 * 60) \
+ (35 * 60), (35 * 60), (4 * 60) \
}
// Validate that endstops are triggered on homing moves
@@ -1888,12 +1888,12 @@
* M501 - Read settings from EEPROM. (i.e., Throw away unsaved changes)
* M502 - Revert settings to "factory" defaults. (Follow with M500 to init the EEPROM.)
*/
-//#define EEPROM_SETTINGS // Persistent storage with M500 and M501
+#define EEPROM_SETTINGS // Persistent storage with M500 and M501
//#define DISABLE_M503 // Saves ~2700 bytes of PROGMEM. Disable for release!
#define EEPROM_CHITCHAT // Give feedback on EEPROM commands. Disable to save PROGMEM.
#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.
+#define EEPROM_AUTO_INIT // Init EEPROM automatically on any errors.
//#define EEPROM_INIT_NOW // Init EEPROM on first boot after a new build.
#endif
@@ -1924,13 +1924,13 @@
//
#define PREHEAT_1_LABEL "PLA"
#define PREHEAT_1_TEMP_HOTEND 180
-#define PREHEAT_1_TEMP_BED 70
+#define PREHEAT_1_TEMP_BED 60
#define PREHEAT_1_TEMP_CHAMBER 35
#define PREHEAT_1_FAN_SPEED 0 // Value from 0 to 255
#define PREHEAT_2_LABEL "ABS"
#define PREHEAT_2_TEMP_HOTEND 240
-#define PREHEAT_2_TEMP_BED 110
+#define PREHEAT_2_TEMP_BED 90
#define PREHEAT_2_TEMP_CHAMBER 35
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255
@@ -1945,7 +1945,7 @@
* P1 Raise the nozzle always to Z-park height.
* P2 Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
*/
-//#define NOZZLE_PARK_FEATURE
+#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
// Specify a park position as { X, Y, Z_raise }
@@ -1997,7 +1997,7 @@
* Caveats: The ending Z should be the same as starting Z.
* Attention: EXPERIMENTAL. G-code arguments may change.
*/
-//#define NOZZLE_CLEAN_FEATURE
+#define NOZZLE_CLEAN_FEATURE
#if ENABLED(NOZZLE_CLEAN_FEATURE)
// Default number of pattern repetitions
@@ -2084,7 +2084,7 @@
*
* View the current statistics with M78.
*/
-//#define PRINTCOUNTER
+#define PRINTCOUNTER
#if ENABLED(PRINTCOUNTER)
#define PRINTCOUNTER_SAVE_INTERVAL 60 // (minutes) EEPROM save interval during print
#endif
@@ -2175,14 +2175,14 @@
* SD Card support is disabled by default. If your controller has an SD slot,
* you must uncomment the following option or it won't work.
*/
-//#define SDSUPPORT
+#define SDSUPPORT
/**
* SD CARD: ENABLE CRC
*
* Use CRC checks and retries on the SD communication.
*/
-//#define SD_CHECK_AND_RETRY
+#define SD_CHECK_AND_RETRY
/**
* LCD Menu Items
@@ -2254,7 +2254,7 @@
// If you have a speaker that can produce tones, enable it here.
// By default Marlin assumes you have a buzzer with a fixed frequency.
//
-//#define SPEAKER
+#define SPEAKER
//
// The duration and frequency for the UI feedback sound.
@@ -2770,7 +2770,7 @@
//
// 480x320, 3.5", FSMC Stock Display from TronxXY
//
-//#define TFT_TRONXY_X5SA
+#define TFT_TRONXY_X5SA
//
// 480x320, 3.5", FSMC Stock Display from AnyCubic
@@ -2808,7 +2808,7 @@
//#define TFT_GENERIC
#if ENABLED(TFT_GENERIC)
// :[ 'AUTO', 'ST7735', 'ST7789', 'ST7796', 'R61505', 'ILI9328', 'ILI9341', 'ILI9488' ]
-#define TFT_DRIVER AUTO
+#define TFT_DRIVER ILI9488
// Interface. Enable one of the following options:
//#define TFT_INTERFACE_FSMC
@@ -2833,7 +2833,7 @@
*/
//#define TFT_CLASSIC_UI
//#define TFT_COLOR_UI
-//#define TFT_LVGL_UI
+#define TFT_LVGL_UI
#if ENABLED(TFT_LVGL_UI)
//#define MKS_WIFI_MODULE // MKS WiFi module
@@ -2865,7 +2865,7 @@
//
// Touch Screen Settings
//
-//#define TOUCH_SCREEN
+#define TOUCH_SCREEN
#if ENABLED(TOUCH_SCREEN)
#define BUTTON_DELAY_EDIT 50 // (ms) Button repeat delay for edit screens
#define BUTTON_DELAY_MENU 250 // (ms) Button repeat delay for menus
@@ -2914,7 +2914,7 @@
// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not as annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE.
-//#define FAN_SOFT_PWM
+#define FAN_SOFT_PWM
// Incrementing this by 1 will double the software PWM frequency,
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index c826a1c..252b8c9 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -506,7 +506,7 @@
* The fan turns on automatically whenever any driver is enabled and turns
* off (or reduces to idle speed) shortly after drivers are turned off.
*/
-//#define USE_CONTROLLER_FAN
+#define USE_CONTROLLER_FAN
#if ENABLED(USE_CONTROLLER_FAN)
//#define CONTROLLER_FAN_PIN -1 // Set a custom pin for the controller fan
//#define CONTROLLER_FAN_USE_Z_ONLY // With this option only the Z axis is considered
@@ -605,7 +605,7 @@
* Multiple extruders can be assigned to the same pin in which case
* the fan will turn on when any selected extruder is above the threshold.
*/
-#define E0_AUTO_FAN_PIN -1
+#define E0_AUTO_FAN_PIN FAN2_PIN
#define E1_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
@@ -2025,12 +2025,12 @@
*
* See https://marlinfw.org/docs/features/lin_advance.html for full instructions.
*/
-//#define LIN_ADVANCE
+#define LIN_ADVANCE
#if ENABLED(LIN_ADVANCE)
//#define EXTRA_LIN_ADVANCE_K // Enable for second linear advance constants
-#define LIN_ADVANCE_K 0.22 // Unit: mm compression per 1mm/s extruder speed
+#define LIN_ADVANCE_K 0 // Unit: mm compression per 1mm/s extruder speed
//#define LA_DEBUG // If enabled, this will generate debug information output over USB.
-//#define EXPERIMENTAL_SCURVE // Enable this option to permit S-Curve Acceleration
+#define EXPERIMENTAL_SCURVE // Enable this option to permit S-Curve Acceleration
//#define ALLOW_LOW_EJERK // Allow a DEFAULT_EJERK value of <10. Recommended for direct drive hotends.
#endif
@@ -2253,8 +2253,8 @@
*
* Override the default value based on the driver type set in Configuration.h.
*/
-//#define MINIMUM_STEPPER_POST_DIR_DELAY 650
-//#define MINIMUM_STEPPER_PRE_DIR_DELAY 650
+#define MINIMUM_STEPPER_POST_DIR_DELAY 20
+#define MINIMUM_STEPPER_PRE_DIR_DELAY 20
/**
* Minimum stepper driver pulse width (in µs)
@@ -2267,7 +2267,7 @@
*
* Override the default value based on the driver type set in Configuration.h.
*/
-//#define MINIMUM_STEPPER_PULSE 2
+#define MINIMUM_STEPPER_PULSE 0
/**
* Maximum stepping rate (in Hz) the stepper driver allows
@@ -2281,7 +2281,7 @@
*
* Override the default value based on the driver type set in Configuration.h.
*/
-//#define MAXIMUM_STEPPER_RATE 250000
+#define MAXIMUM_STEPPER_RATE 5000000
// @section temperature
@@ -2355,7 +2355,7 @@
* Currently handles M108, M112, M410, M876
* NOTE: Not yet implemented for all platforms.
*/
-//#define EMERGENCY_PARSER
+#define EMERGENCY_PARSER
/**
* Realtime Reporting (requires EMERGENCY_PARSER)
@@ -3003,7 +3003,7 @@
#define STEALTHCHOP_I
#define STEALTHCHOP_J
#define STEALTHCHOP_K
-#define STEALTHCHOP_E
+//#define STEALTHCHOP_E
/**
* Optimize spreadCycle chopper parameters by using predefined parameter sets


主要パラメーターだけ説明します。設定する値は3Dプリンタ毎に異なりますが、変更箇所は他の3Dプリンタもだいたい同じです。どんな設定をするのか眺めてみてください。

#define CONFIGURATION_H_VERSION 02000903
以前のバージョンのconfigurationファイルがそのまま使えるとは限りません。バージョンが合わないとコンパイルできないようになっています。Marlinのバージョンを新しくしたら変更点を確認して問題なければバージョン番号を変えます。

#define MOTHERBOARD BOARD_CHITU3D_V6
3Dプリンタが使っている制御ボードを指定します。

#define TEMP_SENSOR_BED 1 
温度センサーが付いていれば1にします。 

//#define ENDSTOPPULLUPS
終端センサーのプルアップ・プルダウンを指定できます。正しく設定していないとヘッド移動が端っこで止まらなくなったりします。時々突然に止まったりあるいは端っこで止まらない時はここを疑いましょう。

#define X_MIN_ENDSTOP_INVERTING true
終端のスイッチの論理反転を設定します。

#define X_DRIVER_TYPE TMC2208_STANDALONE
ステッピングモーターのドライバーICの種類を指定します。制御ボードに載っているドライバICの型番を見て決めます。

#define DEFAULT_AXIS_STEPS_PER_UNIT {160, 160, 800, 764}
ヘッド、ベッド、フィラメントが単位長さ移動するのに必要なステップ数を指定します。これを間違えると移動量が大きくなったり小さくなったりします。

#define FIX_MOUNTED_PROBE
誘導型のZ軸センサーを使う場合はコメントを外し有効にします。

#define NOZZLE_TO_PROBE_OFFSET { -35, -10, 0 }
ノズルからのプローブ位置のオフセット

#define INVERT_X_DIR false
モーターの回転方向と移動方向の整合をとります。

#define X_BED_SIZE 255
#define Y_BED_SIZE 255
#define Z_MAX_POS 245
ベッドサイズと高さの設定です。

#define FILAMENT_RUNOUT_SENSOR
フィラメント切れセンサーがある場合はコメントを外します。
終端センサーと同じくプルアップ プルダウン 論理設定があります。

#define FILAMENT_RUNOUT_SCRIPT "M25"
フィラメント切れを検知した時の動作を指定します。M600ではエラーでビルドできませんでした。

#define AUTO_BED_LEVELING_BILINEAR
自動ベッドレベリングを有効にします。

#define EEPROM_SETTINGS
EEPROMを使えるようにします。

#define SDSUPPORT
SDメモリーカードを使えるようにします。

#define TFT_TRONXY_X5SA
#define TFT_DRIVER ILI9488
TFTディスプレイの種類とドライバーを指定します。

#define TFT_LVGL_UI
UIのデザインを指定します。

#define TOUCH_SCREEN
タッチスクリーンを有効にします。

#define FAN_SOFT_PWM
ファンのPWMコントロールを有効にします。

以下、configuration_adv.hのパラメーター

#define E0_AUTO_FAN_PIN FAN2_PIN
ファンのIOピンを指定します。ファンが回らない時はここらへん。

#define LIN_ADVANCE
リニアアドバンスを有効にします。
XY-2 PROの場合はハードウエアを改造してstealthChopを無効にしないと使えません。エクストルーダーが突然止まるからです。

#define MINIMUM_STEPPER_POST_DIR_DELAY 20
#define MINIMUM_STEPPER_PRE_DIR_DELAY 20
#define MINIMUM_STEPPER_PULSE 0
#define MAXIMUM_STEPPER_RATE 5000000
ステッピングモータードライバーICの種類に合わせ指定された値にします。値はコメントに書かれています。

#define EMERGENCY_PARSER
緊急停止GCODEコマンドを有効にします。

その他、機種によってはCOREXYの設定が必要でしょう。

ビルド

 configurationファイルができたらPlatformIOでビルドします。
PlatformIOにもどんなマイコンボード用の開発をするのか教えなくてはなりません。
platformio.ini ファイルを開きdefault_envsを書き換えます。私のXY-2 PRO TITANの場合は次のように書き換えます。
default_envs = chitu_v5_gpio_init_maple
自前でconfigurationファイルを初めて作ったのならおそらくビルドエラーが出るでしょう。エラーメッセージを良く読んで設定を変えていきます。エラーがどうしても解消できない時はパラメーターを一つ一つ変更してはビルドしてエラーが出るパラメーターを特定しましょう。排他的なパラメーターや一緒に使うパラメーターもあって難しいです。

ビルドに成功するとファームウエアファイルは .PIOフォルダ以下に出来上がっています。

3Dプリンタの型番が同じでもロットによって使っている部品が異なる場合があります。部品が異なればMarlinのconfigurationファイルも変える必要があります。ご自分の3Dプリンタで使われているハードウエアを調べ部品と回路を自分で把握できないのならMarlinへの入れ替えはあきらめましょう。

ビデオ



コメント

  1. 動画ありがとうございます!
    やってみたけどできなかった。エラーが出ます

    返信削除

コメントを投稿

最近のコメント

Threaded Recent Comments will be here.