七七影院色七七_免费观看欧美a一级黄片_亚洲综合久久久久久中文字幕_国产999999在线视频免费观看,国产小视频无码,国产精品亚洲日日摸夜夜添,女人高潮潮叫免费网站,久久影院国产精品,日韩成人在线影院,欧美囗交XX×BBB视频,色在线综合高清

機(jī)械社區(qū)

標(biāo)題: 單片機(jī)MCP制作數(shù)控雕刻機(jī)3D打印機(jī) [打印本頁]

作者: 1五湖四海1    時(shí)間: 2016-8-20 23:56
標(biāo)題: 單片機(jī)MCP制作數(shù)控雕刻機(jī)3D打印機(jī)
本帖最后由 1五湖四海1 于 2016-8-21 00:09 編輯 5 H: t% o  _) z. v( c/ Y: O6 A
9 K9 ~% Q- x3 a. ~
    以前制作過CNC雕刻機(jī),,是用MACH3作為上位機(jī)控制,,硬件是采用PC接并口輸出脈沖和方向使能信號經(jīng)過隔離驅(qū)動(dòng)步進(jìn)電機(jī)驅(qū)動(dòng)器,,步進(jìn)電機(jī)驅(qū)動(dòng)是采用TB6560芯片控制,。最后就接到步進(jìn)電機(jī)。機(jī)械是用鋁合金制作,主要部件有三個(gè)1605的滾珠絲杠,,多個(gè)運(yùn)動(dòng)滑塊等制作,。用這臺DIY CNC雕刻機(jī)可以雕刻木頭塑料等東西,。當(dāng)時(shí)沒有一直玩下去,現(xiàn)在發(fā)現(xiàn)網(wǎng)上有用單片機(jī)制作的雕刻機(jī)挺精巧的現(xiàn)在分享給大家,。
4 h" b! v% N$ k7 A6 W   GRBL CNC 3D打印機(jī),,這就是我說的可以用單片機(jī)來控制的3D打印機(jī),我先照著百度科普下grbl,,Grbl是性能高,,成本低,基于并口運(yùn)動(dòng)控制,,用于CNC雕刻,。它可以運(yùn)行在Vanilla Arduino (Duemillanove/Uno) 只要它配備了Atmega 328型芯片,。 控制器由C編寫并優(yōu)化,利用了AVR 芯片的每一個(gè)靈巧特性來實(shí)現(xiàn)精確時(shí)序和異步控制,。它可以保持超過30kHz的穩(wěn)定,、無偏差的控制脈沖 它接受標(biāo)準(zhǔn)的G代碼而且通過了數(shù)個(gè)CAM工具的輸出測試�,;⌒�,、圓形和螺旋的運(yùn)動(dòng)都可以像其他一些基本G代碼命令一樣完美支持。函數(shù)和變量目前并不支持,,但是會(huì)作為預(yù)處理器包含在將來發(fā)布的版本之中,。 Grbl 包含完整的前瞻性加速度控制。它意味著控制器將提前16到20個(gè)運(yùn)動(dòng)來規(guī)劃運(yùn)行速度,,以實(shí)現(xiàn)平穩(wěn)的加速和無沖擊的轉(zhuǎn)彎,。Grbl是性能高,成本低,,基于并口運(yùn)動(dòng)控制,,用于CNC雕刻。它可以運(yùn)行在Vanilla Arduino (Duemillanove/Uno) 只要它配備了Atmega 328型芯片,。 控制器由C編寫并優(yōu)化,,利用了AVR 芯片的每一個(gè)靈巧特性來實(shí)現(xiàn)精確時(shí)序和異步控制。它可以保持超過30kHz的穩(wěn)定,、無偏差的控制脈沖 它接受標(biāo)準(zhǔn)的G代碼而且通過了數(shù)個(gè)CAM工具的輸出測試�,;⌒�,、圓形和螺旋的運(yùn)動(dòng)都可以像其他一些基本G代碼命令一樣完美支持。函數(shù)和變量目前并不支持,,但是會(huì)作為預(yù)處理器包含在將來發(fā)布的版本之中,。 Grbl 包含完整的前瞻性加速度控制。它意味著控制器將提前16到20個(gè)運(yùn)動(dòng)來規(guī)劃運(yùn)行速度,,以實(shí)現(xiàn)平穩(wěn)的加速和無沖擊的轉(zhuǎn)彎,。很棒吧!開始玩起,。) `  X  F- D( Q, x' V2 U1 N
    還沒有雕刻機(jī)的機(jī)械部分可以用廢舊光驅(qū)制作個(gè)微型雕刻機(jī)運(yùn)動(dòng)平臺,。雕刻機(jī)最重要的是主控程序這次用 Arduino/AVR328單片機(jī),價(jià)格在15元左右,,主控程序是上面提到的目前很火的開源
的GRBL,,還有一種基于STM32平臺的開源主控程序Dlion也不錯(cuò)可以替代grbl。如果從性能比較這兩個(gè)方案,,顯然是stm32平臺運(yùn)行速度更快畢竟他是32單片機(jī)呀,!9 B1 W, @$ x( }/ U' _, U5 ^6 w! ^
3 `: \' W$ w# o; b

! v- g! a4 b; r6 a: V    下面介紹小這個(gè)些主控程序主要干的事,,通過串口PC和主控板通訊,PC命令給控制板,,控制板接收命令做不同的響應(yīng),,PC可以發(fā)G代碼給主控板,接收完成后可以自動(dòng)開始雕刻任務(wù),。
3 b- \; ?" Q" m7 G5 R          在介紹下G代碼因?yàn)镚代碼是雕刻機(jī)的核心部分
% u8 r3 r$ ^, @* ?' N# I' TG代碼是數(shù)控程序中的指令,。一般都稱為G指令。
- S, {8 i; i  K: y% w- CG00------快速定位
' J, Z2 ^) [' @7 Y3 |G01------直線插補(bǔ)- ]9 ~0 _8 B- x7 c# [. `3 u
G02------順時(shí)針方向圓弧插補(bǔ)" ]4 o) J5 ]) x. n
G03------逆時(shí)針方向圓弧插補(bǔ)
' t3 O! M: E: r9 x" qG04------定時(shí)暫停' ~* Z6 U2 s- ]( g0 C
G05------通過中間點(diǎn)圓弧插補(bǔ)* a, z. a5 x( c. E( H" \
G06------拋物線插補(bǔ)
  @" b) @$ Y, A+ `! [' L; p4 d' XG07------Z 樣條曲線插補(bǔ)
, |' R3 h2 `' P7 J% YG08------進(jìn)給加速
: T, j- P1 P- KG09------進(jìn)給減速3 v6 @5 c/ V, i! n- L
G10------數(shù)據(jù)設(shè)置! K6 Z$ }" f; e7 P7 ]- p
G16------極坐標(biāo)編程
8 m! R3 m  S8 C. k2 GG17------加工XY平面
, J6 n7 B& J7 oG18------加工XZ平面
4 j8 d$ G( R0 }G19------加工YZ平面
" \( i. ?: |0 w2 ~
核心就是解析G代碼,,完成步進(jìn)電機(jī)驅(qū)動(dòng),,和控制主軸開啟關(guān)閉,還有插補(bǔ)算法,,直線插補(bǔ),,圓弧插補(bǔ),還有一些步進(jìn)電機(jī)的加減速算法,。
. w% C0 N: V9 Z, z5 ^% R+ i- Z. G下面對grbl主結(jié)構(gòu)做介紹7 j) G) `8 q' `9 Q; i
main()主函數(shù)首先執(zhí)行下面初始化函數(shù)0 z- a. ]% ~) ]1 o
        serial_init();                           // 設(shè)置串口波特率和中斷
- Z  @/ {% ~( p1 y2 R        settings_init();                         // 從ROM加載grbl設(shè)置/ k5 o1 R" c3 s3 y5 j" T
        stepper_init();                          // 配置步進(jìn)方向和中斷定時(shí)器
4 R! L' A4 C- v        system_init();                           // 配置引腳分配別針和pin-change中斷
8 T, p* U8 f! g3 v        memset(&sys, 0, sizeof(system_t));          // 清除所有系統(tǒng)變量4 a9 V% C! m9 u$ C" {  o0 q) k
        sys.abort = true;                           // 中止標(biāo)識位置位  @; b0 a, L& P
        sei();                                         // 使能中斷
# P/ X0 R- y* B2 ?6 j7 ?  #ifdef HOMING_INIT_LOCK                        // 宏運(yùn)算(settings.flags & (1 << 4)) != 0結(jié)果flags等于執(zhí)行sys.state = STATE_ALARM
$ }! ~+ p5 C& o0 Z& z5 u  ~                                                // 系統(tǒng)狀態(tài)賦值為報(bào)警狀態(tài)
2 j3 N9 d# a; R1 u            if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
8 C0 c: e  I1 F  #endif) M/ B$ O: z1 R$ _4 A. d
_____________________________________________________________________________________________________________________________________5 ^' D/ ?$ F2 r$ `4 }' I8 e
接下來是一些主要部分初始化
1 G* O. N3 x4 @$ rfor(;;) {/ m) |1 i9 Q5 R7 u3 {0 q
        serial_reset_read_buffer();         //清除串口讀緩沖區(qū)
; q. }$ w! F+ R  a        gc_init();                         //初始化G代碼功能函數(shù)
. t" G/ o& o  m8 o        spindle_init();                        //主軸初始化; v2 K9 N1 G2 z; S  a
        coolant_init();                        //冷卻液初始化
. U: P6 K7 ~/ `7 c; l/ Z        limits_init();                         //極限開關(guān)初始化( K4 g: F" s# Y9 G9 j1 J. s" R( h
        probe_init();                        //探測部件初始化
" y6 t& Q: S2 N& }/ v        plan_reset();                         //清除塊緩沖區(qū)和規(guī)劃師變量0 V. [: S4 N# ~" S. U
        st_reset();                         //清除步進(jìn)系統(tǒng)變量,。
$ v6 X8 w. r3 {4 f  l+ a7 k, R& b1 M% O, b! N
7 K# y8 @9 @& {, Y0 x1 c* R0 `
        //下面兩行清除同步gcode和策劃師職位當(dāng)前系統(tǒng)位置。/ d( N6 R0 _" j- B( ?: b+ R8 z  ]
        plan_sync_position();
" s' h' z( M8 ?6 ^6 T& G        gc_sync_position();: U0 `7 v9 O& D, n

$ w3 W4 ~1 A+ p5 ~$ D4 z& X$ G2 D9 q! s# ]1 c
        //復(fù)位系統(tǒng)變量
3 ]' y" k, l& D* x; p4 b) g3 D        sys.abort = false;                //系統(tǒng)中止標(biāo)志
0 v1 _' C7 B( \        sys_rt_exec_state = 0;                //系統(tǒng)標(biāo)志位變量狀態(tài)管理,�,?吹紼XEC位掩碼。
8 r: }  E* o9 C+ c        sys_rt_exec_alarm = 0;                //系統(tǒng)標(biāo)志位變量設(shè)置不同的警報(bào),。
6 @9 f* z. D4 J- Y( A        sys.suspend = false;                //系統(tǒng)暫停標(biāo)志位變量管理,取消,和安全保護(hù),。; f2 X, X  p% y' q3 n
        sys.soft_limit = false;                //限位開關(guān)限制狀態(tài)機(jī)錯(cuò)誤。(布爾)
0 y% O+ X7 g/ `" @
. _6 w- N$ o. T$ V/ o
) w* P6 u9 [4 ?) M$ }0 h        protocol_main_loop();                //主協(xié)議循環(huán)8 N- v1 w7 r6 g# y" [0 R
}        //
% [- ]% v; F1 v( _+ v0 [8 _* H_____________________________________________________________________________________________________________________________; S: y) D/ E9 d, {: N; D- q$ p- G
進(jìn)入void protocol_main_loop()函數(shù)
% @' Z' J! |3 w/ u- X2 F' _, M{
; s7 a0 j8 ^* N        report_init_message();                // 打印歡迎信息
, i3 p9 C! m- X% X- m# ~! q        //重啟后檢驗(yàn)和報(bào)告報(bào)警狀態(tài)如果錯(cuò)誤重啟初始化,。" m; r+ a! _* b- A$ J
        if (sys.state == STATE_ALARM) {
: r( P0 L& e# I            report_feedback_message(MESSAGE_ALARM_LOCK); //打印信息
" x" e$ o# i" N! l3 l# F
          } else {
0 k7 @! x: o, s- U            // 如果沒有報(bào)警說明一切正常!但還是要檢查安全門. # e" J3 t5 r$ k7 y! {! o! `
            if (system_check_safety_door_ajar()) {
& i* p( X0 h1 y                     bit_true(sys_rt_exec_state, EXEC_SAFETY_DOOR);4 _/ g! }) f# O' z0 j( C
                     protocol_execute_realtime(); // 進(jìn)入安全模式,。應(yīng)該返回空閑狀態(tài)。
5 s1 P6 @; P# T7 ^& y6 s' y            }         else {
, y* f2 c/ A0 K              sys.state = STATE_IDLE; // .設(shè)置系統(tǒng)做好準(zhǔn)備,。清除所有國家國旗,。
- t% G  ?7 F: @+ N/ p6 p            } 9 I3 s7 A: G; r6 \/ m
            system_execute_startup(line);    //開始執(zhí)行系統(tǒng)腳本
+ [6 O" T: T1 [8 G$ q  J( ]& O  } $ d  E! D% A. B1 A' i

! C8 k3 L8 l; g  T9 m/ V* m2 x4 ]7 a, Z4 k6 G* Z$ O! y; j
  // 這是主循環(huán)!在系統(tǒng)中止時(shí)這是出口回到主函數(shù)來重置系統(tǒng)。
4 L/ s% s4 w% M  // ---------------------------------------------------------------------------------  - Y0 F: p6 R0 N' x( n, p6 z* r& b
  
- u3 C  ]4 m* \' z+ q        uint8_t comment = COMMENT_NONE;
6 U8 _# N+ B0 ^5 _8 e        uint8_t char_counter = 0;
, Y2 b) a( f) r3 D" n9 P        uint8_t c;
  S. ~0 |" d7 [# ~7 S_______________________________________________________________________________________________________________________________
( C' v3 T; r" [接下來進(jìn)入for(;;)循環(huán)                //下面代碼是G代碼解析核心部分,,程序中comment(注釋)變量會(huì)被賦不同值,,代表發(fā)符號有‘(’‘)’‘;’- K& s2 G! |6 v8 u6 a. C
{. Q) W" Q! K3 N% f9 Y4 ]
//串行數(shù)據(jù)輸入一行的的過程,作為數(shù)據(jù),。執(zhí)行一個(gè)
% g2 j6 i8 y" k( H//所有數(shù)據(jù)初始過濾去除空格和注釋,。 4 o' }! n  x, d5 S+ X/ C( \: t$ o6 k' _
//注意:注釋,空格和程序段刪除(如果支持的話)處理技術(shù)
- d% d- D/ c4 D//在G代碼解析器,它有助于壓縮到Grbl傳入的數(shù)據(jù)
1 E5 B. r4 Y) ^# N% U# D* N//線緩沖區(qū),這是有限的。刀位點(diǎn)標(biāo)準(zhǔn)實(shí)際上州一行不行) n1 n( U) @" b3 {/ P
//不能超過256個(gè)字符,Arduino Uno沒有更多內(nèi)存空間,。  E( I, R+ u. x+ o
//有更好的處理器,它會(huì)很容易把這個(gè)初步解析的
0 ]/ _& K- |, a/ V//分離任務(wù)共享的刀位點(diǎn)解析器和Grbl系統(tǒng)命令,。                                                                ( A" N; n8 P, S+ q6 a6 m
    while((c = serial_read()) != SERIAL_NO_DATA) {                             //讀取串口數(shù)據(jù),有數(shù)據(jù)執(zhí)行下面代碼( Z  J) {0 @1 [
      if ((c == '\n') || (c == '\r')) { // End of line reached                //如果數(shù)據(jù)是/r,/n代表一行結(jié)束
  y, G# ?9 m6 o$ Z4 i        line[char_counter] = 0; // Set string termination character.        //設(shè)置結(jié)束標(biāo)志
# v2 i/ L0 M  e+ F6 O0 k" S" S! a; T$ U; l        protocol_execute_line(line); // Line is complete. Execute it!        //一行完成執(zhí)行此函數(shù)# Y0 F% ]3 V2 W
        comment = COMMENT_NONE;                                                //注釋清零$ h+ x+ }! `( |8 k) |# Y) l
        char_counter = 0;                                                    //字符計(jì)數(shù)清零
  P5 Y+ }' y  [  
/ t7 y# Z5 l1 E9 h2 I( e& N        else {
5 B- a# `- d9 F' x9 V8 ?        if (comment != COMMENT_NONE) {* i/ m! x5 y/ M& u+ G& i
                                                     //扔掉所有注釋字符' {; ?) R% d# C
          if (c == ')') {  b) \4 e& N6 l
            //最后注釋。重新開始,。但是如果有分號類型的注釋,。
6 v2 Q6 ~/ ]3 J1 x. h, m            if (comment == COMMENT_TYPE_PARENTHESES) { comment = COMMENT_NONE; }1 c! q1 o5 L1 Z
          }- Z! z% `5 m) ^4 B9 p' A+ j
      } else {: ]& ]0 ~1 X+ g. ]& w
          if (c <= ' ') { - m; T6 l3 v$ [: x$ \  t  L' p
            //扔掉whitepace和控制字符
, |) h' l, V0 P) ?( S" W6 _! U          } else if (c == '/') {
4 r+ V! p* R9 K8 X3 e* M            //塊刪除不支持將忽略字符。
5 V9 s4 ^7 ~) E4 {* e/ R            //注意:如果支持,只需要檢查系統(tǒng)是否啟用了塊刪除,。8 h9 X  B# e" T$ n& o+ u
          } else if (c == '(') {' J3 z+ X3 w% M( X6 l
            // Enable comments flag and ignore all characters until ')' or EOL.2 ~/ `3 B+ v; ^# m) O
            // NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.
# J' J6 t# I# ^+ z            // In the future, we could simply remove the items within the comments, but retain the: n1 T0 _3 ^% {/ ~2 P! o
            // comment control characters, so that the g-code parser can error-check it.
, i$ R7 q) J  D- U; p0 L            comment = COMMENT_TYPE_PARENTHESES;. S, ~8 V1 E+ ]! s6 A; c
          } else if (c == ';') {; N( ~. m8 g7 k$ e7 @9 k
            //注意:','注釋EOL LinuxCNC定義,。沒有國家標(biāo)準(zhǔn)。
( }1 p8 M. t1 [            comment = COMMENT_TYPE_SEMICOLON;$ U) n1 n1 H4 A- T% k' T0 j' Z( w
: U# j; K/ _( v1 v/ m2 m! g

0 r4 l  j6 g/ o0 v4 X_____________________________________________________________________________________________________________________________________' Z* q' o2 p! n
          } else if (char_counter >= (LINE_BUFFER_SIZE-1)) {                        //串口接收數(shù)據(jù)大于80字符時(shí)
9 |2 R* z9 A( z3 }1 Y* ^            // Detect line buffer overflow. Report error and reset line buffer.        檢測緩沖區(qū)溢出,。報(bào)告錯(cuò)誤和復(fù)位線緩沖區(qū),。
. ^! \) ~$ M8 Q- H7 t7 y            report_status_message(STATUS_OVERFLOW);                                //打印溢出信息% |; b/ u* W+ t, |6 z2 g
            comment = COMMENT_NONE;" i; P5 ]( h) _% `% H) e
            char_counter = 0;
/ A5 S4 K% o6 W" _          } else if (c >= 'a' && c <= 'z') { // Upcase lowercase                        //小寫改大寫
/ S8 O9 _0 z5 g            line[char_counter++] = c-'a'+'A';
. `4 k( _: `* ^5 y          } else {/ Z8 ]4 P5 l2 U8 J4 C7 o* w
            line[char_counter++] = c;0 J" P/ x: T9 t; z' n1 Z
          }" i7 h& o& V# a2 f3 q
        }
( ]4 Y1 C8 s' j  Z- a1 ^      }& F9 J( F$ j9 f  T$ n7 l8 f
    }$ x/ y- G; H9 v( z" D
____________________________________________________________________________________________________________________________________' t- F" `7 ?8 |' E
        //如果沒有其他字符在串行處理讀取緩沖區(qū)和執(zhí)行,這表明以完成,自動(dòng)啟動(dòng),如果啟用,任何隊(duì)列動(dòng)作,。# A, ]4 L8 o  F: q2 V- O& x- G
        protocol_auto_cycle_start();                //自動(dòng)開始協(xié)議循環(huán)
# {$ i% a8 I5 ]        
9 [; ]% C  X8 U( O            protocol_execute_realtime();                  //運(yùn)行實(shí)時(shí)命令,。. a: s4 ~0 A; Z; i3 f
            if (sys.abort) { return; }                 //中止標(biāo)識置位程序循環(huán)重置系統(tǒng)。            
, B. k  k: Y6 s: `# u$ b  }
' Z6 I& u) N& w+ r3 _7 K  Z  return;                         //一般程序不會(huì)執(zhí)行到這里, q/ N0 c* X: e' o' v' I6 y3 z. o) m
}
, s( ~) Q/ X' o8 {1 H% ]____________________________________________________________________________________________________________________________________
5 v$ b# g. C: Z正常情況下,,讀取完G代碼程序會(huì)進(jìn)入protocol_auto_cycle_start();//自動(dòng)開始協(xié)議循環(huán) 函數(shù)下面介紹此函數(shù)2 ~8 `& A( B3 N9 u+ _9 q% S# E
// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that
0 f' ]% k& v# I// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that 6 K: U, w: O  ^
// automatically begins the cycle when a user enters a valid motion command manually. This is 7 v: p/ ]& k- C* E! F" g" X
// intended as a beginners feature to help new users to understand g-code. It can be disabled
. x, r. j- d$ o, ~* q8 F9 T/ b7 I// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is
# p, O$ z; v* V, J// manually issuing a cycle start command whenever the user is ready and there is a valid motion 8 T1 g6 `6 R8 ~# @$ B) ^) q- q2 c3 R
// command in the planner queue.
5 t4 r0 H7 b5 x1 ?' a+ S// NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes
2 s7 E" z. ?' m5 C) b// when one of these conditions exist respectively: There are no more blocks sent (i.e. streaming
* r9 n- A# R$ P! f4 K// is finished, single commands), a command that needs to wait for the motions in the buffer to
5 O' f7 R; v, k// execute calls a buffer sync, or the planner buffer is full and ready to go.8 U7 t* h1 W( v/ T, @! O' L9 a
//自動(dòng)開始有兩個(gè)目的:1,。回復(fù)一個(gè)plan_synchronize()調(diào)用的函數(shù)) @- l* p7 {! m6 F. w/ n6 H
//需要規(guī)劃師緩沖區(qū)空(主軸啟用,、住等)2,。作為一個(gè)用戶設(shè)置3 \4 b+ ]6 [6 p% N7 ^& e4 B
//自動(dòng)循環(huán)開始當(dāng)一個(gè)用戶輸入一個(gè)有效的運(yùn)動(dòng)命令手動(dòng)。這是0 X, f, W6 V6 B. F) p
//作為一個(gè)初學(xué)者的特性來幫助新用戶了解刀位點(diǎn),。它可以被禁用
0 |! D8 c7 W/ z//作為一個(gè)初學(xué)者工具,但(1)仍然運(yùn)作,。如果禁用,運(yùn)行周期開始
1 s* k& E! K1 T- ~& Y//手動(dòng)發(fā)出一個(gè)周期開始命令每當(dāng)用戶準(zhǔn)備好,有一個(gè)有效的運(yùn)動(dòng)+ T. U- |: h% U2 u  ]2 g
//命令的規(guī)劃師隊(duì)列。
# ]% D0 _# O9 s- [//注意:這個(gè)函數(shù)被稱為從主循環(huán)緩沖區(qū)同步,mc_line只()并執(zhí)行
- j$ ^, T; w  @( V* J//當(dāng)其中一個(gè)條件分別存在:沒有更多的塊(即流發(fā)送! r5 V0 V% k6 V) m( n
//完成后,單一的命令),一個(gè)命令,需要等待緩沖的動(dòng)作
# p) g5 i! W; F! f: }; t: L1 C//執(zhí)行調(diào)用一個(gè)緩沖區(qū)同步,或規(guī)劃師緩沖區(qū)滿了,準(zhǔn)備好了,。
( Y& f% i# O# w" mvoid protocol_auto_cycle_start() { bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START); }
% _' a' \1 J9 ?  d. ________________________________________________________________________________________________5 h1 F; q3 q$ L: @/ T4 |
接下來程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令,。
0 P' F$ ^: K" ?2 B* V4 d// Executes run-time commands, when required. This is called from various check points in the main
2 g) Z4 e) U$ L9 R: Q- j// program, primarily where there may be a while loop waiting for a buffer to clear space or any" n' O7 }% X2 C$ o3 r, ~
// point where the execution time from the last check point may be more than a fraction of a second.( k/ v+ U* V; F5 S7 l9 B
// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code
" B7 s& L7 `! |; W9 R! W// parsing and planning functions. This function also serves as an interface for the interrupts to 7 [- ~3 o; O+ V) m7 |2 t& N
// set the system realtime flags, where only the main program handles them, removing the need to. F0 |) c: L, ]" [- ]
// define more computationally-expensive volatile variables. This also provides a controlled way to
$ V' I9 W$ d/ a" f2 z! R// execute certain tasks without having two or more instances of the same task, such as the planner
  e' @- p& b, m% x- o// recalculating the buffer upon a feedhold or override.0 M3 I; @6 v2 ^8 Z# s1 @
// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,3 _( U1 B: b9 P8 _* m" D
// limit switches, or the main program.
7 `  J# i8 E' r" c$ ]void protocol_execute_realtime()4 b, m* e/ L' q. s* h' k
uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.臨時(shí)變量來避免多次調(diào)用不穩(wěn)定。
# O6 i0 \1 C, ^4 {1 @9 p就先分享到這吧,!
% p' l7 o5 C, p( }7 D8 P2 x6 Z1 ~4 j3 d; U7 N! N0 Y3 A$ Q

: F3 Q3 A7 {  C5 N/ p' w
6 V7 O/ D& s/ F8 r" B7 b5 _6 V" ?6 |" e# S1 ^2 ^

$ ^9 e1 H' g% Z1 ?! p
7 Q0 G; d6 C$ j. m
2 p. Z: P/ ]2 V+ p
# u2 A' k& d( n$ ~0 ]7 w: H+ C' g' I' E0 y
, u4 y7 E, e2 l; a

! F, d, Y9 Z& q8 R1 k$ o* ^" D; H/ ^
5 j$ A3 c6 S. I- k2 O* W9 _6 B' n0 \& E9 S! B
$ d( s# j8 j2 ]% o/ V+ I. R$ t
) e  n" X+ n9 T2 g! g

+ |* k" O, a- K# W, g4 z. g" C0 {) F0 ~  Y
5 G8 l- t3 v& ]. }# F9 k3 D- |
/ Q* T" A- [# q
5 l" v9 @0 b8 ~$ `

# H; {' Y9 `: S* a) U' }
# L$ E9 x( v, O0 H3 G
/ h+ h5 ^4 ?3 a" _# M. J補(bǔ)充內(nèi)容 (2016-8-25 22:40):. i" [+ `% G5 g) v, [  q. ?
配置說明
9 ?3 t1 R2 S( i9 Q//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng),。在大多數(shù)情況下,
: [2 }" m+ f# P$ g//用戶不需要直接修改這些,但是他們在這里為特定的需求,即。! Y( Y- ^( \/ |- N9 r
//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器,。
% [0 i/ G9 d+ D: G6 i9 M主要配置項(xiàng):+ I" F( `3 r2 @# j3 X0 F: d
1.#define DEFAULTS_GENERIC        //在重置eepm時(shí)使用。在defaults.h改變想要的名字# a* K9 x# n8 Z- ^
2.#define BAUD_RATE 115200        //配置串口波特率115200# T, r6 X: F% ]
3.#define CPU_MAP_ATMEGA328P         // Arduino Uno CPU
# D6 g! `1 K6 E7 u" q$ m4.#define CMD_STATUS_REPORT '?'        //定義實(shí)時(shí)命令特殊字符
& H' ^8 O" J6 P% A! Y" U; f2 o8 a5.#define HOMING_INIT_LOCK         //回原點(diǎn)保護(hù)鎖
7 g4 K# w' o5 a6.#define HOMING_CYCLE_0 (1<<Z_AXIS)              // 第一步Z清除工作區(qū),。8 V) }/ ~" S- j6 f5 A  J
  #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // 然后X,Y在同一時(shí)間,。
: Z. f/ p  p( Z4 T0 D6 m/ _7.#define N_HOMING_LOCATE_CYCLE 1 //回原點(diǎn)循環(huán)次數(shù)
& _# S( S% z  ^0 p9 Y# d# T1 Z8.#define HOMING_FORCE_SET_ORIGIN //取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向。* j0 Y, H4 Z& R0 I# |& n1 m
9.#define N_STARTUP_LINE 2 //塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量,。
, x, A! J. Z/ W8 ~3 v( Q, C10.#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸
: j- u, r! r2 K7 G' z' `   #define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值
# C& Z& d4 I% [; h) R' ^   #define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
% f/ L8 r6 ~, h' u" C9 M   #define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘
# W2 w1 ~" ~+ B& U   #define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對浮點(diǎn)小數(shù)設(shè)置值
& ]7 L& A( \8 C( P( b0 Q11.#define LIMITS_TWO_SWITCHES_ON_AXES //如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用這個(gè)特性
! T" Z; U( r: ~  T) _12.#define USE_LINE_NUMBERS         //允許GRBL跟蹤和報(bào)告gcode行號- _% _; X% U0 v) d9 o" w
13.#define REPORT_REALTIME_RATE //允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率
; t/ ~! u  }( E14.#define MESSAGE_PROBE_COORDINATES  //坐標(biāo)通過Grbl $ #的打印參數(shù)?% m, g: Z! s, E4 K+ x
15.#define SAFETY_DOOR_SPINDLE_DELAY 4000 //安全門主軸延時(shí)) E+ z6 u! t- p. Z2 E- D& P
16.#define SAFETY_DOOR_COOLANT_DELAY 1000 //安全門冷卻液延時(shí)
) I2 w' \, H. o17.#define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS) //啟用CoreXY運(yùn)動(dòng)學(xué),。" x5 d+ V# i% Y' f4 ]- Z
18.#define COREXY // Default disabled. Uncomment to enable.改變X和Y軸的運(yùn)動(dòng)原理  o( t" x/ u% m7 B7 N' O' [" L
19.#define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.反轉(zhuǎn)針銷邏輯的控制命令
7 _/ s) l* F  i: t! B. P20.#define INVERT_SPINDLE_ENABLE_PIN // 反轉(zhuǎn)主軸使銷從low-disabled
5 @/ L8 E$ L5 M. W. w! O21.#define REPORT_CONTROL_PIN_STATE //啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告。2 l/ y7 }* u  D& ^2 G
22.#define FORCE_INITIALIZATION_ALARM //啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示6 V4 o4 U) l: C8 n4 R- U
23.#define REPORT_GUI_MODE // gui允許最小的報(bào)告反饋模式
9 J% o5 i/ ^; ~24.#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時(shí)間分辨率管理子系統(tǒng),。
( n# ]+ @: }; C( K% Y: J, f+ w25.#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING //自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能
+ ?2 a6 `  m/ J! d% @" k7 X$ ]26.#define MAX_STEP_RATE_HZ 30000 //設(shè)置最大一步速率可以寫成Grbl設(shè)置
% I/ g+ T2 Y  C( g2 O27.#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻
! \/ ~/ }5 ?8 v28.#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS //設(shè)置哪個(gè)軸長度補(bǔ)償應(yīng)用的工具,。假設(shè)軸總是與選擇軸工具面向負(fù)方向
1 U0 S! Q0 N5 }/ M0 c29.#define VARIABLE_SPINDLE //允許變量軸輸出電壓不同的轉(zhuǎn)速值。
' O; x- Y! C! Z+ H1 X9 Q, P: l30.#define SPINDLE_MAX_RPM 1000.0  // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
& X% t! n! O  z* f. O   #define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.4 }7 O& Q: H+ q$ B
31.#define MINIMUM_SPINDLE_PWM 5 //使用的變量軸輸出。這迫使PWM輸出最小占空比時(shí)啟用,。1 e" p6 c3 r0 J  e4 O  J
32.#define USE_SPINDLE_DIR_AS_ENABLE_PIN //主軸方向使能M4被刪除- Z" H, ~) D" f7 m3 U3 S+ q! Z
33.#define REPORT_ECHO_LINE_RECEIVED //應(yīng)該對所有正常線路送到Grbl
0 K( `( U3 B3 S0 A5 L34.#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min) //最小規(guī)劃師結(jié)速度,。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃( O" f+ L+ U# U! {9 t  y& z+ O
35.#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率
/ N4 V- r- F& I" @- k3 g* b+ t36.#define N_ARC_CORRECTION 12 //弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡
- N& S1 N) U/ B37.#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了?4 z; N) y6 p$ x/ Q
38.#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) //延時(shí)增加表現(xiàn)在住。默認(rèn)值設(shè)置為50毫秒1 R8 n8 h7 R' [( W0 j5 Y- X
39.#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
+ U& o+ m' u; _& ]8 G  D. w" Y: k3 {% x40.#define BLOCK_BUFFER_SIZE 18  //線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃8 z; L' \5 A3 y+ Q
41.#define SEGMENT_BUFFER_SIZE 6 //控制之間的中間段緩沖大小的步驟執(zhí)行算法& X! c. w$ h+ T! @" ]* L& e! M- Z
42.#define LINE_BUFFER_SIZE 80 //行執(zhí)行串行輸入流的緩沖區(qū)大小,。
8 \4 |+ M- t* n9 P43.define RX_BUFFER_SIZE 128 //串行發(fā)送和接收緩沖區(qū)大小
  B+ `1 v! f( s# [" }) I% x44.#define TX_BUFFER_SIZE 64
) F* Q( d5 o- S& I# K45.#define ENABLE_XONXOFF        ////切換為串行通信發(fā)送流軟件流控制,。4 R+ N1 l* i: e( A" e
46.#define ENABLE_SOFTWARE_DEBOUNCE //一個(gè)簡單的軟件消除抖動(dòng)特性硬限位開關(guān)。) P3 y1 ]. J. ]& p6 }) p
47.#define HARD_LIMIT_FORCE_STATE_CHECK        //Grbl檢查硬限位開關(guān)的狀態(tài)3 y& B2 E4 [, L' n! f# A' Q5 h: {8 X
48.// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:/ }1 z7 S" \0 N
# e7 O- c1 H' _
___________________________________________________________________________________________________
- Z6 w# V% g3 J+ y% n( q/*8 {1 H9 `9 F% R0 G, {; c
  config.h - compile time configuration
$ S* t5 k  p' A; g4 `  Part of Grbl  X! [6 L2 q) z/ e" ^; F+ |
# x! U# o2 X  H
  Copyright (c) 2012-2015 Sungeun K. Jeon9 L% S( }% W0 o/ _6 s9 }
  Copyright (c) 2009-2011 Simen Svale Skogsrud
5 f8 \( e* {5 z* i% Q
4 i' `; s( i: I  Grbl is free software: you can redistribute it and/or modify+ x! z5 \# K, d; _
  it under the terms of the GNU General Public License as published by
$ B+ o1 u* u- W  S* t  the Free Software Foundation, either version 3 of the License, or
8 K1 a4 d& w' n  (at your option) any later version.
& N) c: O3 A- ?: ~- @8 I. A/ W; ]2 {/ U0 B
  Grbl is distributed in the hope that it will be useful,
3 A( l% B* ~* K: i1 \  but WITHOUT ANY WARRANTY; without even the implied warranty of# P9 Z4 t- X, F3 k2 s2 l3 O
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- @/ ^6 j2 u" [# u, {  GNU General Public License for more details.
- n: p1 ~2 n& e
+ P7 e5 ?2 ~5 V8 s% T; M; v  You should have received a copy of the GNU General Public License8 E! v9 _1 h; F' }) X
  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.! d, F4 w8 \$ [
config.h  -編譯時(shí)配置,Grbl的一部分# W# t5 X8 N9 V
% e/ H& _% y! p  ], |
版權(quán)(c)2012 - 2015 Sungeun K. Jeon+ j$ w) j/ x7 Z6 u+ |: w
版權(quán)(c)2009 - 2011 Simen Svale Skogsrud$ E; k' k$ h4 U! i6 g

$ E! U! M/ k7 }7 s8 IGrbl是免費(fèi)軟件:可以重新分配和/或修改
: a$ r8 Q" W) I& c! dGNU通用公共許可證的條款下發(fā)布的自由軟件基金會(huì),版本3的許可,或(任您選)其后的版本,。  K3 ^- z* R) a7 l  _. |& f5 u" _
. ?/ `1 t# b9 j$ H% W" g0 N
Grbl分布,希望這將是有用的,但是沒有任何保證;沒有即使的默示保證適銷性或健身為特定目的,。看到' d2 B8 Q+ l; N; _6 o
GNU通用公共許可證的更多細(xì)節(jié),。
% E& P9 Q1 z" `
( q2 u! N" H; F& k+ g你應(yīng)該收到了GNU通用公共許可證的副本
) Q. s" z3 g. P. L/ r$ Y! y連同Grbl,。如果沒有,看< http://www.gnu.org/licenses/ >。
; v  W" B6 X3 s " H2 x/ J* Q, n! M- J. q0 u
*/
; z) ~4 t2 T' z0 @# _* `, f' ?$ t  
- h' g, E- ?, l: k4 g1 a// This file contains compile-time configurations for Grbl's internal system. For the most part,7 @; u; b% [* U1 S# G
// users will not need to directly modify these, but they are here for specific needs, i.e.+ i3 F0 C: `8 e; n  J1 G
// performance tuning or adjusting to non-typical machines.5 v* I+ v# i3 ~/ ?( X* `6 \
//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng),。在大多數(shù)情況下,
: G3 a) |3 N: {//用戶不需要直接修改這些,但是他們在這里為特定的需求,即,。
" u/ G- [' O6 [! I. k6 m8 @0 e//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。6 Z. u5 L$ ?# {  e+ w
9 N) w" Z& |! K% ~# E
// IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them." c# g0 f, L& z! E- y" Z* ~& X" k
//重要:任何變化需要一個(gè)完整的基于源代碼的傳播,。7 C% g( x/ U0 N* b* c
8 d: W0 o, h4 j6 q3 |
#ifndef config_h
# U" `% ?9 D' B' T5 z#define config_h
" Y. A) ~7 {6 F. M, _7 s#include "grbl.h" // For Arduino IDE compatibility.
# m' Y1 C- j" M; W% J% u# ^% e9 `: J3 N) f; ^  J6 k2 Y) `
// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h7 z3 B4 `5 S+ N3 `/ c
// 默認(rèn)設(shè)置,。在重置eepm時(shí)使用。在defaults.h改變想要的名字0 T  ^/ |! I5 a. B3 V6 N

" `8 `6 S: |" C: E7 U. \#define DEFAULTS_GENERIC
1 M6 x5 Q6 b. o- M
9 ]) U6 v7 U# z8 t5 x9 N// Serial baud rate; S! V2 B" [' X- N  y* B
#define BAUD_RATE 115200                //配置串口波特率115200
# l, @1 q0 v) i& E3 \6 x8 [
' x9 p4 u  e. }; [% \5 a* Z% Q+ l. z// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types- O4 T) z% x8 F) x. {, k
// may exist from user-supplied templates or directly user-defined in cpu_map.h1 A; T% d0 a1 r5 I
//默認(rèn)cpu映射,。Grbl正式支持Arduino Uno,。其他類型的處理器可能存在cpu_map.h直接從用戶提供的模板或用戶定義的
& m( Z! Q. h* X0 y: F& S0 e. Q1 M3 j' \
#define CPU_MAP_ATMEGA328P // Arduino Uno CPU( l3 Z  X: O6 g7 l
  c3 @; v: W1 V0 f1 @
// Define realtime command special characters. These characters are 'picked-off' directly from the
. s2 f) C& h8 V3 ]// serial read data stream and are not passed to the grbl line execution parser. Select characters
. ]0 V9 B- f6 ^: g2 W  o1 P// that do not and must not exist in the streamed g-code program. ASCII control characters may be
; B0 u9 E( y* q  F; ]. t// used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in ; a/ w' }3 K; @" d
// g-code programs, maybe selected for interface programs., ?+ x* B1 o; i; _
// NOTE: If changed, manually update help message in report.c.
9 s3 H) a* J1 Y  n" ^4 D4 h& d5 w
  [0 z! j/ ?  `0 |% }. }//定義實(shí)時(shí)命令特殊字符。這些字符是直接從“各個(gè)擊破”串口讀取數(shù)據(jù)流并沒有傳遞到grbl行執(zhí)行解析器,。選擇角色
, V; b( P. N8 t( q* V. w; ?! L//不,不能存在于程序流刀位點(diǎn),。ASCII控制字符: J" y1 v3 D6 j
//使用,如果他們是可用的每個(gè)用戶設(shè)置。同時(shí),擴(kuò)展的ASCII碼(> 127),從來沒有
/ v, `# X3 \4 _; m8 ^) J//刀位點(diǎn)的程序,也許選擇界面程序,。; O; U% Q' I5 R7 N& b' {8 U9 Q
//注意:如果改變,手動(dòng)更新report.c幫助信息,。
" N% @9 {7 \4 U
, Y  i/ f8 q3 R; g- C#define CMD_STATUS_REPORT '?'2 V4 ~0 D" u/ C$ S/ e
#define CMD_FEED_HOLD '!'
$ X0 l2 W6 |/ O7 S# g& P/ p#define CMD_CYCLE_START '~'
7 F% ~6 S1 J7 B3 }, Q' w#define CMD_RESET 0x18 // ctrl-x.3 y) t* ^( E& e/ e* J6 U
#define CMD_SAFETY_DOOR '@'0 X( Q6 {5 B0 A4 C9 c# E( ~) a1 r

8 l9 w- s" p) {0 y// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces0 Y1 y  ~8 e  g! e
// the user to perform the homing cycle (or override the locks) before doing anything else. This is2 \4 F: n5 R: l8 X) F+ Z
// mainly a safety feature to remind the user to home, since position is unknown to Grbl.% @- a) J5 y' g6 K2 s

* W: q1 ]- K* z4 {. E1 w6 H//如果啟用了回原點(diǎn),導(dǎo)航初始化鎖集Grbl進(jìn)入警報(bào)狀態(tài)啟動(dòng)。這就迫使
; t5 n  B. K# Z//用戶執(zhí)行歸航周期(或覆蓋鎖)在做任何其他事情之前,。這是$ S' C) B+ c% ^7 Y0 M9 r: t
//主要安全功能,提醒用戶家里,因?yàn)镚rbl位置是未知的,。1 [. @+ v0 b0 N0 M

$ u; h% F4 v% i  }8 H( i#define HOMING_INIT_LOCK // Comment to disable# U' B4 v, y, Z$ }. u9 ^5 a+ o
( d/ z5 _8 o6 _5 n( x
// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode% a" {3 _& z% p3 \- k4 d) s3 B& ?
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
4 |) e& [; v2 q1 f% i, f9 T  }' \// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed 4 a/ j) }. O1 H3 _- j/ w" V# j
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If# f2 X3 j, A; z2 e: {5 X
// an axis is omitted from the defines, it will not home, nor will the system update its position.) M/ K5 W9 B4 s/ a& x, L% n
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,
+ d+ l! j3 p0 s& b// with no y), to configure the homing cycle behavior to their needs. / E" |. }; P, @+ ^  D
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
+ @+ }7 _# d/ s$ X4 O// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
5 A; l* g3 y! [2 D  c// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.) Q, T+ a( K* A9 W* c8 N# l' C
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
. S! l+ ]4 h; G* ?' L// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes' W3 Q% E, `. H6 _- ?2 w
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits
* j1 Y; w# T: l0 P3 I# p) d// will not be affected by pin sharing.% _  Q* E  t& M) g! A, c
//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個(gè)搜索模式
4 A6 d- Y* Y6 h//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短
* E4 e3 a# |  n) m3 Q( B! W//拖出運(yùn)動(dòng)脫離限位開關(guān),。以下HOMING_CYCLE_x定義執(zhí)行
, M; Z/ X" B) P/ y4 a$ }7 |//為了與后綴0開始并完成specified-axes只尋的例程,。如果
" g- G$ \  Y# [2 j, `//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置。" A: j, v, R0 l: G( [' l: _
//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,8 v0 I# D, Q5 y  K! ?
//沒有y),配置導(dǎo)航循環(huán)行為對他們的需求,。
3 K% l1 ]9 E) ?5 d4 b//注意:歸航周期允許共享限制針,如果軸不相同) p7 L& K$ l9 q
//循環(huán),但這需要一些銷設(shè)置cpu_map的變化,。h文件。例如,默認(rèn)的導(dǎo)航& Y+ \7 j9 u% o
//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?font class="jammer">( o' V3 j  E* g
//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的,。從理論上講,所有軸限制別針5 W2 J) a# T" t# ]- l1 j. K
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸2 W3 J' o- j: o- ~' f5 K+ j3 h
//在不同銷,但這時(shí)候一個(gè)周期,。同時(shí),應(yīng)該注意的是,硬限制的功能3 \, |" m* w( B8 R6 }, n2 H
//將不會(huì)影響銷共享,。5 y* {/ |! F6 J6 O9 U. B
//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器。z軸首次明確,其次是X和Y,。
% {' P1 |/ m# M& _0 g% p! t
2 X  a! k& D5 V1 l3 u5 m// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.+ ?! K% k9 u( o, I
#define HOMING_CYCLE_0 (1<<Z_AXIS)                // REQUIRED: First move Z to clear workspace. 第一步Z清除工作區(qū),。
  F8 e8 n4 n0 D# Q+ ~/ ?#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // OPTIONAL: Then move X,Y at the same time.然后X,Y在同一時(shí)間。
! t) ~+ d- U" L; H& Y// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable$ @  b. }7 `: |, _. u* @0 R
+ E/ T+ H5 x2 d- r9 Q, f
// Number of homing cycles performed after when the machine initially jogs to limit switches.9 s2 H: ?% |  O1 Y* S
// This help in preventing overshoot and should improve repeatability. This value should be one or
$ ~1 g/ K$ T5 H// greater.
4 G3 K6 j+ Y3 ?//執(zhí)行回原點(diǎn)循環(huán)次數(shù)后,當(dāng)機(jī)器最初慢跑限位開關(guān),。這個(gè)幫助防止過度,應(yīng)該提高重復(fù)性,。這個(gè)值應(yīng)該是一個(gè)或大。
/ K. t# l- A4 Z$ |  y
1 w& T" c+ g. T; r#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)! j0 X2 J5 Y8 b, H5 R9 @& V
( b. B0 y8 e8 T0 F  U/ H
// After homing, Grbl will set by default the entire machine space into negative space, as is typical* D  z) ]; Q, Y' m4 l! m
// for professional CNC machines, regardless of where the limit switches are located. Uncomment this ! |2 o, T0 e5 @
// define to force Grbl to always set the machine origin at the homed location despite switch orientation./ l" u3 |0 \/ ]- ?& r$ r& v! \. |

; S7 g! @7 G% b. y  |4 P' `( k//導(dǎo)航后,默認(rèn)Grbl將整個(gè)機(jī)器空間留白,是典型的專業(yè)數(shù)控機(jī)器,不管限位開關(guān)所在的地方,。
  z) P3 L4 z7 D4 b0 K  E//取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向,。
" f; j2 x; i' g; o: x. D8 c
1 h. s8 e0 C! r8 Z- E& J3 ^// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable." m% L; t/ K1 X5 x. U. W

9 T' m8 G/ s! O$ {  ^* ^1 p0 h7 ~# Q. v/ T1 I+ s5 o- |0 i; S
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size/ d& N6 w6 G  z5 O+ f
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may* a" B$ ]' k$ `; n% V, J; q* T
// be stored and executed in order. These startup blocks would typically be used to set the g-code
4 ]! C5 g) K% a& C; h3 K// parser state depending on user preferences.. S6 }3 u4 X4 n. {( _

! g0 x: F- v, A$ b//塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量。這些塊存儲在eepm,大小
) q  ~6 O, J1 o; a: B( K//和地址在settings.h中定義,。與當(dāng)前設(shè)置,可能2啟動(dòng)塊
9 \, ]9 s0 ~! O9 s//存儲和執(zhí)行,。這些啟動(dòng)塊通常被用來設(shè)置刀位點(diǎn)
( c# z' B  T  |5 ?1 [//解析器的狀態(tài)取決于用戶首選項(xiàng)。
' u2 Y* ?- [; [3 {' L5 v
  p& G7 t) f& a& N9 ~# N#define N_STARTUP_LINE 2 // Integer (1-2)
4 j2 u8 y- a; r: T6 H) |5 x. e. ?
// Number of floating decimal points printed by Grbl for certain value types. These settings are
" }( _8 h& E& F, Z2 Q" k% O// determined by realistic and commonly observed values in CNC machines. For example, position# y+ C1 }! t  Y% m" B7 M0 p4 N" f. K
// values cannot be less than 0.001mm or 0.0001in, because machines can not be physically more
4 `9 G, P7 T# ]2 R$ s3 \// precise this. So, there is likely no need to change these, but you can if you need to here.
  r1 t5 J% X# }* C5 H// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors.! m) [1 b4 s4 d/ H6 K: ~" ]& _7 ~

% X% A* `( p' Q5 P# Q// Grbl浮動(dòng)小數(shù)點(diǎn)的數(shù)字印刷的特定的值類型,。這些設(shè)置是
3 `4 j0 r' }1 a0 r* e9 g6 E//一般由現(xiàn)實(shí)和觀測值在數(shù)控機(jī)器,。例如,位置
/ T! y: i" z6 B0 v//值不能小于0.001毫米或0.0001,因?yàn)闄C(jī)器不能身體更多7 I5 m/ B! ?& ]8 m9 T2 q' b
//精確。因此,有可能不需要改變這些,但你可以在這里如果你需要,。
- ?5 y6 j8 ~! n//注意:必須是一個(gè)整數(shù)值從0 ~ 4,。超過4可能出現(xiàn)舍入錯(cuò)誤。/ J7 {2 g/ s( j' g
' B! v4 _1 s) j; T# }1 q- L: A
#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸5 g  e9 v2 X2 T2 X9 Z
#define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值) y0 c7 K6 r# o
#define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
7 `( h+ B2 O8 B! ~5 I6 T2 h: n! B% w#define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘4 r) U4 N6 ^) s0 H
#define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對浮點(diǎn)小數(shù)設(shè)置值
2 u- h) H, l3 h0 ^. `
' V5 y+ Q4 {! J6 m' S; {) v8 i// If your machine has two limits switches wired in parallel to one axis, you will need to enable
9 A1 c7 _8 N( K// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
' K+ ]2 Q8 r( [8 [// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will " v% ]: [+ P1 c, ?9 f2 @
// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one4 P2 Z, I* @# R
// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a
' k8 F' e9 i& i// homing cycle while on the limit switch and not have to move the machine off of it.
. Y+ ?( [8 s8 m0 R, U1 c) F) I* @/ m) ], K
//如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用2 H' e. V3 a2 M5 M1 d+ D- W. P; @0 s
//這個(gè)特性,。自從兩個(gè)交換機(jī)共享一個(gè)銷,沒有辦法Grbl告訴
" _+ q9 P2 t0 F) m//啟用哪一個(gè),。此選項(xiàng)僅影響歸航,如果限制,Grbl意志& H9 }3 ~- y! G% E9 a" j0 _
//報(bào)警,迫使用戶手動(dòng)松開限位開關(guān)。否則,如果你有一個(gè)
1 \' Z) m( J1 `4 h/ U& x//為每個(gè)軸限位開關(guān),不啟用該選項(xiàng),。通過保持禁用,您可以執(zhí)行
8 h. F- s2 r# O; U! X6 L4 m//導(dǎo)航循環(huán)在限位開關(guān)并沒有將這臺機(jī)器,。7 m' E8 \7 I8 p# {
5 D% _; Q( j( y' m$ g! M
// #define LIMITS_TWO_SWITCHES_ON_AXES- ^: v3 {# l0 w5 j' ~

/ Y5 [6 R2 i, a6 h+ R# X// Allows GRBL to track and report gcode line numbers.  Enabling this means that the planning buffer% A0 `' n: W: x7 i5 U( k5 O6 W# Q
// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct( I( B! ^, D( u( A4 j5 D
3 r1 Y" J. y2 R) E
//允許GRBL跟蹤和報(bào)告gcode行號。使這意味著計(jì)劃緩沖從18歲或16歲,為額外的行號plan_block_t結(jié)構(gòu)中的數(shù)據(jù)% k, m6 p, ?! q8 U* d" r5 Q
, o, U- W6 h  V+ y% f
// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable.
0 B% @, r# z' t4 K7 y2 t: E( Q5 v, x+ a, a8 q
// Allows GRBL to report the real-time feed rate.  Enabling this means that GRBL will be reporting more
0 }' p' [6 j: x7 p& e* O; w// data with each status update.
# `, x- o  q' H0 {) h4 x5 g// NOTE: This is experimental and doesn't quite work 100%. Maybe fixed or refactored later.
2 U! ?4 I: F8 c% w! C" V; C' \//允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率,。使這意味著GRBL將報(bào)告數(shù)據(jù)和狀態(tài)更新,。
8 R; k7 B+ d: [: i3 e//注意:這是實(shí)驗(yàn)和100%沒有工作。也許以后固定或重構(gòu),。
) i) @9 J3 y, k8 ]# D1 e/ m2 k: J$ e+ r6 L( T( M% w
// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable.) R: c0 u) F: u& \
) g6 ]3 r$ K& D$ k- W0 {
// Upon a successful probe cycle, this option provides immediately feedback of the probe coordinates3 h. g3 O6 k$ n9 s) r
// through an automatically generated message. If disabled, users can still access the last probe  x/ m+ d  K+ ^) j8 f6 A
// coordinates through Grbl '$#' print parameters.
3 x1 Z: x! v$ x: ^. m//在一個(gè)成功的調(diào)查周期,這個(gè)選項(xiàng)提供立即反饋的探測器坐標(biāo)* l5 Z0 f9 W2 h/ L5 O
//通過一個(gè)自動(dòng)生成的消息,。如果禁用,用戶仍然能夠訪問調(diào)查
  F" V# Q2 v+ x' z//坐標(biāo)通過Grbl $ #的打印參數(shù)。2 r$ U: W/ u1 k' X( h8 e

1 O7 q/ ~* f1 w#define MESSAGE_PROBE_COORDINATES // Enabled by default. Comment to disable.5 @$ o$ n/ Q" o( v0 O# |5 o1 y

5 f" S# u) [" ~) O& A2 A; Y// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno* |/ }- b  @( ?0 T( w: I
// analog pin 5. Only use this option if you require a second coolant control pin.4 d, m1 Q' P% G& g, O- T; _
// NOTE: The M8 flood coolant control pin on analog pin 4 will still be functional regardless.
' B* f: s; d( Z// #define ENABLE_M7 // Disabled by default. Uncomment to enable.
  [: @# w+ B, Q9 p5 ^6 T$ E3 }8 z9 A# W+ N
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,% \) U# T( n3 q" [) [
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
* k" z8 m7 p* @" z+ T( }// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the
% P7 A8 o2 _' }% m// previous tool path, as if nothing happened.8 T6 q) \. a7 J/ G! i! L  m
// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.' Z6 ?" O7 C9 w3 w+ _) O
2 I, A9 A' s- i: B7 U7 h: s
// After the safety door switch has been toggled and restored, this setting sets the power-up delay* G2 j5 e1 g' U# E6 b6 T
// between restoring the spindle and coolant and resuming the cycle.
7 o; ]4 [. |! ~// NOTE: Delay value is defined in milliseconds from zero to 65,535. 8 j& |" T5 A- }  ?2 E
) l3 I" v; o' d
//定義導(dǎo)航循環(huán)模式的位掩碼,。歸航周期首先執(zhí)行一個(gè)搜索模式
/ ?, f! o8 i* Q1 {* ]) X//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短* G4 I; q  b. D5 S; C9 J
//拖出運(yùn)動(dòng)脫離限位開關(guān),。以下HOMING_CYCLE_x定義執(zhí)行
% f- t$ D6 L, z. Y0 U//為了與后綴0開始并完成specified-axes只尋的例程。如果1 p6 }/ ~' p: d) D
//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置,。
; d. b3 r+ o6 A; A7 T//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,7 K: z/ w6 L- }; ]. p7 D  Y( j
//沒有y),配置導(dǎo)航循環(huán)行為對他們的需求。
- T- ~2 F1 O' t! z4 [  {. M//注意:歸航周期允許共享限制針,如果軸不相同" r# u# u% Y" C/ j2 h! j! ?' O
//循環(huán),但這需要一些銷設(shè)置cpu_map的變化,。h文件,。例如,默認(rèn)的導(dǎo)航
1 Y1 }& Y) J, U* k+ a# T; A//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?font class="jammer">& \1 R6 A8 F* ~2 X  N; ?
//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針0 S7 ?4 |9 L# b% ^
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸3 o9 K1 y: Z: H/ A
//在不同銷,但這時(shí)候一個(gè)周期。同時(shí),應(yīng)該注意的是,硬限制的功能0 F5 v2 N9 v6 F0 S2 u
//將不會(huì)影響銷共享,。
2 I- X, o/ @3 x. V/ X//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器,。z軸首次明確,其次是X和Y。
' s5 E% E" f( {$ ?
) u0 M: `6 \7 ?& A3 M, D
* z9 d+ e4 v: k! ]: m& ^8 ]8 o9 G#define SAFETY_DOOR_SPINDLE_DELAY 4000
4 V: z4 L1 Z) m#define SAFETY_DOOR_COOLANT_DELAY 10006 j$ I2 ^# g4 ?4 i8 R

( T& Q. q6 \' J- j* C+ v; I// Enable CoreXY kinematics. Use ONLY with CoreXY machines.
; Y  M$ J' A# u" _1 G// IMPORTANT: If homing is enabled, you must reconfigure the homing cycle #defines above to
% s( h6 \$ W( d8 q& b- B, @; o//啟用CoreXY運(yùn)動(dòng)學(xué),。只使用與CoreXY機(jī)器,。3 A2 Z0 e; \6 a
//重要:如果啟用了自動(dòng)尋的,你必須重新配置導(dǎo)航循環(huán)#定義上面
, n" z; x- I- n$ l/ A& L1 j; T7 |' B
// #define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS)
' {" e+ H8 H3 n0 E. ?# L: Y; M7 u( p  G
// NOTE: This configuration option alters the motion of the X and Y axes to principle of operation& Z7 Q/ ~* Q% p0 _
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as  O2 e: o- x  ]9 @* [
// described, if not, motions may move in strange directions. Grbl assumes the CoreXY A and B motors
$ B6 _, a4 ]  v; T, l% d/ j// have the same steps per mm internally., c! R0 p& X4 A: A' E6 _. S/ T8 M
//注意:這種配置選項(xiàng)改變X和Y軸的運(yùn)動(dòng)原理,操作% W! A  i( ?3 D" O2 U3 p, ]
//定義(http://corexy.com/theory.html)。汽車被認(rèn)為定位和連接一樣
" @( B: d. b' O3 c4 e8 q$ ^//描述,如果沒有,運(yùn)動(dòng)可能會(huì)奇怪的方向移動(dòng),。A和B Grbl假設(shè)CoreXY馬達(dá)  E9 Y6 C' r/ I
//每毫米內(nèi)部有相同的步驟,。1 T; @6 k8 Z- w& w

8 K) r& X1 v% f! m- ?) w4 t/ @// #define COREXY // Default disabled. Uncomment to enable.
) n4 b) Y# j. ?- n: }5 a# h. g! ^2 @* D
// Inverts pin logic of the control command pins. This essentially means when this option is enabled
6 ^+ {" ]- l+ \# k% h// you can use normally-closed switches, rather than the default normally-open switches." y5 M7 w- N' H! }
// NOTE: Will eventually be added to Grbl settings in v1.0.4 M) i/ E1 }2 ~2 ], e) {* o5 i) x  V- X
//反轉(zhuǎn)針銷邏輯的控制命令。這實(shí)質(zhì)上意味著當(dāng)啟用這個(gè)選項(xiàng)9 h; Q6 a! S  i- b
//可以使用閉合開關(guān),而不是默認(rèn)的常開開關(guān),。) r0 `  e1 j( c) m* Q
//注意:最終將被添加到在v1.0 Grbl設(shè)置,。; z9 D" \3 f0 Q9 P, J

. X- f4 h$ a1 s0 A4 b7 i1 l// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.+ M9 k/ {/ M- @

% J  S4 b, i$ ^1 [# u// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful3 k8 h7 t1 u& z  E
// for some pre-built electronic boards.' Z% w6 a/ o0 G% d" E
// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and 1 I) m$ L9 z- m& o+ Q6 `
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM,
' ?0 |3 W1 y  _  Z; u- K7 ?$ p// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.; y( p' y" J% K* v5 ^2 L
//反轉(zhuǎn)主軸使銷從low-disabled / high-enabled low-enabled / high-disabled。有用的
) P5 M9 j% b! |" T+ h( y2 s, K//預(yù)構(gòu)建的電子板,。5 q, n: x! R, e1 y* z0 w
//注意:如果啟用了VARIABLE_SPINDLE(默認(rèn)),這個(gè)選項(xiàng)作為PWM輸出并沒有影響( X! _2 l* {- y2 S0 J: u
//銷軸使結(jié)合,。如果你需要這個(gè)選項(xiàng)和主軸轉(zhuǎn)速PWM,1 p7 S- [% Y7 L3 y9 G
//取消注釋以下配置選項(xiàng)USE_SPINDLE_DIR_AS_ENABLE_PIN8 @* l7 X# x5 B7 ~( [7 J# K" p* {# ]

; P* ^# B5 E' y+ F// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
) G! w1 i8 ?8 k- N8 C
0 z/ U: H1 T; a6 p; B// Enable control pin states feedback in status reports. The data is presented as simple binary of
( M( Y: `% D' L( r// the control pin port (0 (low) or 1(high)), masked to show only the input pins. Non-control pins on the ; R3 `0 [& K9 u
// port will always show a 0 value. See cpu_map.h for the pin bitmap. As with the limit pin reporting,
. X7 J/ M3 [3 E, l1 l% Q// we do not recommend keeping this option enabled. Try to only use this for setting up a new CNC.: _9 z2 J2 `3 K- @
//啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告。作為簡單的二進(jìn)制數(shù)據(jù)6 o1 p, ?2 W7 O0 R
//控制針端口(0(低)或1(高)),蒙面,只顯示輸入插腳,。非控制性針上
+ Q9 o- i; H7 T! T5 p" u! c* @//端口總是顯示0值,。看到cpu_map,。針位圖h,。與限制銷報(bào)告,
6 K+ z" }" z; ]( C( c* E//我們不推薦保持啟用這個(gè)選項(xiàng)。盡量只使用這個(gè)設(shè)置一個(gè)新的數(shù)控,。8 v" s  t% R9 ~9 u) V
7 @- h! G: i7 [& Y/ B% Z5 ]* }: Z
// #define REPORT_CONTROL_PIN_STATE // Default disabled. Uncomment to enable.: ?+ _( @8 u$ Z: d" P0 t3 B# X1 Q
  u9 W) w0 i7 ]; r6 a; O
// When Grbl powers-cycles or is hard reset with the Arduino reset button, Grbl boots up with no ALARM# q9 g; U% |8 E) S8 O
// by default. This is to make it as simple as possible for new users to start using Grbl. When homing) h$ h8 J" N2 Q% s0 B
// is enabled and a user has installed limit switches, Grbl will boot up in an ALARM state to indicate 6 ^7 m8 u, W. O+ U: S% n* P" |+ E( L
// Grbl doesn't know its position and to force the user to home before proceeding. This option forces
) d/ {2 ^. }0 i) ]8 `// Grbl to always initialize into an ALARM state regardless of homing or not. This option is more for+ H# y; c4 M3 u& l: c
// OEMs and LinuxCNC users that would like this power-cycle behavior.  u5 Q8 C) T8 ~
//當(dāng)Grbl powers-cycles還是硬重置Arduino復(fù)位按鈕,Grbl啟動(dòng)沒有報(bào)警
/ Z( ^) |& n2 H4 z: F//默認(rèn)情況下,。這是為了讓新用戶盡可能簡單使用Grbl開始。當(dāng)歸航
1 f1 _3 A1 z( V//啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示# E. c4 j2 s7 Y+ \8 v) W0 ]! g3 K2 |
// Grbl不知道它的位置,迫使用戶在繼續(xù)之前回家,。這個(gè)選項(xiàng)部隊(duì)1 b' m) @1 j+ a8 `" f3 I
// Grbl總是初始化進(jìn)入警報(bào)狀態(tài)不管歸航,。這個(gè)選項(xiàng)是更多2 B  e" w! N+ C  d' U9 R" L1 W
//原始設(shè)備制造商和LinuxCNC用戶這樣的控制行為。
/ y. E2 V, [" \9 n, p# l7 C2 J( o$ l+ k9 G) `2 @2 Z1 Y9 d
// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.; v0 F; c) [* z7 w; k: P& b* Z( f

* d! d& R, h' x" s8 x// ---------------------------------------------------------------------------------------
1 P# x" R6 M, j& n/ h// ADVANCED CONFIGURATION OPTIONS://高級配置選項(xiàng):% {$ B' D; S) N4 F2 w  g# {  V
: x  l7 t9 M# I0 ~
// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important.* x% m$ M: c% E1 D
// This saves nearly 2KB of flash space and may allow enough space to install other/future features." t/ @- Q3 {8 H
// GUIs will need to install a look-up table for the error-codes that Grbl sends back in their place.
6 ]: x9 l9 G; l* Z' H2 `2 V// NOTE: This feature is new and experimental. Make sure the GUI you are using supports this mode.
7 E$ A/ @8 q  P: {9 H: `* C! c
5 v6 j! ]4 s8 x$ }2 P$ a1 {; h$ K// gui允許最小的報(bào)告反饋模式,人類可讀的字符串在哪里不重要,。3 M( g/ |1 w$ ]
//這個(gè)節(jié)省近2 kb的閃存空間,允許足夠的空間來安裝其他/未來的功能,。
* Y1 D0 O9 r+ \7 r// gui需要安裝一個(gè)查找表的錯(cuò)誤代碼Grbl發(fā)回。; G" k' ~$ @! @" t' `
//注意:此功能是新的和實(shí)驗(yàn),。確保您使用的GUI支持這種模式,。& ?  X* k8 [" F. ?# j) \
% v* z- j8 v  }# b- i, _% \
// #define REPORT_GUI_MODE // Default disabled. Uncomment to enable.
& z" D6 i7 {9 S3 G
0 }( x$ d+ E4 y/ s4 E: L# `// The temporal resolution of the acceleration management subsystem. A higher number gives smoother
# V! ^* {! E3 Q5 _8 ?// acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively
* g+ \; n  H6 ?& Q( S8 w! v& }- s" l, u// impact performance. The correct value for this parameter is machine dependent, so it's advised to8 M3 M7 B# z/ H" [; h! e
// set this only as high as needed. Approximate successful values can widely range from 50 to 200 or more.. t) G! F1 ]$ c3 w2 q/ i- C
// NOTE: Changing this value also changes the execution time of a segment in the step segment buffer.
  I; |  i0 C# Z// When increasing this value, this stores less overall time in the segment buffer and vice versa. Make
3 q9 N4 x0 c- v$ _  r$ B6 H2 D// certain the step segment buffer is increased/decreased to account for these changes.3 ~2 o  a% X2 u
//加速度的時(shí)間分辨率管理子系統(tǒng)。更多更平穩(wěn)
9 w6 t4 l# w  C% X1 {6 k//加速度,特別明顯的機(jī)器上,運(yùn)行在非常高的進(jìn)料速度,但可能負(fù)面
% A# ~# C) v& g0 j; z//影響性能,。正確的值為這個(gè)參數(shù)是依賴于機(jī)器的,所以建議6 D- L% f9 |# _7 Q
//這只設(shè)置為高,。近似成功的價(jià)值觀可以廣泛的范圍從50到200或者更多。5 G9 d* q& L8 X. ]: A
//注意:改變這個(gè)值也變化的部分步驟的執(zhí)行時(shí)間緩沖,。( l9 v$ S' h  n7 j& T3 t
//增加這個(gè)值時(shí),這個(gè)商店部分緩沖區(qū)的總時(shí)間減少,反之亦然,。使. Y8 q7 ^9 h% f
//特定步驟段緩沖是考慮這些變化增加/減少,。7 U7 x, v  A2 C& X9 W/ r, }3 O
6 m) B3 Q6 F1 g1 R9 |/ k
#define ACCELERATION_TICKS_PER_SECOND 100  //加速度的時(shí)間分辨率管理子系統(tǒng)。更多更平穩(wěn)
  B" t* B; W5 Z" {$ p: \! Y
: W) h1 ~, s, n& m7 ?$ t! }9 h// Adaptive Multi-Axis Step Smoothing (AMASS) is an advanced feature that does what its name implies, 9 ~3 w  U! k/ D; L- q
// smoothing the stepping of multi-axis motions. This feature smooths motion particularly at low step4 q3 T' f/ r4 ~
// frequencies below 10kHz, where the aliasing between axes of multi-axis motions can cause audible
" k8 |- w' w0 q$ }$ F% I// noise and shake your machine. At even lower step frequencies, AMASS adapts and provides even better
* C, z$ O% p7 l/ i; p" n! m// step smoothing. See stepper.c for more details on the AMASS system works.
/ D( L& w  |$ d2 t//自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能,它的名字所暗示的那樣,3 `+ }* B% M: O3 Q' y
//平滑的多軸步進(jìn)運(yùn)動(dòng),。這個(gè)特性平滑運(yùn)動(dòng)尤其是在低一步% p' u& T- T$ l$ F/ A6 t9 d  L
//頻率低于10 khz,軸之間的混疊的多軸運(yùn)動(dòng)可能導(dǎo)致音響
6 N( n: K. v3 ?4 ~9 O& z) E& y2 x//噪音和震動(dòng)你的機(jī)器,。在更低的頻率步,積累適應(yīng)并提供更好
0 k  D0 V$ e9 Z0 z. {1 [  O//步驟平滑�,?吹讲竭M(jìn),。c更多細(xì)節(jié)的積累系統(tǒng)的工作原理。
: x4 U3 ~6 e/ z6 b8 ~1 q
, T7 X# u: H4 L; p) `  a. ]#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING  // Default enabled. Comment to disable.//自適應(yīng)多軸步平滑
! W8 J8 F; Q1 P0 p5 \4 u8 h  k0 J
  f2 O% \0 t: p// Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error 9 ~; B4 y1 @0 D0 [: z6 b
// check in the settings module to prevent settings values that will exceed this limitation. The maximum4 Q( u- \5 p, h% ]$ h
// step rate is strictly limited by the CPU speed and will change if something other than an AVR running
" D: \7 G- Q2 N; R// at 16MHz is used.
7 l! G3 R: p; p// NOTE: For now disabled, will enable if flash space permits.2 M5 |- H) d' N1 P4 g8 P$ s; c
//設(shè)置最大一步速率可以寫成Grbl設(shè)置,。這個(gè)選項(xiàng)可以使一個(gè)錯(cuò)誤
) X% T9 t6 |8 k, q. D& Z. [//設(shè)置模塊中檢查,防止設(shè)置值將超過這個(gè)限制,。的最大3 t' g& n; o" }/ R1 a# Q
//步驟嚴(yán)格限制的CPU速度也會(huì)改變?nèi)绻瞧渌鸄VR運(yùn)行" ~! g+ _$ E6 ^: C* u/ d+ e
//使用16兆赫。
- v# P9 n% N# y1 j# r, k+ ^//注意:現(xiàn)在殘疾,將使如果flash空間許可,。
2 [; ?! M8 C7 q* `0 S' ]5 A8 N8 K
5 M% E5 U0 ~. @// #define MAX_STEP_RATE_HZ 30000 // Hz 設(shè)置最大一步速率" W9 Q. X( G" \- K0 x
4 v& Q0 x6 O. l* Q7 `( U
// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors+ m" P3 p$ K3 |3 z' W
// enabled. This simplifies the wiring for users by requiring only a switch connected to ground, / [+ k/ f8 S2 y  S2 e8 E4 |
// although its recommended that users take the extra step of wiring in low-pass filter to reduce
7 e4 v% A4 ]0 F4 W* @$ S5 G0 I// electrical noise detected by the pin. If the user inverts the pin in Grbl settings, this just flips3 H6 T: |1 [  ^3 I3 Z
// which high or low reading indicates an active signal. In normal operation, this means the user " U9 v  C4 `% k$ v; \
// needs to connect a normal-open switch, but if inverted, this means the user should connect a
; K$ T% S- t5 g; L# n- ?+ z! u; e& ^// normal-closed switch. + A8 R3 @8 q% {' d* `
// The following options disable the internal pull-up resistors, sets the pins to a normal-low ( H% e' R" u7 e, B( S
// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning ( a% M% ]% b3 P! P: M* }% n/ l, M
// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
* W1 z  p2 l/ O- S/ _( c6 B// normal-open switch and vice versa.3 Y8 U1 i$ H8 t8 k- M$ _' g
// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.- g$ @% C3 n- H# @. P; U
// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
* u* \8 C9 x0 Z//默認(rèn)情況下,Grbl所有輸入引腳設(shè)置為正常高操作的內(nèi)部上拉電阻
2 G( K* O) L' r//啟用,。這簡化了布線為用戶只需要一個(gè)開關(guān)連接到地面,3 b) [* v/ X" _' D2 s
//雖然其建議用戶采取額外的步驟,在低通濾波器來減少布線9 P# v8 L# O+ _6 z3 M- B# ^
//電噪音檢測銷。如果用戶反轉(zhuǎn)的銷Grbl設(shè)置,這只是翻轉(zhuǎn)4 b' C6 y+ f2 r4 M" i6 ?5 M" y
//讀高或低表明一個(gè)積極的信號,。在正常操作中,這意味著用戶% K6 H* i; U2 x
//需要連接一個(gè)常開開關(guān),但如果倒,這意味著用戶應(yīng)該連接
2 H. W4 F; u* M+ o3 D" n( v5 U// normal-closed開關(guān),。3 y5 a% c" {. J+ g
//以下選項(xiàng)禁用內(nèi)部上拉電阻,一般低設(shè)置別針
. s* F0 {# h0 \% k8 ^2 D2 J: M/ h+ V6 V4 I//操作,現(xiàn)在開關(guān)必須連接到Vcc代替地面。這也掀的意思0 h. f0 D9 v2 Z- N* t5 z
//反銷Grbl設(shè)置,一個(gè)倒置的設(shè)置現(xiàn)在意味著用戶應(yīng)該連接
6 x/ c1 z$ m* Z, B1 @//常開開關(guān),反之亦然,。
# t0 N* c. |1 d6 _7 l//注意:所有針與功能被禁用,例如XYZ限制針,而不是單獨(dú)的軸,。
: x; x* d2 F* A4 T' P//警告:引體向上被禁用時(shí),這需要額外的布線與下拉電阻!
: |  x5 Y1 Q8 @5 Y% ?; W: D* y: s! c4 Z7 Q  W6 A6 o
//#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻2 W$ X" d9 @* v0 C
//#define DISABLE_PROBE_PIN_PULL_UP
# z2 }: ]8 |+ _+ g  ~8 |% r9 a//#define DISABLE_CONTROL_PIN_PULL_UP
! I, j6 [/ J9 o- w% m) y9 W
* V5 M8 t/ x4 e// Sets which axis the tool length offset is applied. Assumes the spindle is always parallel with , s* w2 B7 v9 ^% p8 x# ^" W; ~
// the selected axis with the tool oriented toward the negative direction. In other words, a positive
! C7 U8 v2 l+ Z# [9 Q3 n# w// tool length offset value is subtracted from the current location.  d) m( W7 W5 R  x: X
//設(shè)置哪個(gè)軸長度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與" l( y- Z$ x9 n' f5 g7 C8 D' p! p$ e
//選擇軸工具面向負(fù)方向,。換句話說,一個(gè)積極的
. S0 ~2 r6 l7 \; m# Q//工具長度偏移值減去從當(dāng)前位置,。
  C$ F% [: R: H+ @) W. \' u; S+ ~# ?5 Q  f7 E
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.設(shè)置哪個(gè)軸長度補(bǔ)償應(yīng)用的工具
: Z! Y' ~+ w8 \0 g
% L5 E& f: R4 O9 S/ d  Y1 r// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
; L( }1 A/ h: k8 P9 L9 r// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
8 s5 D7 l% \; s$ S  o; ?// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!6 j4 R; |1 w$ ^' d2 x
// The hardware PWM output on pin D11 is required for variable spindle output voltages." {6 N- e' D: W8 @; U- ^
//允許變量軸輸出電壓不同的轉(zhuǎn)速值。Arduino Uno,主軸" u8 M' u7 f& S+ I# e2 a
//啟用銷將輸出5 v的最高轉(zhuǎn)速256中級水平和0 v時(shí)禁用,。* V. o8 d- r+ z8 S, k, B' W8 e
//注意:重要Arduino凱澤本人!當(dāng)啟用時(shí),Z-limit銷這里和軸銷D12開關(guān)!9 `2 {7 m+ w2 T+ \, r* d0 }
//硬件PWM輸出銷這里需要變量軸輸出電壓,。
+ F; E! B. |0 E( q  U0 K3 c
4 v  r) O" c4 H+ Y* ]  ]: h#define VARIABLE_SPINDLE // Default enabled. Comment to disable.//允許主軸輸出電壓不同的轉(zhuǎn)速值! v6 X5 O5 F$ H1 _

, m, h  U) a+ Q) I+ R// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
5 _, |+ X7 {$ d/ [: K6 s4 Z8 w// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
2 I: G8 f, h2 q2 t2 h4 V" b// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 1000
' p* {+ K. W8 \, \0 _// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands: 6 G( B/ L* D0 R- Z/ M+ C
// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled.3 |" {; N/ [, W. Y; U
//使用的變量軸輸出。這些參數(shù)設(shè)置最大和最小軸轉(zhuǎn)速
9 V! h0 ?7 e1 `' D/ t( ]% V//“S”刀位點(diǎn)值對應(yīng)于銷電壓的最大值和最小值,。有256個(gè)離散和
; o* k- U  q8 _& }! M6 B0 m; p//電壓平均分配箱主軸速度的最大值和最小值之間,。所以對于一個(gè)5 v銷,1000! q0 v5 F. v% b+ f. @, ^, ]. v9 t
// max rpm,250分鐘rpm,主軸輸出電壓將為以下“S”命令:# U6 S  `% A0 ~' n( |# C
// @“S1000 5 v,“S250”@ 0.02 v,“S625”@ 2.5 v(中檔)。銷輸出0 v時(shí)禁用,。
# q$ ]8 m# g0 U7 x3 q4 l8 e
; {% G* X# Q; u4 }: x( O' T" q#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.3 o2 t6 K: ?/ _* V6 h
#define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
8 _' X/ c% ~; }3 Z, ]
& C7 n9 `1 t0 j2 p0 d4 ]0 e// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
& @* z5 g4 E/ N7 U6 f: k$ v1 O// When disabled, the PWM pin will still read 0V. Most users will not need this option, but it may be ) ~  X. M5 t! ]$ _8 Q
// useful in certain scenarios. This setting does not update the minimum spindle RPM calculations. Any
# s" m" y5 a% `. T/ ~; o2 y1 S9 j$ k// spindle RPM output lower than this value will be set to this value.; ?. E, r$ x# m& b
//使用的變量軸輸出,。這迫使PWM輸出最小占空比時(shí)啟用。% V' i- \8 F9 f0 _! u
//當(dāng)禁用,PWM銷仍讀0 v,。大多數(shù)用戶不需要這個(gè)選項(xiàng),但是它可能是
' N% f5 t& z; L0 v- N3 ^+ S//在某些情況下很有用,。這個(gè)設(shè)置不會(huì)更新最小主軸轉(zhuǎn)速計(jì)算。任何1 V& D: |9 z) R1 R4 m) }$ d( s; W
//輸出軸轉(zhuǎn)速低于這個(gè)值將被設(shè)置為這個(gè)值,。( c$ o, B- v) e# C; z8 x
$ [+ }. \' w! U% \  _
// #define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable. Integer (0-255)
* ~4 ]: O/ F+ w+ C& W' B) b" n9 l
# D3 R- [0 t$ o4 C// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help ; e4 q/ {# S4 G9 @$ m
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses( A- E; E5 T9 u  Z2 C
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
/ S! h; q# o$ T/ i% u: v& |# z// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno). . p1 r& Y- ]7 [: F6 s
// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.8 H/ M) G' ]8 `* a; |& M
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with
( d/ P  K3 |0 Z  A. A6 d// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.), ( f' v) C8 Y- b, B/ z1 g, x
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!7 U2 e5 A5 h& P" p4 T' G9 a8 O" J
//默認(rèn)ATmega328 p(Uno),Grbl結(jié)合變量軸PWM和使到一個(gè)銷的幫助; A. k8 H7 t  e6 t( p; f
//保存I / O管腳,。對于某些設(shè)置,這些可能需要單獨(dú)的別針。這個(gè)配置選項(xiàng)使用- U/ p7 C: O; H
//方向軸銷(D13)作為一個(gè)單獨(dú)的軸銷上啟用銷以及主軸轉(zhuǎn)速PWM這里,。
7 q2 P' B4 g' K/ l9 {- I//注意:該配置選項(xiàng)僅適用于VARIABLE_SPINDLE啟用和328 p處理器(Uno),。$ l+ x- _+ V& G# q& h
//注意:沒有方向銷,主軸順時(shí)針M4刀位點(diǎn)命令將被刪除,。M3和M5仍然工作。) J) _1 ~7 |' C3 w3 e
//注意:小心!Arduino引導(dǎo)裝載程序切換D13銷的權(quán)力,。如果flash Grbl" P: B" r# M' h" z6 \
//程序員(您可以使用一個(gè)備用Arduino“Arduino ISP”。搜索網(wǎng)絡(luò)如何線),
  Z* q' n0 N+ n6 R# h0 U//這D13導(dǎo)致切換應(yīng)該消失,。我們還沒有測試這個(gè),。請報(bào)告將會(huì)怎樣!" `) l, t) r# X+ `
2 e4 d& ~# @7 J9 d) |
// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable." A# [: f& ?4 X
4 _& c" v9 f  T2 n/ q- [
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces  u- w: B  g" [1 h7 W0 J+ U! k
// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be 3 g; l- E- P, S8 R  y$ W) @
// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user 6 E6 y2 c3 Y' }
// sendss the line 'g1 x1.032 y2.45 (test comment)', Grbl will echo back in the form '[echo: G1X1.032Y2.45]'.
- O4 z$ }0 ^- e7 j// NOTE: Only use this for debugging purposes!! When echoing, this takes up valuable resources and can effect
! M) F! r9 x! O1 {$ M6 Q. q% H# I// performance. If absolutely needed for normal operation, the serial write buffer should be greatly increased, c: l5 N7 t% K  X! T7 @' r* Z+ U
// to help minimize transmission waiting within the serial write protocol.
0 Q0 v4 G- {& p; C+ x1 J1 H" E9 O$ O3 P8 P( ?# ]/ R
//啟用,Grbl發(fā)回的回聲線已收到,已預(yù)編譯(空間
4 c4 b! }* Z% K; y* \" l//移除,大寫字母,沒有評論),由Grbl立即執(zhí)行�,;芈晫⒉粫�(huì)* F2 a, J$ z# b
//發(fā)送一個(gè)線緩沖區(qū)溢位,但應(yīng)該對所有正常線路送到Grbl,。例如,如果一個(gè)用戶9 A( f5 a9 L! v3 E$ ^, O
//發(fā)送線的g1 x1.032 y2.45(測試評論)形式”,Grbl將回聲”(回聲:G1X1.032Y2.45]”。
6 P) m" W4 F% u, g; ]% P) i. ]//注意:只使用這個(gè)調(diào)試! !當(dāng)呼應(yīng),這占用了寶貴的資源,可以影響6 R# l! u  \' o0 w! \
//性能,。如果正常運(yùn)行所需的絕對,串行寫入緩沖器應(yīng)該大大增加
; b# A4 r; n1 X//幫助最小化傳輸?shù)认盗袃?nèi)寫協(xié)議,。7 p7 [% T0 ~# t- P" H2 k& p
; T9 G7 Y: @% C$ h, y  L* c0 R, G. J/ [
// #define REPORT_ECHO_LINE_RECEIVED // Default disabled. Uncomment to enable.
/ T/ Y8 @6 Z, X/ s% c  J% W+ N7 N$ q8 ^- F) Y
// Minimum planner junction speed. Sets the default minimum junction speed the planner plans to at
) S! g$ Z- H* u# V5 i// every buffer block junction, except for starting from rest and end of the buffer, which are always, I5 Y- |* Q& {/ }; M
// zero. This value controls how fast the machine moves through junctions with no regard for acceleration
4 n& U7 l$ [" C, m// limits or angle between neighboring block line move directions. This is useful for machines that can't
% @6 [. l; t; P// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value: D3 i9 |2 l. d
// should not be much greater than zero or to the minimum value necessary for the machine to work.9 P* g% o, p8 L2 @' _/ l$ y+ n

4 w! K, M3 D4 y2 B8 [# D, @) {2 v//最小規(guī)劃師結(jié)速度。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃
  s0 `9 q. Z8 {//每一個(gè)緩沖塊接頭,除了從結(jié)束休息和緩沖區(qū),它總是! I+ f( e! C& ?( W- M. [
// 0,。這個(gè)值控制機(jī)器的速度穿過路口,沒有考慮加速度
1 _8 J+ u1 E4 A5 p9 R& e//限制或相鄰塊之間的角線方向移動(dòng),。這是有用的機(jī)器,不能& J: G$ i9 z3 B. E
//容忍工具居住某一剎那,即3 d打印機(jī)或激光切割機(jī)。如果使用這個(gè)值$ p& A) w3 F  E& T/ f
//不應(yīng)大于零或機(jī)器工作所需的最小值,。7 Z# x7 V6 f+ D& I" t0 O

" A$ _6 y( t- f! D#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min)4 q5 |: ]$ v9 m9 J/ H8 w6 D
/ Q; r% v9 z- P6 z% A" q+ v& C- I
// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum0 J8 W' ]6 |! ^& x, @
// value. This also ensures that a planned motion always completes and accounts for any floating-point
) |3 Y, M: k! j; G& F// round-off errors. Although not recommended, a lower value than 1.0 mm/min will likely work in smaller
& [* I6 e' q+ y% r+ r, c+ a$ I& y# s// machines, perhaps to 0.1mm/min, but your success may vary based on multiple factors.4 W5 x: j' {- a; {- C; K) Z& I
//設(shè)置計(jì)劃將允許的最小進(jìn)給速率,。任何價(jià)值低于它將被設(shè)置為最低值。這也保證了運(yùn)動(dòng)計(jì)劃總是完成,占任何浮點(diǎn)
) s' j" a" o) S+ p, W6 F//舍入錯(cuò)誤,。雖然不推薦,價(jià)值低于1.0毫米/分鐘可能會(huì)在較小的工作
* q2 b$ _$ ]( E: w, H' ]+ S5 t5 y//機(jī)器,也許到0.1毫米/分鐘,但你的成功基于多種因素可能會(huì)有所不同,。
  ^) Y! p" x5 z. W
! G0 Y& S" `+ A  s5 }#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率
* q5 K0 |! c- ~2 U+ U* ?, z: U: ^: R, X, n  O2 g# @; W1 l0 ~
// Number of arc generation iterations by small angle approximation before exact arc trajectory ; N6 s8 L( B+ Y4 p) B* ?
// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there 9 Q" p% P, G' P" P8 ^' _
// are issues with the accuracy of the arc generations, or increased if arc execution is getting2 W) V! w( X, c
// bogged down by too many trig calculations.
  W8 {; Q6 m" l5 e//弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡
, @. M: V% M0 I' c, n//修正與昂貴的sin()和cos()calcualtions。如果有這個(gè)參數(shù)可能減少
* z2 e4 l$ I# t//與弧一代又一代的準(zhǔn)確性問題,或如果電弧執(zhí)行得到增加
; l* o6 |% f& `/ L/ ?$ v; ~//太多的三角計(jì)算的泥潭,。
" v, d+ g$ s7 |) W/ k0 u) r/ D+ T) Y
. M* D2 l& \& b2 D; o, g#define N_ARC_CORRECTION 12 // Integer (1-255)) [: ?* W) U1 M9 t5 ]% I
: c; ]! z$ G0 m/ o
// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical
& w1 b! a" r, p" O  v( n// errors when arc at semi-circles(pi) or full-circles(2*pi). Offset-based arcs are much more accurate & d! {+ q1 C# K' V3 g
// but still have a problem when arcs are full-circles (2*pi). This define accounts for the floating
& t" i7 A0 E. N/ x! o. y) F# c// point issues when offset-based arcs are commanded as full circles, but get interpreted as extremely
2 ]! k5 F- I3 R" s$ @# S  s// small arcs with around machine epsilon (1.2e-7rad) due to numerical round-off and precision issues.3 _4 `, q2 f$ B6 U# I
// This define value sets the machine epsilon cutoff to determine if the arc is a full-circle or not.! O! T0 d: G" ]1 p0 d9 a
// NOTE: Be very careful when adjusting this value. It should always be greater than 1.2e-7 but not too0 G, m+ \' T2 d$ S# |
// much greater than this. The default setting should capture most, if not all, full arc error situations.
- i* c% o6 k: p; y0 u( D( F4 Z//弧G2/3刀位點(diǎn)的標(biāo)準(zhǔn)定義是有問題的,。Radius-based弧有可怕的數(shù)值0 V3 N. J" L4 a: L; f" _
//錯(cuò)誤當(dāng)電弧在半圓(π)或原點(diǎn)(2 *π)。Offset-based弧更準(zhǔn)確: i0 c8 M) d  m. B4 M! d7 M, s5 E
//但仍有一個(gè)問題當(dāng)弧原點(diǎn)(2 *π),。這個(gè)定義占浮動(dòng)
, b3 P5 ~0 n+ Q! N4 ]2 W4 J//當(dāng)offset-based弧吩咐點(diǎn)問題完整的圓,但解釋為極
: K3 E9 b, x# Y% s3 S4 f% J2 |//小弧機(jī)周圍ε(1.2 e-7rad)由于數(shù)字舍入和精度問題,。
: i9 x' M/ y# z  i" e//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了。
% b, X2 B8 r. k% m  n//注意:調(diào)整這個(gè)值時(shí)非常小心,。它應(yīng)該總是大于1.2 e -但不要太
; U% ^% p$ _+ K" E! d" q( P1 k//比這大得多,。默認(rèn)設(shè)置應(yīng)該捕獲大部分,如果不是全部,全部錯(cuò)誤的情況。
+ C! K9 P2 d* g& q% T& f
+ n, [4 S9 ?: N3 r#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)) m9 ]3 V) v9 L/ X: c6 r5 F$ a

- U6 Q8 H# L0 A& c// Time delay increments performed during a dwell. The default value is set at 50ms, which provides
8 u' t9 g. o; O) ^' l// a maximum time delay of roughly 55 minutes, more than enough for most any application. Increasing
/ j+ C# A: v. z1 @7 H// this delay will increase the maximum dwell time linearly, but also reduces the responsiveness of
+ F, c, h$ w& b) G: V+ c  n% j// run-time command executions, like status reports, since these are performed between each dwell
  @: O! r# b: R. d) K( J// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.0 n  i/ x: k9 O' B
//延時(shí)增加表現(xiàn)在住,。默認(rèn)值設(shè)置為50毫秒,它提供了8 E0 k: ?( j) O2 M( w2 p8 X/ I
//最大延時(shí)約55分鐘,足夠?qū)Υ蠖鄶?shù)任何應(yīng)用程序,。增加
. I% `# Q( r  M6 k//這種延遲將增加線性最大停留時(shí)間,也減少了響應(yīng)能力
  i9 K4 r; g- G8 ?//運(yùn)行命令執(zhí)行狀態(tài)報(bào)告一樣,因?yàn)檫@些每個(gè)住之間執(zhí)行
' E$ d6 y1 a8 b: D3 O: k! }//時(shí)間步。還有,記住,Arduino延遲計(jì)時(shí)器不是很準(zhǔn)確的長時(shí)間延誤,。
! t  J  h  W$ V  B/ I$ v
" @: T4 D6 b# D) `  R#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
1 X  u9 a1 v5 {, ^
% I' u- s3 Z8 S- _1 b, v# w// Creates a delay between the direction pin setting and corresponding step pulse by creating
8 t) H0 _. h9 D& w; G4 G. O' n// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare) % G8 ~; e, ^% d5 u# {7 U. L1 T
// sets the direction pins, and does not immediately set the stepper pins, as it would in
- b+ ^) d. @+ `, m5 C  b: [// normal operation. The Timer2 compare fires next to set the stepper pins after the step
9 y( g$ ]: g" V1 |1 z9 g// pulse delay time, and Timer2 overflow will complete the step pulse, except now delayed ) _9 W7 k0 M* U* u$ \$ S
// by the step pulse time plus the step pulse delay. (Thanks langwadt for the idea!)
' R* @: Q' g. I; `5 G# r/ d" f// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the
1 E) m8 D$ |' \" X- A$ c( m// user-supplied step pulse time, the total time must not exceed 127us. Reported successful5 F& p9 G! @, D( f8 Z; ~% [9 l4 ?; U
// values for certain setups have ranged from 5 to 20us." k# a! f" f) E- H" ?
//創(chuàng)建一個(gè)方向銷之間的延遲脈沖通過創(chuàng)建設(shè)置和相應(yīng)的步驟/ Q; p  J+ E' N1 |& V
//另一個(gè)中斷(Timer2比較)來管理它,。主要Grbl中斷(Timer1比較)+ P1 J% m5 j$ g) v9 B
//設(shè)置方向針,不立即設(shè)置步進(jìn)針,因?yàn)樗鼤?huì)在
  Q, ]$ A6 M- Q. t0 Z//正常操作。Timer2比較火旁邊設(shè)置步進(jìn)針后一步
$ x0 o/ _! z# i9 g0 `- }  S//脈沖延遲時(shí)間,Timer2溢出脈沖將完成的步驟,現(xiàn)在延遲除外
' C' g5 z. L! u- l/ {//脈沖時(shí)間加上的一步一步脈沖延遲,。(感謝langwadt主意!)6 [; Q9 W! B. }6 L* N
//注意:取消啟用,。必須> 3,建議延遲,當(dāng)添加的
' u- A9 J7 H3 ^  s//用戶提供的步驟脈沖時(shí)間,總時(shí)間不得超過127美元,。成功的報(bào)道; p3 m4 J3 \7 f# s
//值對某些設(shè)置范圍從5到20。8 @4 m& Z0 j! j. |2 Q2 Q

- T9 Z! J6 I  x& s// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.; S/ y2 S" {& X  w6 I

6 Q( }  l4 I4 y; \; p# M// The number of linear motions in the planner buffer to be planned at any give time. The vast2 g5 I4 J6 C/ Q+ B9 D& x
// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra & O+ t& Q8 r/ i* N' b9 ?: Y+ M1 ~
// available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino0 L0 u* R; u, X0 O! z4 D. T
// begins to crash due to the lack of available RAM or if the CPU is having trouble keeping4 Y) D+ a4 j9 Z
// up with planning new incoming motions as they are executed.
- t) N, u( r3 F5 H. g+ ^//線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃,。絕大
; i7 L1 |* }2 [8 }/ \//多數(shù)RAM Grbl使用基于這個(gè)緩沖區(qū)的大小,。如果有額外的只會(huì)增加
/ V; ~2 I* P* q: C3 R//可用內(nèi)存,比如當(dāng)基于大型或Sanguino。如果Arduino或減少8 O- F3 l  g" o; K3 V
//開始崩潰由于缺乏可用的RAM或者CPU是難以保持
) z) d0 W9 j2 M5 J//與規(guī)劃新傳入的動(dòng)作執(zhí)行,。( R4 @: {8 B. {0 i8 y3 H3 n. l

$ T9 P6 e' X: p// #define BLOCK_BUFFER_SIZE 18  // Uncomment to override default in planner.h.
" y6 J0 @2 Q( ^+ t/ X7 H1 T
2 j) T( u) X; {7 }// Governs the size of the intermediary step segment buffer between the step execution algorithm
1 Z- v! P, Z4 U6 H4 k// and the planner blocks. Each segment is set of steps executed at a constant velocity over a0 {. H" K: _& u' Y0 O
// fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner8 v4 y3 O: `) A0 _+ U! F
// block velocity profile is traced exactly. The size of this buffer governs how much step
# s, n, ?2 e2 R9 c// execution lead time there is for other Grbl processes have to compute and do their thing , I4 s5 }1 Q+ X0 o6 @* x
// before having to come back and refill this buffer, currently at ~50msec of step moves.; D5 \6 }, B( }: R, g: v+ X& c
//控制之間的中間段緩沖大小的步驟執(zhí)行算法
8 u6 s. U4 Z4 o+ M( ]" h, d//和規(guī)劃師塊,。每一部分的步驟執(zhí)行在一個(gè)恒定的速度
; l0 h5 J. b6 |1 s) y  ~  }//固定的時(shí)間由ACCELERATION_TICKS_PER_SECOND定義的。他們計(jì)算的計(jì)劃9 l4 t+ b! k' Z
//塊速度剖面追蹤到底,。這個(gè)緩沖區(qū)的大小控制多少步驟
& [6 Z7 @" ^7 E$ W9 Q//執(zhí)行時(shí)間有其他Grbl過程需要計(jì)算和做他們的事情4 t) k, M0 G- i
//之前必須回來重新填充這個(gè)緩沖區(qū),目前移動(dòng)~ 50毫秒的一步,。8 X0 i9 ]1 N2 I

; e  N& {# z0 h$ r4 z// #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h.
6 H" \2 p3 @8 }6 K% w
5 W& H3 y) K) [4 M+ ~* U3 h// Line buffer size from the serial input stream to be executed. Also, governs the size of
/ D: f) Q# ~7 x/ ?1 V1 E  H// each of the startup blocks, as they are each stored as a string of this size. Make sure
( r9 F( M5 \* C1 A) n// to account for the available EEPROM at the defined memory address in settings.h and for
4 O' ~& X6 {# n" b2 H% C; a// the number of desired startup blocks.2 I) G' z! w! j6 m" A, g; y3 L
// NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size
$ x8 `4 Q% A5 u0 g/ |9 K! F// can be too small and g-code blocks can get truncated. Officially, the g-code standards / o" F2 G; Z/ w( Y7 t, |
// support up to 256 characters. In future versions, this default will be increased, when
1 P( l; I) _4 C8 _0 Y// we know how much extra memory space we can re-invest into this.
: c4 e# c' ^2 f! W//行執(zhí)行串行輸入流的緩沖區(qū)大小。同時(shí),大小的控制
% s$ @6 e. A7 I7 F//每個(gè)啟動(dòng)模塊,它們分別存儲為字符串的大小,。確保
: G5 H  k" b0 c7 F6 S4 o9 a//占可用eepm定義內(nèi)存地址的設(shè)置,。h和1 O; X4 @# v" u4 \7 y
//需要啟動(dòng)塊的數(shù)量。- Y0 B4 K: @8 y& n- T7 D
//注意:80個(gè)字符不是一個(gè)問題,除了極端的情況下,但線緩沖區(qū)大小
; l! O$ M" ?6 T/ Z//可以太小和刀位點(diǎn)塊可以截?cái)�,。正�?刀位點(diǎn)標(biāo)準(zhǔn)
3 x( X: Y# |0 I6 ~, f//支持多達(dá)256個(gè)字符,。在未來的版本中,這個(gè)違約將會(huì)增加,當(dāng)/ H8 r8 R  v. l+ L  K, S' j0 b$ r6 @4 r
//我們知道多少額外內(nèi)存空間的時(shí)候我們可以再投資。
# w7 `. C/ F+ ~7 i/ i! c* |
. y! K& H8 O' V# @+ _5 U: M6 R3 h// #define LINE_BUFFER_SIZE 80  // Uncomment to override default in protocol.h5 M# ~& w$ S1 [% i
  
- v: b! I3 }6 o. a' ~) A( i* q  u// Serial send and receive buffer size. The receive buffer is often used as another streaming
: |) g% x# G" ^# c& ~1 p// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming
3 U; Y3 M  _( N3 i' A// interfaces will character count and track each block send to each block response. So,
7 }3 \. l) A% G6 ^, j/ Y// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
) n2 r# W# K) z: Q0 `// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
3 Z" I9 ]1 l* a6 g/ h+ _9 Z// messages are sent and Grbl begins to stall, waiting to send the rest of the message." z+ }. D( Y1 ~" L* s
// NOTE: Buffer size values must be greater than zero and less than 256.% Z8 M/ T* g6 d/ l" `
// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h9 {( x7 f) P# Q  d- g5 J  W+ ^
//串行發(fā)送和接收緩沖區(qū)大小,。接收緩沖區(qū)通常用作另一個(gè)流" w* N3 n" P; D+ V
//緩沖存儲傳入的塊來處理Grbl當(dāng)它準(zhǔn)備好了,。最流
& @* w4 Y; c, u$ z# l" C//接口將字符計(jì)數(shù)和跟蹤每一塊發(fā)送給每個(gè)塊的回應(yīng)。所以,. G! Y! y) w' l
//增加接收緩沖區(qū)如果需要更深層次的接收緩沖區(qū)為流,,、- n5 x/ j- e: O+ `* @
//內(nèi)存允許,。Grbl發(fā)送緩沖主要處理消息。只會(huì)增加如果大
/ d8 Q5 ^4 p. m# P, v* b//消息發(fā)送和Grbl開始停滯,等待發(fā)送其余的消息,。
5 F( S. ]' a" _7 @//注意:緩沖區(qū)大小值必須大于零,小于256,。' X) b5 O: ]; q  ?0 b* I8 c6 F/ e- G
// # define RX_BUFFER_SIZE 128 / /取消serial.h覆蓋默認(rèn)值9 `3 z$ d; `; y5 r6 ~* g

7 V3 |# ?( {* g6 A6 }# `  P
" O& v8 \! p5 m, ]1 X/ Z3 `* M4 |! ]// #define TX_BUFFER_SIZE 64
/ k- I. N& ^& y4 F6 ^; l  7 r4 T" ?# T- |$ z
// Toggles XON/XOFF software flow control for serial communications. Not officially supported' N: H/ n3 q* _! c
// due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware8 j  c2 O. Q& x+ G+ W( m( p8 L
// on these chips do not support XON/XOFF flow control characters and the intermediate buffer 0 ~  ]" T. D, ^' L* k
// in the chips cause latency and overflow problems with standard terminal programs. However, 4 x, \0 `8 ?' H$ F. c/ X% }  d
// using specifically-programmed UI's to manage this latency problem has been confirmed to work.! A. O3 s0 M3 z4 @% N3 [
// As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard# |8 ^% I) k2 p4 q. U/ y
// terminal programs since their firmware correctly manage these XON/XOFF characters. In any: R7 G  ]* D3 V$ m) c
// case, please report any successes to grbl administrators!
: K+ h; f" g6 p+ P//切換為串行通信發(fā)送樸通/發(fā)送葡開軟件流控制。不是官方支持
  g: ~; N' H  q( {& d7 h//由于問題涉及Atmega8U2 USB-to-serial當(dāng)前arduino芯片,。固件
' x! Z% U' ~0 Q. U" C! B3 j- S//在這些芯片不支持發(fā)送樸通/發(fā)送葡開流控制字符和中間緩沖區(qū)3 |2 Z+ K0 \5 X1 N7 {  U$ w5 R
//芯片導(dǎo)致延遲和溢出問題的標(biāo)準(zhǔn)終端程序,。然而,
9 j5 H6 z3 Y  ~9 \/ r//使用specifically-programmed UI的管理這個(gè)延遲問題已經(jīng)確認(rèn)工作。
1 D8 R, F8 ], O//以及老FTDI FT232RL-based arduino(Duemilanove)是已知的標(biāo)準(zhǔn)
, v, g1 r: B+ S. j/ }1 e& i//終端程序因?yàn)樗麄冋_的固件管理這些發(fā)送樸通/發(fā)送葡開的角色,。在任何
4 ^9 @+ x+ Z1 P- n& \! Y, p//情況,請報(bào)告任何成功grbl管理員!
' ^$ C% e$ s* F0 z0 D) Y4 O/ b1 t7 o, G. b6 b
// #define ENABLE_XONXOFF // Default disabled. Uncomment to enable.: F- C8 D/ s: O; }
% L# y# `$ `8 y. s' c" E& [  s
// A simple software debouncing feature for hard limit switches. When enabled, the interrupt
+ ?* Y* X& D) y+ Q: b// monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check 4 t5 z& `% r: J) {
// the limit pin state after a delay of about 32msec. This can help with CNC machines with
2 `% M& [) G. M: h" [// problematic false triggering of their hard limit switches, but it WILL NOT fix issues with
5 q' z8 n, c7 o5 j3 y// electrical interference on the signal cables from external sources. It's recommended to first
5 b8 N) w" s! H: u9 r" X// use shielded signal cables with their shielding connected to ground (old USB/computer cables
6 Q& Q# ?- H8 t// work well and are cheap to find) and wire in a low-pass circuit into each limit pin.) [+ G" {+ B9 @1 j8 w5 C- u
//一個(gè)簡單的軟件消除抖動(dòng)特性硬限位開關(guān),。當(dāng)啟用時(shí),中斷
! n" c9 k6 j- L//監(jiān)控硬限位開關(guān)針將使Arduino的看門狗定時(shí)器重新審視# g: ^6 J% B* a1 k
//銷的極限狀態(tài)后約32毫秒的延遲。這可以幫助與數(shù)控機(jī)器
- O2 f5 Y7 j9 Z# P- Y7 I//問題錯(cuò)誤引發(fā)的硬限位開關(guān),但是它不會(huì)解決問題: s7 c/ h5 F$ ~! N
//電干擾信號電纜從外部來源,。首先它的建議
# w6 N( `& M9 B* _2 R6 l* G0 ?//使用屏蔽信號電纜的屏蔽連接到地面(老USB /計(jì)算機(jī)電纜
; X  F# a$ R7 n7 X5 ^! u//工作得很好,很便宜)和線低通電路到每個(gè)限位銷,。. B; l/ A' I' }4 t! W

* M$ g) z3 t2 G% r, C// #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable.- O1 B" q/ `; y/ s( T' ]; z/ _
2 J+ L) L% P9 r0 `
// Force Grbl to check the state of the hard limit switches when the processor detects a pin
2 g( t1 K5 {) q// change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits. d. j. l/ O8 X8 R
// alarm upon any pin change, since bouncing switches can cause a state check like this to
9 M" q. M* Y$ P- k% T) T// misread the pin. When hard limits are triggered, they should be 100% reliable, which is the% R7 r. `3 F+ k) Q1 G; h/ Y6 O
// reason that this option is disabled by default. Only if your system/electronics can guarantee
6 ^2 I, l8 E4 u* B( \// that the switches don't bounce, we recommend enabling this option. This will help prevent2 e2 @! c7 z5 ?' z8 |2 ^! z
// triggering a hard limit when the machine disengages from the switch.
# g9 _% x$ n" e1 |// NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled.  \; h$ {% ?5 c
//力Grbl檢查硬限位開關(guān)的狀態(tài),當(dāng)處理器檢測到一個(gè)銷; A. N, y( t3 x! ?% Y3 r$ `
//改變內(nèi)部硬限制ISR例行公事。默認(rèn)情況下,Grbl將觸發(fā)硬限制  p' T! t* w! ]9 G# {2 \
//報(bào)警在任何銷更改,因?yàn)樘_關(guān)可以導(dǎo)致這樣的狀態(tài)檢查
( y: Z6 |  B* j/ O% Z% o$ W5 W1 P//誤讀了銷,。硬限制觸發(fā)時(shí),他們應(yīng)該100%可靠,這是. o2 [' B. d# g& @* }( }& [
//原因,這個(gè)選項(xiàng)默認(rèn)是禁用的,。只有在你的系統(tǒng)/電子產(chǎn)品可以保證7 p7 G$ z1 s# g! @7 |1 J
//開關(guān)不反彈,我們建議啟用這個(gè)選項(xiàng)。這將有助于防止( r3 X7 ^! L- Q4 K) r
//觸發(fā)機(jī)退出時(shí)硬限制開關(guān)。
  |% k  Q2 @: l  u0 f//注意:這個(gè)選項(xiàng)如果啟用了SOFTWARE_DEBOUNCE沒有影響,。
9 L3 ]. Z# Z9 s  r2 G
) L9 ~# V8 P- P1 _// #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable.
5 R) y1 F9 I2 k5 L9 u* E/ w8 W1 {
( a4 e+ ]& r$ c5 C# [6 T
( @# X8 N3 \3 [5 V// ---------------------------------------------------------------------------------------8 S9 X$ j- F5 X8 v5 A5 I
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:' m/ H1 O6 j+ W5 Y# r

1 N; M0 i$ b% S2 m& y; B#ifndef HOMING_CYCLE_0: ^6 X) G; z8 G8 [8 ?/ T, _
  #error "Required HOMING_CYCLE_0 not defined."
+ p  C( c& ?/ c' a2 E#endif
3 e3 g0 }" a- d' a, s1 l
) z5 x) |+ R, i/ p#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
9 M1 J) p$ k$ d, t  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"
- i- O& Y% r5 Y& ^8 a, _#endif1 J- ^6 i+ \2 G: @- b3 M
4 M3 L! H9 h  I
#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)! u4 F+ S* K* S/ D
  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
0 O, H8 H; H3 _: Q( f$ w#endif
8 A/ C8 }0 E/ i5 I* M9 ^$ r$ @6 ?
* u9 a( t1 w! x// ---------------------------------------------------------------------------------------% s' P) J8 M8 U3 }/ C
, l2 w  @/ Y0 }' G' y$ l
3 J' n+ B2 Q1 z9 X& y" V
#endif
' n4 B- S( D) A" m  k. L1 O* J: F. r* ]4 I2 B3 k
+ L: `$ N# T$ C  U2 n

5 {( }+ j7 h) I3 \# ^) f4 d- o% G" A5 Y: j
9 N/ k8 {9 U' L2 V9 b

# ]5 O2 x! T5 q# f/ }
1 @3 {+ i! X* I4 h1 o! Z) A% }( ?! X9 t; l+ N

) [& Z  I) f5 p) G
. t! P5 r( }6 a' e$ F
/ n8 b2 h+ E1 Q8 i
& W" \4 S- m: ^7 T' d0 [; G- Q
* @4 Z2 J7 X. ]% s; \& z
8 S+ Q8 _: L9 p% f+ X
% ^/ F1 ?# Y; V8 z! X& Y+ V0 z  J. T6 o+ ~9 w* g' p9 G

作者: 1五湖四海1    時(shí)間: 2016-8-21 00:11
那些沒有用的照片不知道怎么就上去了好討厭,。
作者: 1五湖四海1    時(shí)間: 2016-8-21 00:14
% h1 M9 E' E2 w. x8 h

作者: 凸輪設(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ǔ)充
% c  r" t( V4 X2 n+ m+ O程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令。. _5 d/ D/ n' \6 F3 d
// Executes run-time commands, when required. This is called from various check points in the main
" i- x" G  a$ I1 v// program, primarily where there may be a while loop waiting for a buffer to clear space or any
& S/ D) A  z( y( _8 s1 `// point where the execution time from the last check point may be more than a fraction of a second.
( p$ c. M) H5 {1 ]// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code
1 E) b. u6 r$ A% p& z// parsing and planning functions. This function also serves as an interface for the interrupts to
9 w$ b% ^* a0 X2 S& @' {' m. C// set the system realtime flags, where only the main program handles them, removing the need to
% \) @- M" b1 E/ V: H+ B6 |// define more computationally-expensive volatile variables. This also provides a controlled way to - u3 r- F8 m+ t. N
// execute certain tasks without having two or more instances of the same task, such as the planner/ X6 D; p, s* i  A
// recalculating the buffer upon a feedhold or override.
' [  y5 B1 s$ {0 w/ W+ T// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,2 C  L, T" Z$ ^
// limit switches, or the main program." P* |% Y2 Q  U( V% H3 E. y

7 o# j* d! c3 L& \8 M5 F//執(zhí)行運(yùn)行時(shí)間命令,在需要時(shí),。這就是所謂的從各種主程序要檢查站
4 L/ ]% i0 T4 S- S, z0 i//,主要是那里可能是一個(gè)while循環(huán)等待緩沖區(qū)空間或任何
5 j7 W# A& ~* H0 j* O1 n5 Y//執(zhí)行時(shí)間從過去的止點(diǎn)可以超過幾分之一秒。
9 I# g$ Y( ?  i  h) n& {//這是一種異步執(zhí)行實(shí)時(shí)命令(又名多任務(wù))grbl的刀位點(diǎn)
2 p% t& Y4 k* E6 f4 K6 d//解析和規(guī)劃功能,。這個(gè)函數(shù)也可以作為一個(gè)接口,用于中斷( J$ `6 A$ u9 a4 E
//設(shè)置系統(tǒng)實(shí)時(shí)的旗幟,只有主程序處理,消除的需要6 E5 R* b9 p* J8 }% Q7 e
//定義更多的計(jì)算昂貴volatile變量,。這也提供了一種控制方法
* e' a; e2 R$ e, z/ M9 M//執(zhí)行某些任務(wù)不相同的兩個(gè)或多個(gè)實(shí)例的任務(wù),比如計(jì)劃8 [" z: X% K! @, y7 y
//重新計(jì)算緩沖feedhold或覆蓋。
5 `. a1 x- `- X8 D//注意:sys_rt_exec_state變量標(biāo)志設(shè)置任何過程,步驟或串行中斷,插腳引線,2 m$ ]2 e: c. E/ i
//限位開關(guān)或主程序,。% ^7 ^/ L' v0 o  X0 g% B% ~0 i
void protocol_execute_realtime(); I# v) f9 o& r) k' N
{* S# \% v4 f9 g) J4 G/ Y! K
        // Temp variable to avoid calling volatile multiple times.6 z3 v% d. L  `2 v! m7 E% ~
        // 臨時(shí)變量來避免多次調(diào)用不穩(wěn)定,。
( z0 m6 [- e! ], ~2 [. }        uint8_t rt_exec;
+ M. G5 M, A9 M: G4 k2 m        do{5 m* {# `! t* J
          if (rt_exec) {                 // 有標(biāo)志位置位進(jìn)入
; U2 ^0 m9 u" b: @; T        " v+ t9 u0 h# R1 T6 R7 u- d# V
            sys.state = STATE_ALARM; // 設(shè)置系統(tǒng)為報(bào)警狀態(tài)+ W! s2 R4 U5 ]3 t& R
      report_alarm_message(ALARM_HARD_LIMIT_ERROR);        //報(bào)告報(bào)警信息為接近極限值9 o& b* r0 U( C
    } else if (rt_exec & EXEC_ALARM_SOFT_LIMIT) {                        //報(bào)告執(zhí)行軟件限位報(bào)警/ a5 h% a  q8 Y2 A4 S
      report_alarm_message(ALARM_SOFT_LIMIT_ERROR);        //報(bào)告出現(xiàn)軟件限位報(bào)警3 X! X5 F+ F9 Y* r+ i  G0 L# d
    } else if (rt_exec & EXEC_ALARM_ABORT_CYCLE) {                //執(zhí)行停止循環(huán)報(bào)警      # ]( k$ W, Y2 B4 Q& J
      report_alarm_message(ALARM_ABORT_CYCLE);                //出現(xiàn)終止循環(huán)報(bào)警
% i8 E/ N$ d7 f7 X1 n+ l* @    } else if (rt_exec & EXEC_ALARM_PROBE_FAIL) {                        //執(zhí)行探查失敗報(bào)警
% O% X! Y# N6 P; A" F      report_alarm_message(ALARM_PROBE_FAIL);                        //出現(xiàn)探查失敗報(bào)警8 f0 w) U% A) k: C) x* I
    } else if (rt_exec & EXEC_ALARM_HOMING_FAIL) {                //執(zhí)行返回原點(diǎn)失敗報(bào)警  O# v& {- d6 l* W, Y# K* Y/ t
      report_alarm_message(ALARM_HOMING_FAIL);                //出現(xiàn)返回原點(diǎn)失敗報(bào)警
( O8 a; h# m8 K/ O9 K    }1 F4 D# g) N) u9 M9 A2 |! m3 Q. H6 L
; Q9 f. t' Z" r/ ?* I
    // Halt everything upon a critical event flag. Currently hard and soft limits flag this.: A* h8 h9 P9 I0 }! C4 a
    // 停止一切在一個(gè)關(guān)鍵事件標(biāo)志。目前硬和軟限制標(biāo)志( x  l/ S  E( q2 _+ Y2 l
           if (rt_exec & EXEC_CRITICAL_EVENT) {                //如果系統(tǒng)是循環(huán)事件進(jìn)入
" Q. o6 j; Q2 }2 G; n             report_feedback_message(MESSAGE_CRITICAL_EVENT);        //報(bào)告反饋信息! ?3 H) i* d, h# ^
              bit_false_atomic(sys_rt_exec_state,EXEC_RESET);                         //清除目前的復(fù)位狀態(tài)  s' F6 K; X+ B+ B/ p

" N1 S$ [9 I3 x        bit_false_atomic(sys_rt_exec_alarm,0xFF);                                 // 清除所有報(bào)警標(biāo)志
# L4 d( m6 H$ `" \8 W        }       
& q8 ]* u+ j+ Q# L# s1 M) \' L& Y, Y9 P( z! Y
上面代碼將rt_exec = sys_rt_exec_alarm ,,如果rt_exec為真,,打印不同報(bào)警信息
$ a! n. o/ N0 x$ W+ J和限位保護(hù)信息,然后清除報(bào)警狀態(tài)
4 S  `) A3 `' M8 m___________________________________________________________________________
, G  N4 S, W. C& B' r4 D# V8 O沒有報(bào)警進(jìn)行執(zhí)行下面代碼,執(zhí)行了終止命令,,串口打印命令/ q$ R& q" K8 {  t2 w1 D8 D
        // Check amd execute realtime commands        校驗(yàn)和執(zhí)行實(shí)時(shí)命令/ \6 A3 g7 X6 t( w+ {# \% v
          rt_exec = sys_rt_exec_state; // Copy volatile sys_rt_exec_state! A& i, c0 Y% X' z+ l9 }
* i. V4 _/ H: c
        if (rt_exec) { // 輸入標(biāo)志是正確的執(zhí)行' K3 C0 Q1 N+ k, f9 z% D% J/ z3 D
/ M1 o5 s+ M) o0 u' i; B1 K$ e
            // Execute system abort. 執(zhí)行系統(tǒng)終止命令
8 a6 x3 N& m" v5 @3 |- f            if (rt_exec & EXEC_RESET) {
4 p" c9 C4 r* X- E! f+ a& I              sys.abort = true;  // Only place this is set true.2 N5 \  N% s% O' t5 D
              return; // Nothing else to do but exit.: f) d7 u8 F$ w  N8 H5 _3 y
        }
: }  D) r, H/ [, i0 R9 J; `, r# B6 b/ ~/ n3 [6 I" ~
            // Execute and serial print status 執(zhí)行和串口打印狀態(tài)
+ C+ ?7 k* s* X- ~% u/ G' G8 X            if (rt_exec & EXEC_STATUS_REPORT) { 1 s$ K) _3 x# P0 {: m, J/ I0 \. h
              report_realtime_status();        //報(bào)告實(shí)時(shí)狀態(tài)
( o1 ~, s; N0 P* x% F              bit_false_atomic(sys_rt_exec_state,EXEC_STATUS_REPORT);        //清除報(bào)告狀態(tài)清零
, @  ]9 [. y9 y. [# ^3 F            }
- K" t# u. [+ w) y; @) m$ [0 Q_____________________________________________________________________________+ t/ o6 r  ^9 ]- I
下面代碼7 P! v" ]/ T# h( b5 q
//執(zhí)行狀態(tài),。) ^: E$ ?2 C2 M' c' Z. J% B
//注意:所涉及的數(shù)學(xué)計(jì)算持有應(yīng)該足夠低對大多數(shù)人來說,即使不是全部,. |- P- J0 A, G8 S# S" R
//操作場景。一旦啟動(dòng),系統(tǒng)進(jìn)入暫停狀態(tài)4 k& S6 w4 C; Q6 t, u: q
//主程序流程,直到重置或恢復(fù),。
1 H+ S' t9 H; h, i: s待辦事項(xiàng):檢查模式?如何處理呢?可能沒有,因?yàn)樗粫?huì)在空閑,然后重置Grbl,。
+ q3 P5 G( w& W4 p- N$ s8 f5 w7 W8 _狀態(tài)檢查容許狀態(tài)的方法。
$ j( J) o! \' }; r, q$ o5 E4 W2 p- h7 C: F+ f. L$ X3 r/ J
        //如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入% E9 E- q! {: a3 g
            if (rt_exec & (EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR)) {       
- c- T7 R* H- y1 x  j# U/ O& T/ M7 \! U" y9 h! W7 |/ P2 X
        //如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)
4 A: h: x& q: N; ?' |        if (sys.state == STATE_CYCLE) {
% i' t9 `' X6 ~        st_update_plan_block_parameters(); //通知stepper module驗(yàn)算減速,。
( K5 ?4 g4 C: N0 F        sys.suspend = SUSPEND_ENABLE_HOLD; // 開始暫停標(biāo)志7 o" \$ o. G3 e/ D
        }
% u" L- N4 E& S2 m5 i' d/ O2 a
7 d8 q# J$ v" b2 A5 Z7 V        // 如果,Grbl空閑不在運(yùn)動(dòng),。簡單的指示暫停就緒狀態(tài)。: i- Z7 W& T4 J& Y5 d6 {. ^
        if (sys.state == STATE_IDLE) { sys.suspend = SUSPEND_ENABLE_READY; }
7 f( \/ e1 G6 S
* e5 |) ?- G0 f+ A/ v
/ @8 y3 u9 `) i% Q: J        //執(zhí)行和標(biāo)志和減速運(yùn)動(dòng)取消并返回空閑,。主要由探測使用周期
  G8 N6 T8 `5 s        //停止和取消剩余的運(yùn)動(dòng),。       % ]0 n/ d8 Y6 y
        if (rt_exec & EXEC_MOTION_CANCEL) {
! o8 R4 T% H( N. n$ Y5 J" D          if (sys.state == STATE_CYCLE) { sys.state = STATE_MOTION_CANCEL; }
  u7 l+ M3 n8 Q: M          sys.suspend |= SUSPEND_MOTION_CANCEL; 1 O+ D" n: e7 q; @$ s
        }2 F5 y, Z) p& A3 j# s

. Q6 D& L* [8 s7 h        // 只在循環(huán)時(shí)執(zhí)行進(jìn)給保持減速
+ |% \& M) v2 l- K: }+ K: |         if (rt_exec & EXEC_FEED_HOLD) {
: O. p- {9 M$ w9 Q- ^) c        //只有安全門為1才執(zhí)行保持進(jìn)給狀態(tài)賦值
3 E; y& j0 Z8 L6 b; g8 S4 l3 J          if (bit_isfalse(sys.state,STATE_SAFETY_DOOR)) { sys.state = STATE_HOLD; }2 `$ k1 s# t; ?* b* X( q( [/ u
        }* z- h5 O# T2 ?" R

2 Z$ h6 q! L; R; X        if (rt_exec & EXEC_SAFETY_DOOR) {
9 T7 ?5 f& B: N: |, X! h: ?          report_feedback_message(MESSAGE_SAFETY_DOOR_AJAR); - X1 N3 z7 y& c, C
/ /如果已經(jīng)活躍,準(zhǔn)備好重新開始,CYCLE_STOP標(biāo)志設(shè)置為強(qiáng)制斷開。4 r0 p; c8 d& K. p' g% _" B
/ /注意:只是暫時(shí)設(shè)置“rt_exec”變量,不是動(dòng)蕩的“rt_exec_state”變量,。" B. Q& h' P$ C8 d/ L, K1 C, _- v
          if (sys.suspend & SUSPEND_ENABLE_READY) { bit_true(rt_exec,EXEC_CYCLE_STOP); }
/ b: J2 a4 g: o! e" U/ Z          sys.suspend |= SUSPEND_ENERGIZE;
+ C9 G1 b* L- H  e8 F0 W$ O          sys.state = STATE_SAFETY_DOOR;
0 K" [; |$ U7 N, {( w% G  K. ?# `* i: k        }
* c* L, e3 C  C* J+ p9 r& r% ?$ l  Z" J
bit_false_atomic(sys_rt_exec_state,(EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR));    9 C0 P( t% ~0 G1 L( y1 V

! s( {* ?$ ~5 F% a  H& g/ E7 y}( Y& A" r; Z  A+ N7 N
以上代碼執(zhí)行了' B. [4 ~% j' Z7 f7 r9 T9 i" M
1.如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入
! ^$ W7 E$ J% y- p$ r9 H2.系統(tǒng)為閑著狀態(tài),, 開始循環(huán)狀態(tài), 回原點(diǎn)狀態(tài),, 控制取消狀態(tài),, 開始保持狀態(tài), 開始安全門狀態(tài)時(shí)進(jìn)入
. A( A- [% ^& u3.如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)0 {' H8 T2 r2 g, ?) }! v
4.如果系統(tǒng)閑置狀態(tài)執(zhí)行暫停就緒狀態(tài)
; R8 G0 x; X1 L- s9 @5.執(zhí)行動(dòng)作取消
8 J. j+ V5 s/ q( h. [6.如果是保持進(jìn)給狀態(tài),,執(zhí)行保持進(jìn)給狀態(tài)1 _' F- `7 T! w/ t' k3 ]
7.執(zhí)行安全門狀態(tài)
, W$ W; ?* [- O. f4 `最后執(zhí)行bit_false_atomic清標(biāo)志清除(執(zhí)行取消動(dòng)作)(執(zhí)行進(jìn)給保持)(執(zhí)行安全門)標(biāo)志位                 
  P2 ~8 @2 w- D3 z3 J0 T_____________________________________________________________________________
. H" ^4 L  n" z1 [5 O- s+ H5 V2 o8 j; y
. b& u" {+ L5 W% Q1 R2 W    // Execute a cycle start by starting the stepper interrupt to begin executing the blocks in queue.
. t) L+ L" K( z1 ?. y$ m    // 執(zhí)行一個(gè)循環(huán)開始啟動(dòng)步進(jìn)開始執(zhí)行中斷隊(duì)列的街區(qū)
3 h* p3 N9 I! m! q* A    if (rt_exec & EXEC_CYCLE_START) {        //循環(huán)開始狀態(tài)進(jìn)入
5 a  }) ]. S/ S' o8 T      // Block if called at same time as the hold commands: feed hold, motion cancel, and safety door.7 n4 ^- k$ D+ @! x. q* l1 q
      // Ensures auto-cycle-start doesn't resume a hold without an explicit user-input.
, O1 X8 D" e/ H          //塊如果在同時(shí)舉行的命令:保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門,。 //確保auto-cycle-start沒有簡歷沒有顯式的用戶輸入,。
! [# [) p+ n& |$ y$ z          
$ _$ `4 t4 d7 ~" y- [: u  h      if (!(rt_exec & (EXEC_FEED_HOLD | EXEC_MOTION_CANCEL | EXEC_SAFETY_DOOR))) {   //狀態(tài)機(jī)如果不是保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門。
3 Q* m3 t/ {( H/ `5 [9 T        // Cycle start only when IDLE or when a hold is complete and ready to resume./ m' i" Y8 F$ N0 s7 B$ ]* E$ t9 [
        // NOTE: SAFETY_DOOR is implicitly blocked. It reverts to HOLD when the door is closed.% h  T, o' d9 h8 [0 b" X4 G
                //循環(huán)開始時(shí)只有當(dāng)閑置或持有完成并準(zhǔn)備簡歷,。" {9 h& f) {6 s: s8 X7 i
                //注意:SAFETY_DOOR是隱式地屏蔽,。它返回的時(shí)候門是關(guān)閉的。   
( v& Q( ]0 g# r7 n. U5 h6 l# v6 o
* J$ b; v" n1 N- G8 {                // 如果系統(tǒng)狀態(tài)為閑著狀態(tài),,系統(tǒng)狀態(tài)為開始進(jìn)給或運(yùn)動(dòng)取消,,暫停標(biāo)志為位重新開始
' n$ l$ }' q$ x* a  ~$ r        if ((sys.state == STATE_IDLE) || ((sys.state & (STATE_HOLD | STATE_MOTION_CANCEL)) && (sys.suspend & SUSPEND_ENABLE_READY))) {8 H# Y# n8 U* ~0 H: Z: h
          // Re-energize powered components, if disabled by SAFETY_DOOR.4 a# R& v9 M+ s$ t- ^; m; p
          //        由SAFETY_DOOR重振組件供電,如果禁用。2 w/ Z" w( z" q* k
          if (sys.suspend & SUSPEND_ENERGIZE) {   W& O# J9 P$ B/ t
            // Delayed Tasks: Restart spindle and coolant, delay to power-up, then resume cycle.
- F& U; j/ H7 U            //延遲任務(wù):重新啟動(dòng)主軸和冷卻劑,延遲升高,然后恢復(fù)周期,。
; R& s3 ?* }0 s1 [& E            if (gc_state.modal.spindle != SPINDLE_DISABLE) {   //主軸模式不是失能進(jìn)入
. a( j4 X: r; E' Y7 F              spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); //設(shè)置狀態(tài)和速度8 {( f% O1 N! W8 J% C, j; o: K7 H
              //待辦事項(xiàng):阻塞函數(shù)調(diào)用,。最終需要一個(gè)非阻塞。
8 X& p' x9 V5 ?5 L2 a. F# m                delay_ms(SAFETY_DOOR_SPINDLE_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
% @3 P& k% X; \' b            }
) d: }; C% V; ~5 I            if (gc_state.modal.coolant != COOLANT_DISABLE) {
. T& r6 V% l6 {( u1 w1 T              coolant_set_state(gc_state.modal.coolant);
$ M/ w1 i$ P/ _; X. l9 s/ @              delay_ms(SAFETY_DOOR_COOLANT_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
5 x4 {8 Q: F" t% M/ `0 P2 s7 W  |            }0 N" r5 s2 ?9 P9 x2 E. e" V
            // TODO: Install return to pre-park position.
# @7 P* Q2 s7 Q6 w( D9 R; Q          }
3 z; o  K, ?! L% h+ j! r______________________________________________________________________________________________________________* l+ w  |1 |6 j% _8 \
          // Start cycle only if queued motions exist in planner buffer and the motion is not canceled.
3 u% c" n1 `- s& ~  i+ P                  6 H$ a7 j% F4 U+ k3 Z" p/ X
                  //只有在隊(duì)列馬達(dá)存在規(guī)定的緩沖,,并且動(dòng)機(jī)沒有讓取消,,才會(huì)循環(huán)& Q$ U. z' C0 y3 K& n+ |2 p
                  
5 A, D( ]7 U" ?' t! m# F8 F          if (plan_get_current_block() && bit_isfalse(sys.suspend,SUSPEND_MOTION_CANCEL)) {
6 f5 C3 g' d* t! a            sys.state = STATE_CYCLE;
2 l+ s. N& ~8 @& k- _            st_prep_buffer(); // Initialize step segment buffer before beginning cycle.初始化步開始循環(huán)之前3 n9 ?4 U2 Z) s# d% E( b! D# x, U, r
            st_wake_up();
! Q8 j/ }$ K8 r" Y2 N          } else { // Otherwise, do nothing. Set and resume IDLE state.否則,什么也不做,,設(shè)置和復(fù)位空閑模式" p2 n7 j2 q% N. Z7 K& B
            sys.state = STATE_IDLE;) F! `0 K5 M' i) y
          }
5 T) _$ K. t4 K2 t5 U% E          sys.suspend = SUSPEND_DISABLE; // Break suspend state.$ N. P+ ?6 e8 l: v( q0 C0 \. O3 F1 `
        }' e5 N5 y, u+ Q7 m; i1 E0 |
      }    ! w# t; B( P$ w/ a- B0 M0 f+ K
      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_START);        ! s3 M* \7 ?4 M( B% _
    }
' `$ U$ x' k1 S8 s  T1 E, R
; R2 k, \, H1 P$ S1 q_______________________________________________________________________________________________________
' H) w" k9 _: ]% e( f4 ^    // Reinitializes the cycle plan and stepper system after a feed hold for a resume. Called by # d& ^) t' j- U+ h$ r7 p9 s
    // realtime command execution in the main program, ensuring that the planner re-plans safely.
/ _. T! e: p, O8 o    // NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper' B0 d8 {) y; {6 Y4 h
    // cycle reinitializations. The stepper path should continue exactly as if nothing has happened.   
# x: d8 M- Q) H+ n& m    // NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
! d/ k5 q6 Y4 a# J" X5 S* z2 @1 ~+ ^$ |# v& M! E' Y+ _
        //重新啟動(dòng)后循環(huán)計(jì)劃和步進(jìn)系統(tǒng)的進(jìn)給保持簡歷,。通過實(shí)時(shí)命令執(zhí)行主程序,確保安全計(jì)劃重新計(jì)劃。
7 _8 D4 _3 N/ E        //注意:畫線算法變量仍保持通過規(guī)劃師和步進(jìn)( ?9 t/ k+ s) U1 u% ?1 w
        //循環(huán)僅,。步進(jìn)路徑應(yīng)該繼續(xù),好像什么都沒發(fā)生一樣,。       
3 _6 M* c' S! M        //注意:EXEC_CYCLE_STOP由步進(jìn)子系統(tǒng)周期或進(jìn)給保持時(shí)完成。
1 n- l& ~/ h1 U; }  h" Y1 W
$ j- Q# w# ~. p* S    if (rt_exec & EXEC_CYCLE_STOP) {                         //如果是循環(huán)停止?fàn)顟B(tài)進(jìn)入$ R( X9 L9 Y9 S( L/ L- i
      if (sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) {
" ?$ w& z. b+ p3 r9 G9 f        // Hold complete. Set to indicate ready to resume.  Remain in HOLD or DOOR states until user1 y4 p/ H3 z, e7 A, V7 d, i
        // has issued a resume command or reset.! ~; F# @0 n' y- E' f+ K

7 z, ?0 h) }' q                //保存完整,。設(shè)置為指示準(zhǔn)備簡歷,。繼續(xù)持有或門狀態(tài),直到用戶
2 e" {8 M) |: ~. i; a3 {6 g                //已發(fā)布了一份簡歷命令或重置。
" f0 m8 S1 T- J. `               
7 U, m' p# }; k0 w        if (sys.suspend & SUSPEND_ENERGIZE) { // De-energize system if safety door has been opened. 如果安全的門已被打開,。斷開系統(tǒng)
! T9 v9 \9 K5 h! Q* _) K2 }5 A  r          spindle_stop();- f3 ?9 p0 A# ^" ]6 P' n
          coolant_stop();% f* S! v6 v" x6 u: }. L( D
          // TODO: Install parking motion here. 安裝停車動(dòng)作,。6 {& C4 X$ O2 V9 B8 m* P
        }  q2 V+ K; z2 E# K
        bit_true(sys.suspend,SUSPEND_ENABLE_READY);* }; ]1 F5 Z5 S. B+ B7 X$ X9 Y
      } else { // Motion is complete. Includes CYCLE, HOMING, and MOTION_CANCEL states. 電機(jī)完成,循環(huán),,回原點(diǎn),,,MOTION_CANCEL1 ?6 B! A7 I8 m- |& a+ _& U5 n
        sys.suspend = SUSPEND_DISABLE;: q3 @0 Q- O) t9 i9 Y
        sys.state = STATE_IDLE;
2 j9 Q& ^1 I" @/ ^. |5 J* I+ a0 X, W      }' j+ U& }/ y$ m) i# P8 f! p
      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);& K8 [2 Y. \+ ^, V. V
    }& {  `- \( q% m4 a2 A* a
   
1 Z# |$ Q0 ^1 F4 k& z5 W) h( S  }3 R' V8 c; R+ X; U
___________________________________________________________________________________________________) |% ^! x& d, b1 W

' k! `& C# h/ b9 X8 G2 D  // Overrides flag byte (sys.override) and execution should be installed here, since they
8 B, S( ]* M0 A* V9 J/ D( {* O  // are realtime and require a direct and controlled interface to the main stepper program.
! y- m# u: {3 K$ [2 s, J4 o- D8 O6 a# H- S: ^2 N
  //重寫標(biāo)志字節(jié)(sys.override)和執(zhí)行應(yīng)該安裝在這里,因?yàn)樗麄?font class="jammer">$ C& W2 \- z1 ?2 s
  //實(shí)時(shí)和需要直接和控制接口的主要步進(jìn)程序。0 M( {% J- A& P' K  [/ e4 j. f4 t

, t! J* x7 W# ^( i2 X" G. G: z
9 O' q3 x. R; c! f8 V  w7 x  // Reload step segment buffer 重新加載步段緩沖( \0 g' @; v4 R% p. d4 e
  if (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_MOTION_CANCEL | STATE_SAFETY_DOOR | STATE_HOMING)) { st_prep_buffer(); }
3 A9 J  W2 T% y- N5 b' B" p3 E* H% n" u5 L+ c2 Q. v. \
  // If safety door was opened, actively check when safety door is closed and ready to resume.+ i5 @% x! b) K) I( Q
  // NOTE: This unlocks the SAFETY_DOOR state to a HOLD state, such that CYCLE_START can activate a resume.       
' p9 K" ], _! a9 X1 `0 M( I. C/ G) Q0 @& g( J) D+ n, u& K0 l$ N
//如果安全的門被打開,積極檢查當(dāng)安全門關(guān)閉,準(zhǔn)備簡歷,。, c' n8 E: {' H9 P8 U# [: R& u+ l5 E
  //注意:這解鎖SAFETY_DOOR狀態(tài)保持狀態(tài),這樣CYCLE_START可以激活一個(gè)簡歷,。
4 o* |- i$ S9 U: g: Z3 H7 K9 W: K& u. e1 h: Z" V# ?% b
  if (sys.state == STATE_SAFETY_DOOR) {                 //安全門狀態(tài)進(jìn)入" r% i5 Q5 A3 c7 w4 H$ s
    if (bit_istrue(sys.suspend,SUSPEND_ENABLE_READY)) { 4 x) ]& T. A6 N6 D! y
      if (!(system_check_safety_door_ajar())) {% l4 |+ o8 v# y% o. y* a0 i+ I5 S
        sys.state = STATE_HOLD; // Update to HOLD state to indicate door is closed and ready to resume. 更新保存狀態(tài)指示門關(guān)閉,準(zhǔn)備簡歷。1 d+ p9 P+ i7 u3 b3 u6 s; X- F1 Q
      }2 ]1 Q$ J% s' U. b- y4 s
    }# y5 ~" l1 h) m. [$ v/ q' p
  }
- x9 z3 G% j# f6 O0 [  x6 C8 w# ?3 a) A& v1 e
  } while(sys.suspend); // Check for system suspend state before exiting.: _/ B4 }; A3 e" d
  
/ E' X$ l& v3 \# f+ x" M}  
作者: szg不敗    時(shí)間: 2016-8-25 09:31
樓主這些代碼,。是網(wǎng)上搜來,,然后自己組合的嗎?全是自己想的,,那是牛逼了
作者: 1五湖四海1    時(shí)間: 2016-8-25 22:19
szg不敗 發(fā)表于 2016-8-25 09:319 w- t: x! x0 }( `) e  b6 r
樓主這些代碼,。是網(wǎng)上搜來,然后自己組合的嗎?全是自己想的,,那是牛逼了
! `& F$ e! w' c1 n
外國的開源軟件grbl,,在研究它,將打注釋了下而已,,研究透徹了好移植的其他平臺應(yīng)用,,學(xué)習(xí)階段。
+ Z& h3 d* v" U9 ^https://github.com/grbl/grbl1 p4 C- i% _6 [, {- q% C6 i- `' F

作者: 1五湖四海1    時(shí)間: 2016-8-25 22:34
本帖最后由 1五湖四海1 于 2016-8-25 22:44 編輯
7 Q2 I, C. Z5 s# C  r2 {6 U$ P; {, O
這個(gè)defaults.h文件作為一個(gè)中央默認(rèn)設(shè)置配置不同的機(jī)器類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器,。這里的設(shè)置所列出的文件是由用戶提供的,9 ]# Q; M/ F  {, d
所以您的你的需求可能不同,。所以應(yīng)該你了解你的機(jī)器和調(diào)整設(shè)置根據(jù)你的個(gè)性的需求,制造機(jī)器,。
) v# R  `( f/ Y/ A, c+ Bdefaults_h文件是選擇是否將一些參數(shù)設(shè)置為默認(rèn)值0 Q5 A) p5 B, s$ {$ I9 y+ x' O8 H
定義各種參數(shù)7 \- ^0 N. X5 _1 v
1.defaults/defaults_generic.h        //Grbl通過通用默認(rèn)設(shè)置就可以在不同的機(jī)器上工作,。/ z8 p: c6 j/ \8 C# N) _7 S# V$ u
2.defaults/defaults_sherline.h  //描述:Sherline 5400制造廠三個(gè)NEMA 23客戶KL23H256-21-8B 185扭力步進(jìn)電機(jī)
- y! n) P; ~3 C" y+ I8 q3 L3.defaults/defaults_shapeoko.h  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的6 q# K  ~4 w6 K: j! L4 j
4.defaults/defaults_shapeoko3   //描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 23步進(jìn)電機(jī),由CarbideMotion驅(qū)動(dòng)的
  g9 ?  V; r( a( C2 f/ m7 ^8 E% B9 x5.defaults/defaults_x_carve_500mm //描述:X-Carve 3 d卡佛數(shù)控機(jī)有三個(gè)200步/汽車由Synthetos牧師grblShield 24 v。
8 y: X' ^0 w7 B% h6.defaults/defaults_zen_toolworks_7x7         //描述:禪宗Toolworks 7 x7機(jī)有三個(gè)Shinano SST43D2121 65扭力NEMA 17步進(jìn)電機(jī),。導(dǎo)螺桿不同于一些ZTW包,大多數(shù)是1.25毫米/牧師而不是8.0毫米/牧師,。由30 v 6電源和TI DRV8811步進(jìn)電機(jī)驅(qū)動(dòng)程序! A7 F6 ^( y% a9 t0 o
7.defaults/defaults_oxcnc                 // Grbl設(shè)置OpenBuilds牛數(shù)控機(jī)床
9 z, M+ t* |  H7 S1 g1 _& Y$ @8.defaults/defaults_simulator) {( f% N! Z. ^. k/ ?

' A+ N4 q: W6 D) g$ U  L* A; c6 u/*7 q8 P# O$ ^2 ^! S& X- n. o7 G
  defaults.h - defaults settings configuration file: g) G; w& O, h. x# d8 F
  Part of Grbl1 t( L3 f! z- y: M3 r

1 t1 r7 ?+ P2 s) r( D# m7 E  Copyright (c) 2012-2015 Sungeun K. Jeon' k% u8 g6 Z% m5 C5 e: g
: t9 M7 o- k8 ?/ S3 y5 l
  Grbl is free software: you can redistribute it and/or modify
2 v( b5 O) |) y0 e) o( {  it under the terms of the GNU General Public License as published by
# |' \. H; J6 r3 F  the Free Software Foundation, either version 3 of the License, or; Y2 i  \- X7 g  S& V+ t# U
  (at your option) any later version.) }! x# w& V7 @/ {* ]% ]
( |  E. o- ?# ]! l5 K
  Grbl is distributed in the hope that it will be useful,8 K, G3 L9 w# ~0 u" @: x
  but WITHOUT ANY WARRANTY; without even the implied warranty of
" o, g* U5 ]$ ]5 I  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! K$ P: h% E& I8 L9 {, \  c8 |  h
  GNU General Public License for more details.
. v) W6 ^+ M6 D
7 U2 |! u) d2 P  You should have received a copy of the GNU General Public License" e$ f: a8 B4 j4 [5 \4 i. \, m
  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.+ A) l5 v! U1 }" `0 z  o7 E2 x8 N- x
*/
! A, l0 j# I+ m# H2 p4 l5 e8 c% x0 G$ p: S5 j! h2 E; z- p/ H
/* The defaults.h file serves as a central default settings selector for different machine( ~. c- R) H  X$ \- J- M" H
   types, from DIY CNC mills to CNC conversions of off-the-shelf machines. The settings
2 t+ L: N2 v* C6 |   files listed here are supplied by users, so your results may vary. However, this should" d( y$ W8 m6 B, ?
   give you a good starting point as you get to know your machine and tweak the settings for4 H# j: [4 g' e0 n( i; `* z
   your nefarious needs.* A" z2 y( _, F1 h, X
   Ensure one and only one of these DEFAULTS_XXX values is defined in config.h & N1 K: Y# X3 b5 E5 B. r! ~

) j- A- S% _7 k. W$ E4 q) M   The defaults.h文件作為一個(gè)中央默認(rèn)設(shè)置選擇不同的機(jī)器
2 K! t5 X) G6 _. C" f: t   類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器。的設(shè)置
- g7 f9 c: R+ Q   這里列出的文件是由用戶提供的,所以您的結(jié)果可能不同,。然而,這應(yīng)該
% w$ S7 e9 d; B% q   給你一個(gè)很好的起點(diǎn),你了解你的機(jī)器和調(diào)整設(shè)置/ j) k# L, D7 S0 R1 f4 c8 o. u
   你的個(gè)性的需求。' a& l/ ]4 n6 Z3 `( Z
   確保一個(gè)且只有一個(gè)這些DEFAULTS_XXX config.h中定義的值
" p& I6 j, O- \' J2 V   */
3 s; ~. e+ Y! m* h3 ~) b8 a/ k; X. N) K' m
#ifndef defaults_h
+ j0 A' @7 [# c# j% Y5 V0 e# W8 W( k7 K, M* d5 T3 d1 n6 W
// Only define the DEFAULT_XXX with where to find the corresponding default_XXX.h file.
% b) _3 ~; E& M9 q( j// Don't #define defaults_h here, let the selected file do it. Prevents including more than one.
- e. t6 Q. ]7 B6 F//只有定義DEFAULT_XXX在哪里可以找到相應(yīng)的DEFAULT_XXX,。h文件,。8 a/ J( k1 B4 k- A' A. G) P& N
//別在這里# define defaults_h,讓選中的文件。防止包括不止一個(gè),。
  A5 H8 x- M5 \" m9 B
$ U" g) H" y  b6 E  ?! q#ifdef DEFAULTS_GENERIC
# o& ~' N  D4 A& B. y( k$ i  // Grbl generic default settings. Should work across different machines.
: P' K, }% Z2 x& d# D+ v  // Grbl通過通用默認(rèn)設(shè)置就可以在不同的機(jī)器上工作,。
$ W6 N$ n6 F% }' O0 Q- J& j7 {  #include "defaults/defaults_generic.h"
  r% `" ~1 O& f" D, I; M#endif
- ^1 w9 h, E$ H* R, X- z+ F) _$ b$ z4 I* G8 E* K* v
#ifdef DEFAULTS_SHERLINE_5400
+ u9 p) z- s8 {0 F) Y/ Q; d' F  // Description: Sherline 5400 mill with three NEMA 23 Keling  KL23H256-21-8B 185 oz-in stepper motors,
) F" H5 h# A, y4 \( q3 u  // driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding.
$ j* H  R; Z/ i8 N: U  //描述:Sherline 5400制造廠三個(gè)NEMA 23客戶KL23H256-21-8B 185扭力步進(jìn)電機(jī),( V+ c( P1 s5 T
  //由三個(gè)Pololu A4988步進(jìn)驅(qū)動(dòng)30 v,6在每1.5繞組供電。7 U" }# a' ]  I
6 d4 f6 n7 G/ a& v
  #include "defaults/defaults_sherline.h"% ~8 U" a! l1 {4 S# A, w
#endif5 ~4 l* T; a- q0 B1 P. e1 L* }  P

, b4 {+ P8 [3 K$ F#ifdef DEFAULTS_SHAPEOKO0 l) c  C# R2 h% D3 i
          // Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos% u( s: }4 x  q: v, ?
          // grblShield with a 24V, 4.2A power supply.3 W6 `$ I4 u3 j3 j8 \' w
        // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的
  v" y+ r/ K. ^$ P1 `) R3 n- b         // grblShield 24 v,4.2電源,。( w0 U3 n5 Y: k0 _4 P' C
/ v8 Y% a6 E/ m3 I
  #include "defaults/defaults_shapeoko.h"* d9 z  s( k- s. R1 m* n
#endif  A  }( j3 p! ?! D) v% ]
0 w; _" w8 M, c" y4 E2 b+ X
#ifdef DEFAULTS_SHAPEOKO_2
# o7 }9 C8 S4 R0 @$ l) E( B  // Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
( Y% M: O5 a8 ~8 y  // grblShield at 28V.& Y4 A2 a8 f% E% A7 \' c/ Y. S9 o
  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的3 h; y3 g- Q9 E% z  ~
  // grblShield 28 v,。
0 v( r" l: o- z% K6 v0 F
; f5 M& b" D8 o' v# V0 _) N  #include "defaults/defaults_shapeoko2.h"
3 M9 C1 S3 r" v$ o#endif
1 p( y, ^$ D9 f! z. x/ p/ ?0 ?) X1 Y
#ifdef DEFAULTS_SHAPEOKO_37 E% l3 v1 M8 e% O+ J) o
  // Description: Shapeoko CNC mill with three NEMA 23 stepper motors, driven by CarbideMotion
; n* R& `( ?+ c  l! x  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 23步進(jìn)電機(jī),由CarbideMotion驅(qū)動(dòng)的
( D# A/ _2 b* j. @( O1 P# o- r  E! n& R/ t6 [
  #include "defaults/defaults_shapeoko3.h"
2 X. v5 \& `/ _/ M" X; t, b# Q1 b#endif
% f: ~" t0 ?) p: Y
) D' c2 k0 r9 X% a#ifdef DEFAULTS_X_CARVE_500MM8 j  p! P2 ~  V1 k( ?6 `& N0 f
  // Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos3 J1 w$ v* ?$ b4 [! F, [% z$ w
  // grblShield at 24V.
5 E' b' j1 Q) S  N9 ?8 j* m  // 描述:X-Carve 3 d卡佛數(shù)控機(jī)有三個(gè)200步/汽車由Synthetos牧師grblShield 24 v。
# g" a; z0 j6 k! o! o# n% s/ I  #include "defaults/defaults_x_carve_500mm.h"
# K0 L: n& g% p  g#endif
1 H1 \; F1 \# c/ T2 b5 D0 h- G' d# F. T/ `4 I; O+ H) _9 O. S
#ifdef DEFAULTS_X_CARVE_1000MM6 u# @' t; ?+ [/ T
  // Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos6 e4 E4 M1 G/ r% |+ n) p$ ^
  // grblShield at 24V.
; |" o2 G, F) A  #include "defaults/defaults_x_carve_1000mm.h"; ]% a) I/ L4 D' R' j
#endif( c* D* u0 X6 m. ]% b

( v0 m6 f& I2 b$ N2 d#ifdef DEFAULTS_ZEN_TOOLWORKS_7x73 |0 G9 G% }3 s! Z! w7 C' l" d
  // Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors.
. g7 Z& M$ [' s# }  // Leadscrew is different from some ZTW kits, where most are 1.25mm/rev rather than 8.0mm/rev here.( x/ [% n8 n6 U
  // Driven by 30V, 6A power supply and TI DRV8811 stepper motor drivers.& L5 v* y1 q- o8 ?+ P* s
  //描述:禪宗Toolworks 7 x7機(jī)有三個(gè)Shinano SST43D2121 65扭力NEMA 17步進(jìn)電機(jī),。
+ d* F9 }: S+ l  e  //導(dǎo)螺桿不同于一些ZTW包,大多數(shù)是1.25毫米/牧師而不是8.0毫米/牧師,。) L) J% f7 E" O8 ~! U5 k
  //由30 v 6電源和TI DRV8811步進(jìn)電機(jī)驅(qū)動(dòng)程序。
" G' t3 w- h' o3 y. b/ C! Y5 f& q# {
  #include "defaults/defaults_zen_toolworks_7x7.h"
5 C; I& j* h; ?7 j#endif/ L! S8 l0 L; N1 V. g0 p0 U, j9 {  X+ y
* o8 R$ N2 j2 F; X, V
#ifdef DEFAULTS_OXCNC
6 i0 q' P4 `0 P1 W  // Grbl settings for OpenBuilds OX CNC Machine3 l; k0 K" V  d0 J* F
  // http://www.openbuilds.com/builds/openbuilds-ox-cnc-machine.341/
! Y' C9 M9 ^! V' F6 a# o( @( h& Z7 P
  // http://www.openbuilds.com/builds/openbuilds-ox-cnc-machine.341/ 1 m0 b& ^5 r" s# r) ]+ n1 `
  #include "defaults/defaults_oxcnc.h" // Grbl設(shè)置OpenBuilds牛數(shù)控機(jī)床
/ g$ J5 E$ ~5 u5 ~#endif
' A" t3 @  F/ t, e5 I7 T; n" S3 o# N5 z6 l& z
#ifdef DEFAULTS_SIMULATOR. j1 d. ^( ]! `. |2 }/ _: d- F
  // Settings only for Grbl Simulator (www.github.com/grbl/grbl-sim)
. Z0 v" U0 X+ ?, o  #include "defaults/defaults_simulator.h" //設(shè)置只對Grbl模擬器(www.github.com/grbl/grbl-sim)
/ |6 Z% y4 O+ \- M$ O#endif! A0 [+ r* i  B; ?( O6 }$ s

! C. t& b7 O/ E/ _7 d- {2 y, n#endif3 p& W) F- l& T: {; _# s1 ?
' ~8 t, ?9 e% }  y
__________________________________________________________________________________________________________________5 U9 D* v4 \: g9 x7 X/ X
/*
2 B5 J6 r9 q% l; ldefaults_generic.h -默認(rèn)設(shè)置配置文件Grbl的一部分: Q1 N) x7 t5 k( O& [: E
版權(quán)(c)2012 - 2015 Sungeun k全
$ J" u8 M! ^9 kGrbl是免費(fèi)軟件:可以重新分配和/或修改
& Z- {2 y+ p5 x% q4 [# `$ LGNU通用公共許可證的條款下發(fā)布的
, b4 u3 c2 F* |* B  N8 w4 c4 c自由軟件基金會(huì),版本3的許可,或
3 t/ z+ G' M0 R0 ^- V(任您選)其后的版本,。/ [/ K  u: @# p  L+ \

9 t5 [4 T. @9 \8 XGrbl分布,希望這將是有用的,& @8 i  s& q9 i- W: L& N& k0 k
但是沒有任何保證;沒有即使的默示保證8 @( n% y6 {. ?4 }4 e; [  h9 ~/ N
適銷性或健身為特定目的,。看到
, \- z) c: ~8 h. c+ Y$ BGNU通用公共許可證的更多細(xì)節(jié),。
7 G1 b+ U0 b, e$ j
* ^+ A* N7 e: |2 X你應(yīng)該收到了GNU通用公共許可證的副本& A5 r. l$ H+ I
連同Grbl,。如果沒有,看< http://www.gnu.org/licenses/ >。
7 f  ^2 `7 Q' D/ M, ?4 d! V. B* /- ^$ p9 k! l/ D( y
* U) X$ f5 `# ]# V0 H
/ *默認(rèn)值,。h文件作為一個(gè)中央默認(rèn)設(shè)置文件不同的機(jī)器. m4 o& H4 y1 K
類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器,。的設(shè)置% D. s, z' U: r& x+ f* O
這是由用戶提供,所以您的結(jié)果可能不同。然而,這應(yīng)該給你' z" l3 `  v: }6 i3 o$ R
一個(gè)好的起點(diǎn),你了解你的機(jī)器和調(diào)整的設(shè)置/ W% d0 ~4 {8 |& a4 _8 M2 _% r
邪惡的需求。*// B, F) w; Q+ Q& t' e6 ~3 H* C4 v

; G- q' G9 C. t8 k7 }
. R1 R5 I8 i+ n#ifndef defaults_h
( m& f5 X' i# ^/ M# I4 A3 p#define defaults_h! B) V& B3 L5 O# Q0 f0 K# r
& f4 J1 |# z6 Z
  // Grbl generic default settings. Should work across different machines.6 H5 y$ ^1 j, Z8 N$ T
  #define DEFAULT_X_STEPS_PER_MM 250.0        //X軸每mm脈沖當(dāng)量        2 u9 z$ B/ p4 V5 F
  #define DEFAULT_Y_STEPS_PER_MM 250.0
; f& ^7 f+ g9 I! H& L) r# o  W, ]) D  #define DEFAULT_Z_STEPS_PER_MM 250.0
) F; ?$ z+ \) I" p% N2 n! O  #define DEFAULT_X_MAX_RATE 500.0 // mm/min 最大速度
2 ~' [" T3 Q, W+ _- K$ Q; P( B- A  #define DEFAULT_Y_MAX_RATE 500.0 // mm/min
9 a6 K1 D7 ?1 [) e; S' n, [' h  #define DEFAULT_Z_MAX_RATE 500.0 // mm/min7 z+ H( Z+ l: ~6 W. L' T5 t3 h4 C
/*這是毫米/秒/秒的加速度,。
, s% Q& K) ], P: O( F6 W你不需要理解這是什么意思,我只想說,一個(gè)較低的值給smooooother加速度而價(jià)值更高的收益率更嚴(yán)格的措施,達(dá)到所需的進(jìn)料速度更快,。8 c" ]# z" |2 W, @- |7 P
從技術(shù)角度講,這是您的機(jī)器的點(diǎn)對點(diǎn)的加速度,獨(dú)立于軸。設(shè)置加速度值高達(dá)你最限制軸可以讓你在不丟失任何步驟,。. k3 n3 F- ^# Z+ ]) z: r4 ~" T
通常你想給自己一些緩沖,因?yàn)槿绻闶チ瞬襟E,Grbl不知道這發(fā)生了(開環(huán)控制步進(jìn)),并將繼續(xù),。*/: O8 U0 Y! a* A
  #define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2        加速度
8 C' Y; l3 D1 W9 Q! B% z, A! B: P  #define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^21 j' k$ s. C. K4 p  e4 L
  #define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
+ y9 {, L* G6 \0 n# v4 d/ S0 y" f! q  #define DEFAULT_X_MAX_TRAVEL 200.0 // mm                最大步行
! `, P' h( ~! Q/ a$ L: u  #define DEFAULT_Y_MAX_TRAVEL 200.0 // mm               
; P3 d7 D0 V5 I9 F$ s8 [& I& S9 e: l  #define DEFAULT_Z_MAX_TRAVEL 200.0 // mm                & G: g0 u- N) ^- b: M: P: A6 d8 O" f
  #define DEFAULT_STEP_PULSE_MICROSECONDS 10        //步進(jìn)驅(qū)動(dòng)脈沖長度
3 @& ~: r1 \) d  #define DEFAULT_STEPPING_INVERT_MASK 0                //步進(jìn)是否反轉(zhuǎn)" ]( h8 N0 M2 _
  #define DEFAULT_DIRECTION_INVERT_MASK 0                //方向是否反轉(zhuǎn)
& Z/ j2 @6 [& G9 S  /*0 J/ t7 U  k7 |4 x
  每次你完成步進(jìn)運(yùn)動(dòng)和停止,Grbl將禁用默認(rèn)步進(jìn)。
/ T8 @8 u8 H2 v: g6 P- i6 L  M鎖步進(jìn)空閑時(shí)間時(shí)間長度Grbl將步進(jìn)鎖之前禁用,。
" d& a) {/ I* _5 A" k% w根據(jù)系統(tǒng)中,您可以將這個(gè)參數(shù)設(shè)置為零,禁用它,。對他人,你可能需要25 - 50毫秒來確保你的斧子來完成禁用前停止。(我的機(jī)器往往漂移稍微如果我沒有啟用,。)0 g$ k' G* l% F1 |& j- M
或者,你可以讓你的軸在任何時(shí)候啟用通過將這個(gè)值設(shè)置為最大255毫秒,。再次重復(fù),你總是可以保持所有軸通過設(shè)置啟用7美元= 255。*/4 `7 p+ U7 N9 E  B7 V4 O7 M1 u' I# ~
  #define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)步進(jìn)閑著時(shí)間
  r0 q  y$ _- Z$ {7 _0 g( P9 L  #define DEFAULT_STATUS_REPORT_MASK ((BITFLAG_RT_STATUS_MACHINE_POSITION)|(BITFLAG_RT_STATUS_WORK_POSITION)) //是否打印狀態(tài)報(bào)告' v0 q, F3 H; W1 P9 }
/*一些高低cnc-stepper控制器需要輸入反方向和步驟,。
$ c- v6 k- l. C1 Q6 |' P) n; d信號線路通常是高或低信號方向或高,低了幾微秒一步事件信號,。為了達(dá)到這個(gè)目標(biāo),Grbl可以反轉(zhuǎn)輸出比特來滿足特定的需求。1 z6 d1 l5 n1 m
反掩碼值是一個(gè)字節(jié),xor的步驟和方向步進(jìn)港數(shù)據(jù)之前發(fā)送,。這樣你可以使用這兩個(gè)轉(zhuǎn)化步驟脈沖或轉(zhuǎn)化的一個(gè)或多個(gè)方向的軸,。
5 N/ r7 @7 }, K0 D6 Q& H$ U" @) {這個(gè)字節(jié)對應(yīng)的比特分配給介入config.h別針。請注意,不用于反演位0和1,。默認(rèn)比特分配是這樣的:*/
" u3 R; w! @! C8 R
; o3 y3 Y; N2 B) E6 O* r/*  轉(zhuǎn)彎路口偏差使用加速度經(jīng)理決定它如何快速穿過一條路徑,。
4 A3 I9 ^+ |5 i; S  數(shù)學(xué)有點(diǎn)復(fù)雜,但總的來說,更高的價(jià)值給一般快,可能的波動(dòng)運(yùn)動(dòng)。低價(jià)值使得加速度經(jīng)理更加謹(jǐn)慎,將導(dǎo)致小心和慢轉(zhuǎn)彎,。& z8 \3 r, U9 b! C9 X5 b5 W3 g
  如果你遇到問題,你的機(jī)器試圖把一個(gè)角落太快,降低此值使它慢下來,。8 ]$ @% Q  f0 A& s7 w* {
  如果你想讓你的機(jī)器通過連接移動(dòng)得更快,增加這個(gè)值速度。
! {* [+ V0 q' M* j  為技術(shù)人員,點(diǎn)擊這個(gè)鏈接閱讀關(guān)于Grbl轉(zhuǎn)彎算法,速度和結(jié)角占一個(gè)很簡單,高效和可靠的方法,。*/
, }# y1 y; j& G0 w" x! N2 n' K9 Z7 {  s- d  o4 c
  #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm        //偏差& r4 g! E8 d" e  L6 S
  #define DEFAULT_ARC_TOLERANCE 0.002 // mm                //圓弧公差
, O, G. [. _' T  Y; R+ r3 n. B  #define DEFAULT_REPORT_INCHES 0 // false                //打印英寸
0 b. j! `1 ^& }4 K- _% |6 [  /*默認(rèn)情況下,步進(jìn)使銷是啟用禁用高和低,。如果您的設(shè)置需要相反的,只是反步進(jìn)使銷通過輸入15美元= 1。禁用與15美元= 0,。(可能需要一個(gè)動(dòng)力循環(huán)加載的變化,。)*/, D0 q4 N. Q+ o" d8 t
  #define DEFAULT_INVERT_ST_ENABLE 0 // false
; X7 t- Q' Z- I5 m0 J. J' z8 D  `  #define DEFAULT_INVERT_LIMIT_PINS 0 // false        //反轉(zhuǎn)限位引腳, |# c" G  N4 i8 ^
  #define DEFAULT_SOFT_LIMIT_ENABLE 0 // false        //軟件限位
& @1 }2 M! R; w2 I% ^( W+ k# |  #define DEFAULT_HARD_LIMIT_ENABLE 0  // false        //硬件限位
8 r& u: r2 P$ u9 F) q! J  #define DEFAULT_HOMING_ENABLE 0  // false                //回原點(diǎn)使能, p" c" ]# i  f4 p, L  X0 K
  #define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
9 Z+ Z! D* s- e4 w  #define DEFAULT_HOMING_FEED_RATE 25.0 // mm/min
; h/ @: f% L( a  #define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min
' }# i- U4 H; {2 K0 T& N  #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)防抖動(dòng)延時(shí)
0 t. N' j- W1 P$ L  #define DEFAULT_HOMING_PULLOFF 1.0 // mm
* Z. `# M- B. m7 [; t0 }& A+ L* ]1 u3 s& k
#endif, Z9 D( L, u; o
8 X1 y' F# f4 U/ S2 d, ~
  h6 D- b9 s7 H  }, E/ F

) P7 y9 M0 B3 h7 N( [0 d
" @3 {  q- M) ~( K# I) ]% ^& w9 s/ ]$ m* K+ |1 O# B& u

8 l) l$ m; m5 _/ M! z9 k& k- _& C- G2 f3 g7 I/ |

& l2 }& I% s6 r" ]# i
2 D( S3 ~, s; R. t
! U- _  R- V. F9 S$ [9 P3 j( \) H  U7 G( N/ d0 N/ L1 G: n/ @

$ K3 R3 Y; G8 R( f+ e  Q  |; _* q! i) {
- V8 F$ k' }) X
  [5 m( V8 H$ z  r

  r2 Q3 v, W" l7 f
! p! a0 N& O/ r8 j
6 [8 L3 {4 H* F& u
% D; T( g# C6 f2 {2 ^. y8 F* e% t7 N- g! a- I% r" i) h

" X7 g& w: p/ ?, o
# ^# i5 q+ Z7 d) Y4 _2 C! G1 o& o9 m- W5 p$ J. f

' I. L9 Y1 P8 ?9 C1 e  |- t: A
# s, P( y- ~: }1 f+ b' q2 d9 p9 r1 T+ w& A

作者: 怒吼的瘋狂    時(shí)間: 2016-8-27 22:24
膜拜大嬸
作者: 墨影染林    時(shí)間: 2017-5-24 10:23
你好,你收的那個(gè)Dlion為什么在百度找不到,,能提供相應(yīng)的鏈接嗎
作者: 墨影染林    時(shí)間: 2017-5-24 10:24
大神你好,,你說的 那個(gè)Dlion在百度怎么搜不到,能提供相應(yīng)的鏈接嗎
作者: simee_tww    時(shí)間: 2017-7-26 13:12
GRBL固件控制的運(yùn)動(dòng),,步脈沖的頻率不要超過30KHz,, 因?yàn)槌^30KHZ時(shí), 可能會(huì)引起timer1的ISR中斷服務(wù)程序執(zhí)行異常,,運(yùn)動(dòng)出現(xiàn)卡頓,,丟步,,速度不準(zhǔn)確。




歡迎光臨 機(jī)械社區(qū) (http://97307.cn/) Powered by Discuz! X3.4