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