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