|
本帖最后由 1五湖四海1 于 2016-8-21 00:09 編輯 ) V9 }. m4 Q' ^3 I" d# j
# ^0 ?) |, X- R7 |9 o
以前制作過CNC雕刻機,是用MACH3作為上位機控制,硬件是采用PC接并口輸出脈沖和方向使能信號經過隔離驅動步進電機驅動器,步進電機驅動是采用TB6560芯片控制。最后就接到步進電機。機械是用鋁合金制作,主要部件有三個1605的滾珠絲杠,多個運動滑塊等制作。用這臺DIY CNC雕刻機可以雕刻木頭塑料等東西。當時沒有一直玩下去,現在發現網上有用單片機制作的雕刻機挺精巧的現在分享給大家。
2 \6 v) E, A4 p3 |5 q8 J) D" m GRBL CNC 3D打印機,這就是我說的可以用單片機來控制的3D打印機,我先照著百度科普下grbl,Grbl是性能高,成本低,基于并口運動控制,用于CNC雕刻。它可以運行在Vanilla Arduino (Duemillanove/Uno) 只要它配備了Atmega 328型芯片。 控制器由C編寫并優化,利用了AVR 芯片的每一個靈巧特性來實現精確時序和異步控制。它可以保持超過30kHz的穩定、無偏差的控制脈沖 它接受標準的G代碼而且通過了數個CAM工具的輸出測試。弧形、圓形和螺旋的運動都可以像其他一些基本G代碼命令一樣完美支持。函數和變量目前并不支持,但是會作為預處理器包含在將來發布的版本之中。 Grbl 包含完整的前瞻性加速度控制。它意味著控制器將提前16到20個運動來規劃運行速度,以實現平穩的加速和無沖擊的轉彎。Grbl是性能高,成本低,基于并口運動控制,用于CNC雕刻。它可以運行在Vanilla Arduino (Duemillanove/Uno) 只要它配備了Atmega 328型芯片。 控制器由C編寫并優化,利用了AVR 芯片的每一個靈巧特性來實現精確時序和異步控制。它可以保持超過30kHz的穩定、無偏差的控制脈沖 它接受標準的G代碼而且通過了數個CAM工具的輸出測試。弧形、圓形和螺旋的運動都可以像其他一些基本G代碼命令一樣完美支持。函數和變量目前并不支持,但是會作為預處理器包含在將來發布的版本之中。 Grbl 包含完整的前瞻性加速度控制。它意味著控制器將提前16到20個運動來規劃運行速度,以實現平穩的加速和無沖擊的轉彎。很棒吧!開始玩起。![]()
" u4 n5 q$ P0 F. w8 G* s% l 還沒有雕刻機的機械部分可以用廢舊光驅制作個微型雕刻機運動平臺。雕刻機最重要的是主控程序這次用 Arduino/AVR328單片機,價格在15元左右,主控程序是上面提到的目前很火的開源的GRBL,還有一種基于STM32平臺的開源主控程序Dlion也不錯可以替代grbl。如果從性能比較這兩個方案,顯然是stm32平臺運行速度更快畢竟他是32單片機呀! u; O2 A; ^! m; Q6 z+ ^
' k; G7 C% S% Y' p4 z4 M% M2 u- @& m% M" K, y5 U1 M
下面介紹小這個些主控程序主要干的事,通過串口PC和主控板通訊,PC命令給控制板,控制板接收命令做不同的響應,PC可以發G代碼給主控板,接收完成后可以自動開始雕刻任務。
! o- U1 b; U6 X6 E; }5 z 在介紹下G代碼因為G代碼是雕刻機的核心部分
+ |3 I/ i& I( n, u6 tG代碼是數控程序中的指令。一般都稱為G指令。5 c0 e5 {) R+ x- W
G00------快速定位
7 _) A) X4 l& u& _! U& R4 YG01------直線插補9 F9 J8 _, O/ @+ f8 c
G02------順時針方向圓弧插補
5 _9 T# {; N& I* y! I- uG03------逆時針方向圓弧插補8 m! Z6 \# N$ l* W5 r
G04------定時暫停
+ @0 o7 f7 h9 U: Q4 T/ q* K' eG05------通過中間點圓弧插補) ~: s, h/ P, e; x" |2 B
G06------拋物線插補
* M1 y* A4 _; f3 ^" s; \" r3 `G07------Z 樣條曲線插補+ y* N4 Y% `( O. h( [5 G- S- i
G08------進給加速
$ S- m& R, b+ @) hG09------進給減速& k5 B* Y2 l3 M6 f$ f
G10------數據設置# m; h c) `3 e8 n* {; i/ H
G16------極坐標編程2 t6 A, {5 x( E: F
G17------加工XY平面% q5 _; C5 p1 @& x' Y" d
G18------加工XZ平面
& w2 V8 O% r6 _; yG19------加工YZ平面
6 y3 B3 o" E6 c: H9 }( u核心就是解析G代碼,完成步進電機驅動,和控制主軸開啟關閉,還有插補算法,直線插補,圓弧插補,還有一些步進電機的加減速算法。
3 v- I2 h4 |7 W下面對grbl主結構做介紹
6 q% Q, L( C- x& Smain()主函數首先執行下面初始化函數2 a$ |' X ^0 }- T
serial_init(); // 設置串口波特率和中斷
# H# W! v% M' S5 x/ K0 y settings_init(); // 從ROM加載grbl設置
7 x p1 g& s- D2 ~. J. t; [ stepper_init(); // 配置步進方向和中斷定時器# k+ k/ J! g. l N* z
system_init(); // 配置引腳分配別針和pin-change中斷
o# w3 S5 D! H+ {3 d6 E memset(&sys, 0, sizeof(system_t)); // 清除所有系統變量
3 Z5 m, Z+ g; V9 m l( R8 s' I, i0 o9 s sys.abort = true; // 中止標識位置位6 x& |1 V4 k2 o, v1 m
sei(); // 使能中斷+ h5 W5 s& F: z) J1 M, V; Y) m# \3 v
#ifdef HOMING_INIT_LOCK // 宏運算(settings.flags & (1 << 4)) != 0結果flags等于執行sys.state = STATE_ALARM( w/ P4 T# {8 V6 R$ t* p- K
// 系統狀態賦值為報警狀態
' c0 m5 l# O) W& f1 H if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }5 A4 F# V5 d5 S# k) _
#endif
5 E3 }- U" K4 ~5 n+ c_____________________________________________________________________________________________________________________________________. m4 L' v3 x6 [- F% [* p9 R
接下來是一些主要部分初始化
! r1 a' ?# K( y' G! t/ H& ^for(;;) {
0 B6 b% h$ W. I6 r serial_reset_read_buffer(); //清除串口讀緩沖區
0 {/ V4 u& k% ~) z0 N* b M9 a% U gc_init(); //初始化G代碼功能函數% I8 I; @* P; A' ?2 A
spindle_init(); //主軸初始化! q: a1 Z6 E4 T% F% x& ]- P/ Z
coolant_init(); //冷卻液初始化
- c) B9 f4 q5 D$ [4 z limits_init(); //極限開關初始化5 ?; K* Z! R( @; m1 |
probe_init(); //探測部件初始化
- J5 y, ~' \+ |& U7 J4 `* w" r! x* @ plan_reset(); //清除塊緩沖區和規劃師變量
& N. }5 b+ d6 F3 D& |' h# _1 ^ st_reset(); //清除步進系統變量。
+ u, h8 h- G) C6 V
- l9 x6 L) q* W" g2 I1 w3 b* U7 i5 L5 b M4 {3 v
//下面兩行清除同步gcode和策劃師職位當前系統位置。% C5 x6 _/ g+ [0 }9 A+ W( t
plan_sync_position();
$ C4 X5 P' B- C8 d1 F% A9 D gc_sync_position();" ]/ @3 A7 k [$ r! n7 k
5 X, l2 m5 c6 a; c( Y1 Y
! N" J) Q0 \6 P$ ^ //復位系統變量
8 k- F6 \# d1 @# C C0 I sys.abort = false; //系統中止標志) Q$ n/ {/ x" x% i. I% ^1 O
sys_rt_exec_state = 0; //系統標志位變量狀態管理。看到EXEC位掩碼。
" I7 o4 w6 k: _* |# {, q+ K3 j C sys_rt_exec_alarm = 0; //系統標志位變量設置不同的警報。. M) ^- e Q; k5 g$ i: d- _* i `
sys.suspend = false; //系統暫停標志位變量管理,取消,和安全保護。
0 g6 Q7 k4 l4 X8 N sys.soft_limit = false; //限位開關限制狀態機錯誤。(布爾)3 f$ Q# D, S7 G6 d I6 z Q+ j
2 F, N4 Q7 k+ R$ h9 ^2 P% T8 n: d! C+ b6 I' Q: i0 C
protocol_main_loop(); //主協議循環# ]/ f& d% D" U4 s) o- p
} //& o7 X: p. u4 ?4 V3 Q
_____________________________________________________________________________________________________________________________+ ~/ i$ U( w9 Y; v' Z# R8 ~
進入void protocol_main_loop()函數
5 k0 v0 s% A5 |2 }+ I8 m1 G{
8 |, P7 K& C; N7 t- X. Z report_init_message(); // 打印歡迎信息
5 n% `) Q9 p4 P( U0 V5 E //重啟后檢驗和報告報警狀態如果錯誤重啟初始化。9 ?2 F5 f: N8 \
if (sys.state == STATE_ALARM) {2 L" d& ]4 P; u2 }4 `
report_feedback_message(MESSAGE_ALARM_LOCK); //打印信息8 _8 F0 e; H2 U) H- C5 g5 Z
} else {; a, w) n0 w1 Y$ ^& r# B
// 如果沒有報警說明一切正常!但還是要檢查安全門.
# Z+ \, {- H [7 _ if (system_check_safety_door_ajar()) {- F1 G& a# P+ _, j8 K# W) ~# A
bit_true(sys_rt_exec_state, EXEC_SAFETY_DOOR);
" u5 r& C2 L! z3 T2 n" T protocol_execute_realtime(); // 進入安全模式。應該返回空閑狀態。+ T9 ?, S- l/ |+ u5 `: n- s0 A) P
} else {
' x4 ]1 z3 A* I& S6 y# G sys.state = STATE_IDLE; // .設置系統做好準備。清除所有國家國旗。' W! X4 J% ~0 m0 M% e2 l
}
. \- F( B% f$ d. [; ^* K system_execute_startup(line); //開始執行系統腳本2 L; x" z0 q: a9 v
}
$ \, y& @% S! v) U, p: ~
9 v( }7 K2 D w- u3 k8 c
" D% s! @; M( i( M // 這是主循環!在系統中止時這是出口回到主函數來重置系統。 |6 O; s" i b' T4 [! t2 P
// --------------------------------------------------------------------------------- , Y0 a$ {; J" ~: a* y
$ t& ^) g( ?: D- d5 B1 V6 g9 o- c7 T uint8_t comment = COMMENT_NONE;
& |, M) O) Q9 E9 ^ uint8_t char_counter = 0;
; S5 W- ~& W/ q1 p- O! C* Y uint8_t c;& `$ b# z1 f4 r7 B& y( A
_______________________________________________________________________________________________________________________________' e" {1 N. U, Y' J4 X- l; x! M9 Z
接下來進入for(;;)循環 //下面代碼是G代碼解析核心部分,程序中comment(注釋)變量會被賦不同值,代表發符號有‘(’‘)’‘;’
/ m5 ?1 M* Z8 U* P; f) B5 z+ Y! B{7 }9 {& Z6 B0 }" I& O
//串行數據輸入一行的的過程,作為數據。執行一個
9 J# ]* ^/ H! A9 ~/ j7 R% V. w) F//所有數據初始過濾去除空格和注釋。 / g) u2 U" S1 L8 `- r' F6 u, r2 B
//注意:注釋,空格和程序段刪除(如果支持的話)處理技術
: g/ n9 D; q2 y//在G代碼解析器,它有助于壓縮到Grbl傳入的數據3 q* x. [+ c6 X+ w
//線緩沖區,這是有限的。刀位點標準實際上州一行不行- Y% U# [( O/ }. S2 w7 O
//不能超過256個字符,Arduino Uno沒有更多內存空間。3 Y2 H [3 _% w/ A+ {
//有更好的處理器,它會很容易把這個初步解析的
6 O9 @' y# M* |//分離任務共享的刀位點解析器和Grbl系統命令。
* l+ B7 W/ k' ^7 h! y while((c = serial_read()) != SERIAL_NO_DATA) { //讀取串口數據,有數據執行下面代碼# x9 @7 B! }: G6 F% w
if ((c == '\n') || (c == '\r')) { // End of line reached //如果數據是/r,/n代表一行結束
( t! s8 G, `, a) M line[char_counter] = 0; // Set string termination character. //設置結束標志* X/ n- z! M4 ~, @" y
protocol_execute_line(line); // Line is complete. Execute it! //一行完成執行此函數$ \6 i: m; S: q& e6 ?& q
comment = COMMENT_NONE; //注釋清零
" @3 e1 @( e' _# g# n' Q char_counter = 0; //字符計數清零
8 _% ~8 i9 `: w% ]9 s" _ c7 s
5 o! y5 r, O2 O3 _2 u* W) ]- p else {
- e8 G& V# j/ g6 L! n4 ?2 c if (comment != COMMENT_NONE) {7 j: A1 p2 }0 H2 ]# ]5 o' V6 `1 }
//扔掉所有注釋字符
9 S( P, I' e) J$ }# z; P! @ if (c == ')') {
7 e) `' \- c! z6 O //最后注釋。重新開始。但是如果有分號類型的注釋。/ V: s u9 G1 d7 c1 x4 b) p% `7 z
if (comment == COMMENT_TYPE_PARENTHESES) { comment = COMMENT_NONE; }
7 R3 S/ y0 S- H! e# Y. | }7 P {, e6 A( f
} else {
0 J8 ?3 l) n7 s7 H ^" { if (c <= ' ') { 8 v# h4 ]8 {- U
//扔掉whitepace和控制字符
7 p: k0 \0 s, T o! L } else if (c == '/') {
3 O D% C3 \9 O$ A; h( t5 Y //塊刪除不支持將忽略字符。, n7 r$ Q5 N2 _. c( t! r& Q
//注意:如果支持,只需要檢查系統是否啟用了塊刪除。
: f; t3 T& W4 P( ~8 Z1 f- f, a( D } else if (c == '(') {+ _, [) x0 i$ \
// Enable comments flag and ignore all characters until ')' or EOL.0 O# A0 i. L8 n4 V
// NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.( }! ? m4 a, a% O" B2 j T
// In the future, we could simply remove the items within the comments, but retain the
, A `) J/ ]2 @, d j7 u // comment control characters, so that the g-code parser can error-check it.7 O* N1 s$ W" y& ?
comment = COMMENT_TYPE_PARENTHESES;
' I% p: b+ \" F( J" J- u# J } else if (c == ';') {6 v! a6 F% \, [4 E, z; u* w
//注意:','注釋EOL LinuxCNC定義。沒有國家標準。
# ~) _" C( }9 p comment = COMMENT_TYPE_SEMICOLON;# s+ b& V) }' I
/ g' |- k* E8 D( }1 Z9 h
$ l$ M# ~1 B+ [$ X- E7 C3 Y
_____________________________________________________________________________________________________________________________________
8 F& w5 c& z, R, C \3 E } else if (char_counter >= (LINE_BUFFER_SIZE-1)) { //串口接收數據大于80字符時
6 L5 @" }/ f+ N8 P# G, @ // Detect line buffer overflow. Report error and reset line buffer. 檢測緩沖區溢出。報告錯誤和復位線緩沖區。
1 A X# |7 ?; A0 k. H5 u# d report_status_message(STATUS_OVERFLOW); //打印溢出信息
: D. r1 z# X" m comment = COMMENT_NONE;
5 @( U# D- E- R" _' R5 l char_counter = 0;
5 T; {2 E' v' U* u v+ `9 y' C } else if (c >= 'a' && c <= 'z') { // Upcase lowercase //小寫改大寫5 Z8 z2 r4 C3 v# i* [
line[char_counter++] = c-'a'+'A';7 x9 J0 J8 ]. E2 o9 Q! ^
} else {
5 g! c& s$ `" r8 G line[char_counter++] = c;
R4 ]9 g# _" l5 `) ]/ X }( [% i3 x8 Y" B5 w ~4 N
}% I. P9 [ ], U% V: `
}6 y& @1 B7 c+ I( ~
}7 t# i7 R) M1 B/ t6 p4 m: _
____________________________________________________________________________________________________________________________________
" ?' Y- t: J# @* X# s //如果沒有其他字符在串行處理讀取緩沖區和執行,這表明以完成,自動啟動,如果啟用,任何隊列動作。0 \6 n+ q4 }5 f4 O/ @
protocol_auto_cycle_start(); //自動開始協議循環; w' S( h" P5 t
% d' v- r2 c* {, \! _/ o% Y/ D
protocol_execute_realtime(); //運行實時命令。
$ i5 r& C6 ~; M# \- c if (sys.abort) { return; } //中止標識置位程序循環重置系統。
/ p8 `4 L8 L$ `3 R1 I- o0 X }
4 e5 B+ \% n% j; F1 F3 E return; //一般程序不會執行到這里
* }5 e" O0 L- i) f/ Q3 H}
" m3 |& k( d- l, {/ @& i) O____________________________________________________________________________________________________________________________________. W6 F' |8 C; i' x u4 V# {
正常情況下,讀取完G代碼程序會進入protocol_auto_cycle_start();//自動開始協議循環 函數下面介紹此函數
! B* V. p) X8 @$ H// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that1 C! T/ p, |7 a2 O( u" d6 O6 x
// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that ! `2 z+ @) n0 L& \: K K
// automatically begins the cycle when a user enters a valid motion command manually. This is M4 p" ]2 ~$ M+ U* O5 D# A1 h9 Q% o
// intended as a beginners feature to help new users to understand g-code. It can be disabled* m6 P, d6 O6 D& n
// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is
2 s/ b0 N8 A: d/ A5 r// manually issuing a cycle start command whenever the user is ready and there is a valid motion 1 E7 }# ?! `1 l4 c: C9 b
// command in the planner queue.; X- l+ g7 n% @7 W
// NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes ! C' P( f( k2 F7 H8 d2 ^2 t
// when one of these conditions exist respectively: There are no more blocks sent (i.e. streaming & A# D0 D' p3 w5 m/ Y, ~+ C9 p* k. w
// is finished, single commands), a command that needs to wait for the motions in the buffer to ! s, c+ d, ~$ _8 G
// execute calls a buffer sync, or the planner buffer is full and ready to go.* F% u& J* a+ X, o; F
//自動開始有兩個目的:1。回復一個plan_synchronize()調用的函數
! @3 E# w a- n9 ^( k//需要規劃師緩沖區空(主軸啟用、住等)2。作為一個用戶設置
# s4 M7 @+ x0 Y; U! U. K& d//自動循環開始當一個用戶輸入一個有效的運動命令手動。這是. u0 r6 @/ h' v# a- U/ _! d x4 Q2 p! |
//作為一個初學者的特性來幫助新用戶了解刀位點。它可以被禁用
* W3 Y4 A' S( P# f. |6 v5 b" J//作為一個初學者工具,但(1)仍然運作。如果禁用,運行周期開始' X! v* N" h1 @3 z7 M4 X1 U
//手動發出一個周期開始命令每當用戶準備好,有一個有效的運動: a+ n0 C8 z0 }: I( `2 c; d% r" W
//命令的規劃師隊列。' `1 U- D# T5 x, a2 \9 z
//注意:這個函數被稱為從主循環緩沖區同步,mc_line只()并執行
" _% [, Y* d8 V9 N+ \//當其中一個條件分別存在:沒有更多的塊(即流發送
% ~8 s) O. K: W; @0 K//完成后,單一的命令),一個命令,需要等待緩沖的動作
. g* f) @: ?8 ~( O//執行調用一個緩沖區同步,或規劃師緩沖區滿了,準備好了。( m" O' ?+ C. [! y5 n/ @+ Y* J; E7 w
void protocol_auto_cycle_start() { bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START); } % V% v" f. z+ T* f
_______________________________________________________________________________________________
# i8 `1 o6 b/ B$ \接下來程序運行protocol_execute_realtime(); /運行實時命令。6 Y7 Z) F2 j! }& R! z6 _$ a
// Executes run-time commands, when required. This is called from various check points in the main
6 q; o8 k, u' J% i1 {// program, primarily where there may be a while loop waiting for a buffer to clear space or any
2 e3 d( O# ]. h8 g8 m// point where the execution time from the last check point may be more than a fraction of a second.
5 l4 s2 U7 e' X3 Z, |6 e// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code
_, _, d5 P' }& k// parsing and planning functions. This function also serves as an interface for the interrupts to
% O) H( A" Q; P& [2 a$ r' N// set the system realtime flags, where only the main program handles them, removing the need to' b; s: O" w' [: y. x* s! |
// define more computationally-expensive volatile variables. This also provides a controlled way to
) N4 `: N, }+ N! K// execute certain tasks without having two or more instances of the same task, such as the planner
* P( n# ^# c2 o, p& Q s// recalculating the buffer upon a feedhold or override.0 J* w1 Y6 @, ]( Z, ^( F
// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
6 D1 I; Z% s/ f// limit switches, or the main program.# Y6 \9 A0 o6 j2 R# ]% z) g8 i
void protocol_execute_realtime()
) p/ y& o# r- a& c uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.臨時變量來避免多次調用不穩定。
6 `/ ^, {! m: A( v2 z+ @ u7 j就先分享到這吧!: I0 ~$ Y' R5 V: K9 w
2 `- }% M" w8 p! ]4 i
2 T; T0 w! ]4 X; ]8 n/ N! J" l1 U
$ J% w& ~' e8 w, |0 m: g A
/ G# Y6 L) L0 [$ w
) K. {. M8 x0 i! `1 X
& _, _: l9 U. M0 H5 C1 M# h! S V4 C- o4 W! ^0 I
! o8 D* D& s, D3 s7 C" `
: X' I8 u- h- t; t
' T2 R. ?5 _8 J1 g3 @, u4 v
7 t, A- D/ D4 B9 c- M5 ^3 p- d: o! K
* I- L" | j8 ?5 U5 V
( k5 P: s5 w3 f# p
9 V, J. n q* D% W" N# x* ^+ Y- Z
0 n8 i) z; r8 f( }5 v
7 { J( H3 P+ [2 H8 _0 D+ U
! i( {9 `! n# i( P0 e
9 A' G5 R& X7 k8 j; S! w3 J( t; {6 j a; N4 ]
# b6 L) E- S, D補充內容 (2016-8-25 22:40):
1 X [7 l5 B, x7 D* _; R配置說明! X% P0 C. X' P( b w7 t
//這個文件包含編譯時配置Grbl的內部系統。在大多數情況下,) t9 k$ o* K' F8 J- i2 E9 R! v
//用戶不需要直接修改這些,但是他們在這里為特定的需求,即。" z3 g: h% x0 w* Q, B5 Q s4 `
//性能調優或適應非典型的機器。1 P+ {2 E7 U% N {! m
主要配置項:
5 F6 @+ c8 d# u7 G1.#define DEFAULTS_GENERIC //在重置eepm時使用。在defaults.h改變想要的名字
) ] v7 j( D0 n1 O' T3 v$ V# Y8 }2.#define BAUD_RATE 115200 //配置串口波特率115200( o4 t3 E9 n/ N/ _4 j c4 V$ J
3.#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
: {( ^+ e# F) x" ~8 H4 j/ J. q4.#define CMD_STATUS_REPORT '?' //定義實時命令特殊字符
8 g3 b0 }+ Y4 t- O' c5.#define HOMING_INIT_LOCK //回原點保護鎖1 |) X7 Y# M8 u3 }4 w6 M6 F( {& v
6.#define HOMING_CYCLE_0 (1<<Z_AXIS) // 第一步Z清除工作區。
8 ?& w% I# i! j, P, c* s2 L9 t7 g #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // 然后X,Y在同一時間。
! l8 B4 y s9 p2 Z" {. {7.#define N_HOMING_LOCATE_CYCLE 1 //回原點循環次數
4 H2 p: ^% T- z% o/ p. C# _7 m8.#define HOMING_FORCE_SET_ORIGIN //取消這定義迫使Grbl總是在這時候位置設置機器原點盡管開關方向。3 \# u8 h5 |4 I! G& [& v) N
9.#define N_STARTUP_LINE 2 //塊Grbl啟動時執行的數量。 ]0 ~0 v6 @0 ` _# _
10.#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協調或位置價值英寸8 }4 y* ]: |- h4 @% c* _
#define N_DECIMAL_COORDVALUE_MM 3 // Coordinate or position value in mm 協調在毫米或位置價值
7 m4 A* z. E8 W% a. Y+ K/ z2 P- ] #define N_DECIMAL_RATEVALUE_INCH 1 // Rate or velocity value in in/min 率或/分鐘的速度值
. _, T- ~; _3 E% C4 d i #define N_DECIMAL_RATEVALUE_MM 0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘$ Q; B, ^* h' ]! l. L
#define N_DECIMAL_SETTINGVALUE 3 // Decimals for floating point setting values 對浮點小數設置值
; E5 h5 D+ c1 v11.#define LIMITS_TWO_SWITCHES_ON_AXES //如果你的機器有兩個極限開關連接在平行于一個軸,您需要啟用這個特性" N7 I6 {9 ?9 A# T+ r- i
12.#define USE_LINE_NUMBERS //允許GRBL跟蹤和報告gcode行號
7 e; [7 U; \7 n7 e* Z0 W13.#define REPORT_REALTIME_RATE //允許GRBL報告實時進給速率4 E, c; Y" l# K5 V: F
14.#define MESSAGE_PROBE_COORDINATES //坐標通過Grbl $ #的打印參數?) G% M+ S& y/ p+ U
15.#define SAFETY_DOOR_SPINDLE_DELAY 4000 //安全門主軸延時
9 L1 w( E* o+ ?* k; B/ X9 ?% r16.#define SAFETY_DOOR_COOLANT_DELAY 1000 //安全門冷卻液延時$ I; l) R) h/ l4 D
17.#define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS) //啟用CoreXY運動學。
: v8 t9 R a' I: }' x6 ^18.#define COREXY // Default disabled. Uncomment to enable.改變X和Y軸的運動原理
% |! X" X2 U3 N k/ H7 J19.#define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.反轉針銷邏輯的控制命令' n) Q6 I% B( w$ ?' z o o- o% z
20.#define INVERT_SPINDLE_ENABLE_PIN // 反轉主軸使銷從low-disabled+ |0 d! `- p7 F) M0 K) V' ~4 C
21.#define REPORT_CONTROL_PIN_STATE //啟用控制銷狀態反饋狀態報告。# Q, y1 f+ A) X. u2 A3 P2 _
22.#define FORCE_INITIALIZATION_ALARM //啟用和用戶安裝限位開關,Grbl將啟動報警狀態指示
; F. X8 Z* U+ `& E' h# Q& x3 d' }23.#define REPORT_GUI_MODE // gui允許最小的報告反饋模式
* q. M- N6 x @* {2 G! w* u24.#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時間分辨率管理子系統。, a/ X& Y) [1 O
25.#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING //自適應多軸步平滑(積累)是一種先進的功能 * Q% G; G0 w8 l, a t
26.#define MAX_STEP_RATE_HZ 30000 //設置最大一步速率可以寫成Grbl設置
" Y) Y$ b/ u5 n, t27.#define DISABLE_LIMIT_PIN_PULL_UP //以下選項禁用內部上拉電阻4 ]( c* C& H3 M% w1 ?( s
28.#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS //設置哪個軸長度補償應用的工具。假設軸總是與選擇軸工具面向負方向
5 O" J; b' h& j) h+ U29.#define VARIABLE_SPINDLE //允許變量軸輸出電壓不同的轉速值。
0 x; b0 ^' |8 @30.#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.( k2 M% i- b1 x4 E# E8 B/ `* r
#define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
& k+ x: y( i3 H* z4 Z `' {& X' B31.#define MINIMUM_SPINDLE_PWM 5 //使用的變量軸輸出。這迫使PWM輸出最小占空比時啟用。8 s+ }. A1 g/ c8 y3 A/ j- s* A1 V1 R
32.#define USE_SPINDLE_DIR_AS_ENABLE_PIN //主軸方向使能M4被刪除/ s/ \* l7 x# P: W) a
33.#define REPORT_ECHO_LINE_RECEIVED //應該對所有正常線路送到Grbl( Q3 F- s& \: g* f3 G
34.#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min) //最小規劃師結速度。設置默認最小連接速度規劃計劃' l2 } H8 s' P# V
35.#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設置計劃將允許的最小進給速率
. @# w2 W' n8 n/ p36.#define N_ARC_CORRECTION 12 //弧生成迭代次數之前小角度近似精確的弧線軌跡& w: R" ]2 E- b$ K* I
37.#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)//定義值設置機器ε截止來確定電弧是一個原點了?
8 H9 A5 Z* T0 H1 N. R5 V6 _38.#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) //延時增加表現在住。默認值設置為50毫秒
Z# q! {! M4 C/ e; p* _39.#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
, e' q" ]; O$ p- s+ l40.#define BLOCK_BUFFER_SIZE 18 //線性運動規劃師緩沖區的數量在任何給出時間計劃
' K0 l4 }8 s, ~. @7 N41.#define SEGMENT_BUFFER_SIZE 6 //控制之間的中間段緩沖大小的步驟執行算法
5 g' c, s/ c3 N) l/ y- E42.#define LINE_BUFFER_SIZE 80 //行執行串行輸入流的緩沖區大小。
( X' B3 f0 v7 J43.define RX_BUFFER_SIZE 128 //串行發送和接收緩沖區大小
; ?4 }; t2 O) |2 |; s9 F4 P n44.#define TX_BUFFER_SIZE 64
/ x0 y/ C" N. Z& f& n% {45.#define ENABLE_XONXOFF ////切換為串行通信發送流軟件流控制。8 J3 j6 f. ]) w5 \. p. W a9 h& f5 e6 \
46.#define ENABLE_SOFTWARE_DEBOUNCE //一個簡單的軟件消除抖動特性硬限位開關。
7 P1 t0 e: ]/ b ^2 j. o7 i47.#define HARD_LIMIT_FORCE_STATE_CHECK //Grbl檢查硬限位開關的狀態 k/ }" [8 |0 F* K. U
48.// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時錯誤檢查的定義值: ^) k" _3 }! _- }2 Q9 V
; F- F% R7 J) ]* p+ B, z! H___________________________________________________________________________________________________0 g1 C. z3 [! C2 R8 @' j
/*
. s* _, l% o$ f" l config.h - compile time configuration: U. P3 Q9 ?2 d) L
Part of Grbl
' T4 l8 |/ S$ q+ @- V4 Y% V9 {$ J# ?/ d- J2 h" c) w) ^
Copyright (c) 2012-2015 Sungeun K. Jeon
4 o4 {; p2 t' @! ` Copyright (c) 2009-2011 Simen Svale Skogsrud
# M: E. h/ M' @ D: v( D9 X. H2 T' s" p8 a+ Y! j1 H
Grbl is free software: you can redistribute it and/or modify" s# j! H" A( p4 X; w1 w/ o
it under the terms of the GNU General Public License as published by
1 I! v B4 l* c0 m, H/ T5 a6 ] the Free Software Foundation, either version 3 of the License, or
, [4 Y! b% j/ P# [4 @ B) s (at your option) any later version.& T% o6 |* t4 |
4 K5 y$ S: j" O- @3 A/ d Grbl is distributed in the hope that it will be useful,
) i- l& j; L) }' O1 B3 q. { but WITHOUT ANY WARRANTY; without even the implied warranty of W& c" e$ D5 y6 l
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 x) W Q# u2 M7 X( Y" ~8 w
GNU General Public License for more details.
! S$ z2 F6 T" [+ u( B9 }2 [4 i; o7 M2 m. C( V5 v
You should have received a copy of the GNU General Public License
7 ]/ @- U) [4 u% E9 J v5 ~+ L' n- t along with Grbl. If not, see <http://www.gnu.org/licenses/>.4 y" ~# E# C; C
config.h -編譯時配置,Grbl的一部分% X$ x6 ~5 O8 X% g: [9 }
2 H2 h% Z, V. y2 a, U; w版權(c)2012 - 2015 Sungeun K. Jeon" P, L) }: d3 c8 g$ `
版權(c)2009 - 2011 Simen Svale Skogsrud
3 L0 b5 X4 h2 \7 Q. l
# r$ K6 [1 l2 WGrbl是免費軟件:可以重新分配和/或修改2 G+ G; m' d* e* B) F. U
GNU通用公共許可證的條款下發布的自由軟件基金會,版本3的許可,或(任您選)其后的版本。% m8 S) d% m; [+ a( G8 }
+ a3 ^ Q! w- q$ h' uGrbl分布,希望這將是有用的,但是沒有任何保證;沒有即使的默示保證適銷性或健身為特定目的。看到2 c( s) G" H4 N/ V
GNU通用公共許可證的更多細節。
% \: K7 b# C$ A3 v. t0 `( F4 O8 Y/ @1 e( }' o. U" F% x
你應該收到了GNU通用公共許可證的副本' F; ]* T5 W0 G+ H
連同Grbl。如果沒有,看< http://www.gnu.org/licenses/ >。1 b6 `1 K5 x* r! P
$ L6 Z6 ~- u8 ?/ U2 J' M*/
, G* {, h K5 ?5 U 2 n! _; A5 M6 V1 |
// This file contains compile-time configurations for Grbl's internal system. For the most part,& C5 {* B. \" X, s$ S+ [7 h( T6 L
// users will not need to directly modify these, but they are here for specific needs, i.e.% X' A2 u! E) t# o3 {. ^$ k
// performance tuning or adjusting to non-typical machines.5 }/ C. K# o4 L. B, Z/ O
//這個文件包含編譯時配置Grbl的內部系統。在大多數情況下,
i% O6 P2 K5 W' u//用戶不需要直接修改這些,但是他們在這里為特定的需求,即。# k& ?/ m# q% \4 Z! [
//性能調優或適應非典型的機器。5 c3 y* y" p* {! W; ?$ V6 s
7 B2 B' H. h- p5 n: Z: k// IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them.4 K1 J" D( i6 e4 r# L
//重要:任何變化需要一個完整的基于源代碼的傳播。
: q2 @/ h6 ~8 Z4 G2 ~4 b3 I+ W: X1 p r4 Q, E' c3 g
#ifndef config_h, O+ y( c- E7 e( W! ]/ D. a& m+ [& A
#define config_h
3 a+ w0 H4 v9 `0 k/ P#include "grbl.h" // For Arduino IDE compatibility.& t& T8 j9 j ?# J
, j4 k) Z/ P- m# v! t8 p% R4 I// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h6 g) v Q Q P3 o1 h7 A2 x$ z. m' w9 v
// 默認設置。在重置eepm時使用。在defaults.h改變想要的名字2 S: X7 p( l& t( B" u1 [
* ?' {8 O. j3 S, L3 e
#define DEFAULTS_GENERIC
$ N3 Q! e$ O" i3 m& n! T7 b ~# l" E. x$ {4 i& ^, V
// Serial baud rate
8 l# l4 c( X8 B#define BAUD_RATE 115200 //配置串口波特率115200
+ x0 |$ O9 H/ H3 y( B. g/ Y, w4 {( Z" k4 I7 }
// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types# Q5 J5 B# R: C0 S' |/ @
// may exist from user-supplied templates or directly user-defined in cpu_map.h' Z0 W9 V: R0 v, H; y
//默認cpu映射。Grbl正式支持Arduino Uno。其他類型的處理器可能存在cpu_map.h直接從用戶提供的模板或用戶定義的* G! _! [! ]0 @# Z T* |
6 }* v* X+ I# r5 [& y& V( z4 \
#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
. z7 N! [" v0 ]
1 P3 x) H+ b3 l/ Q// Define realtime command special characters. These characters are 'picked-off' directly from the
( T( {) f& C- R! B% ]// serial read data stream and are not passed to the grbl line execution parser. Select characters; ^9 s. ]" x( c: S3 x" S3 X2 T2 G
// that do not and must not exist in the streamed g-code program. ASCII control characters may be
3 b0 q* I0 ^6 ?9 e7 J// used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in Q" \9 G2 c8 j* G* O
// g-code programs, maybe selected for interface programs.9 {4 e8 X# g' D; O
// NOTE: If changed, manually update help message in report.c.
: g3 G- n: P% d1 x, F4 ?- S, j: S% h0 |. u) y$ b5 D! I
//定義實時命令特殊字符。這些字符是直接從“各個擊破”串口讀取數據流并沒有傳遞到grbl行執行解析器。選擇角色. C9 n- q; Z1 ]! k5 b
//不,不能存在于程序流刀位點。ASCII控制字符( ?6 d+ Z/ F: n$ _+ q( I" d! A
//使用,如果他們是可用的每個用戶設置。同時,擴展的ASCII碼(> 127),從來沒有
% \) D3 P. A/ I. {3 I1 Y$ m//刀位點的程序,也許選擇界面程序。
' U: f+ Y+ \) m1 b//注意:如果改變,手動更新report.c幫助信息。
8 { i! O! x% l9 T C0 E( g5 i6 T6 h2 s' M D7 E3 t% Y9 y5 d
#define CMD_STATUS_REPORT '?'
9 _. F6 N# K2 O- ~#define CMD_FEED_HOLD '!'! T" O$ |3 ~4 L
#define CMD_CYCLE_START '~'! A/ t5 X; S0 ^! R7 p
#define CMD_RESET 0x18 // ctrl-x.
2 g) j, ^* C& t+ y* T#define CMD_SAFETY_DOOR '@'- j5 u$ v6 D. F7 v
+ {3 h# F% h" v// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces
# Q* ]5 W3 l# V$ ]// the user to perform the homing cycle (or override the locks) before doing anything else. This is' @$ M7 d; C: g3 s q4 U
// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
& z" D5 A v }# r7 K5 @& Y, [! C* f9 N5 f- R1 v7 I1 E6 \, k
//如果啟用了回原點,導航初始化鎖集Grbl進入警報狀態啟動。這就迫使
. m+ \0 ^2 z# T$ [; m: p//用戶執行歸航周期(或覆蓋鎖)在做任何其他事情之前。這是
& R- E6 z3 @) |5 e//主要安全功能,提醒用戶家里,因為Grbl位置是未知的。
. E8 U4 s3 _1 E
& b: s, T2 Z5 U b& s4 u; K#define HOMING_INIT_LOCK // Comment to disable
" G y8 T$ e- m
8 n9 l$ b" l; v- O// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode4 }0 e* ~0 H7 a1 B; z: a
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short1 q! I8 B9 M3 }" W, v# i
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed 0 S4 W. |& f! J! q* O
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If" M2 T b Z* a% p9 k
// an axis is omitted from the defines, it will not home, nor will the system update its position.$ P# a/ }: z, y" o E& O8 ~
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,8 i- A- y+ Q7 J$ m- z0 r" s- x5 I
// with no y), to configure the homing cycle behavior to their needs.
* B# G' }* F" ~' E+ O( R// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
6 p, l3 Z4 i/ i// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
6 [7 Z4 W3 N$ s// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
I2 z0 o+ M4 Z& f6 U- \! R ]// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
; A+ O2 k$ t& s8 x' ?1 A, k// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes5 H6 d( R9 D& g$ Z
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
( T, @" r' {8 R// will not be affected by pin sharing.
% d% p* ~. X2 `" ~" ^) I5 |3 a//定義導航循環模式的位掩碼。歸航周期首先執行一個搜索模式' q: | p8 m* G: T4 Z
//快速進行限位開關,其次是較慢的定位模式,完成了由一個短
) L; C# y6 j7 ?+ t* C; ?4 O//拖出運動脫離限位開關。以下HOMING_CYCLE_x定義執行
+ ~) k6 C: W: W2 h& v+ j//為了與后綴0開始并完成specified-axes只尋的例程。如果( D1 N/ n- ~- y) K4 v5 I
//定義省略一個軸,它會不在家,也不會系統更新它的位置。& U1 f4 N- e6 p4 n+ f; S
//意義,這允許用戶與非標準笛卡爾的機器,比如車床(x,z,: _- a, F' n: `' ~9 x* ^
//沒有y),配置導航循環行為對他們的需求。+ U+ a+ d8 ^! K- g4 {, c
//注意:歸航周期允許共享限制針,如果軸不相同
3 s* C- J+ _ M. z% f) N; K//循環,但這需要一些銷設置cpu_map的變化。h文件。例如,默認的導航6 i) i4 b. R" g) V4 g( C5 s. E
//循環可以分享Z限位銷X或Y限制針,因為它們是在不同的周期。- o$ c) k! o( V' W
//通過共享一個銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針
0 k/ k6 I P, b9 A' w5 s//可能會減少到一個銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個軸
" P0 Z' A Y5 m//在不同銷,但這時候一個周期。同時,應該注意的是,硬限制的功能6 k. Z5 [) t5 l) Z7 _
//將不會影響銷共享。1 \4 _9 W m! |" p
//注意:默認設置為一個傳統的硬件數控機器。z軸首次明確,其次是X和Y。
" C! N* v/ S- B7 F4 O* E& [, e M: c7 y
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
( R* S3 D- W7 _! s: m#define HOMING_CYCLE_0 (1<<Z_AXIS) // REQUIRED: First move Z to clear workspace. 第一步Z清除工作區。
) H. @7 ^1 D3 D; d! L8 D#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS)) // OPTIONAL: Then move X,Y at the same time.然后X,Y在同一時間。
& n% _, r! w) o+ q5 W// #define HOMING_CYCLE_2 // OPTIONAL: Uncomment and add axes mask to enable
- _. w# r0 a) i/ g" f* \2 T! M+ S# X/ f7 ^
// Number of homing cycles performed after when the machine initially jogs to limit switches.& `& k! H$ H0 b1 ^1 B4 K
// This help in preventing overshoot and should improve repeatability. This value should be one or 4 k7 W# ]+ m& ^
// greater.) u+ F5 V& g4 d( R1 D4 f
//執行回原點循環次數后,當機器最初慢跑限位開關。這個幫助防止過度,應該提高重復性。這個值應該是一個或大。, T' S* E2 h x6 {5 K
( e8 w+ |. ]4 u7 M! v#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128) J5 J0 O; X; I5 s# e* k
* @) a; h1 P: s// After homing, Grbl will set by default the entire machine space into negative space, as is typical
0 ^0 H w& E- ^* K& e7 F// for professional CNC machines, regardless of where the limit switches are located. Uncomment this
" J1 E7 O% A9 z9 Z8 O// define to force Grbl to always set the machine origin at the homed location despite switch orientation.& g- B* ?: }1 r* i
7 }5 {/ D. J* R2 ?( k
//導航后,默認Grbl將整個機器空間留白,是典型的專業數控機器,不管限位開關所在的地方。
' M4 R1 H4 }, |6 {" N3 P) W' f6 Q//取消這定義迫使Grbl總是在這時候位置設置機器原點盡管開關方向。
" f+ m( d! Q z( ^0 {6 e
! d3 _1 ?2 B$ E, X# @( M// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
' ~2 `: H9 B9 S# y* b% D
" v) W: [1 M9 u. R( T$ G: c
3 ?9 G9 p4 G: c( ?4 C// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
4 c: e0 e: q# c' g6 ]// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may3 H& i, T/ ^% z9 {
// be stored and executed in order. These startup blocks would typically be used to set the g-code
5 E' \* V9 I+ J# b& ~- L: R; I// parser state depending on user preferences.
3 m, `3 q& u: Q% t5 h
9 j% c6 {. `, s/ e//塊Grbl啟動時執行的數量。這些塊存儲在eepm,大小8 ~7 y. M/ r; [" Q
//和地址在settings.h中定義。與當前設置,可能2啟動塊
4 B) |( n n5 A//存儲和執行。這些啟動塊通常被用來設置刀位點1 i' ]0 l. Y2 W! J! {+ V
//解析器的狀態取決于用戶首選項。% W' T" v% @7 q- ]( m
, k5 s! P, J' j2 |- K3 y5 n#define N_STARTUP_LINE 2 // Integer (1-2)4 ]' ~3 h) l/ n/ d; ~0 o
% @! e" ]( f! u" Y3 l( Z; F5 G// Number of floating decimal points printed by Grbl for certain value types. These settings are
: { G/ N r; e/ T3 Y// determined by realistic and commonly observed values in CNC machines. For example, position
7 m. L! v) F# f; I/ f& T// values cannot be less than 0.001mm or 0.0001in, because machines can not be physically more, N( t8 K$ u9 ]& F4 t% h+ T+ n, v
// precise this. So, there is likely no need to change these, but you can if you need to here.
4 Z' h# g D9 w" Q! K+ E# D/ ?, ~// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors.7 {+ V$ N) g' V
/ h0 U) x6 Z6 Q5 `, q// Grbl浮動小數點的數字印刷的特定的值類型。這些設置是3 u, `! m' Q' o5 g$ x* ]/ E
//一般由現實和觀測值在數控機器。例如,位置
% @. q0 x" ~9 {: V3 H A//值不能小于0.001毫米或0.0001,因為機器不能身體更多- P2 @( H4 e4 }
//精確。因此,有可能不需要改變這些,但你可以在這里如果你需要。
) U8 ~# L: _& y4 \//注意:必須是一個整數值從0 ~ 4。超過4可能出現舍入錯誤。
$ p+ T; m+ N; s. o4 \# |& C2 k. L2 S" h% C
#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協調或位置價值英寸0 x8 G9 D, V/ w( x( {; k
#define N_DECIMAL_COORDVALUE_MM 3 // Coordinate or position value in mm 協調在毫米或位置價值' A6 k, S& j1 c7 |$ _
#define N_DECIMAL_RATEVALUE_INCH 1 // Rate or velocity value in in/min 率或/分鐘的速度值$ c1 f+ I" a9 G/ M
#define N_DECIMAL_RATEVALUE_MM 0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘
- z: B2 s5 l( `4 F- f' O5 q3 G#define N_DECIMAL_SETTINGVALUE 3 // Decimals for floating point setting values 對浮點小數設置值( s) x( n$ \5 n7 Y7 Y$ W9 b
) _! x, F+ i8 M+ J J// If your machine has two limits switches wired in parallel to one axis, you will need to enable
) ^' i/ m6 P( q: Q! F// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell/ x; x Y; G& Q% h$ `* o
// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will
4 d! O- N5 O# l7 Q// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one
7 V6 l" [. _4 \0 q// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a7 t. P( v! D: ]7 J E) h2 ^- B
// homing cycle while on the limit switch and not have to move the machine off of it.% D. H$ p: g- ~+ `& b, K
! \0 _/ n r, R( V; e//如果你的機器有兩個極限開關連接在平行于一個軸,您需要啟用' k; ?' I7 a+ U) o$ R: U' q- X! N+ S
//這個特性。自從兩個交換機共享一個銷,沒有辦法Grbl告訴
3 X+ m# D+ [3 D0 ~# h# W//啟用哪一個。此選項僅影響歸航,如果限制,Grbl意志
8 c) S4 J! y4 N$ u9 R2 s9 l: a//報警,迫使用戶手動松開限位開關。否則,如果你有一個3 r' O, ^1 m# Q: O# A
//為每個軸限位開關,不啟用該選項。通過保持禁用,您可以執行! i( q3 a7 J9 I1 S+ l* _, x/ X
//導航循環在限位開關并沒有將這臺機器。
6 K/ n' @& C, S" l9 |' W( Z( S% L& ~* r+ u0 z, y- M% y! Y
// #define LIMITS_TWO_SWITCHES_ON_AXES
; \$ h- e" @+ u% w! o- _/ J4 i3 V5 u$ W* R% ?, M" W# y( b) v e/ }9 f
// Allows GRBL to track and report gcode line numbers. Enabling this means that the planning buffer7 [6 a% c7 }1 [. w9 b0 `
// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct
# F7 x. I; @0 \1 N, @5 ^4 Q+ m( M) F; P- \- i+ W; g
//允許GRBL跟蹤和報告gcode行號。使這意味著計劃緩沖從18歲或16歲,為額外的行號plan_block_t結構中的數據
. w# a3 V7 O/ J- p9 `
2 q8 a* K( B, v Z) Q// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable./ K5 e* r- ~ d2 l8 I' p1 \; }
# F6 K& l3 A/ h' X, o// Allows GRBL to report the real-time feed rate. Enabling this means that GRBL will be reporting more ( b+ [& K: B4 n
// data with each status update.
" A6 P8 g# O, W) a- ^/ Y// NOTE: This is experimental and doesn't quite work 100%. Maybe fixed or refactored later.
9 S3 ^5 h. W J1 K8 E//允許GRBL報告實時進給速率。使這意味著GRBL將報告數據和狀態更新。
# @% E3 j7 W0 r0 c( B, p//注意:這是實驗和100%沒有工作。也許以后固定或重構。
3 J L1 p2 t& u$ |
0 H) B G& k) u5 L* T% G: o$ V// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable.
7 q( C& D( w' m' {( l' L
- S1 Y" Q x r7 f0 `// Upon a successful probe cycle, this option provides immediately feedback of the probe coordinates# P5 U9 @; V q
// through an automatically generated message. If disabled, users can still access the last probe0 T$ o! Q) i$ A# U5 C2 q+ U8 s
// coordinates through Grbl '$#' print parameters.! J: }+ O/ T3 U, g3 ^& i$ H% I
//在一個成功的調查周期,這個選項提供立即反饋的探測器坐標
. q) B2 }/ }4 V8 H( H//通過一個自動生成的消息。如果禁用,用戶仍然能夠訪問調查
3 F; ]) e6 A7 T; C//坐標通過Grbl $ #的打印參數。- {2 M- y5 s \
; I. l3 U, u6 }+ E6 [, X. R/ a
#define MESSAGE_PROBE_COORDINATES // Enabled by default. Comment to disable.7 M/ a. V4 z" Q" [5 E
% Q. d; q% E. p: f! o8 T// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
# C* S; h. T3 k7 O8 d. U N0 u// analog pin 5. Only use this option if you require a second coolant control pin.9 v2 U$ f' j" W% I. B
// NOTE: The M8 flood coolant control pin on analog pin 4 will still be functional regardless.1 t2 `4 P8 X' s
// #define ENABLE_M7 // Disabled by default. Uncomment to enable.9 n: q" A( i9 I
7 N6 X) |1 @1 m
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,0 N1 ^( T& E: h" o* S3 b. S* N6 V
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until! s* E7 F& c1 X* W: G
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the& s- D( N$ B8 |. L+ l. X' V
// previous tool path, as if nothing happened.
+ [+ A- ^4 B* j/ F# W9 p// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable. O9 B; d2 Z+ D/ U" J
* g$ v/ ~, E3 `5 R
// After the safety door switch has been toggled and restored, this setting sets the power-up delay$ o3 `# Y2 A; k+ ^1 H( v1 }& R, O9 x
// between restoring the spindle and coolant and resuming the cycle.8 V4 c( s4 X' z2 f0 c+ r
// NOTE: Delay value is defined in milliseconds from zero to 65,535. , v% T* f. @% x L
; d9 A$ W y5 [! c* g+ x* G//定義導航循環模式的位掩碼。歸航周期首先執行一個搜索模式5 s M3 h8 e* h, n0 M
//快速進行限位開關,其次是較慢的定位模式,完成了由一個短
& Z. h( K8 i6 G: U9 i2 B//拖出運動脫離限位開關。以下HOMING_CYCLE_x定義執行# i# R) p/ W) _- T; Y( L
//為了與后綴0開始并完成specified-axes只尋的例程。如果( Z% E- Z9 k4 t, z
//定義省略一個軸,它會不在家,也不會系統更新它的位置。
) g; M6 A9 P# h5 U! h//意義,這允許用戶與非標準笛卡爾的機器,比如車床(x,z,
, t. C# |1 o: e8 N _. P//沒有y),配置導航循環行為對他們的需求。
9 `& H' I4 S {" O* B$ m/ b//注意:歸航周期允許共享限制針,如果軸不相同
1 C4 i4 F$ m- a' t//循環,但這需要一些銷設置cpu_map的變化。h文件。例如,默認的導航 {6 h3 \1 c, l. V4 `
//循環可以分享Z限位銷X或Y限制針,因為它們是在不同的周期。
9 H& E) ^! S9 b+ ]6 ~2 y/ @1 m' X//通過共享一個銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針
8 _9 y- ?4 p8 O) q; `7 {! o2 ^# E//可能會減少到一個銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個軸
# _# w- L h# X//在不同銷,但這時候一個周期。同時,應該注意的是,硬限制的功能
; O* t) G4 J2 B' ~) i//將不會影響銷共享。1 F& E% Z' [7 k) L! g1 W
//注意:默認設置為一個傳統的硬件數控機器。z軸首次明確,其次是X和Y。
0 O* X% v* ~- M) x5 L7 w X6 u/ r" q* |
( a/ S+ `- f/ h$ o
#define SAFETY_DOOR_SPINDLE_DELAY 4000
% Y. V& _. K' E7 P#define SAFETY_DOOR_COOLANT_DELAY 10009 @& L# h) h o
1 B3 D5 u% S' Q9 _. J// Enable CoreXY kinematics. Use ONLY with CoreXY machines. 8 N4 W' o; v" X1 z3 i: `
// IMPORTANT: If homing is enabled, you must reconfigure the homing cycle #defines above to
* }0 c4 A( j5 P//啟用CoreXY運動學。只使用與CoreXY機器。; y8 b1 O# E: N) P
//重要:如果啟用了自動尋的,你必須重新配置導航循環#定義上面
4 r M- ]! Y/ S- f: Q0 I+ r& i$ b3 Q4 j, |3 H
// #define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS)
; B4 N8 n m, @* Q" s/ B' U4 J5 f6 J* f: Z: A; P8 S0 J
// NOTE: This configuration option alters the motion of the X and Y axes to principle of operation
- m% v7 D" P) v// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
) J2 K5 ] W) x& H// described, if not, motions may move in strange directions. Grbl assumes the CoreXY A and B motors
) f x2 y* O( k, X3 T// have the same steps per mm internally.
. t r! A. I, T3 o5 v//注意:這種配置選項改變X和Y軸的運動原理,操作2 h3 L1 @/ J( l2 N. E: c$ n3 h
//定義(http://corexy.com/theory.html)。汽車被認為定位和連接一樣- J& f8 p* d! Y' O' s
//描述,如果沒有,運動可能會奇怪的方向移動。A和B Grbl假設CoreXY馬達0 a: p0 @# z* w% |
//每毫米內部有相同的步驟。3 \% z1 O1 C: W; \8 l
4 F2 R6 V4 P5 Z* j% b' c// #define COREXY // Default disabled. Uncomment to enable.
. y. m, c( u( `. {9 ^1 C6 g. Z
2 ~# F, O, H8 W' m// Inverts pin logic of the control command pins. This essentially means when this option is enabled9 F) f% }) B- [4 y3 u* Y) F+ Y
// you can use normally-closed switches, rather than the default normally-open switches.2 r$ @( t; f8 C
// NOTE: Will eventually be added to Grbl settings in v1.0.) u, L/ x$ f6 k/ Q
//反轉針銷邏輯的控制命令。這實質上意味著當啟用這個選項
' q7 a; g! u5 E: F/ `//可以使用閉合開關,而不是默認的常開開關。
/ b/ P( h$ M2 }0 f! X1 d2 c- p) F& A//注意:最終將被添加到在v1.0 Grbl設置。* g1 Q4 l8 y m3 k/ H8 j, Z
9 x5 O. F/ {: ]. h
// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.( |5 M; ?2 C% b0 I7 i* c( E% k
' V/ n& w+ D( F2 D2 g( v$ T9 Z/ x' n
// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
% G4 H) l6 p Q6 b* u7 S i7 d// for some pre-built electronic boards.9 H, h) r3 b( l5 I
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and & E3 B' Z$ x; p- k$ g
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM, 6 e+ F! R0 `( ]; ~( v, v
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.% N' c% S' W+ `) ~& W
//反轉主軸使銷從low-disabled / high-enabled low-enabled / high-disabled。有用的
" e* b- k) R) e//預構建的電子板。
% ], I5 @2 |0 W: ]//注意:如果啟用了VARIABLE_SPINDLE(默認),這個選項作為PWM輸出并沒有影響& R8 Z4 C: j; a8 P* C" R
//銷軸使結合。如果你需要這個選項和主軸轉速PWM,
& H0 B- _# `5 y P% j! {$ S//取消注釋以下配置選項USE_SPINDLE_DIR_AS_ENABLE_PIN
' Z2 W4 v) ?4 t' _/ g( Q' J/ x) M l, z# V. _
// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
( Q5 e( c! [7 [8 j9 z$ \3 H3 m* N t* L* a
// Enable control pin states feedback in status reports. The data is presented as simple binary of" a8 L+ v, h8 t" B! P
// the control pin port (0 (low) or 1(high)), masked to show only the input pins. Non-control pins on the
" _( {4 u0 |, A2 W9 {! _; l1 k// port will always show a 0 value. See cpu_map.h for the pin bitmap. As with the limit pin reporting,0 C& ~* P9 n% Z1 z) `
// we do not recommend keeping this option enabled. Try to only use this for setting up a new CNC.
5 {" f o3 W: B: E% S; a9 G+ X* E' p//啟用控制銷狀態反饋狀態報告。作為簡單的二進制數據
+ W. s, v2 Z! Z8 T//控制針端口(0(低)或1(高)),蒙面,只顯示輸入插腳。非控制性針上
5 j' w* E; V9 m3 l9 J7 }# G- M2 a//端口總是顯示0值。看到cpu_map。針位圖h。與限制銷報告,! m+ D/ p, M+ v7 f1 _: P) S7 w
//我們不推薦保持啟用這個選項。盡量只使用這個設置一個新的數控。4 Z4 r3 z) F" l# ]
/ g; o- p7 M3 p// #define REPORT_CONTROL_PIN_STATE // Default disabled. Uncomment to enable.6 ^2 T' x: M0 ~7 [
# g1 e7 U1 U: ~* F// When Grbl powers-cycles or is hard reset with the Arduino reset button, Grbl boots up with no ALARM
6 u. b2 A: o) ?: H// by default. This is to make it as simple as possible for new users to start using Grbl. When homing8 e F% W: b: N7 o( N" S' F7 J, a
// is enabled and a user has installed limit switches, Grbl will boot up in an ALARM state to indicate ; K6 c- P6 X. q! t2 C
// Grbl doesn't know its position and to force the user to home before proceeding. This option forces
( g1 J8 w2 o1 _+ U# U// Grbl to always initialize into an ALARM state regardless of homing or not. This option is more for
3 A! L$ g# d6 T- N// OEMs and LinuxCNC users that would like this power-cycle behavior.
$ I' N6 o- j: R, o( _//當Grbl powers-cycles還是硬重置Arduino復位按鈕,Grbl啟動沒有報警
9 E' }: W b, f: b/ z* m* P//默認情況下。這是為了讓新用戶盡可能簡單使用Grbl開始。當歸航
, Q5 w6 V. w/ K//啟用和用戶安裝限位開關,Grbl將啟動報警狀態指示4 f( e7 X& X* C/ S& p
// Grbl不知道它的位置,迫使用戶在繼續之前回家。這個選項部隊# _9 h. G2 d! X, y: C/ b$ K% n4 O
// Grbl總是初始化進入警報狀態不管歸航。這個選項是更多
3 v. G6 [* A4 f//原始設備制造商和LinuxCNC用戶這樣的控制行為。4 O8 o7 d" n6 P
# x# q; E/ n: P. Q// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.: G% a) t3 q5 q/ ^ A+ L; I
6 Q* R) Q" e$ D, s. {// ---------------------------------------------------------------------------------------
' y3 @( F- t" P! b/ U, b// ADVANCED CONFIGURATION OPTIONS://高級配置選項:
$ Q# h! D P7 s6 k9 _0 b8 H$ V$ ]% q0 @! ~& L q
// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important.0 d5 ~( t2 j6 D4 D
// This saves nearly 2KB of flash space and may allow enough space to install other/future features.2 A6 {! b/ n+ |% k5 _6 n
// GUIs will need to install a look-up table for the error-codes that Grbl sends back in their place.
7 K q/ K- q' b* U( O// NOTE: This feature is new and experimental. Make sure the GUI you are using supports this mode.
% U9 c/ s+ A) b' K; }
5 V/ u7 w+ r2 Z* z! M7 C% \// gui允許最小的報告反饋模式,人類可讀的字符串在哪里不重要。$ ~$ D3 T: f* L2 |9 k' g4 Z3 D
//這個節省近2 kb的閃存空間,允許足夠的空間來安裝其他/未來的功能。! E* \" W1 o" {+ f9 }2 u
// gui需要安裝一個查找表的錯誤代碼Grbl發回。* k4 d, y$ j; P3 g$ H! B7 I6 n9 x) n4 A
//注意:此功能是新的和實驗。確保您使用的GUI支持這種模式。2 ~6 d& ?. V( C! Z* E
9 w) \) |" }/ _) [// #define REPORT_GUI_MODE // Default disabled. Uncomment to enable.. f/ A$ U8 ?/ R- |6 T4 T5 P2 m _; a- v
2 d. Y* D2 p. B) z$ [
// The temporal resolution of the acceleration management subsystem. A higher number gives smoother
+ S2 Y& A; [& E# H) Q; W2 E G// acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively( E% R4 S; A- M- n9 u. i
// impact performance. The correct value for this parameter is machine dependent, so it's advised to, Z# S1 H3 P$ [( x" e3 U3 t
// set this only as high as needed. Approximate successful values can widely range from 50 to 200 or more.
( d) g# W1 `( N+ N, E- W2 a6 i// NOTE: Changing this value also changes the execution time of a segment in the step segment buffer.
" ~, t$ L, u$ Z* L; s8 }/ O: L// When increasing this value, this stores less overall time in the segment buffer and vice versa. Make) [$ ?# z' M; T8 V8 ]" l2 K
// certain the step segment buffer is increased/decreased to account for these changes.
" a! Y( m3 P# W Q3 v//加速度的時間分辨率管理子系統。更多更平穩
. b0 O+ ]& t# d1 W" i. u' M9 D//加速度,特別明顯的機器上,運行在非常高的進料速度,但可能負面2 ?0 W# T$ S6 o' A7 W5 E
//影響性能。正確的值為這個參數是依賴于機器的,所以建議
. i7 {( [: N. r8 u+ d//這只設置為高。近似成功的價值觀可以廣泛的范圍從50到200或者更多。
6 Q1 B ~; r4 N* z# Q//注意:改變這個值也變化的部分步驟的執行時間緩沖。% N/ {2 O! ^2 e/ o
//增加這個值時,這個商店部分緩沖區的總時間減少,反之亦然。使
5 N! E) A% O0 V: Z# q1 t//特定步驟段緩沖是考慮這些變化增加/減少。
8 I! _, ]) Y0 o% H; _" ?- [, D) H. K4 O$ G* `0 A
#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時間分辨率管理子系統。更多更平穩' p6 g3 @1 M, V& T1 p( y
2 s4 l4 @8 i4 K/ Z& F- R0 t0 i// Adaptive Multi-Axis Step Smoothing (AMASS) is an advanced feature that does what its name implies,
[' O2 U6 G; B4 K: H4 A1 Z* ^* K8 z// smoothing the stepping of multi-axis motions. This feature smooths motion particularly at low step( m1 [% K/ \1 e2 d9 g& r( p
// frequencies below 10kHz, where the aliasing between axes of multi-axis motions can cause audible ( d' K/ i4 s( t+ m# G% O
// noise and shake your machine. At even lower step frequencies, AMASS adapts and provides even better
2 ~+ h! e: l) j, M: X& s// step smoothing. See stepper.c for more details on the AMASS system works.
! Z2 V# c$ h W( R9 `//自適應多軸步平滑(積累)是一種先進的功能,它的名字所暗示的那樣,
7 ^) A# K. N4 Q9 \1 f0 C( {, J//平滑的多軸步進運動。這個特性平滑運動尤其是在低一步
1 S9 q; _+ S: J7 l//頻率低于10 khz,軸之間的混疊的多軸運動可能導致音響4 e1 O- Y( W/ `4 D; o
//噪音和震動你的機器。在更低的頻率步,積累適應并提供更好2 X" D- q! p' P0 Q5 `$ b
//步驟平滑。看到步進。c更多細節的積累系統的工作原理。
, ~6 B; M8 I7 a) a( t" r7 {" B
! g% L7 b& I( b( E2 \. Z. y#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING // Default enabled. Comment to disable.//自適應多軸步平滑/ \ Q: A0 H3 g0 S. i' R0 S& z+ C: K; ~
# D7 u' d* W6 ?# {1 B* R1 A$ G
// Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error
* t4 J" `; a5 c% ?6 _// check in the settings module to prevent settings values that will exceed this limitation. The maximum
. F5 w, A0 C* E Q. e3 |6 O// step rate is strictly limited by the CPU speed and will change if something other than an AVR running; `* _! d, K" ^4 o% {& S Z3 \
// at 16MHz is used.
8 U: T! j' W7 e5 O* J0 q0 K// NOTE: For now disabled, will enable if flash space permits.
: ]( N# l$ _% @( ~' X- N n//設置最大一步速率可以寫成Grbl設置。這個選項可以使一個錯誤
5 f0 @! F4 v, L* \* H6 U* p//設置模塊中檢查,防止設置值將超過這個限制。的最大
# g& N" f5 A9 O$ Y# a3 Y$ I: }//步驟嚴格限制的CPU速度也會改變如果是其他AVR運行- O8 }0 N" ~1 ^6 m6 Z
//使用16兆赫。" z( n3 D c' N' @ c2 C, A
//注意:現在殘疾,將使如果flash空間許可。
) @! I" T1 Q$ J" @
8 |, Q/ ^& |8 ]; E/ g2 ^3 _6 s# b// #define MAX_STEP_RATE_HZ 30000 // Hz 設置最大一步速率- }! o& [: e) X2 U- t, W& S
, @' k1 ^) n; { x& {+ \5 r( }// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors
# K/ @$ Z# @' s1 J# z5 M3 t& p/ R" l// enabled. This simplifies the wiring for users by requiring only a switch connected to ground,
: D" n4 G0 c' g& w1 n1 q. E6 h// although its recommended that users take the extra step of wiring in low-pass filter to reduce9 \0 _, s1 Z4 M
// electrical noise detected by the pin. If the user inverts the pin in Grbl settings, this just flips: ?; D- h& [3 V M
// which high or low reading indicates an active signal. In normal operation, this means the user
$ J7 t# x6 Q& s- |// needs to connect a normal-open switch, but if inverted, this means the user should connect a
; M& y/ {: F/ n4 w// normal-closed switch.
1 M( K T8 `6 X7 M& D, t// The following options disable the internal pull-up resistors, sets the pins to a normal-low ( Z2 r# c0 B' p4 X- {, }' s
// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning
' d9 S, F! s5 i. g" a( N& _7 E$ R// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
% [, M) O4 p: Q& K6 [3 B" r. b// normal-open switch and vice versa.
5 @" ~0 r, |4 D6 y/ a9 N// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.
9 Y$ @& v, W$ {// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
& z, C" l# m- f" V0 R0 O0 T//默認情況下,Grbl所有輸入引腳設置為正常高操作的內部上拉電阻1 w2 r$ I0 K7 k X' V; i) E6 q
//啟用。這簡化了布線為用戶只需要一個開關連接到地面,& k2 O) U: T0 e8 h" b3 s
//雖然其建議用戶采取額外的步驟,在低通濾波器來減少布線
& P6 V* `7 z, ]3 \3 U//電噪音檢測銷。如果用戶反轉的銷Grbl設置,這只是翻轉* ^( x4 b. j. }, g. W* S
//讀高或低表明一個積極的信號。在正常操作中,這意味著用戶6 k8 k4 y4 E( h1 |$ H# n5 ]
//需要連接一個常開開關,但如果倒,這意味著用戶應該連接; i( n* `9 \) D( I! b+ u
// normal-closed開關。
. O* y, n( W L8 k4 e4 l//以下選項禁用內部上拉電阻,一般低設置別針) y7 {: P7 T& d9 q p
//操作,現在開關必須連接到Vcc代替地面。這也掀的意思
o/ V4 v% @0 {//反銷Grbl設置,一個倒置的設置現在意味著用戶應該連接
% N- o( T& u+ N& V8 b//常開開關,反之亦然。
z1 L1 l% ^; {0 k( E8 d+ G/ g0 C9 w//注意:所有針與功能被禁用,例如XYZ限制針,而不是單獨的軸。5 g$ D$ A, c; G- p0 S8 G
//警告:引體向上被禁用時,這需要額外的布線與下拉電阻!3 b- [" U5 ^0 k4 Y" n
. v. ]( ?% Z2 e9 D& n) O
//#define DISABLE_LIMIT_PIN_PULL_UP //以下選項禁用內部上拉電阻
; I: p/ e, j6 \" Q2 X//#define DISABLE_PROBE_PIN_PULL_UP5 a' h1 T& L* \
//#define DISABLE_CONTROL_PIN_PULL_UP, z. O$ R, @9 Z; h. F1 i
3 F1 h8 ?& Q. N9 y/ d) b* s
// Sets which axis the tool length offset is applied. Assumes the spindle is always parallel with % b5 _; L* E* R
// the selected axis with the tool oriented toward the negative direction. In other words, a positive* t; w- i& [; I% V( m- _
// tool length offset value is subtracted from the current location.
, h' o$ x3 r y% U+ B6 N! A//設置哪個軸長度補償應用的工具。假設軸總是與7 X, S/ u: |, t& v* f) e, Y! `+ A
//選擇軸工具面向負方向。換句話說,一個積極的
1 E% O' s1 j, P ]7 o. q( ~//工具長度偏移值減去從當前位置。
9 Z/ g2 n( L9 ], `( c% d. b# P- M: o' c
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.設置哪個軸長度補償應用的工具- J o' B* J, X2 e
4 C( W* [% e( m5 S/ m" n// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
d6 G( J# s5 Y. T! D) v// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
1 m3 }& }/ R, s9 A ^/ Y5 X// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!2 t T- J/ s I4 J: H
// The hardware PWM output on pin D11 is required for variable spindle output voltages.
6 H, H' e0 r* h6 L8 N" q* ~//允許變量軸輸出電壓不同的轉速值。Arduino Uno,主軸
/ X9 R- f* `5 {3 e% k6 ~7 {; P//啟用銷將輸出5 v的最高轉速256中級水平和0 v時禁用。0 A: C4 I1 g9 ?& Q7 ^$ d) e' B8 `
//注意:重要Arduino凱澤本人!當啟用時,Z-limit銷這里和軸銷D12開關!5 a6 J8 T# \; c2 Y% C8 W; V
//硬件PWM輸出銷這里需要變量軸輸出電壓。
) x4 x9 Z- E* `5 \
( v+ n' q9 H% u9 K9 m! {! T#define VARIABLE_SPINDLE // Default enabled. Comment to disable.//允許主軸輸出電壓不同的轉速值! e8 Q( E3 j4 Y7 _. D; s3 i* h
, z5 s6 `" j0 I# v) \0 Y! a
// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
- u5 [* r7 f$ Y4 q) X$ l$ g% K: n// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
; V* E1 G. E0 }// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 10004 x! M- R7 E. I1 W9 f
// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands: - b/ e9 Z" b: r1 p6 `* D+ g1 S; |5 k! G2 w
// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled./ n" O j2 ^3 C# {5 \
//使用的變量軸輸出。這些參數設置最大和最小軸轉速
; j% s3 n7 O0 h$ \//“S”刀位點值對應于銷電壓的最大值和最小值。有256個離散和/ Q1 J ]% ?8 g9 `
//電壓平均分配箱主軸速度的最大值和最小值之間。所以對于一個5 v銷,10003 G: b. f6 c/ f3 Y+ G0 C
// max rpm,250分鐘rpm,主軸輸出電壓將為以下“S”命令:$ z5 q7 s! M: L/ v
// @“S1000 5 v,“S250”@ 0.02 v,“S625”@ 2.5 v(中檔)。銷輸出0 v時禁用。
+ X I6 N o7 I5 d. _5 F% G" ?7 H& W) o0 q0 k5 n
#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
6 e0 f( l @* ?2 @#define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM. a+ r1 R+ I# @& O0 @' K/ M
. o& J- P P) [9 X* x" K7 `6 p
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.( F# o2 y) \# E; w) I7 }. N
// When disabled, the PWM pin will still read 0V. Most users will not need this option, but it may be
1 I/ J1 M* y/ Z2 D6 m. m/ L# U; s// useful in certain scenarios. This setting does not update the minimum spindle RPM calculations. Any1 M$ Z+ i. @! x, m- V# y$ W: ^
// spindle RPM output lower than this value will be set to this value.8 G" v3 y7 ~6 _
//使用的變量軸輸出。這迫使PWM輸出最小占空比時啟用。
5 u6 k- @) A$ [8 y//當禁用,PWM銷仍讀0 v。大多數用戶不需要這個選項,但是它可能是
, o3 |* g% C, C% D1 D" K3 b' x//在某些情況下很有用。這個設置不會更新最小主軸轉速計算。任何# ?4 t9 U$ I5 `- W. \' u
//輸出軸轉速低于這個值將被設置為這個值。
1 o! H5 {1 K! e8 ]" J- C0 b% C9 v+ N- Q; T
// #define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable. Integer (0-255)2 V7 n: I2 K$ ]2 Z
" M3 v5 \" a/ ] j
// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help * \- B% z! S* i, k& p
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
6 B9 i+ H I! g' [# X; `// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11. / |: t1 ?0 \- ^ l }
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
* W$ g4 ^/ e% D! P3 m// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.
; C. B) h8 O9 \: f, j" {+ u5 _// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
2 d; V: X# w' b# A// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
4 n# C, T5 T5 x: }* T// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!, Z7 {% I" ], L7 ^& [9 Q
//默認ATmega328 p(Uno),Grbl結合變量軸PWM和使到一個銷的幫助* ?6 T; B. n" Z# \% J# }0 S0 z
//保存I / O管腳。對于某些設置,這些可能需要單獨的別針。這個配置選項使用
: d$ e6 [* K8 a) I+ F9 q//方向軸銷(D13)作為一個單獨的軸銷上啟用銷以及主軸轉速PWM這里。
& x; d7 m3 ?, [: A, q//注意:該配置選項僅適用于VARIABLE_SPINDLE啟用和328 p處理器(Uno)。$ A- F, Z% }1 Y# _* q/ a/ t
//注意:沒有方向銷,主軸順時針M4刀位點命令將被刪除。M3和M5仍然工作。- _7 Z: l' z5 L% g( p
//注意:小心!Arduino引導裝載程序切換D13銷的權力。如果flash Grbl4 o8 \* Y5 ]# y- S+ T( z
//程序員(您可以使用一個備用Arduino“Arduino ISP”。搜索網絡如何線),
7 M; c; z# j* F- g* p* `//這D13導致切換應該消失。我們還沒有測試這個。請報告將會怎樣!
5 Z7 M- c$ E3 x5 a5 d$ `3 ~9 D; p8 N8 J, K Z
// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.: @5 S& G9 ]/ m0 r
$ Q0 Z9 r" G9 [: j
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces
5 g. N+ }6 v# u' T! f// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be $ b. Z3 C; t3 C9 a* G1 k
// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user / ]' A: D$ a( k! q$ O# Y0 C, q
// sendss the line 'g1 x1.032 y2.45 (test comment)', Grbl will echo back in the form '[echo: G1X1.032Y2.45]'./ J+ ~2 }# i( x& C3 T
// NOTE: Only use this for debugging purposes!! When echoing, this takes up valuable resources and can effect
/ z* n+ M# ^! v5 s// performance. If absolutely needed for normal operation, the serial write buffer should be greatly increased
5 M8 {2 H* e* P& k6 Y) d% ]// to help minimize transmission waiting within the serial write protocol.
3 c5 f h( Z" a1 ^1 D( y( z( l( V: T6 U' X+ e
//啟用,Grbl發回的回聲線已收到,已預編譯(空間, W' l7 Q8 r0 d- w$ j
//移除,大寫字母,沒有評論),由Grbl立即執行。回聲將不會- E& P0 l, F. ]/ W4 @
//發送一個線緩沖區溢位,但應該對所有正常線路送到Grbl。例如,如果一個用戶
' `, O7 [) Z: z3 c5 _1 t4 I//發送線的g1 x1.032 y2.45(測試評論)形式”,Grbl將回聲”(回聲:G1X1.032Y2.45]”。
) A# l; G% o' q: J//注意:只使用這個調試! !當呼應,這占用了寶貴的資源,可以影響
/ E4 Q+ y1 v* ?" x- w$ j4 {+ r7 A//性能。如果正常運行所需的絕對,串行寫入緩沖器應該大大增加
0 R6 W) ^! n: T//幫助最小化傳輸等系列內寫協議。
% y. \( [ n9 U$ M" L
, F+ B: c) `8 H. M" C// #define REPORT_ECHO_LINE_RECEIVED // Default disabled. Uncomment to enable./ K7 P: t0 L4 O1 S
! |6 W( i: B/ { a1 V* l8 z// Minimum planner junction speed. Sets the default minimum junction speed the planner plans to at
8 F- x! R9 o5 X# r; _// every buffer block junction, except for starting from rest and end of the buffer, which are always+ l2 E9 z q' t0 [0 S" q
// zero. This value controls how fast the machine moves through junctions with no regard for acceleration
8 j$ t6 n# ~3 z9 S; A" T2 ^; B// limits or angle between neighboring block line move directions. This is useful for machines that can't" z. u' I7 {/ N% \2 R9 i
// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value
: D- _% L, Q* h! |# t// should not be much greater than zero or to the minimum value necessary for the machine to work.
) l# `& L# I! M3 v
0 k1 d3 ?* I/ F//最小規劃師結速度。設置默認最小連接速度規劃計劃
6 P2 d3 }# n& n* l$ G, K, X//每一個緩沖塊接頭,除了從結束休息和緩沖區,它總是$ o/ P# X. ^" o m8 T# M
// 0。這個值控制機器的速度穿過路口,沒有考慮加速度
( k$ c! n4 ~5 g" q7 v: {+ C//限制或相鄰塊之間的角線方向移動。這是有用的機器,不能
0 T' ?- f: v8 s( x7 C1 B//容忍工具居住某一剎那,即3 d打印機或激光切割機。如果使用這個值" T1 C9 `" N0 \1 R6 B% s
//不應大于零或機器工作所需的最小值。
5 f9 E8 \ T$ E
& `& T! c6 q% q5 t; |- s#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min)
( O) }/ \/ o. K4 ^6 w7 D) C3 u4 C8 r" e9 C9 [
// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum; T4 i# P+ J- |& U/ Q. u
// value. This also ensures that a planned motion always completes and accounts for any floating-point
& ^+ J, G2 J3 g, [6 k' E// round-off errors. Although not recommended, a lower value than 1.0 mm/min will likely work in smaller
' v3 k) C9 ^4 d// machines, perhaps to 0.1mm/min, but your success may vary based on multiple factors.
9 Z2 x7 P) N5 t. b0 {- }2 e//設置計劃將允許的最小進給速率。任何價值低于它將被設置為最低值。這也保證了運動計劃總是完成,占任何浮點
6 @) I- u. Q3 `0 p1 c$ H1 K, v//舍入錯誤。雖然不推薦,價值低于1.0毫米/分鐘可能會在較小的工作 u- p7 `8 Y6 v/ K
//機器,也許到0.1毫米/分鐘,但你的成功基于多種因素可能會有所不同。# b& \$ o0 V1 j' L) ]9 w7 r" w
( T7 f2 n9 E) w2 e5 q) g
#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設置計劃將允許的最小進給速率
% {/ S% x. K, p2 q) m& M6 m; h, O: O: I# K
// Number of arc generation iterations by small angle approximation before exact arc trajectory 3 ~0 S# z6 k3 Q: |! z
// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there
0 y: _" q8 k& V' |: ^4 O* r9 m) X// are issues with the accuracy of the arc generations, or increased if arc execution is getting
( j6 m7 W0 H( N// bogged down by too many trig calculations.
6 c+ T1 U/ H$ e$ P; R//弧生成迭代次數之前小角度近似精確的弧線軌跡
4 N. K9 Q' U- C* e' i; B3 [//修正與昂貴的sin()和cos()calcualtions。如果有這個參數可能減少( G, r w( r8 G4 ^( c
//與弧一代又一代的準確性問題,或如果電弧執行得到增加7 q3 {) F; f5 a, M
//太多的三角計算的泥潭。: e: q# g% I3 i' T3 ]# o9 D
. a! k+ F R# b _8 ^/ M#define N_ARC_CORRECTION 12 // Integer (1-255)/ Z0 U1 O- H, I' ?
, M S! m6 ]. D9 i// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical 3 L/ ^6 \- L4 V& s! a5 D- }9 J# O
// errors when arc at semi-circles(pi) or full-circles(2*pi). Offset-based arcs are much more accurate
8 F( V3 T# q( p// but still have a problem when arcs are full-circles (2*pi). This define accounts for the floating
& u+ E8 Y$ R% H// point issues when offset-based arcs are commanded as full circles, but get interpreted as extremely
5 K4 K# y# |2 V9 m// small arcs with around machine epsilon (1.2e-7rad) due to numerical round-off and precision issues.0 M/ Z) v6 y! [* T; c. s% B8 L
// This define value sets the machine epsilon cutoff to determine if the arc is a full-circle or not.0 |) S: g0 K, l: d. A7 X) S
// NOTE: Be very careful when adjusting this value. It should always be greater than 1.2e-7 but not too/ r% J; U; M3 @( v; y A
// much greater than this. The default setting should capture most, if not all, full arc error situations.
4 l6 j$ O* v0 z9 [3 I( ?) C//弧G2/3刀位點的標準定義是有問題的。Radius-based弧有可怕的數值4 F$ L6 j4 P% } z
//錯誤當電弧在半圓(π)或原點(2 *π)。Offset-based弧更準確) h7 E- C" F9 m9 H9 [
//但仍有一個問題當弧原點(2 *π)。這個定義占浮動
" d1 d: y6 j" a( p: H0 \+ F) M' A7 m//當offset-based弧吩咐點問題完整的圓,但解釋為極
$ m$ d5 i+ W0 e6 B. f" Q9 Z//小弧機周圍ε(1.2 e-7rad)由于數字舍入和精度問題。
, c Z- T0 F+ W# z; L//定義值設置機器ε截止來確定電弧是一個原點了。: g4 {0 ^8 N6 W3 `; r7 K+ D" y2 A
//注意:調整這個值時非常小心。它應該總是大于1.2 e -但不要太" u. H% w- }, e
//比這大得多。默認設置應該捕獲大部分,如果不是全部,全部錯誤的情況。
0 K n+ y+ [7 [( |/ ^5 i
- N1 e! G" @# E% R$ [#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)
+ m* `+ C8 M' p9 J8 }8 ^9 p7 u! q1 f; x; W0 E" ~
// Time delay increments performed during a dwell. The default value is set at 50ms, which provides0 {7 u( |+ t% ]& X
// a maximum time delay of roughly 55 minutes, more than enough for most any application. Increasing" X8 V3 Z. o9 e/ g2 i2 o$ p; v
// this delay will increase the maximum dwell time linearly, but also reduces the responsiveness of
4 f: h# \8 u W) o2 z$ o) k// run-time command executions, like status reports, since these are performed between each dwell ' W" T( l" w* X3 ]/ a+ o0 e
// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.
( S, S6 L% b) {/ N//延時增加表現在住。默認值設置為50毫秒,它提供了) w6 n0 K/ ]; T1 d* {6 r. _+ {
//最大延時約55分鐘,足夠對大多數任何應用程序。增加( \2 {# ]: [2 ~
//這種延遲將增加線性最大停留時間,也減少了響應能力
) [6 \' j8 Q+ {0 w; |% }6 ], L//運行命令執行狀態報告一樣,因為這些每個住之間執行, u- h4 c' u! v+ f0 ^7 x
//時間步。還有,記住,Arduino延遲計時器不是很準確的長時間延誤。) I* C9 ?, W1 D; J/ _
& a% c9 z+ ~2 h7 E4 T! l#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
4 r+ ~, y8 c: e' A& ?+ x- q
3 N) u# l1 d# M# V// Creates a delay between the direction pin setting and corresponding step pulse by creating
8 M1 C0 \; J& h! O$ X& r) {// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare)
$ _6 x) u! k- d T! Z1 \* }: \// sets the direction pins, and does not immediately set the stepper pins, as it would in
: s, y% V/ v5 ]// normal operation. The Timer2 compare fires next to set the stepper pins after the step & v8 c+ x3 F) @- r0 b f) h
// pulse delay time, and Timer2 overflow will complete the step pulse, except now delayed
2 p0 _5 b M5 W5 `& T// by the step pulse time plus the step pulse delay. (Thanks langwadt for the idea!)
& p) E3 U" ?4 C) V( D6 _( s- |/ R h' `// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the
0 l" C1 Q: ~; w- Z r, R// user-supplied step pulse time, the total time must not exceed 127us. Reported successful& ~2 M/ ^% l* ?) _
// values for certain setups have ranged from 5 to 20us., T# P6 D7 O3 R/ ^+ {. Y- w
//創建一個方向銷之間的延遲脈沖通過創建設置和相應的步驟' ?. S& O& d M1 g u0 Z0 j5 e
//另一個中斷(Timer2比較)來管理它。主要Grbl中斷(Timer1比較), W `" }1 O& U! G3 V% W% t
//設置方向針,不立即設置步進針,因為它會在/ S( m3 N2 `& b. b" D$ u) {0 r
//正常操作。Timer2比較火旁邊設置步進針后一步
. f# ^' U9 i5 S l" B# |//脈沖延遲時間,Timer2溢出脈沖將完成的步驟,現在延遲除外
! e7 q* e0 h0 Y& m7 g: M$ c. \//脈沖時間加上的一步一步脈沖延遲。(感謝langwadt主意!)
2 D2 @1 Z, F5 g# z7 o. Q! G//注意:取消啟用。必須> 3,建議延遲,當添加的$ m6 C d+ j' z
//用戶提供的步驟脈沖時間,總時間不得超過127美元。成功的報道
W$ \. L/ y5 }//值對某些設置范圍從5到20。5 @& Z% |/ d" i5 \5 ?1 V
7 r0 r) G- F5 O/ ` ^, e
// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
5 C! ~/ y( `' H
8 Y# C6 G0 M! \% g// The number of linear motions in the planner buffer to be planned at any give time. The vast
- D6 @0 h( T) T0 \ a! t, f: D# I// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra
- H8 ?0 k: z) i! i6 p2 G+ y// available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino
' w: Q0 T5 A( x! _! d" z" w// begins to crash due to the lack of available RAM or if the CPU is having trouble keeping/ ^" u" ]2 ]% h+ U$ K$ b8 c# v+ I
// up with planning new incoming motions as they are executed. ) W# y# \6 O: u% U+ C* e
//線性運動規劃師緩沖區的數量在任何給出時間計劃。絕大
, F1 Z- S; `: f" r' q" J6 n W//多數RAM Grbl使用基于這個緩沖區的大小。如果有額外的只會增加
) j, K5 R4 \/ j! T" Z: H//可用內存,比如當基于大型或Sanguino。如果Arduino或減少
1 u) c+ d/ a/ n+ s% J7 B* _//開始崩潰由于缺乏可用的RAM或者CPU是難以保持1 a& M2 v4 w4 J; l9 u+ F# T0 e
//與規劃新傳入的動作執行。
; A+ m% N0 ^6 d
8 i* t- u7 G9 ^& o5 {/ v// #define BLOCK_BUFFER_SIZE 18 // Uncomment to override default in planner.h.
3 r0 f3 g. B1 X1 C- T
$ Y1 X# T. [# K- I; _// Governs the size of the intermediary step segment buffer between the step execution algorithm" U/ {7 z9 X- |1 s
// and the planner blocks. Each segment is set of steps executed at a constant velocity over a, J, `: `1 x8 \: x
// fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner
2 \2 j. y& P' \" z, {( K! L// block velocity profile is traced exactly. The size of this buffer governs how much step
: V( J7 |0 }! `+ o. Y% A* I// execution lead time there is for other Grbl processes have to compute and do their thing
2 d1 V/ k7 L) ^9 W2 s// before having to come back and refill this buffer, currently at ~50msec of step moves.1 }* V/ c/ l. D- p3 B
//控制之間的中間段緩沖大小的步驟執行算法
! y" r# H$ Q5 y//和規劃師塊。每一部分的步驟執行在一個恒定的速度
2 b+ X3 ^+ _: v7 S$ J- S//固定的時間由ACCELERATION_TICKS_PER_SECOND定義的。他們計算的計劃
; _2 K( P1 Q( s# v. o//塊速度剖面追蹤到底。這個緩沖區的大小控制多少步驟9 p9 C6 u' E0 j, a) t6 O
//執行時間有其他Grbl過程需要計算和做他們的事情
9 q$ o9 |# A+ S( k//之前必須回來重新填充這個緩沖區,目前移動~ 50毫秒的一步。: j$ L& y5 j: ?3 Z
6 p% N3 [. _6 c$ G. u
// #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h.
& P/ ?$ g {& H; f# Z& ~) W$ l. _
* _) K2 i# g9 A// Line buffer size from the serial input stream to be executed. Also, governs the size of
0 I6 E Q5 w4 v& H; f. x. U! I9 h. b// each of the startup blocks, as they are each stored as a string of this size. Make sure+ d' y* y3 _9 ]" t
// to account for the available EEPROM at the defined memory address in settings.h and for+ K8 S" ~+ t5 B1 H5 G* ]9 Q
// the number of desired startup blocks.
_, Q' l" k" u8 n, B* ^: w" X1 w+ R// NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size * [3 g. V2 e* j; b5 E! O
// can be too small and g-code blocks can get truncated. Officially, the g-code standards
6 [$ q2 g7 O e3 U// support up to 256 characters. In future versions, this default will be increased, when
; p# u7 O8 _6 E1 F: j// we know how much extra memory space we can re-invest into this.
, b. l/ [* G& _9 q7 G3 v//行執行串行輸入流的緩沖區大小。同時,大小的控制
* c0 s( W" x; j$ f//每個啟動模塊,它們分別存儲為字符串的大小。確保
& \. T/ s) b. r7 {//占可用eepm定義內存地址的設置。h和& A* P; e" J7 l# K
//需要啟動塊的數量。
. j' R$ ]6 H6 U//注意:80個字符不是一個問題,除了極端的情況下,但線緩沖區大小0 g4 r: |& j u8 H& _6 i
//可以太小和刀位點塊可以截斷。正式,刀位點標準
9 E0 ^- _+ ^2 [9 _( |. g* e: c//支持多達256個字符。在未來的版本中,這個違約將會增加,當2 O1 y) z/ U$ @) g$ ` `
//我們知道多少額外內存空間的時候我們可以再投資。
7 [) \9 G- }" w* |7 T% }% u& k8 F
4 r1 w$ u6 D! n/ O. \9 h// #define LINE_BUFFER_SIZE 80 // Uncomment to override default in protocol.h
4 ?0 g+ F# ]7 Y. ]/ N Y
0 W- ~0 o! m1 ]" N6 A// Serial send and receive buffer size. The receive buffer is often used as another streaming& q1 q+ @3 ` {/ l7 O
// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming
, q5 b1 R8 h# Z/ p2 B/ q// interfaces will character count and track each block send to each block response. So, 6 F0 u; r: i0 @8 S; j
// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
. `) S! v) y/ l4 Z- u$ x// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
0 D7 J2 |1 M1 I! k// messages are sent and Grbl begins to stall, waiting to send the rest of the message.
: |3 s$ T1 W' [- K// NOTE: Buffer size values must be greater than zero and less than 256.
! |, B, ]$ A. Z; {" }. z0 \* F( P// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h* A! q4 M* e& ?4 e$ U
//串行發送和接收緩沖區大小。接收緩沖區通常用作另一個流
1 L2 u, N0 H* i+ b. x- u* Q//緩沖存儲傳入的塊來處理Grbl當它準備好了。最流
8 Q( W; {, I# i7 W& p% r//接口將字符計數和跟蹤每一塊發送給每個塊的回應。所以,' Z; g9 t! ^+ Y- k
//增加接收緩沖區如果需要更深層次的接收緩沖區為流,、
8 ?" n- U: }1 K( {9 ]% J7 g$ c) c//內存允許。Grbl發送緩沖主要處理消息。只會增加如果大
; U* D, J( W( ]//消息發送和Grbl開始停滯,等待發送其余的消息。
7 ^# w2 F# A, s, [# j5 A2 y9 z5 f//注意:緩沖區大小值必須大于零,小于256。
, G7 H6 p" \! ^// # define RX_BUFFER_SIZE 128 / /取消serial.h覆蓋默認值
6 P2 ]6 t# N* F# l. e
0 ?3 _7 }; \3 M- I# e/ x* N; ~
% p2 p6 a* f6 x/ t, x* _, t// #define TX_BUFFER_SIZE 64
# M8 Z z+ H5 C8 D 6 i" \. \/ V/ i8 ]7 r7 z- i
// Toggles XON/XOFF software flow control for serial communications. Not officially supported
$ p& ]7 G' ~% {( K// due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware
: p, a9 e: ~3 x3 G: q! t// on these chips do not support XON/XOFF flow control characters and the intermediate buffer
, O/ l* c! S/ \" b* u. F# Z// in the chips cause latency and overflow problems with standard terminal programs. However,
( r) {. `# W8 F7 P3 ~5 K8 ^1 T/ _// using specifically-programmed UI's to manage this latency problem has been confirmed to work.4 l' z* y& s3 K+ V
// As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard
# n; d, ^( e* E9 H B" r$ N// terminal programs since their firmware correctly manage these XON/XOFF characters. In any
f% ^ h: J! N' @8 O" C2 g! N) I// case, please report any successes to grbl administrators!- e$ h5 D6 U0 m, K0 y' J/ C
//切換為串行通信發送樸通/發送葡開軟件流控制。不是官方支持
( _1 L$ N2 _5 `2 k7 Q( O( \# E//由于問題涉及Atmega8U2 USB-to-serial當前arduino芯片。固件
; s$ j6 z/ g' t: W) o2 k4 S6 t//在這些芯片不支持發送樸通/發送葡開流控制字符和中間緩沖區
( _1 @5 ~( m1 J5 n: x8 c- A& d//芯片導致延遲和溢出問題的標準終端程序。然而,
# W) y+ f/ o4 U( i" l$ U//使用specifically-programmed UI的管理這個延遲問題已經確認工作。
' g$ X4 I) Z4 }//以及老FTDI FT232RL-based arduino(Duemilanove)是已知的標準
]8 K/ H7 k1 r9 k: G* C0 L' A% s9 c//終端程序因為他們正確的固件管理這些發送樸通/發送葡開的角色。在任何6 v7 J/ N1 O. B6 P: r' k4 t `
//情況,請報告任何成功grbl管理員!1 s ?% k }3 U$ h$ t( x
4 s0 t; x& o2 w' l% e- Z4 y
// #define ENABLE_XONXOFF // Default disabled. Uncomment to enable.
: b0 J6 b3 ?7 n& ?0 Q7 S) U m: Y/ T1 I
// A simple software debouncing feature for hard limit switches. When enabled, the interrupt
4 D# R7 V( B: Y) @3 L* ]% x// monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check 2 w- ]5 P4 w6 c, O, |% v* {
// the limit pin state after a delay of about 32msec. This can help with CNC machines with
7 d4 ?; r1 L7 N// problematic false triggering of their hard limit switches, but it WILL NOT fix issues with
, M- B; r+ l$ t// electrical interference on the signal cables from external sources. It's recommended to first4 J4 G2 B7 R6 @" ?& f) ^
// use shielded signal cables with their shielding connected to ground (old USB/computer cables
9 |9 N$ c2 ]; ^* p# i# y// work well and are cheap to find) and wire in a low-pass circuit into each limit pin.
% Z) s1 t v/ n7 j! w//一個簡單的軟件消除抖動特性硬限位開關。當啟用時,中斷
) O# Z! x: V) P& ]//監控硬限位開關針將使Arduino的看門狗定時器重新審視
: t+ G9 x4 B* p* d( s' x% C9 ?//銷的極限狀態后約32毫秒的延遲。這可以幫助與數控機器: v. [7 y" D# Y6 i/ H
//問題錯誤引發的硬限位開關,但是它不會解決問題6 ?. s/ u: y( y
//電干擾信號電纜從外部來源。首先它的建議
3 A- E- y+ c ^! ~* d5 A2 X//使用屏蔽信號電纜的屏蔽連接到地面(老USB /計算機電纜
+ B; Z B7 _- t! P//工作得很好,很便宜)和線低通電路到每個限位銷。
. t. u3 S1 z( u1 { T- K- M9 Z
- t! x, U: e6 y. G// #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable.- s2 F2 i) V G- p R& ]: F4 t0 y
f" Q& r2 Q( a6 a4 U2 z
// Force Grbl to check the state of the hard limit switches when the processor detects a pin1 A! I$ r8 N4 e( p6 H# f/ l" t0 i1 x
// change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits
- C+ Z; I! l# F( |// alarm upon any pin change, since bouncing switches can cause a state check like this to
4 G: N5 _* G: F8 b, l7 N3 L; c0 W// misread the pin. When hard limits are triggered, they should be 100% reliable, which is the/ M5 h; I- e, i( a
// reason that this option is disabled by default. Only if your system/electronics can guarantee
\ m' Q. p& L8 p) I. i5 ] t// that the switches don't bounce, we recommend enabling this option. This will help prevent
8 |/ ~' e& y3 [5 J/ k// triggering a hard limit when the machine disengages from the switch.7 C! m) _* F) l
// NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled.
% v% y0 r1 `/ k+ L ~% g6 D//力Grbl檢查硬限位開關的狀態,當處理器檢測到一個銷
* q& Z! [; D7 t: g! ?//改變內部硬限制ISR例行公事。默認情況下,Grbl將觸發硬限制 c. T" [% b- n3 | O
//報警在任何銷更改,因為跳開關可以導致這樣的狀態檢查
( f0 ?/ K& B/ \//誤讀了銷。硬限制觸發時,他們應該100%可靠,這是
6 [/ S( L K$ z* [# b o: j//原因,這個選項默認是禁用的。只有在你的系統/電子產品可以保證
' N" N) `. D# S3 `/ s; g//開關不反彈,我們建議啟用這個選項。這將有助于防止
! S0 {: o# o F7 N//觸發機退出時硬限制開關。; t/ C& C0 S* J" ~
//注意:這個選項如果啟用了SOFTWARE_DEBOUNCE沒有影響。
: a/ @% u6 V5 H5 Q3 n R$ V& I, O5 h8 O/ s$ I
// #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable.- p2 l; T. ?. ^4 q) E
8 ~ B) b8 P. X* _$ S
' ]( _7 W; [( O# G+ f# [- y v9 A+ c+ D
// ---------------------------------------------------------------------------------------$ d* h. `% z: N3 d' s' k# k2 l! _8 O
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時錯誤檢查的定義值:
5 R) j. q- B( p4 T4 q4 G
* e4 m2 X F2 P& t#ifndef HOMING_CYCLE_0
! {) j* B W! i! M' ^5 U5 u #error "Required HOMING_CYCLE_0 not defined."
; D& D8 O/ v) v7 {, a0 @! W* @#endif* W2 R" h& Q1 B5 ~; {
) E6 v3 ^- j! }2 d& O) b#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)6 n8 v( \: Y' h( ?4 Q
#error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
1 w! u! D8 C( u! m" u#endif
0 h2 {+ W* D! B1 O6 x, O: m
( V$ w; Z/ }1 T8 V4 D5 [0 J#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
: O- C5 G6 Q2 v8 G$ @ #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
/ {8 _, i6 d+ c' z4 j/ l E#endif. z3 ?! B; b" Q' H
! t$ F6 s/ J5 t" H9 |! S// ---------------------------------------------------------------------------------------' H5 e# ^+ e- V* w+ T0 c& ^- i* w* P/ l
6 M' x- w7 I0 n. ?+ ` ?$ b' q& l9 h
; w c8 }9 @8 n0 m8 n1 }9 |5 a#endif9 I' F% W: U9 T+ F5 H
2 [" B3 a' n+ u6 ?; @$ N& T0 q& G
' B) `9 Y _' F U" e: u" ~/ E; R$ {4 h+ k+ S; e
& D T s' I- q+ W! e$ x) u1 R& G* v: T) ^+ t
8 O5 ] K2 b- |# [- v7 A3 x; {4 C: d
' k. b4 @1 e' ?
6 B1 ^$ |/ ^% w
$ c2 Z' E/ Y1 {& I4 }) [
( J5 b* S$ V) b) r/ m! s4 T
t$ ]4 v/ V7 ?5 Z% r4 d( a% v
3 c* L* I6 k/ _1 T
+ @+ B2 {( Z* e! |$ I6 ?( r& U+ M; h/ l* b* n
|
本帖子中包含更多資源
您需要 登錄 才可以下載或查看,沒有賬號?注冊會員
×
評分
-
查看全部評分
|