Marlin——开源固件,3D打印控制系统。本质是一个Gcode代码解释器,接收来自上位机的控制命令或者读取存储卡中的gcode文件。把程序(固件)烧录到主板,这块主板就相当于微型电脑一般,而控制系统就相当于操作系统(这是我以前接触这块的理解)。研究Marlin代码,我觉得最好是有一些电子方面的知识,容易理解(可惜我这方面知识很薄弱,只是略懂皮毛)。
控制系统,顾名思义,主要是用于控制主板各种行为。
1.驱动控制板;
2.执行队列中的命令;
3.控制步进电机;
4.温度控制和侦测(挤出头和热床的温度);
5.读写SD卡;
6.控制显示屏(LCD或触摸屏)
Configuration.h:主要是一些定义,如波特率,打印行程, 限位开关,PID等。ultralcd.h和ultralcd.cpp:显示屏界面。watchdog.h和watchdog.cpp:看门狗。
Marlin_main.cpp:setup()函数用于初始化工作。
/*
* Marlin entry-point: Set up before the program loop
* - Set up the kill pin, filament runout, power hold
* - Start the serial port
* - Print startup messages and diagnostics
* - Get EEPROM or default settings
* - Initialize managers for:
* temperature
* planner
* watchdog
* stepper
* photo pin
* servos
* LCD controller
* Digipot I2C
* Z probe sled
* status LEDs
*/
loop()函数:重复执行。
/**
* The main Marlin program loop
*
* - Save or log commands to SD
* - Process available commands (if not saving)
* - Call heater manager
* - Call inactivity manager
* - Call endstop manager
* - Call LCD update
*/
相关指令:
/* "G" Codes
*
* G0 -> G1
* G1 - Coordinated Movement X Y Z E
* G2 - CW ARC
* G3 - CCW ARC
* G4 - Dwell S<seconds> or P<milliseconds>
* G5 - Cubic B-spline with XYZE destination and IJPQ offsets
* G10 - Retract filament according to settings of M207
* G11 - Retract recover filament according to settings of M208
* G12 - Clean tool
* G20 - Set input units to inches
* G21 - Set input units to millimeters
* G28 - Home one or more axes
* G29 - Detailed Z probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
* G30 - Single Z probe, probes bed at X Y location (defaults to current XY location)
* G31 - Dock sled (Z_PROBE_SLED only)
* G32 - Undock sled (Z_PROBE_SLED only)
* G38 - Probe target - similar to G28 except it uses the Z_MIN endstop for all three axes
* G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates
* G92 - Set current position to coordinates given
*
* "M" Codes
*
* M0 - Unconditional stop - Wait for user to press a button on the LCD (Only i

Marlin是一款开源3D打印控制系统固件,支持多种3D打印机。其核心功能包括驱动控制板、执行Gcode命令、控制步进电机及温度等。Marlin通过一系列配置文件和源代码实现对3D打印机的精确控制。
最低0.47元/天 解锁文章
2290

被折叠的 条评论
为什么被折叠?



