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