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