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