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

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

 找回密碼
 注冊(cè)會(huì)員

QQ登錄

只需一步,,快速開始

搜索
查看: 18330|回復(fù): 15
打印 上一主題 下一主題

單片機(jī)MCP制作數(shù)控雕刻機(jī)3D打印機(jī)

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
1#
發(fā)表于 2016-8-20 23:56:23 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
本帖最后由 1五湖四海1 于 2016-8-21 00:09 編輯
  I+ l) S, k" i% B/ Q% i# R7 b* S1 c% h0 |) _5 C/ v' K
    以前制作過CNC雕刻機(jī),,是用MACH3作為上位機(jī)控制,,硬件是采用PC接并口輸出脈沖和方向使能信號(hào)經(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)滑塊等制作。用這臺(tái)DIY CNC雕刻機(jī)可以雕刻木頭塑料等東西,。當(dāng)時(shí)沒有一直玩下去,,現(xiàn)在發(fā)現(xiàn)網(wǎng)上有用單片機(jī)制作的雕刻機(jī)挺精巧的現(xiàn)在分享給大家。0 q- s  a6 D' Y9 [. a
   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工具的輸出測(cè)試�,;⌒�,、圓形和螺旋的運(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工具的輸出測(cè)試,�,;⌒巍A形和螺旋的運(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)彎。很棒吧,!開始玩起,。0 r; m) O( l. z4 n; t# V9 i
    還沒有雕刻機(jī)的機(jī)械部分可以用廢舊光驅(qū)制作個(gè)微型雕刻機(jī)運(yùn)動(dòng)平臺(tái)。雕刻機(jī)最重要的是主控程序這次用 Arduino/AVR328單片機(jī),,價(jià)格在15元左右,,主控程序是上面提到的目前很火的開源
的GRBL,,還有一種基于STM32平臺(tái)的開源主控程序Dlion也不錯(cuò)可以替代grbl,。如果從性能比較這兩個(gè)方案,顯然是stm32平臺(tái)運(yùn)行速度更快畢竟他是32單片機(jī)呀,!/ g" k# o9 C, A9 D( T3 y
; V7 A0 j1 E: ^

; i; U5 Y; U4 o; y    下面介紹小這個(gè)些主控程序主要干的事,,通過串口PC和主控板通訊,,PC命令給控制板,控制板接收命令做不同的響應(yīng),,PC可以發(fā)G代碼給主控板,,接收完成后可以自動(dòng)開始雕刻任務(wù)。) x. ^; v1 r4 H$ Y! |; ~  Q% Y
          在介紹下G代碼因?yàn)镚代碼是雕刻機(jī)的核心部分& l" S& w3 h# Z) g4 m+ i
G代碼是數(shù)控程序中的指令,。一般都稱為G指令,。( [5 I6 p* d, H9 m6 y
G00------快速定位6 e; |* Q, A3 P  [; e+ y
G01------直線插補(bǔ)
& V! y2 J( c4 l9 G9 H  {, NG02------順時(shí)針方向圓弧插補(bǔ)
- {) ?, ^4 O2 F9 s/ y  {3 JG03------逆時(shí)針方向圓弧插補(bǔ)
+ l& ^$ n) H% IG04------定時(shí)暫停% g# D) y. _  L6 W
G05------通過中間點(diǎn)圓弧插補(bǔ)2 C  d2 Q. N. ~  P
G06------拋物線插補(bǔ)
' s: R3 G+ |+ U( T! D$ Z( B* dG07------Z 樣條曲線插補(bǔ), `1 ?: O, X: u$ q. N
G08------進(jìn)給加速
) x7 d* B% F' p+ v; SG09------進(jìn)給減速
+ L& |3 e- ^6 i6 j( iG10------數(shù)據(jù)設(shè)置' o) }. E: N9 t1 ]
G16------極坐標(biāo)編程
4 Q0 p7 X# P6 H( @3 z" `G17------加工XY平面; S4 z& s% `3 o' [. U& B0 U
G18------加工XZ平面
2 `3 S2 e+ a! W1 ?G19------加工YZ平面
6 o5 D9 ]) o. P6 R2 G# a" {
核心就是解析G代碼,完成步進(jìn)電機(jī)驅(qū)動(dòng),,和控制主軸開啟關(guān)閉,,還有插補(bǔ)算法,直線插補(bǔ),,圓弧插補(bǔ),,還有一些步進(jìn)電機(jī)的加減速算法,。9 r$ }" l, Y; ]+ K! U7 `* d* n
下面對(duì)grbl主結(jié)構(gòu)做介紹
) O+ \. k+ J( r, s8 [+ Gmain()主函數(shù)首先執(zhí)行下面初始化函數(shù)$ g& v9 |1 M# w( U9 ]- {5 E
        serial_init();                           // 設(shè)置串口波特率和中斷& h; @# V$ c' q4 x& |
        settings_init();                         // 從ROM加載grbl設(shè)置) W  t2 k  U& v$ R- v" k
        stepper_init();                          // 配置步進(jìn)方向和中斷定時(shí)器3 E5 E1 N8 ?: `3 e1 V! ^4 q# E$ I* }- Z
        system_init();                           // 配置引腳分配別針和pin-change中斷
# p2 |  V. F% f& a' [5 p        memset(&sys, 0, sizeof(system_t));          // 清除所有系統(tǒng)變量0 O0 b8 X) N8 U: s
        sys.abort = true;                           // 中止標(biāo)識(shí)位置位
3 E& e; H) [; H* y+ f        sei();                                         // 使能中斷+ T4 l. W2 d4 _# Y$ X* m- _
  #ifdef HOMING_INIT_LOCK                        // 宏運(yùn)算(settings.flags & (1 << 4)) != 0結(jié)果flags等于執(zhí)行sys.state = STATE_ALARM
' ~! |( I8 \) A. U2 V. b9 o                                                // 系統(tǒng)狀態(tài)賦值為報(bào)警狀態(tài)6 G6 f6 f2 P* q7 m7 }0 F* J
            if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
, N( l; w) ?4 p% ~) C  #endif' v0 y" `2 F: X# F4 X
_____________________________________________________________________________________________________________________________________. x# L8 D: @6 A1 K& b# i) `8 {; a
接下來是一些主要部分初始化/ W, Y5 P$ q  G5 V. m6 g, z  R- J
for(;;) {  x$ n2 f% J, }8 @# B
        serial_reset_read_buffer();         //清除串口讀緩沖區(qū)
' I# V& U8 n1 J, N* @, A        gc_init();                         //初始化G代碼功能函數(shù)
& O' A' k% O6 g# w        spindle_init();                        //主軸初始化
* l, }% M5 J) E2 Z! @* v        coolant_init();                        //冷卻液初始化2 M" a/ V/ ~5 @( a: W! n# Y( J' {
        limits_init();                         //極限開關(guān)初始化
/ `' m8 p4 d3 S% n/ Y        probe_init();                        //探測(cè)部件初始化6 j8 v; C( V3 p2 R& P
        plan_reset();                         //清除塊緩沖區(qū)和規(guī)劃師變量+ I, o5 W' ^$ k
        st_reset();                         //清除步進(jìn)系統(tǒng)變量。; }1 B5 E  `  X7 C) h1 b( v
$ A4 Q3 Y, d3 U5 S3 t/ P

' b7 ~# q5 I9 u$ d! {7 Z        //下面兩行清除同步gcode和策劃師職位當(dāng)前系統(tǒng)位置,。
, V: s( O  J' a. T. q% \9 Y
        plan_sync_position();
* o4 d* [. d  ~$ e4 n) P        gc_sync_position();
: U2 O  S- i: T# H0 \" d* J  k9 b; H
9 p# ~* o4 M% Q. f
        //復(fù)位系統(tǒng)變量; k6 I; p7 q5 ?( D2 v3 |& B+ Q
        sys.abort = false;                //系統(tǒng)中止標(biāo)志
/ L; D/ g" d( Z# e        sys_rt_exec_state = 0;                //系統(tǒng)標(biāo)志位變量狀態(tài)管理,。看到EXEC位掩碼,。$ n0 n# t3 U1 q8 S
        sys_rt_exec_alarm = 0;                //系統(tǒng)標(biāo)志位變量設(shè)置不同的警報(bào),。
- ~: ^, u0 d$ b1 j        sys.suspend = false;                //系統(tǒng)暫停標(biāo)志位變量管理,取消,和安全保護(hù)。  c, P7 O3 Z$ n. V. J: P. j
        sys.soft_limit = false;                //限位開關(guān)限制狀態(tài)機(jī)錯(cuò)誤,。(布爾)* ^0 h- x7 D1 F0 P( i7 r
! Y, f  v& a. s4 r% b

" N3 J) [2 p/ A/ D) u% F# E        protocol_main_loop();                //主協(xié)議循環(huán); S9 B& k9 W" f. G
}        //
+ u5 S4 u2 }9 Y1 W7 l3 X" X  \_____________________________________________________________________________________________________________________________5 L; X/ V0 C; M6 H1 v8 g
進(jìn)入void protocol_main_loop()函數(shù)6 I( z# v. L- }' }0 L7 B
{
# R9 K) H; i& J9 S  p7 d5 p  q        report_init_message();                // 打印歡迎信息 & ]( g7 W' u1 g0 W; f
        //重啟后檢驗(yàn)和報(bào)告報(bào)警狀態(tài)如果錯(cuò)誤重啟初始化,。
1 o) x( \& Y  r/ n2 {
        if (sys.state == STATE_ALARM) {$ ~# r0 K/ b1 J$ X. w3 G
            report_feedback_message(MESSAGE_ALARM_LOCK); //打印信息, Z$ H; x, ~8 p- g6 r' {, M
          } else {
$ y6 Q: M& o' l            // 如果沒有報(bào)警說明一切正常!但還是要檢查安全門. ( l* t" I& J# x1 k! E
            if (system_check_safety_door_ajar()) {
9 l' h" c4 c: B6 S                     bit_true(sys_rt_exec_state, EXEC_SAFETY_DOOR);5 {+ ~  Y& W8 g4 B
                     protocol_execute_realtime(); // 進(jìn)入安全模式。應(yīng)該返回空閑狀態(tài),。' \: c. A3 B/ r6 A, `
            }         else {
) e, q+ D  Y5 m8 D              sys.state = STATE_IDLE; // .設(shè)置系統(tǒng)做好準(zhǔn)備,。清除所有國家國旗。3 A1 O5 s$ }: S: s
            }
+ {  j2 B8 y4 t' b3 I2 h% q            system_execute_startup(line);    //開始執(zhí)行系統(tǒng)腳本
! G  o9 J: d: g5 C  } ; n1 f' X' @. @, Y9 N
- B- ]( T5 ]5 v% }+ }8 {0 t, U! B

$ a8 s$ b: Q& F! x; ~/ [  // 這是主循環(huán)!在系統(tǒng)中止時(shí)這是出口回到主函數(shù)來重置系統(tǒng),。- p. M9 b4 }8 o- g
  // ---------------------------------------------------------------------------------  # |0 h  m0 g5 E. L
  % q8 ^7 O# \$ Y$ {  n+ }
        uint8_t comment = COMMENT_NONE;
2 K0 `' ?! }- ?- I( h7 b        uint8_t char_counter = 0;
9 i4 \; V! G- E( E        uint8_t c;
9 L0 v" Q* f6 B- t2 {& `_______________________________________________________________________________________________________________________________6 g# Q! u5 Z; ]0 S& C- C/ I/ g
接下來進(jìn)入for(;;)循環(huán)                //下面代碼是G代碼解析核心部分,,程序中comment(注釋)變量會(huì)被賦不同值,代表發(fā)符號(hào)有‘(’‘)’‘,;’( J1 T) e+ p  g
{7 g6 P7 M" s# A% O4 B6 z
//串行數(shù)據(jù)輸入一行的的過程,作為數(shù)據(jù),。執(zhí)行一個(gè)1 W: t& A; J) y2 F: o8 X) j9 j
//所有數(shù)據(jù)初始過濾去除空格和注釋。 + A  x' k" l. F, L: n7 _6 r' |' T
//注意:注釋,空格和程序段刪除(如果支持的話)處理技術(shù)
$ |, ^$ z" }& m& M: Y, D7 O/ _//在G代碼解析器,它有助于壓縮到Grbl傳入的數(shù)據(jù)
, j! u% [1 U  A( y//線緩沖區(qū),這是有限的,。刀位點(diǎn)標(biāo)準(zhǔn)實(shí)際上州一行不行
, t: Y1 U: p4 B9 q2 e5 R$ Z//不能超過256個(gè)字符,Arduino Uno沒有更多內(nèi)存空間。& ^. }# [8 x1 M3 G  y& `( _
//有更好的處理器,它會(huì)很容易把這個(gè)初步解析的+ t! a+ m9 q: g- O7 ~0 p
//分離任務(wù)共享的刀位點(diǎn)解析器和Grbl系統(tǒng)命令,。                                                               
, F+ {" V. f- p6 u    while((c = serial_read()) != SERIAL_NO_DATA) {                             //讀取串口數(shù)據(jù),,有數(shù)據(jù)執(zhí)行下面代碼
8 g/ h( P& ]6 M, j% T) J      if ((c == '\n') || (c == '\r')) { // End of line reached                //如果數(shù)據(jù)是/r,/n代表一行結(jié)束
: J% n) I1 _& P        line[char_counter] = 0; // Set string termination character.        //設(shè)置結(jié)束標(biāo)志
( Z% _0 O3 D# _; A# R& C* e$ T* L" j        protocol_execute_line(line); // Line is complete. Execute it!        //一行完成執(zhí)行此函數(shù)
5 l  A/ p1 d3 l( [- `; z5 \        comment = COMMENT_NONE;                                                //注釋清零
" F% H- V5 \( q% q+ z0 b, U        char_counter = 0;                                                    //字符計(jì)數(shù)清零
' |1 w* Z: p2 F1 D% x7 P% N! t  
) p' q7 n0 G3 W5 T% ~0 o        else {
  \9 A8 x8 b1 b6 F6 r        if (comment != COMMENT_NONE) {
5 E' c1 _+ a5 H$ f                                                     //扔掉所有注釋字符% H3 i$ H$ ^6 |! q3 a2 R" R
          if (c == ')') {
% v9 ^$ m! N  B7 v            //最后注釋。重新開始,。但是如果有分號(hào)類型的注釋,。7 P& w* N& L9 l9 |
            if (comment == COMMENT_TYPE_PARENTHESES) { comment = COMMENT_NONE; }
( j' y# I4 p  L0 [, r! @! J          }5 C1 g6 w$ A; \, ~$ W
      } else {
: I1 n1 m- X5 x' P          if (c <= ' ') { % H( e3 B9 p: O& n
            //扔掉whitepace和控制字符" V4 z' L' b: F- I" E: s" z
          } else if (c == '/') {
' m1 h  J+ ]) L            //塊刪除不支持將忽略字符。* j8 a. J- E: \+ `  c8 z
            //注意:如果支持,只需要檢查系統(tǒng)是否啟用了塊刪除,。6 G$ b$ F  M/ u" `; p' E* O0 C
          } else if (c == '(') {# L' u# {8 M3 ~3 m4 e: d1 y
            // Enable comments flag and ignore all characters until ')' or EOL.8 v6 H9 p: k" r" y4 w
            // NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.& Q& u& P7 @5 E
            // In the future, we could simply remove the items within the comments, but retain the
" K) {5 T. E: ~9 D) r, c/ ?9 Q            // comment control characters, so that the g-code parser can error-check it." `& d4 P* v7 [# A! v
            comment = COMMENT_TYPE_PARENTHESES;
( S; x! {/ Z& k+ @) c( d          } else if (c == ';') {. E8 n$ r+ Z. K: {/ O" |
            //注意:','注釋EOL LinuxCNC定義,。沒有國家標(biāo)準(zhǔn)。. r! a  A( b8 B  k- M, X: X% O2 [' O
            comment = COMMENT_TYPE_SEMICOLON;% g5 U+ W  A1 Z1 t$ P% u

; J& O9 T8 ^: R; h3 R5 r/ ^% e1 K' G, i3 ~& t( n, o5 y
_____________________________________________________________________________________________________________________________________
  W% @7 r$ k  s* c7 S0 J          } else if (char_counter >= (LINE_BUFFER_SIZE-1)) {                        //串口接收數(shù)據(jù)大于80字符時(shí)6 B( V, b7 B( e+ S
            // Detect line buffer overflow. Report error and reset line buffer.        檢測(cè)緩沖區(qū)溢出,。報(bào)告錯(cuò)誤和復(fù)位線緩沖區(qū),。, b  W3 z3 \! e5 i6 o$ I, q
            report_status_message(STATUS_OVERFLOW);                                //打印溢出信息
  b& _" A# _: h/ E3 o& |            comment = COMMENT_NONE;
# W2 A2 }( s3 V+ f  \' Q            char_counter = 0;
1 k1 F3 Q5 h, G; d/ ?0 D, @( o9 J          } else if (c >= 'a' && c <= 'z') { // Upcase lowercase                        //小寫改大寫7 s, x+ L# h8 K1 Z$ V' s( F, ^
            line[char_counter++] = c-'a'+'A';
, T0 f- N( y- B6 b          } else {
) ~+ ]2 j0 T5 E9 ~/ V' V            line[char_counter++] = c;( u8 d, x. E! u
          }# v* B2 ?! _  m6 Q3 u/ s) X
        }
$ L: v" u4 J2 a! g8 C( }      }# u& _- c/ w, P, F: m* u
    }5 P5 S- [" S5 Y4 u. u' C- X
____________________________________________________________________________________________________________________________________  q5 ^1 g6 b4 H  w* }" ~9 }  n
        //如果沒有其他字符在串行處理讀取緩沖區(qū)和執(zhí)行,這表明以完成,自動(dòng)啟動(dòng),如果啟用,任何隊(duì)列動(dòng)作,。4 K8 q: v/ z, M1 `5 k% G4 I
        protocol_auto_cycle_start();                //自動(dòng)開始協(xié)議循環(huán)
: C; M; k; L+ u0 l+ s" N3 d        
7 `4 A1 z. o, S# C  @( F0 `            protocol_execute_realtime();                  //運(yùn)行實(shí)時(shí)命令,。2 q* E4 q2 N* W8 `
            if (sys.abort) { return; }                 //中止標(biāo)識(shí)置位程序循環(huán)重置系統(tǒng)。            
' A. X+ N! z; C0 V- x7 w+ p; E  } ) ?( ]  A7 w7 s* @7 Y
  return;                         //一般程序不會(huì)執(zhí)行到這里
; S+ [+ \" e+ s/ c  ^}: _" g  L8 \( B
____________________________________________________________________________________________________________________________________
5 i1 V8 @! X' s, U正常情況下,,讀取完G代碼程序會(huì)進(jìn)入protocol_auto_cycle_start();//自動(dòng)開始協(xié)議循環(huán) 函數(shù)下面介紹此函數(shù)1 n! g% `- P$ ?8 s! w$ @. p$ i9 U9 f
// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that+ X. {( h2 h! P
// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that , a. w# e% l& @4 p& z
// automatically begins the cycle when a user enters a valid motion command manually. This is ( W) i6 R) }! I8 [- j  \
// intended as a beginners feature to help new users to understand g-code. It can be disabled' |% T; L! B- V. E" U9 i
// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is( m/ y% ]% C* I+ C! l
// manually issuing a cycle start command whenever the user is ready and there is a valid motion
- i' F& {3 y9 L& P- J6 n// command in the planner queue.* f4 V, D' X% v- }% d& n
// NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes
" v2 K" Q$ L$ G( b& h6 R; k// when one of these conditions exist respectively: There are no more blocks sent (i.e. streaming ; E+ g, N7 r: Y* S
// is finished, single commands), a command that needs to wait for the motions in the buffer to 4 p/ }& }" T# b/ M* v
// execute calls a buffer sync, or the planner buffer is full and ready to go.
% ^9 {5 `- g$ p2 V$ @2 z1 X  s: x//自動(dòng)開始有兩個(gè)目的:1,�,;貜�(fù)一個(gè)plan_synchronize()調(diào)用的函數(shù)3 b; n1 a, u+ e/ ?6 T1 p
//需要規(guī)劃師緩沖區(qū)空(主軸啟用、住等)2,。作為一個(gè)用戶設(shè)置) O4 x3 J) r% T/ S5 F
//自動(dòng)循環(huán)開始當(dāng)一個(gè)用戶輸入一個(gè)有效的運(yùn)動(dòng)命令手動(dòng),。這是
* S7 M5 j& ?2 c6 `4 S" i//作為一個(gè)初學(xué)者的特性來幫助新用戶了解刀位點(diǎn)。它可以被禁用
; C( G1 D( G0 r, Y6 o//作為一個(gè)初學(xué)者工具,但(1)仍然運(yùn)作,。如果禁用,運(yùn)行周期開始# E2 R" G6 x" Z; ]. S; |, c5 o
//手動(dòng)發(fā)出一個(gè)周期開始命令每當(dāng)用戶準(zhǔn)備好,有一個(gè)有效的運(yùn)動(dòng)9 f# ^1 c/ n& _- H2 S* p' [
//命令的規(guī)劃師隊(duì)列,。
5 y. s7 C- L5 U- S9 u3 [5 N9 b/ r//注意:這個(gè)函數(shù)被稱為從主循環(huán)緩沖區(qū)同步,mc_line只()并執(zhí)行9 P' y! J( S' G5 y- O% Q* x
//當(dāng)其中一個(gè)條件分別存在:沒有更多的塊(即流發(fā)送, k, ]! @) X5 t. O
//完成后,單一的命令),一個(gè)命令,需要等待緩沖的動(dòng)作
0 i) {5 D) h- y8 M. y//執(zhí)行調(diào)用一個(gè)緩沖區(qū)同步,或規(guī)劃師緩沖區(qū)滿了,準(zhǔn)備好了。! L$ d% b+ F' V; _
void protocol_auto_cycle_start() { bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START); }
6 l0 h1 ~0 s8 T; ]_______________________________________________________________________________________________4 V" `% @) `* ^1 s. F+ H
接下來程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令,。4 ]! f0 H- v' C% j, J
// Executes run-time commands, when required. This is called from various check points in the main  c2 |- S: N3 \  \1 G7 P  T# A
// program, primarily where there may be a while loop waiting for a buffer to clear space or any
1 G- t: Y+ ^. I# o// point where the execution time from the last check point may be more than a fraction of a second.
5 l5 K2 t' R. k1 G* [// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code
1 \* R3 D7 `/ v/ M. Y3 H; j! I& U// parsing and planning functions. This function also serves as an interface for the interrupts to
& q! x  s1 s: @3 }7 _; P% L; U// set the system realtime flags, where only the main program handles them, removing the need to$ m6 g6 r  Y. {0 ~( v) Z; A
// define more computationally-expensive volatile variables. This also provides a controlled way to
7 ^3 A7 O$ X* q% @% \* V7 S// execute certain tasks without having two or more instances of the same task, such as the planner
% C+ O: g- u9 s  I// recalculating the buffer upon a feedhold or override.  E5 v0 l# ]0 \7 e, @1 z  }9 l
// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,2 f7 Y. @8 G: Y! L. {& u( X% I
// limit switches, or the main program.. Q5 c, X, j5 t+ j3 i0 J6 L1 Y
void protocol_execute_realtime()- W' U  y* @6 F! a% I. I7 B# @8 b1 _
uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.臨時(shí)變量來避免多次調(diào)用不穩(wěn)定,。$ s4 v, ]' q  _$ [: m+ k2 k
就先分享到這吧!
9 ^6 K2 k% l: G5 n+ m3 e, m- D. \2 E: z
' A4 ~" J5 X! Q# `9 T) L

; Y) q* G/ {" f
  `1 G  l* ^0 I2 [0 C8 D
% U: f9 L. q( y7 R/ c+ m5 P& e1 ]
  I* k7 e1 P8 c, G+ O
. g+ C/ C' H# a5 z# w7 J4 @2 A
3 E8 l& k$ L: [
9 f( r2 c" I% h$ m* _) V" G
1 s, ^1 t; X% C+ d- }( ~) m# X( X9 U1 f

) W* o1 E) J/ h5 K, ]% {
- ^& `6 {1 |9 D4 F: E: Z. s
; ?4 H7 L9 {% {* }' _0 U' S0 b! y/ S! o. w  r# T0 u& Z
5 H: f5 b6 c! e6 M. B* B

4 N6 G1 f& M3 k) u, V7 s; [- ^% @6 _: n# V

  F( V1 ]5 v6 h6 e4 s
$ F1 b: L; F6 P; j
% d% O- M9 e* U; H; V8 Z
+ P2 o7 w2 b/ }1 r- f
* p- X3 ]( t  _% u' i. a
補(bǔ)充內(nèi)容 (2016-8-25 22:40):
8 ]# J7 J7 `0 e( c! e  E# v! l8 D配置說明
: T. r" p1 G2 a9 ]$ Q//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng),。在大多數(shù)情況下,
' V6 p1 p7 {/ V; ~  ^* k7 [3 h//用戶不需要直接修改這些,但是他們?cè)谶@里為特定的需求,即,。6 F7 z9 E/ c* ~
//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。
7 V0 A; ]4 [& R- v5 U. j+ v+ i主要配置項(xiàng):. i5 Y+ R5 H9 G7 m
1.#define DEFAULTS_GENERIC        //在重置eepm時(shí)使用,。在defaults.h改變想要的名字# I" |' _- n, l) r' m8 d
2.#define BAUD_RATE 115200        //配置串口波特率115200
# E5 T3 V( c+ T% N3.#define CPU_MAP_ATMEGA328P         // Arduino Uno CPU
8 T" y! R; v7 s/ T# G4.#define CMD_STATUS_REPORT '?'        //定義實(shí)時(shí)命令特殊字符% p  X" o9 s2 i& m: W/ ^
5.#define HOMING_INIT_LOCK         //回原點(diǎn)保護(hù)鎖  k( V* a7 y6 c9 ]& S  j
6.#define HOMING_CYCLE_0 (1<<Z_AXIS)              // 第一步Z清除工作區(qū),。
6 f- h: T) O. Z. E* z  @  #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // 然后X,Y在同一時(shí)間。+ }$ G) f, ?! }/ o
7.#define N_HOMING_LOCATE_CYCLE 1 //回原點(diǎn)循環(huán)次數(shù), a7 K/ T# [/ \& @+ Q* ?& V
8.#define HOMING_FORCE_SET_ORIGIN //取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向,。8 P& v* e% E/ C2 m/ U
9.#define N_STARTUP_LINE 2 //塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量,。: s5 p) C8 m. E
10.#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸
; x! b' O$ u( [5 B" {   #define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值7 [9 i/ x* @3 N7 U0 T, E
   #define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
. K: {# ?  J& @1 r   #define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘9 d7 _1 G$ Z* _- J7 f/ ?% |
   #define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對(duì)浮點(diǎn)小數(shù)設(shè)置值4 x7 ]9 T1 |: v7 z+ |0 x4 E7 r
11.#define LIMITS_TWO_SWITCHES_ON_AXES //如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用這個(gè)特性
2 ^+ {, K" m. @9 F& G% Q& z12.#define USE_LINE_NUMBERS         //允許GRBL跟蹤和報(bào)告gcode行號(hào)  o, d" J0 A+ [' }: w* u0 A
13.#define REPORT_REALTIME_RATE //允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率* `6 l5 A; d4 E/ Z( r  W2 n" c8 t, M
14.#define MESSAGE_PROBE_COORDINATES  //坐標(biāo)通過Grbl $ #的打印參數(shù)?( Z; T  \- K7 _$ M0 w& _' G
15.#define SAFETY_DOOR_SPINDLE_DELAY 4000 //安全門主軸延時(shí)
1 A+ Q2 |& o) a# ?16.#define SAFETY_DOOR_COOLANT_DELAY 1000 //安全門冷卻液延時(shí)! e3 q% ^  W7 f+ o, `
17.#define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS) //啟用CoreXY運(yùn)動(dòng)學(xué)。
' u8 B# q% J7 X( y9 l- `18.#define COREXY // Default disabled. Uncomment to enable.改變X和Y軸的運(yùn)動(dòng)原理8 W9 n- S3 I0 x5 c! B6 _7 H0 M0 W
19.#define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.反轉(zhuǎn)針銷邏輯的控制命令1 D* ]5 O/ a% w0 L
20.#define INVERT_SPINDLE_ENABLE_PIN // 反轉(zhuǎn)主軸使銷從low-disabled, \1 l; S; R$ f* L3 L
21.#define REPORT_CONTROL_PIN_STATE //啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告,。. q* w: z" h, Q- a+ ^' d" B8 n" J
22.#define FORCE_INITIALIZATION_ALARM //啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示
+ n) O+ Y' W1 m9 d! w5 Z: e23.#define REPORT_GUI_MODE // gui允許最小的報(bào)告反饋模式( n& S1 B( [5 j: P( y+ X! t/ z
24.#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時(shí)間分辨率管理子系統(tǒng),。
/ E& q, G* {; d; m- ]25.#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING //自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能 6 P7 N0 @$ i, U
26.#define MAX_STEP_RATE_HZ 30000 //設(shè)置最大一步速率可以寫成Grbl設(shè)置
0 g8 d6 b: N$ @8 ~! l& H* ~+ y  k# [- N27.#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻
7 Z' V) U% O0 T3 _8 }8 k- I3 y0 N28.#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS //設(shè)置哪個(gè)軸長(zhǎng)度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與選擇軸工具面向負(fù)方向2 I( e( L/ n3 o4 \
29.#define VARIABLE_SPINDLE //允許變量軸輸出電壓不同的轉(zhuǎn)速值,。3 m5 X4 A# O4 m! r
30.#define SPINDLE_MAX_RPM 1000.0  // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
/ z- U+ W0 o# E1 ~6 z9 n   #define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.! c1 _# r  t0 B8 a5 r% {# K
31.#define MINIMUM_SPINDLE_PWM 5 //使用的變量軸輸出,。這迫使PWM輸出最小占空比時(shí)啟用。
" A" \+ |/ U7 }, F+ H$ j  n32.#define USE_SPINDLE_DIR_AS_ENABLE_PIN //主軸方向使能M4被刪除
: \" d0 t% {2 C0 B33.#define REPORT_ECHO_LINE_RECEIVED //應(yīng)該對(duì)所有正常線路送到Grbl
. T" m+ P% e2 h: Y) W+ `% z34.#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min) //最小規(guī)劃師結(jié)速度,。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃
5 u/ z( G8 ^+ s6 K. S. M4 y1 g35.#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率. `& T( r6 g9 |* R, L% ~
36.#define N_ARC_CORRECTION 12 //弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡$ |( M# r# K& h5 J3 R: x* g
37.#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了?
% w$ r  C) H* L5 q" C7 X- ?38.#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) //延時(shí)增加表現(xiàn)在住,。默認(rèn)值設(shè)置為50毫秒$ {, V4 H, G8 M: Y* z1 F
39.#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
' z4 Y0 I7 [" H3 a40.#define BLOCK_BUFFER_SIZE 18  //線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃
1 U- l3 ~% u; G41.#define SEGMENT_BUFFER_SIZE 6 //控制之間的中間段緩沖大小的步驟執(zhí)行算法1 @- q( W; Z0 p/ f# i5 Z/ ~
42.#define LINE_BUFFER_SIZE 80 //行執(zhí)行串行輸入流的緩沖區(qū)大小。
% m: [2 i- w! u0 c; o43.define RX_BUFFER_SIZE 128 //串行發(fā)送和接收緩沖區(qū)大小
& m! i" P- x# L) F44.#define TX_BUFFER_SIZE 64
7 D, N! [; C8 S+ y+ n$ N/ l45.#define ENABLE_XONXOFF        ////切換為串行通信發(fā)送流軟件流控制,。' I% e: C1 G, Z5 O' O
46.#define ENABLE_SOFTWARE_DEBOUNCE //一個(gè)簡(jiǎn)單的軟件消除抖動(dòng)特性硬限位開關(guān),。
6 y2 k% c1 y. X- b3 f& ^47.#define HARD_LIMIT_FORCE_STATE_CHECK        //Grbl檢查硬限位開關(guān)的狀態(tài)9 Q- g4 ?& X% B% ^
48.// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:% O1 ~8 G( P# y0 y) U

) Z) J8 w) k4 P___________________________________________________________________________________________________% f( [! p* ?  n4 {
/*" [+ D! c! `$ X  s1 @/ N( Q1 {
  config.h - compile time configuration
' ~4 y. |+ c% v/ i8 R* Z( \  Part of Grbl. s$ D) s" O3 [3 P3 o

  ?( g* @. K% \! L7 ?  Copyright (c) 2012-2015 Sungeun K. Jeon
4 D! b$ A+ E5 }; v2 q' c' K  Copyright (c) 2009-2011 Simen Svale Skogsrud
( i5 C8 Z4 K) \7 d% ^$ K; X5 [$ v6 t& n9 u/ M
  Grbl is free software: you can redistribute it and/or modify& {$ J' B( @9 z5 w  `3 S
  it under the terms of the GNU General Public License as published by3 T6 F2 \# [2 N* z1 r/ a2 d
  the Free Software Foundation, either version 3 of the License, or9 y) F& v( L: ^* g" I6 F
  (at your option) any later version.4 q2 N. a7 @0 d9 y8 L

" o' R/ K# u, x1 M  \& X8 B! f, e6 @  Grbl is distributed in the hope that it will be useful,; E/ L6 K3 u. M2 A6 S; E4 b& R7 n
  but WITHOUT ANY WARRANTY; without even the implied warranty of
3 B2 M- C" ]: n! e  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. c& j' V! V8 R, j8 W0 f
  GNU General Public License for more details.
& h9 n- c2 y/ `& H+ l5 M& b) B$ s' A# r
  You should have received a copy of the GNU General Public License# p' ]& [4 m* {' M
  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.7 b% m* v, C1 I* E- {# r  r
config.h  -編譯時(shí)配置,Grbl的一部分
+ \( ]  @" \3 v: T" Q+ ]6 }2 r0 R) \: R$ `
版權(quán)(c)2012 - 2015 Sungeun K. Jeon
. N# v0 ^. e8 {, ?3 @, o- x$ o& L版權(quán)(c)2009 - 2011 Simen Svale Skogsrud$ [2 w* C: l$ f  Z$ X$ ~

8 S0 {: w5 k: h  b: G: ~1 X  kGrbl是免費(fèi)軟件:可以重新分配和/或修改
! F) s& _2 h6 g, {GNU通用公共許可證的條款下發(fā)布的自由軟件基金會(huì),版本3的許可,或(任您選)其后的版本。" Y- O# a, U$ W$ T! Y# X6 m

- I- L- U" z( ]( F0 w/ r# PGrbl分布,希望這將是有用的,但是沒有任何保證;沒有即使的默示保證適銷性或健身為特定目的,�,?吹�
4 M; @' g( b  B. [) tGNU通用公共許可證的更多細(xì)節(jié)。& L- B2 d# q& @4 l3 C' P
. M% j; v2 y; P% W8 H) N
你應(yīng)該收到了GNU通用公共許可證的副本$ {$ v! K$ i" x3 B* n$ j4 P
連同Grbl,。如果沒有,看< http://www.gnu.org/licenses/ >,。3 z) _7 c1 \8 D$ T' @' G7 a

. s' M0 j9 Z! g& K* `" v*/
4 I1 T. K( o' {+ ^: p# F  2 [6 S5 \1 D- U9 V# V1 m
// This file contains compile-time configurations for Grbl's internal system. For the most part,# H% X/ J7 }7 Q5 r
// users will not need to directly modify these, but they are here for specific needs, i.e.
0 u" @% q: E& \- A8 w. H// performance tuning or adjusting to non-typical machines.
9 t$ z) t( C1 F//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng)。在大多數(shù)情況下,
: M$ t$ `* L. a3 |//用戶不需要直接修改這些,但是他們?cè)谶@里為特定的需求,即,。
" f4 D) {- ]; a/ s: `, z# i2 O//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器,。2 B8 u5 r$ W& S" O

" M8 ?5 x3 E% w& _// IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them.
( ~+ J, j3 [8 _1 D( C: |1 T: z//重要:任何變化需要一個(gè)完整的基于源代碼的傳播,。* y- R& E) t) k4 G. R
2 s6 R% B( l7 r1 e/ E8 ]# O
#ifndef config_h
( g4 g3 \. w' m#define config_h
* R* l+ E' L3 I, x) h2 g) }#include "grbl.h" // For Arduino IDE compatibility.& c# [2 U9 f) q! J
- [- r* e# b! g( s/ q: b
// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h. G! o& z; m$ N" a( \! x
// 默認(rèn)設(shè)置。在重置eepm時(shí)使用,。在defaults.h改變想要的名字3 E/ f5 E, o7 Y7 q- ~  {  y3 L

" |+ G: M* v& @+ T8 N#define DEFAULTS_GENERIC
. n* z3 n# @/ L! l6 i
: d0 l7 X: ^& A" q7 P// Serial baud rate" b" C; O3 G1 K; [, H" g% S: M) a
#define BAUD_RATE 115200                //配置串口波特率115200* l/ E8 a, f' {' M& V
8 @6 k! ?  B1 t. ^
// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types, T  {9 ]6 Y  B
// may exist from user-supplied templates or directly user-defined in cpu_map.h9 @  @3 @+ `+ C9 Y. u' x& l+ Z2 N7 m+ x
//默認(rèn)cpu映射,。Grbl正式支持Arduino Uno。其他類型的處理器可能存在cpu_map.h直接從用戶提供的模板或用戶定義的
% {/ m  E5 U; J0 a4 _
4 ?4 N' ]8 R# s' F  I#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
) p( h6 \! ?* D: I
1 b* [' w1 S. U1 k// Define realtime command special characters. These characters are 'picked-off' directly from the; O' m3 [4 K" N% ?4 S
// serial read data stream and are not passed to the grbl line execution parser. Select characters" f# i, Q0 C( \, O0 @% U
// that do not and must not exist in the streamed g-code program. ASCII control characters may be 0 _7 X3 V6 H5 R, }! [5 m
// used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in % \3 u! [# T, e3 C* A1 T
// g-code programs, maybe selected for interface programs.( c: R( Z  H) H- p
// NOTE: If changed, manually update help message in report.c.
3 d7 t  f& S: G. l. R& L
; U( M$ b' L' ^" }//定義實(shí)時(shí)命令特殊字符,。這些字符是直接從“各個(gè)擊破”串口讀取數(shù)據(jù)流并沒有傳遞到grbl行執(zhí)行解析器,。選擇角色5 ]! b! O6 k8 b2 Q9 U! n
//不,不能存在于程序流刀位點(diǎn)。ASCII控制字符
% `+ c. o, S  J$ ^, ^//使用,如果他們是可用的每個(gè)用戶設(shè)置,。同時(shí),擴(kuò)展的ASCII碼(> 127),從來沒有9 k7 _4 e: e8 P
//刀位點(diǎn)的程序,也許選擇界面程序,。2 N1 T4 w; [! ]6 r
//注意:如果改變,手動(dòng)更新report.c幫助信息。
# U" b: J2 K6 M. `+ D5 @# w
5 j9 a5 d9 B2 G" G#define CMD_STATUS_REPORT '?'
' ]5 y" g: h0 {) b2 N#define CMD_FEED_HOLD '!'
, K/ @" h6 \  U& z" |#define CMD_CYCLE_START '~'; d% Q# n1 S3 P, X# k7 H- @+ I, h
#define CMD_RESET 0x18 // ctrl-x.
0 _0 r" E! u4 A#define CMD_SAFETY_DOOR '@') \3 w9 i( G/ A: s: N& N

. |9 M6 M9 u# ~// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces
. |; }& H& X7 @2 i( i9 K# {// the user to perform the homing cycle (or override the locks) before doing anything else. This is
8 \$ I( o) L# p& w// mainly a safety feature to remind the user to home, since position is unknown to Grbl.+ h+ e, B/ J4 c# d) F, y* t
' I: q( ?  V# a; i$ I
//如果啟用了回原點(diǎn),導(dǎo)航初始化鎖集Grbl進(jìn)入警報(bào)狀態(tài)啟動(dòng),。這就迫使
* i7 k) g% l6 x# V, A/ p//用戶執(zhí)行歸航周期(或覆蓋鎖)在做任何其他事情之前,。這是
2 i+ W' A4 Q4 S) l//主要安全功能,提醒用戶家里,因?yàn)镚rbl位置是未知的。4 V% H/ o/ X9 }; X6 X
- Z5 Y2 Q+ X' F# ~; v
#define HOMING_INIT_LOCK // Comment to disable
; J5 o$ Y4 D% y) h1 S
% ?/ ~' Y/ Q  A// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode6 C) s+ [# h7 Y7 G  j" {' E+ e7 V
// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short
: }; G+ O5 _8 a2 G/ P/ K- N, l, t$ g// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed 4 T- _* F* u) ?2 S# Y! z
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If
/ r# j3 f  m* |// an axis is omitted from the defines, it will not home, nor will the system update its position.+ u) d3 u( u7 U
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,
3 {! U3 `# x! t% b! }, ^1 v// with no y), to configure the homing cycle behavior to their needs. ; d' J& Z+ Q) [" `5 W$ Y
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same  d& I! \$ t* t# v; j
// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
, A) A" n% a& q0 B7 u  V// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles.
# U4 T* \/ b% u3 ~' ^- W// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins% Q' J- t( B9 |- G+ w7 Y
// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes0 T& `! P; y6 q2 @+ _' J( n
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits / t. P6 Q4 s- k- U2 U' `! N
// will not be affected by pin sharing.
: Q# @' i' D: }- d& O! n//定義導(dǎo)航循環(huán)模式的位掩碼,。歸航周期首先執(zhí)行一個(gè)搜索模式! [$ E. ^7 r( c; k
//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短
) g1 t7 k7 i) g//拖出運(yùn)動(dòng)脫離限位開關(guān),。以下HOMING_CYCLE_x定義執(zhí)行
; @! z" @3 w( B- f. T# N- h//為了與后綴0開始并完成specified-axes只尋的例程。如果
- y* A$ M+ Q7 l4 w$ M$ n& T- S//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置,。
1 s! |$ x8 q( k5 B- @3 h) C//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,/ h5 n$ o* K# F: L, N' V
//沒有y),配置導(dǎo)航循環(huán)行為對(duì)他們的需求,。
: R' U, }- @# Z! E, V//注意:歸航周期允許共享限制針,如果軸不相同
$ U# }1 {0 x* d- C- H8 J. m; i- J//循環(huán),但這需要一些銷設(shè)置cpu_map的變化。h文件,。例如,默認(rèn)的導(dǎo)航
) R7 Q; y7 c4 n8 r6 W//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?br /> ! }; v9 N/ m3 H4 t) {% e//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的,。從理論上講,所有軸限制別針  u' {! d6 C& g* L8 E
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸
9 \+ l+ }/ p8 L' H0 n! H//在不同銷,但這時(shí)候一個(gè)周期。同時(shí),應(yīng)該注意的是,硬限制的功能
4 N; G$ q& x" X/ d9 r//將不會(huì)影響銷共享,。" ?# t' z3 U' C, R* u' b; b( S0 t  O, ]
//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器,。z軸首次明確,其次是X和Y。" @) d& e* y# }" K+ u( F5 @, L1 x

% X$ o1 \" U4 O// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.. D3 E+ Z) q( i7 @: n9 E; P- G
#define HOMING_CYCLE_0 (1<<Z_AXIS)                // REQUIRED: First move Z to clear workspace. 第一步Z清除工作區(qū),。
, s8 j: f5 G& x- w* _- t6 [5 {# V# A9 p#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // OPTIONAL: Then move X,Y at the same time.然后X,Y在同一時(shí)間。
) |! h8 n! E% I6 z5 K2 C// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable
( j$ v( b$ P+ D
: v) [/ E1 f+ ]7 Z& X  {8 n// Number of homing cycles performed after when the machine initially jogs to limit switches.
/ p' f" K8 X  B4 B! T6 a( O# |// This help in preventing overshoot and should improve repeatability. This value should be one or 5 S; u: @4 [+ V. u# c/ _; Y7 s8 n
// greater.; a4 y7 T. |4 W3 L6 p2 y
//執(zhí)行回原點(diǎn)循環(huán)次數(shù)后,當(dāng)機(jī)器最初慢跑限位開關(guān),。這個(gè)幫助防止過度,應(yīng)該提高重復(fù)性,。這個(gè)值應(yīng)該是一個(gè)或大。
6 n$ _* H, r1 M# d! U' N. p$ x2 o- m$ s
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
4 n0 g0 P0 i1 ]/ R: f: K" J! Y: d- `0 Y7 R9 S1 C4 L9 @
// After homing, Grbl will set by default the entire machine space into negative space, as is typical
+ G3 x8 n) G& ]3 Q// for professional CNC machines, regardless of where the limit switches are located. Uncomment this 3 b$ {, s9 s% b& ]' e8 L7 _
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
4 R' F, w" [+ h' C9 t
' o& w& `1 w. o% e  N//導(dǎo)航后,默認(rèn)Grbl將整個(gè)機(jī)器空間留白,是典型的專業(yè)數(shù)控機(jī)器,不管限位開關(guān)所在的地方,。( p# K. t: Z! h
//取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向,。
$ G7 k" Z& [4 u6 k- X* ]
0 W5 o( `6 B+ p* r& L// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable./ J9 I8 \, b( `, U% {4 s; a/ M2 s9 n

7 o( `: w. ]" F: s) m0 c! K& C8 w: q
8 k% \" d# Y- U: f" i: Y// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size/ {* a$ i5 q' f( P  Q8 r& ]! P0 |$ c( p
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may6 i4 O; Q5 _8 A& ~- i2 J
// be stored and executed in order. These startup blocks would typically be used to set the g-code. Z2 S9 l; v. @
// parser state depending on user preferences.3 `1 L2 U5 E+ b  {8 x

7 L5 B2 L1 x5 G' y4 n/ J8 P//塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量。這些塊存儲(chǔ)在eepm,大小4 \$ V  o: y7 z* [6 c2 r0 W9 L
//和地址在settings.h中定義,。與當(dāng)前設(shè)置,可能2啟動(dòng)塊
: y3 V* `0 V( p$ E4 b) v  r//存儲(chǔ)和執(zhí)行,。這些啟動(dòng)塊通常被用來設(shè)置刀位點(diǎn): X3 ^5 x7 J, y* G
//解析器的狀態(tài)取決于用戶首選項(xiàng)。* E' s& Q+ D" h1 D! T' j( S
  N& a" ~1 f; R1 @. b
#define N_STARTUP_LINE 2 // Integer (1-2)
, z( U1 \: X4 n1 r3 Y
( N# ?# r* p! k* Z" z- C3 Y, E// Number of floating decimal points printed by Grbl for certain value types. These settings are . }, q$ {% |2 `9 D" d3 ^
// determined by realistic and commonly observed values in CNC machines. For example, position9 V2 G5 ~6 x. g- @5 w5 x
// values cannot be less than 0.001mm or 0.0001in, because machines can not be physically more
$ x  b6 ~  G1 L' A// precise this. So, there is likely no need to change these, but you can if you need to here.8 S( W9 ~+ }- e9 C* m
// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors.- m/ N  @3 k1 O) D, D" x

( o7 Q5 ~2 a0 x9 E+ L// Grbl浮動(dòng)小數(shù)點(diǎn)的數(shù)字印刷的特定的值類型,。這些設(shè)置是
/ q: _6 z: K' V5 {% F//一般由現(xiàn)實(shí)和觀測(cè)值在數(shù)控機(jī)器,。例如,位置
2 Q- Q: X3 \2 }//值不能小于0.001毫米或0.0001,因?yàn)闄C(jī)器不能身體更多1 H9 P8 M2 Z/ [
//精確,。因此,有可能不需要改變這些,但你可以在這里如果你需要。8 h! v  A* H) L9 I
//注意:必須是一個(gè)整數(shù)值從0 ~ 4,。超過4可能出現(xiàn)舍入錯(cuò)誤,。
! H- O1 O0 S) X' q* w  l. J' j* C1 S/ Z, [% u' {& ^  }
#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸1 O. l7 e7 _- j) u0 l) O3 h/ c* a3 ^3 k
#define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值: N/ R' Q  [  ]* b; i
#define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
) \; `8 S5 T2 ^1 C1 F9 v1 r#define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘
! \- ?8 T& `% ]0 k# f& e  y. I#define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對(duì)浮點(diǎn)小數(shù)設(shè)置值. \. C: j: A) L1 [1 O- I8 a) E4 i, N& j

: k, z( D" P) J* z0 Y: {/ |// If your machine has two limits switches wired in parallel to one axis, you will need to enable  s$ V- |) M. M6 q% K/ L% Q8 p
// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
" H# u4 q: S: d& g2 G// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will
) h. v% s3 ]6 D// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one# g, r1 }' n2 H# ], y) \
// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a, ?0 w2 P! ]9 y) K$ R' s$ g' ^7 \6 e
// homing cycle while on the limit switch and not have to move the machine off of it.
' N- @& X1 w- \. g+ e$ q" j: ?4 u" Q, [* [! h, O/ ~
//如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用! s) ?5 T/ e$ w2 [" u0 m% Q
//這個(gè)特性。自從兩個(gè)交換機(jī)共享一個(gè)銷,沒有辦法Grbl告訴) `9 S4 u( z2 ?" ]: \, B3 I# Y2 Z
//啟用哪一個(gè),。此選項(xiàng)僅影響歸航,如果限制,Grbl意志
. H" |: @0 m; x; P3 d# C//報(bào)警,迫使用戶手動(dòng)松開限位開關(guān),。否則,如果你有一個(gè)
, W! K0 T2 j7 {2 ~( O; f0 O% w" E//為每個(gè)軸限位開關(guān),不啟用該選項(xiàng)。通過保持禁用,您可以執(zhí)行
0 |0 Q8 Z% o3 n* D9 [//導(dǎo)航循環(huán)在限位開關(guān)并沒有將這臺(tái)機(jī)器,。
& |2 |* J. H$ |2 c# E+ q6 i- K# \* h7 m/ o' Z, k  d) t
// #define LIMITS_TWO_SWITCHES_ON_AXES
) K; `, A. g' V2 \
3 V& w; P4 J- n4 _" [1 a) W// Allows GRBL to track and report gcode line numbers.  Enabling this means that the planning buffer
! `( h" F( x3 `; y. x// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct! B. c9 B- i* \* O  S6 [
) H" o# f6 n4 u; f) \1 _& N( c
//允許GRBL跟蹤和報(bào)告gcode行號(hào),。使這意味著計(jì)劃緩沖從18歲或16歲,為額外的行號(hào)plan_block_t結(jié)構(gòu)中的數(shù)據(jù)1 {& `' t4 D) x" A% B4 Y- a  F8 A

0 x' o) d7 E4 C6 H" z// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable.
. I( P3 K- B+ U. h2 o; w# D) r
9 ^3 y2 w) z* f// Allows GRBL to report the real-time feed rate.  Enabling this means that GRBL will be reporting more 7 S: n/ L$ ]8 g7 T
// data with each status update./ a) T  b8 X7 ^# H3 w7 A
// NOTE: This is experimental and doesn't quite work 100%. Maybe fixed or refactored later.
6 {7 b- q4 R  O' G9 o* \//允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率。使這意味著GRBL將報(bào)告數(shù)據(jù)和狀態(tài)更新,。
$ n) }6 {+ Y2 B" `. q. V//注意:這是實(shí)驗(yàn)和100%沒有工作,。也許以后固定或重構(gòu)。& |. |4 Y. D- p' A9 o! N

$ v3 R& W0 {) P# [; j. ?5 V9 R// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable.0 s% ^! F- a- D! Z! ~- A" U
- q/ T6 w+ v+ I( i- \. N$ F
// Upon a successful probe cycle, this option provides immediately feedback of the probe coordinates; Q+ J' X: o- c9 V
// through an automatically generated message. If disabled, users can still access the last probe: I- K: U7 [. h% r( B  J4 @/ N& q
// coordinates through Grbl '$#' print parameters.% C7 w, v/ u4 }
//在一個(gè)成功的調(diào)查周期,這個(gè)選項(xiàng)提供立即反饋的探測(cè)器坐標(biāo)
: H0 @- S4 `4 t# K/ s8 M: c# O//通過一個(gè)自動(dòng)生成的消息,。如果禁用,用戶仍然能夠訪問調(diào)查+ G& F" K2 S& z# F- W+ t, o& \) D
//坐標(biāo)通過Grbl $ #的打印參數(shù),。
8 i+ Q' M6 M+ Y6 r6 g( G8 v) j8 z: @0 G7 h
#define MESSAGE_PROBE_COORDINATES // Enabled by default. Comment to disable.9 a5 x! n8 Q% C+ H

  T; A) a' B( Q8 ]; Y. _) u// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
* h8 \' [3 W% C! ]. z" n' ?' C4 X// analog pin 5. Only use this option if you require a second coolant control pin.+ g8 g, l6 n: [) V: i
// NOTE: The M8 flood coolant control pin on analog pin 4 will still be functional regardless.: ^3 j, P* c: D/ s
// #define ENABLE_M7 // Disabled by default. Uncomment to enable.
! S7 t7 G9 l8 t: S+ Q* v+ i# w0 T& B% z) b/ k/ y+ Q
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,/ f6 L3 U+ l* P, |1 D& L$ }
// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
  G; r! R  q6 F) E2 F// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the6 E- U  ?) F" J& J. I% J
// previous tool path, as if nothing happened.
0 r$ ^3 H/ u+ I0 |7 J2 y// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.
& Q" [. g5 d" h! g, U+ @/ p2 Q; X! H; J* D( }, h7 i8 ^
// After the safety door switch has been toggled and restored, this setting sets the power-up delay
: W" Q) l! D7 |' G* R// between restoring the spindle and coolant and resuming the cycle.
, p/ w3 _+ |" e; B. M// NOTE: Delay value is defined in milliseconds from zero to 65,535.
5 H& N' z# e, Z' `# F5 M
5 i; n/ k: E& O6 |. z//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個(gè)搜索模式
3 C: T: q+ g, A: e" r- W" o6 ]8 U; K//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短% W& S  c% O! f: O* {8 P9 Q9 g
//拖出運(yùn)動(dòng)脫離限位開關(guān),。以下HOMING_CYCLE_x定義執(zhí)行% E2 p& r: h$ b7 s1 h- q- J+ h" d
//為了與后綴0開始并完成specified-axes只尋的例程,。如果) k% t) j. L, R1 b3 g
//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置。) K( Y# W0 H! F8 M- x2 v
//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,
/ A4 V5 ]( W% N/ R* O& F5 Z//沒有y),配置導(dǎo)航循環(huán)行為對(duì)他們的需求,。7 [7 @1 y' [" k8 U* [8 }
//注意:歸航周期允許共享限制針,如果軸不相同
, ]: }8 N# \& P5 |//循環(huán),但這需要一些銷設(shè)置cpu_map的變化,。h文件。例如,默認(rèn)的導(dǎo)航9 n2 J3 }/ W- G0 G5 {- e
//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?br /> 2 A4 k2 ~9 ~5 U- T0 s0 }//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的,。從理論上講,所有軸限制別針  e1 r  S4 _. d% {. q" n! S
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸! T$ D5 v8 ?4 b1 n
//在不同銷,但這時(shí)候一個(gè)周期,。同時(shí),應(yīng)該注意的是,硬限制的功能
2 c5 R6 p; m1 s$ q$ s/ T" p//將不會(huì)影響銷共享。7 y4 v0 R& o5 R& l% [
//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器,。z軸首次明確,其次是X和Y,。  T% i2 ^' T5 C. w% {- [; Y
: J# E) c) ?# t( _) |
" B6 U( i  `) W# `3 K
#define SAFETY_DOOR_SPINDLE_DELAY 4000- j% h7 n. c+ z
#define SAFETY_DOOR_COOLANT_DELAY 1000
) l" [+ n& e7 ]! _% {' h# M; p% w. v" q( H+ D$ W9 Z$ V! b
// Enable CoreXY kinematics. Use ONLY with CoreXY machines. : [0 R( `! g. j) @/ T9 D
// IMPORTANT: If homing is enabled, you must reconfigure the homing cycle #defines above to
3 A% e3 O' ^* q3 T$ t! R4 k//啟用CoreXY運(yùn)動(dòng)學(xué)。只使用與CoreXY機(jī)器,。3 g1 s, M; n9 Q2 E6 k# r
//重要:如果啟用了自動(dòng)尋的,你必須重新配置導(dǎo)航循環(huán)#定義上面
. ~. v' P4 q2 J) \# L* j
, T5 B; A% P* B# B! Y# W) `// #define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS)
/ I; j3 @4 N4 _# u  |0 U5 F: n
: f) i+ a# Y# H// NOTE: This configuration option alters the motion of the X and Y axes to principle of operation
* Q$ ?, R) ^- e& M; O9 z# S( A// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
) k: j* x, |" Q// described, if not, motions may move in strange directions. Grbl assumes the CoreXY A and B motors
) i2 ]5 c  ?4 p' [; e// have the same steps per mm internally.
8 w! i! _, p' Q9 Q7 Y//注意:這種配置選項(xiàng)改變X和Y軸的運(yùn)動(dòng)原理,操作
6 U7 m! v% w3 b3 M//定義(http://corexy.com/theory.html),。汽車被認(rèn)為定位和連接一樣
4 M5 J! u! p$ f0 C//描述,如果沒有,運(yùn)動(dòng)可能會(huì)奇怪的方向移動(dòng)。A和B Grbl假設(shè)CoreXY馬達(dá)6 u6 |: `: {5 d) K' c4 Y
//每毫米內(nèi)部有相同的步驟,。
- L# p- n' h( Y% t; s
; ^; M( Z9 a) a7 _// #define COREXY // Default disabled. Uncomment to enable.
4 a" s, s: E0 I, f; P8 ^) z9 J& p* ]; l) Q( p: t9 ~
// Inverts pin logic of the control command pins. This essentially means when this option is enabled
6 V% m" d3 E6 o: x! R" @// you can use normally-closed switches, rather than the default normally-open switches.
8 e1 F9 g: v" n+ ~// NOTE: Will eventually be added to Grbl settings in v1.0.( F+ J8 u" x4 H% q) ?
//反轉(zhuǎn)針銷邏輯的控制命令,。這實(shí)質(zhì)上意味著當(dāng)啟用這個(gè)選項(xiàng)
+ w# n# |. O. M2 t8 S& }//可以使用閉合開關(guān),而不是默認(rèn)的常開開關(guān)。
- l3 n3 E# M' ?  R2 l//注意:最終將被添加到在v1.0 Grbl設(shè)置,。2 [& r$ j0 R; N9 @
8 E; M! x9 Q! N4 C4 x
// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable." H! c9 P" D8 d8 u% P( C
: F& w: Q& r8 ~- n! A( d8 j! N
// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
( k0 M( R' U% ~# }, ?6 ^// for some pre-built electronic boards.
0 Y3 d4 z  X( D, a0 s// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and ' M. A% `9 R; {6 p2 M, h% j2 C
// spindle enable are combined to one pin. If you need both this option and spindle speed PWM, * Z, {/ @$ D0 v7 t- E8 j5 H) p
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below." ?1 I/ g. R4 _# }& d
//反轉(zhuǎn)主軸使銷從low-disabled / high-enabled low-enabled / high-disabled,。有用的
' ~9 D/ d5 W: t# v$ B/ C//預(yù)構(gòu)建的電子板。
9 \; M# m; O# G9 F9 p: y1 L" a% k/ t//注意:如果啟用了VARIABLE_SPINDLE(默認(rèn)),這個(gè)選項(xiàng)作為PWM輸出并沒有影響8 k  n5 G& E; w3 g
//銷軸使結(jié)合。如果你需要這個(gè)選項(xiàng)和主軸轉(zhuǎn)速PWM,: L7 l! k$ ~4 K4 e
//取消注釋以下配置選項(xiàng)USE_SPINDLE_DIR_AS_ENABLE_PIN
3 x1 ~3 I. Y9 y/ c7 @; h! [
% u/ {: ^3 e& N( k$ c- W// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
1 C" Q; A& A& C2 T  Y. ^1 i! n' F9 p$ q. b7 |# n1 t" x
// Enable control pin states feedback in status reports. The data is presented as simple binary of
6 ]5 g# l3 O8 T, f// the control pin port (0 (low) or 1(high)), masked to show only the input pins. Non-control pins on the
6 `& h0 r( E& F. l* o2 B  @2 X// port will always show a 0 value. See cpu_map.h for the pin bitmap. As with the limit pin reporting,) u3 B& r! Q; ?6 x/ H
// we do not recommend keeping this option enabled. Try to only use this for setting up a new CNC.
: W8 v( W! d: {& J& b) w& I/ |2 D//啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告,。作為簡(jiǎn)單的二進(jìn)制數(shù)據(jù)
' e; x* g- S- M+ ?# {3 f//控制針端口(0(低)或1(高)),蒙面,只顯示輸入插腳,。非控制性針上3 Z: S3 r* ?# X3 V2 D* D' ?
//端口總是顯示0值�,?吹絚pu_map,。針位圖h。與限制銷報(bào)告,
. J* q( Z8 D8 O& q0 `7 d//我們不推薦保持啟用這個(gè)選項(xiàng),。盡量只使用這個(gè)設(shè)置一個(gè)新的數(shù)控,。
$ h0 G2 O) h2 ], q5 T% Q/ S6 H1 M6 w2 t; t7 R0 u
// #define REPORT_CONTROL_PIN_STATE // Default disabled. Uncomment to enable.  a4 N. f" |5 u, h' U/ q4 k
  R# H* o% M8 L! V4 d* }
// When Grbl powers-cycles or is hard reset with the Arduino reset button, Grbl boots up with no ALARM% j1 b( {! s+ o- b6 C- E& _
// by default. This is to make it as simple as possible for new users to start using Grbl. When homing
+ a5 c" H. n9 g! Z: m; V4 ]" U) o( Y// is enabled and a user has installed limit switches, Grbl will boot up in an ALARM state to indicate . e/ j( P% J3 X6 E( I' i
// Grbl doesn't know its position and to force the user to home before proceeding. This option forces, L5 @( K2 I1 F6 k
// Grbl to always initialize into an ALARM state regardless of homing or not. This option is more for
# a. [, N, L6 T% }. v" N4 H* b8 t) Y/ z// OEMs and LinuxCNC users that would like this power-cycle behavior.$ q9 Y! S2 i/ {7 M4 {- W) |% j4 j
//當(dāng)Grbl powers-cycles還是硬重置Arduino復(fù)位按鈕,Grbl啟動(dòng)沒有報(bào)警4 a# [8 b0 I' r1 m) o" T5 [
//默認(rèn)情況下。這是為了讓新用戶盡可能簡(jiǎn)單使用Grbl開始,。當(dāng)歸航
: ~3 W* G' T7 x- \( c/ S' h//啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示) \6 \! A( o2 A2 Z, Y4 P
// Grbl不知道它的位置,迫使用戶在繼續(xù)之前回家,。這個(gè)選項(xiàng)部隊(duì)3 B! w  N8 E6 `3 x# }, u4 z
// Grbl總是初始化進(jìn)入警報(bào)狀態(tài)不管歸航。這個(gè)選項(xiàng)是更多0 Z0 C  z, T! [
//原始設(shè)備制造商和LinuxCNC用戶這樣的控制行為,。2 P3 j. a, u+ U6 r. Q2 P
. ^$ D$ U) Q- S% R+ P8 F
// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.' s; T+ ~6 v! Y0 `
8 U9 |  [3 r: ^7 u
// ---------------------------------------------------------------------------------------
& E0 p+ O$ ~4 j// ADVANCED CONFIGURATION OPTIONS://高級(jí)配置選項(xiàng):
/ \& k4 `6 O5 V$ d' ?. E8 v* T2 c( G# @. Y2 e: g
// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important.
, C1 T% T2 T$ [0 Z4 G// This saves nearly 2KB of flash space and may allow enough space to install other/future features.
2 }! ?( x3 j* g- A  L// GUIs will need to install a look-up table for the error-codes that Grbl sends back in their place.+ `5 S! C; N8 o7 f" S
// NOTE: This feature is new and experimental. Make sure the GUI you are using supports this mode.1 d' E8 b- p; j9 F: {" h% [

* a+ S! O* I2 A' H// gui允許最小的報(bào)告反饋模式,人類可讀的字符串在哪里不重要,。/ M9 R4 R1 S+ ^- J3 n
//這個(gè)節(jié)省近2 kb的閃存空間,允許足夠的空間來安裝其他/未來的功能。# B7 Z9 J9 W0 G
// gui需要安裝一個(gè)查找表的錯(cuò)誤代碼Grbl發(fā)回,。3 D+ x6 ^' N; _& D
//注意:此功能是新的和實(shí)驗(yàn),。確保您使用的GUI支持這種模式。8 O' b( g; s0 s; T1 |% E
7 b) z4 z2 H! C  a( x: m$ e9 I, z1 S
// #define REPORT_GUI_MODE // Default disabled. Uncomment to enable.% K" p) y; }' e3 k0 ]+ Q$ E

1 k; L" ^! v! t2 h9 l9 N// The temporal resolution of the acceleration management subsystem. A higher number gives smoother1 a! {# q2 L% A4 q; X% B
// acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively& I- ?) b" E# C0 I  V: s
// impact performance. The correct value for this parameter is machine dependent, so it's advised to: N2 b/ P! R& C
// set this only as high as needed. Approximate successful values can widely range from 50 to 200 or more.2 g6 ^- z& }7 w, S6 [
// NOTE: Changing this value also changes the execution time of a segment in the step segment buffer.
. F+ g  t7 t9 z// When increasing this value, this stores less overall time in the segment buffer and vice versa. Make' Y, D5 g3 H  a( R3 k; d
// certain the step segment buffer is increased/decreased to account for these changes.5 @  Z# U6 j0 B! Y; {* X
//加速度的時(shí)間分辨率管理子系統(tǒng),。更多更平穩(wěn)& H( R# o8 I! w9 H5 L
//加速度,特別明顯的機(jī)器上,運(yùn)行在非常高的進(jìn)料速度,但可能負(fù)面! ]& q% _' p' x( {& ~  [  k7 m
//影響性能,。正確的值為這個(gè)參數(shù)是依賴于機(jī)器的,所以建議
' I, O- j+ [" m3 \/ P- G//這只設(shè)置為高。近似成功的價(jià)值觀可以廣泛的范圍從50到200或者更多,。
9 u5 j+ t7 Q' V) ]- g//注意:改變這個(gè)值也變化的部分步驟的執(zhí)行時(shí)間緩沖,。
% z; L4 z! _0 x/ U3 ~) `4 P4 a//增加這個(gè)值時(shí),這個(gè)商店部分緩沖區(qū)的總時(shí)間減少,反之亦然。使
2 T! Q- r5 ~. G, ^1 c//特定步驟段緩沖是考慮這些變化增加/減少,。- q- ]( [9 ^: ^' r3 M2 y, X7 T. @1 N! s
/ @" R; T+ \; o4 O' q8 T. ]* p2 J
#define ACCELERATION_TICKS_PER_SECOND 100  //加速度的時(shí)間分辨率管理子系統(tǒng),。更多更平穩(wěn)
/ q" P3 t1 [" U6 p, _" K5 y/ L$ f
- k; a+ Q- `7 a- N6 A// Adaptive Multi-Axis Step Smoothing (AMASS) is an advanced feature that does what its name implies,
, K+ z6 a5 v1 B& ~0 W5 G( y1 S// smoothing the stepping of multi-axis motions. This feature smooths motion particularly at low step$ K2 E6 @# ~  J
// frequencies below 10kHz, where the aliasing between axes of multi-axis motions can cause audible & s% M" G6 t3 N) x8 C6 g. J
// noise and shake your machine. At even lower step frequencies, AMASS adapts and provides even better3 G6 R8 i, `" M3 j
// step smoothing. See stepper.c for more details on the AMASS system works.% X, a! C* h6 n3 i2 @! w( ~* ]3 H
//自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能,它的名字所暗示的那樣,9 j, o2 I; `. U+ i
//平滑的多軸步進(jìn)運(yùn)動(dòng)。這個(gè)特性平滑運(yùn)動(dòng)尤其是在低一步. c7 ~9 G9 g- _* U6 ]! V3 ~3 X  S
//頻率低于10 khz,軸之間的混疊的多軸運(yùn)動(dòng)可能導(dǎo)致音響  m4 q) }* D5 D1 T
//噪音和震動(dòng)你的機(jī)器,。在更低的頻率步,積累適應(yīng)并提供更好! F$ o5 D# r" {2 ~8 G  @* g9 O
//步驟平滑,。看到步進(jìn),。c更多細(xì)節(jié)的積累系統(tǒng)的工作原理,。
2 ^/ A) }. Z. _7 G2 ~7 O  {
" i. @, P* t, `5 y, t7 p$ V#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING  // Default enabled. Comment to disable.//自適應(yīng)多軸步平滑' e0 n4 Z4 Q2 c' b  y
" p# U  U, E& X) L! P
// Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error 5 _/ h  a: }( a! @# @) b
// check in the settings module to prevent settings values that will exceed this limitation. The maximum
: X8 h: P0 e+ R6 Y+ \5 y/ x1 W$ [$ R// step rate is strictly limited by the CPU speed and will change if something other than an AVR running
$ T3 O/ Z$ E7 M/ o8 q/ b/ L5 j. r// at 16MHz is used.
0 K: g6 `- d0 o5 L4 c/ T// NOTE: For now disabled, will enable if flash space permits.
" u  k) ^' R+ ^! s* ?//設(shè)置最大一步速率可以寫成Grbl設(shè)置。這個(gè)選項(xiàng)可以使一個(gè)錯(cuò)誤1 m! `. Q. @  [  E
//設(shè)置模塊中檢查,防止設(shè)置值將超過這個(gè)限制,。的最大' S& N6 Q. T8 _4 F
//步驟嚴(yán)格限制的CPU速度也會(huì)改變?nèi)绻瞧渌鸄VR運(yùn)行. A5 X9 F) P: ]& u3 p+ G2 H$ |
//使用16兆赫。
% `- J& {- T- C: w//注意:現(xiàn)在殘疾,將使如果flash空間許可,。  ]$ y- e$ K9 h7 c
! S3 _/ d9 J) L& j9 K6 k% n: ?3 A: u
// #define MAX_STEP_RATE_HZ 30000 // Hz 設(shè)置最大一步速率
  g9 Y* Z7 ]* `( K9 e& b& \
- w1 c; \: n* q6 `9 i3 o// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors
7 B! i$ O3 o; E5 x9 {// enabled. This simplifies the wiring for users by requiring only a switch connected to ground,
; F$ Z- z( D% f' j6 r# b// although its recommended that users take the extra step of wiring in low-pass filter to reduce) D  `' |0 m/ w6 {: R( s- u, D
// electrical noise detected by the pin. If the user inverts the pin in Grbl settings, this just flips5 _( C. C/ ]3 Q
// which high or low reading indicates an active signal. In normal operation, this means the user
8 D' C8 R" Z  [6 T: p! Q// needs to connect a normal-open switch, but if inverted, this means the user should connect a 7 G6 C# z, B+ W8 @6 n- H
// normal-closed switch.
  y6 f; ~$ W. S8 }0 |// The following options disable the internal pull-up resistors, sets the pins to a normal-low - Z" @: f3 d* N& R% p8 _" t4 H
// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning
  Z( W. Z9 D( Z6 Q6 A- d) ]) g// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
0 ~1 L  r# B! t! W( h# W// normal-open switch and vice versa.
3 H! ^, {9 Z6 ?( Q7 N3 c1 g% G// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.
+ g+ k% ?0 H5 T% j( @" E0 A// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
+ [7 v" E, M4 I; I5 r//默認(rèn)情況下,Grbl所有輸入引腳設(shè)置為正常高操作的內(nèi)部上拉電阻8 x  j/ N2 }% r+ y. Q
//啟用,。這簡(jiǎn)化了布線為用戶只需要一個(gè)開關(guān)連接到地面,$ ]9 c; X8 F6 _
//雖然其建議用戶采取額外的步驟,在低通濾波器來減少布線
6 G7 N6 S2 Y0 g* m; a( \//電噪音檢測(cè)銷。如果用戶反轉(zhuǎn)的銷Grbl設(shè)置,這只是翻轉(zhuǎn)
3 o* W2 y. J: C+ d//讀高或低表明一個(gè)積極的信號(hào),。在正常操作中,這意味著用戶
. J1 i. `3 T, {5 t//需要連接一個(gè)常開開關(guān),但如果倒,這意味著用戶應(yīng)該連接
% L5 X$ Y* Y8 l6 e7 p// normal-closed開關(guān),。
/ e0 |3 N* E, E//以下選項(xiàng)禁用內(nèi)部上拉電阻,一般低設(shè)置別針, X9 r1 B4 p. ~7 i! z7 o/ A6 ~
//操作,現(xiàn)在開關(guān)必須連接到Vcc代替地面,。這也掀的意思
6 e8 v4 Q7 [. e//反銷Grbl設(shè)置,一個(gè)倒置的設(shè)置現(xiàn)在意味著用戶應(yīng)該連接
. q; r$ f! R( ?/ b8 {: w# R# [//常開開關(guān),反之亦然。) L5 [, o9 }& d  p& d
//注意:所有針與功能被禁用,例如XYZ限制針,而不是單獨(dú)的軸,。1 E' M1 U$ x! c8 D# }
//警告:引體向上被禁用時(shí),這需要額外的布線與下拉電阻!
# M. _: ~) {$ L8 K
3 G  t) `* a4 d: c% m//#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻
+ F) D! u4 v0 ?% f, i//#define DISABLE_PROBE_PIN_PULL_UP* p/ s& D4 K$ T6 ?- Z  J2 o/ {
//#define DISABLE_CONTROL_PIN_PULL_UP
2 a: B1 ]8 [$ Y/ c& z2 C+ t) T5 j2 Q, v1 l
// Sets which axis the tool length offset is applied. Assumes the spindle is always parallel with ' q, O8 _3 _* |0 b+ d* O
// the selected axis with the tool oriented toward the negative direction. In other words, a positive( c1 E& e( c  |3 ^, Q- G3 m
// tool length offset value is subtracted from the current location.9 V- c) J5 `' q, n$ ?1 d! h
//設(shè)置哪個(gè)軸長(zhǎng)度補(bǔ)償應(yīng)用的工具,。假設(shè)軸總是與
* g# R9 B# R% H6 D4 ?0 E//選擇軸工具面向負(fù)方向。換句話說,一個(gè)積極的9 j' a. r! ^% b+ N' |7 X
//工具長(zhǎng)度偏移值減去從當(dāng)前位置,。* m: ^8 Y6 b& T0 |
8 v) H9 \3 n, d* w  P7 \/ G
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.設(shè)置哪個(gè)軸長(zhǎng)度補(bǔ)償應(yīng)用的工具
. T8 R+ _. q9 R3 C/ t- z9 a0 j' B* T& R; m7 g5 I/ Y
// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
7 ?5 ^3 d4 I! j6 i: u1 A// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
* x3 N9 ~' U( h2 D+ S/ b// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!$ D4 H% D3 b( A4 Q; S* a: ~
// The hardware PWM output on pin D11 is required for variable spindle output voltages.7 [, b1 E: v7 S: s1 X
//允許變量軸輸出電壓不同的轉(zhuǎn)速值,。Arduino Uno,主軸2 ~  q  K# ?0 W7 R" a
//啟用銷將輸出5 v的最高轉(zhuǎn)速256中級(jí)水平和0 v時(shí)禁用。
/ \" R% H' x, h% Q$ c//注意:重要Arduino凱澤本人!當(dāng)啟用時(shí),Z-limit銷這里和軸銷D12開關(guān)!
7 ]9 |$ V) p' H% _( K3 f1 o//硬件PWM輸出銷這里需要變量軸輸出電壓,。% S$ F% F) D- s! ?
; _7 [$ S. D! m3 l, T0 o( }
#define VARIABLE_SPINDLE // Default enabled. Comment to disable.//允許主軸輸出電壓不同的轉(zhuǎn)速值
& o: i" U( G/ J
9 O) o" ?- J, z/ j3 t4 [* y// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed2 h7 U) c  c0 z+ T
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and 2 a+ `& v! F$ b/ N
// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 10001 F: y8 }8 @% h" [6 Q
// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands:
% }: `6 P- `- l6 X" ]8 D// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled.( E5 V! F3 L6 u% ~7 n3 m
//使用的變量軸輸出,。這些參數(shù)設(shè)置最大和最小軸轉(zhuǎn)速( [' p2 {4 f6 T5 E1 A8 X2 L3 G. i
//“S”刀位點(diǎn)值對(duì)應(yīng)于銷電壓的最大值和最小值。有256個(gè)離散和
9 c3 r: c) j' Q4 p; |8 {- T9 R4 W//電壓平均分配箱主軸速度的最大值和最小值之間,。所以對(duì)于一個(gè)5 v銷,1000
0 Z# J; k5 ?2 \* t/ _* h! d( N// max rpm,250分鐘rpm,主軸輸出電壓將為以下“S”命令:, E9 p. X3 E7 w  l/ G
// @“S1000 5 v,“S250”@ 0.02 v,“S625”@ 2.5 v(中檔),。銷輸出0 v時(shí)禁用。9 d4 Q& f6 }+ A: A

( Z' C- i( E; ?' D8 C#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
: C" z' T) m% V: @* N1 w# n#define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
) x8 ?' G0 x6 J, x3 D! J. Y0 I; d; D4 X. S3 I7 `. p+ N$ l
// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.  s& j! h5 G; C) t
// When disabled, the PWM pin will still read 0V. Most users will not need this option, but it may be
7 _. u3 ^( |! Z$ G, x// useful in certain scenarios. This setting does not update the minimum spindle RPM calculations. Any% I' u& z5 j2 f
// spindle RPM output lower than this value will be set to this value.% f; r% I" h) m. a& `" [! b
//使用的變量軸輸出,。這迫使PWM輸出最小占空比時(shí)啟用,。6 D0 G. i$ C. J$ b8 W
//當(dāng)禁用,PWM銷仍讀0 v。大多數(shù)用戶不需要這個(gè)選項(xiàng),但是它可能是
5 v3 u* o  s$ j//在某些情況下很有用,。這個(gè)設(shè)置不會(huì)更新最小主軸轉(zhuǎn)速計(jì)算,。任何* F  G; R$ W/ |6 x0 L, m
//輸出軸轉(zhuǎn)速低于這個(gè)值將被設(shè)置為這個(gè)值。3 O6 a+ m& I# i: U% x3 }2 U: ~

" \- H, K& y  e) f% J' {// #define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable. Integer (0-255)# J" C8 E  c8 g+ `

& ~2 v+ R; k" t6 z. I// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help & W& {1 N' K0 ]% _7 i9 S' N$ {  W0 k
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses  m) m2 W+ E* E" M% L& R
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
  T# @7 ^9 c, C3 N& V// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno). ( d$ C' d9 v7 F1 c. A$ q4 k
// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.! u" G! c  t9 y
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with  V/ k) b& _3 a& w
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.), / a  m5 }# ~' \
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
: ]9 `; Z# ^. P- u$ C7 [//默認(rèn)ATmega328 p(Uno),Grbl結(jié)合變量軸PWM和使到一個(gè)銷的幫助" a6 R' y& h% |6 ^5 n1 i
//保存I / O管腳,。對(duì)于某些設(shè)置,這些可能需要單獨(dú)的別針,。這個(gè)配置選項(xiàng)使用- s' J( O* F5 h6 O8 j
//方向軸銷(D13)作為一個(gè)單獨(dú)的軸銷上啟用銷以及主軸轉(zhuǎn)速PWM這里。
6 N# ~. o- q. Q//注意:該配置選項(xiàng)僅適用于VARIABLE_SPINDLE啟用和328 p處理器(Uno),。
$ o, @* ~' \7 A5 E! c//注意:沒有方向銷,主軸順時(shí)針M4刀位點(diǎn)命令將被刪除,。M3和M5仍然工作。) k& F" g2 h* i. ^; g6 p
//注意:小心!Arduino引導(dǎo)裝載程序切換D13銷的權(quán)力,。如果flash Grbl
  }/ N$ I* V* g  o& F2 q# m//程序員(您可以使用一個(gè)備用Arduino“Arduino ISP”,。搜索網(wǎng)絡(luò)如何線)," w8 U+ V% }0 y. Q
//這D13導(dǎo)致切換應(yīng)該消失。我們還沒有測(cè)試這個(gè),。請(qǐng)報(bào)告將會(huì)怎樣!
9 ]2 K$ |7 N% T5 d+ T  u, R* k2 g2 }( i4 c& b6 o$ K5 _8 b( c
// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.
5 D/ G& T1 d4 m  d6 F7 m) {( t% b; D
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces0 M- ^8 z. j& M7 t6 N. ]
// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be
1 r, H1 t3 V9 s/ H' M// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user ; e7 k5 V: z% O' b  m+ ]0 ~4 ], I( H
// sendss the line 'g1 x1.032 y2.45 (test comment)', Grbl will echo back in the form '[echo: G1X1.032Y2.45]'.
" T6 c8 C* r4 f* ?+ ?// NOTE: Only use this for debugging purposes!! When echoing, this takes up valuable resources and can effect
- ?5 E& x4 g5 h7 V% ]+ F/ Y// performance. If absolutely needed for normal operation, the serial write buffer should be greatly increased( t3 B# L5 K3 k5 [/ N/ j! C
// to help minimize transmission waiting within the serial write protocol.% t5 }4 [6 {. q

# J& {* i4 W1 g3 T//啟用,Grbl發(fā)回的回聲線已收到,已預(yù)編譯(空間* w( K8 x- G! I! ~
//移除,大寫字母,沒有評(píng)論),由Grbl立即執(zhí)行,。回聲將不會(huì)
( Z6 d7 U( D7 i, [- d% A+ A' o  u//發(fā)送一個(gè)線緩沖區(qū)溢位,但應(yīng)該對(duì)所有正常線路送到Grbl,。例如,如果一個(gè)用戶
7 p! e5 @, z: L! Z5 h8 C; f+ H//發(fā)送線的g1 x1.032 y2.45(測(cè)試評(píng)論)形式”,Grbl將回聲”(回聲:G1X1.032Y2.45]”,。# G% @4 G& P2 z6 R3 ~
//注意:只使用這個(gè)調(diào)試! !當(dāng)呼應(yīng),這占用了寶貴的資源,可以影響3 \) m6 X3 w& n. v* D
//性能。如果正常運(yùn)行所需的絕對(duì),串行寫入緩沖器應(yīng)該大大增加
* X! N' p4 [* Z4 ]//幫助最小化傳輸?shù)认盗袃?nèi)寫協(xié)議,。
+ i# c7 D; ~1 b7 I! I/ _6 e2 j. G: `2 @0 R! ^: V5 E# V  Y4 S
// #define REPORT_ECHO_LINE_RECEIVED // Default disabled. Uncomment to enable.
% d8 p# U: d5 W+ U. R$ d& Y8 d% H( p4 {0 E7 o! t+ T9 R
// Minimum planner junction speed. Sets the default minimum junction speed the planner plans to at
& h$ N% {$ i. t/ K// every buffer block junction, except for starting from rest and end of the buffer, which are always1 j& H, n2 X0 N2 C! M9 q
// zero. This value controls how fast the machine moves through junctions with no regard for acceleration
! n! i' N! J! B' [! K4 z5 h// limits or angle between neighboring block line move directions. This is useful for machines that can't
- r4 s1 W% G! K, `// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value
  u/ e4 {$ T7 \) Y// should not be much greater than zero or to the minimum value necessary for the machine to work.
8 Y! M6 {& ]+ ?2 _; j, S% y1 o8 x: L4 s+ D( r1 u  P8 Y
//最小規(guī)劃師結(jié)速度,。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃4 T( D7 W  g" r! z* E
//每一個(gè)緩沖塊接頭,除了從結(jié)束休息和緩沖區(qū),它總是
( x2 X; ?0 ?: f# U- b9 G// 0。這個(gè)值控制機(jī)器的速度穿過路口,沒有考慮加速度0 ?7 u1 B* {0 x
//限制或相鄰塊之間的角線方向移動(dòng)。這是有用的機(jī)器,不能# U$ H" p# J/ z9 _3 n
//容忍工具居住某一剎那,即3 d打印機(jī)或激光切割機(jī),。如果使用這個(gè)值
7 f1 ?" Q0 X$ h: H; D! ]//不應(yīng)大于零或機(jī)器工作所需的最小值,。8 V; A! j) Q  a' s

: n- s; A" n2 [7 w2 l( N#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min)
9 y0 Z6 H0 q7 u
9 T& n( p8 h5 w' M// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum
- z9 G8 Y& e5 r( ]// value. This also ensures that a planned motion always completes and accounts for any floating-point) g) _$ k+ l9 o: U2 V# `
// round-off errors. Although not recommended, a lower value than 1.0 mm/min will likely work in smaller5 r/ E0 ^0 B( X" i! B! T+ [
// machines, perhaps to 0.1mm/min, but your success may vary based on multiple factors.8 g1 |0 F) X# m' D, X
//設(shè)置計(jì)劃將允許的最小進(jìn)給速率。任何價(jià)值低于它將被設(shè)置為最低值,。這也保證了運(yùn)動(dòng)計(jì)劃總是完成,占任何浮點(diǎn)
( b$ ^, l0 ?/ `+ {/ k) h//舍入錯(cuò)誤,。雖然不推薦,價(jià)值低于1.0毫米/分鐘可能會(huì)在較小的工作
9 {( e' H  W  f# `( y' [//機(jī)器,也許到0.1毫米/分鐘,但你的成功基于多種因素可能會(huì)有所不同。
! L' N' r+ |. g5 O$ ?. q
, n% ]$ ?/ x$ P0 v, [2 }#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率' a: D/ C6 {2 C! ~
% g. c  d7 g6 G3 Q
// Number of arc generation iterations by small angle approximation before exact arc trajectory - O; P& ]- D8 E3 I+ g
// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there % Y; L0 u+ T' n& ^0 `
// are issues with the accuracy of the arc generations, or increased if arc execution is getting. y5 g+ b; S  r7 x, X0 m
// bogged down by too many trig calculations.
+ q, P( m9 g' R, r$ p# x//弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡2 k0 F0 a% @  p
//修正與昂貴的sin()和cos()calcualtions,。如果有這個(gè)參數(shù)可能減少
# I/ ]  O4 O' W: R  g8 @9 c, `//與弧一代又一代的準(zhǔn)確性問題,或如果電弧執(zhí)行得到增加; l5 R) r! ?: I
//太多的三角計(jì)算的泥潭,。: e1 y8 E" f; h

! K" ~4 j: `+ T( I+ x9 ]% S#define N_ARC_CORRECTION 12 // Integer (1-255)
/ o) a* A" c, H# L3 e5 h9 i+ N3 M/ s
// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical
. j- T" E0 F( O& A% }// errors when arc at semi-circles(pi) or full-circles(2*pi). Offset-based arcs are much more accurate
! b1 D  `- n& s5 y$ g// but still have a problem when arcs are full-circles (2*pi). This define accounts for the floating
2 ^( Y, E- y" y/ Q; \- P# z// point issues when offset-based arcs are commanded as full circles, but get interpreted as extremely4 ^% `) g5 a$ Z- V
// small arcs with around machine epsilon (1.2e-7rad) due to numerical round-off and precision issues.- T/ C! f! A) U9 o2 w  f/ U  g
// This define value sets the machine epsilon cutoff to determine if the arc is a full-circle or not.
. e7 u/ C8 f$ T1 a8 U// NOTE: Be very careful when adjusting this value. It should always be greater than 1.2e-7 but not too0 a) \# F2 J) c+ N$ p% L. h5 f
// much greater than this. The default setting should capture most, if not all, full arc error situations.7 F  F! j. _: |" p4 C" K
//弧G2/3刀位點(diǎn)的標(biāo)準(zhǔn)定義是有問題的。Radius-based弧有可怕的數(shù)值
0 i8 d% L/ r7 |" H6 q# m//錯(cuò)誤當(dāng)電弧在半圓(π)或原點(diǎn)(2 *π),。Offset-based弧更準(zhǔn)確
) t/ N& y0 m# a3 n( ]" x+ c7 ^, r//但仍有一個(gè)問題當(dāng)弧原點(diǎn)(2 *π),。這個(gè)定義占浮動(dòng)
' D" b# \. h4 R- a, c2 V0 d3 G//當(dāng)offset-based弧吩咐點(diǎn)問題完整的圓,但解釋為極
+ h5 p8 d; j$ ^6 z; _//小弧機(jī)周圍ε(1.2 e-7rad)由于數(shù)字舍入和精度問題。
$ O4 G$ }. j# X$ W" D9 v//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了,。8 N  Z% L* G# ?3 ^' l6 }& g
//注意:調(diào)整這個(gè)值時(shí)非常小心,。它應(yīng)該總是大于1.2 e -但不要太
) y' }3 G3 H5 r8 P6 L8 U2 w+ i//比這大得多。默認(rèn)設(shè)置應(yīng)該捕獲大部分,如果不是全部,全部錯(cuò)誤的情況,。' r- b3 n9 e# r7 d" l! G
9 R4 t6 ], D* B9 a
#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)
7 R3 z( a- o; ?& e5 S
+ q& C$ u: `8 P0 P* {! P' ~// Time delay increments performed during a dwell. The default value is set at 50ms, which provides# C% \9 K# C& r3 v
// a maximum time delay of roughly 55 minutes, more than enough for most any application. Increasing6 Z, t3 D, H% u
// this delay will increase the maximum dwell time linearly, but also reduces the responsiveness of
$ u+ b* B& }  E2 P5 h0 Z  H// run-time command executions, like status reports, since these are performed between each dwell 7 r. m! |9 K/ F7 ?8 \+ x
// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.* ~- e" R" @3 t& Z
//延時(shí)增加表現(xiàn)在住,。默認(rèn)值設(shè)置為50毫秒,它提供了
! I/ V5 u' M" ]1 K5 U//最大延時(shí)約55分鐘,足夠?qū)Υ蠖鄶?shù)任何應(yīng)用程序。增加# {8 @. \4 r" x# i0 n  o# S
//這種延遲將增加線性最大停留時(shí)間,也減少了響應(yīng)能力7 n! _4 A: K! L; V- p6 `2 m
//運(yùn)行命令執(zhí)行狀態(tài)報(bào)告一樣,因?yàn)檫@些每個(gè)住之間執(zhí)行
6 a0 m& p6 ^: c- V) V//時(shí)間步,。還有,記住,Arduino延遲計(jì)時(shí)器不是很準(zhǔn)確的長(zhǎng)時(shí)間延誤,。
3 ^3 X' b2 [' h! @
6 [4 \. e) H- n% z' u7 J) [#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds): n8 y! m3 i/ S: @5 @
9 a9 K  V; I: k8 r. _! U
// Creates a delay between the direction pin setting and corresponding step pulse by creating( k( g1 d6 y  s. a/ ~
// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare) 6 p) ?4 o3 |% R3 t- p3 H4 L
// sets the direction pins, and does not immediately set the stepper pins, as it would in 7 f' n, ?' E' r, K, R
// normal operation. The Timer2 compare fires next to set the stepper pins after the step ! K  I7 L9 d6 U& H; P7 N
// pulse delay time, and Timer2 overflow will complete the step pulse, except now delayed
' S( K, J1 s& m! z5 [6 ]9 E// by the step pulse time plus the step pulse delay. (Thanks langwadt for the idea!)
6 R6 C: y. A5 V% N' Z# j2 m// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the) p" m( }/ v& U( f  o- `
// user-supplied step pulse time, the total time must not exceed 127us. Reported successful
- h3 X6 `9 ~, Y0 ?  T, S2 x// values for certain setups have ranged from 5 to 20us.8 j( Q; x7 U. `  }, P5 e8 B( F
//創(chuàng)建一個(gè)方向銷之間的延遲脈沖通過創(chuàng)建設(shè)置和相應(yīng)的步驟
9 B" s0 f2 v* t2 c; m//另一個(gè)中斷(Timer2比較)來管理它。主要Grbl中斷(Timer1比較)' X/ `; M% @/ g1 M
//設(shè)置方向針,不立即設(shè)置步進(jìn)針,因?yàn)樗鼤?huì)在
. u( Q- ~+ B8 p4 h4 Q//正常操作,。Timer2比較火旁邊設(shè)置步進(jìn)針后一步$ Q  L7 k5 `' p
//脈沖延遲時(shí)間,Timer2溢出脈沖將完成的步驟,現(xiàn)在延遲除外
) h; _, `! [' N, x4 r7 g//脈沖時(shí)間加上的一步一步脈沖延遲,。(感謝langwadt主意!)
+ F$ c0 T% G+ A0 a- h4 s) {6 @0 ^" f//注意:取消啟用。必須> 3,建議延遲,當(dāng)添加的
" a$ V9 m: G* a6 Y//用戶提供的步驟脈沖時(shí)間,總時(shí)間不得超過127美元,。成功的報(bào)道! C' d9 z6 F* I, w# Z# A4 Y
//值對(duì)某些設(shè)置范圍從5到20,。3 F' k! o3 s, h; `* y- @/ f
- Z* Q; M0 G7 p+ S# F
// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.+ _5 s  M# B6 k9 Z/ o! F

$ A: T+ X0 s& D: `// The number of linear motions in the planner buffer to be planned at any give time. The vast9 t2 A1 D7 ]# ~" L! o" K
// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra
( }: {1 i8 _/ F* F% x6 b1 r// available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino7 W' D% o9 I( f+ b$ V
// begins to crash due to the lack of available RAM or if the CPU is having trouble keeping
! G: t4 v  @( t$ `7 R// up with planning new incoming motions as they are executed.
8 g4 G, A* v( T1 g//線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃。絕大
# Q7 s4 I) s+ H0 ?//多數(shù)RAM Grbl使用基于這個(gè)緩沖區(qū)的大小,。如果有額外的只會(huì)增加! U" T! {# h% q$ ]( s4 X
//可用內(nèi)存,比如當(dāng)基于大型或Sanguino,。如果Arduino或減少- A, p& f8 I& V6 j( N' t4 ?
//開始崩潰由于缺乏可用的RAM或者CPU是難以保持) A3 n; ?5 T2 r
//與規(guī)劃新傳入的動(dòng)作執(zhí)行。% {' Z8 J) d" q; r

4 k0 p" c! Y0 l3 y( I% F* Q// #define BLOCK_BUFFER_SIZE 18  // Uncomment to override default in planner.h.) n* i9 i' l. E3 W3 ?, i# _9 \+ \

6 j' y" s0 S( h; |0 B2 `  T1 H+ ^// Governs the size of the intermediary step segment buffer between the step execution algorithm
; @" r$ ^- B  J, g// and the planner blocks. Each segment is set of steps executed at a constant velocity over a
" u7 X6 X# m' ?" V  V// fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner
7 R- L1 e* i5 @// block velocity profile is traced exactly. The size of this buffer governs how much step / H$ I- \: w; I9 r) P* J
// execution lead time there is for other Grbl processes have to compute and do their thing $ W# C% \% _' \2 a9 ?5 Z
// before having to come back and refill this buffer, currently at ~50msec of step moves.
& S, U0 v: O- B. c. Q//控制之間的中間段緩沖大小的步驟執(zhí)行算法
$ \# g/ h1 ?5 l. q! w//和規(guī)劃師塊,。每一部分的步驟執(zhí)行在一個(gè)恒定的速度+ h$ O; [. u9 X+ }8 m) d
//固定的時(shí)間由ACCELERATION_TICKS_PER_SECOND定義的,。他們計(jì)算的計(jì)劃
; d" k$ F2 d) c" Z//塊速度剖面追蹤到底。這個(gè)緩沖區(qū)的大小控制多少步驟) h1 h' B, H5 `! U/ N
//執(zhí)行時(shí)間有其他Grbl過程需要計(jì)算和做他們的事情5 e7 R8 D: S$ J+ d! A# ^# t( ]
//之前必須回來重新填充這個(gè)緩沖區(qū),目前移動(dòng)~ 50毫秒的一步,。
4 p$ k7 `" y7 p3 c2 g+ k8 k# @; x/ G/ V1 P
// #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h.; {/ s  a1 y  S

' R9 G! Z5 }! ^# \// Line buffer size from the serial input stream to be executed. Also, governs the size of + L. i. B2 \4 A; d- a/ }
// each of the startup blocks, as they are each stored as a string of this size. Make sure5 s  y: J# g; p
// to account for the available EEPROM at the defined memory address in settings.h and for6 v) n' Q8 ]: c& `; |1 n$ u! E
// the number of desired startup blocks.
% `* \3 A- @4 b- Q// NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size
* ?; s. {  s, R/ Z5 p6 D4 S// can be too small and g-code blocks can get truncated. Officially, the g-code standards " t, C9 h: ?. q. u* \
// support up to 256 characters. In future versions, this default will be increased, when
1 l; H" h( Y( N8 f. x& T// we know how much extra memory space we can re-invest into this.
* f2 s, B( V5 j//行執(zhí)行串行輸入流的緩沖區(qū)大小,。同時(shí),大小的控制& A3 C; F3 m+ ]
//每個(gè)啟動(dòng)模塊,它們分別存儲(chǔ)為字符串的大小。確保
* U( R; j% h6 _# y8 f7 ?0 y+ ?//占可用eepm定義內(nèi)存地址的設(shè)置,。h和8 ], A( R: d+ e$ p: \2 k3 y
//需要啟動(dòng)塊的數(shù)量,。
7 n: K0 @1 u4 H1 m: v//注意:80個(gè)字符不是一個(gè)問題,除了極端的情況下,但線緩沖區(qū)大小- R6 ^/ b' K0 G$ H
//可以太小和刀位點(diǎn)塊可以截?cái)�,。正�?刀位點(diǎn)標(biāo)準(zhǔn)
; t; H1 R& a# v! b  B0 s//支持多達(dá)256個(gè)字符。在未來的版本中,這個(gè)違約將會(huì)增加,當(dāng)- N6 k: `% [1 ^& w/ V% n
//我們知道多少額外內(nèi)存空間的時(shí)候我們可以再投資,。
3 Q2 }4 i. V) V+ |
5 S: Q4 q5 [5 z, N, `: y2 n// #define LINE_BUFFER_SIZE 80  // Uncomment to override default in protocol.h' t; B  w8 L: }8 v% x0 y* m
  / @: A& W& {2 q8 i: G
// Serial send and receive buffer size. The receive buffer is often used as another streaming9 c* ?, \; s2 r8 |, t; R
// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming+ b( i& m! x) r2 i/ J- G
// interfaces will character count and track each block send to each block response. So,   [$ n3 I% g* d  c8 v+ t- c
// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable% E$ h$ p' W: v+ t* u' E
// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
% }$ k' o2 S; Z9 {4 I3 \! Y// messages are sent and Grbl begins to stall, waiting to send the rest of the message.; z7 h( ~5 r6 s+ M
// NOTE: Buffer size values must be greater than zero and less than 256.8 v- Y! V8 Q3 N
// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h9 `9 b! d- \5 R& p: \/ S
//串行發(fā)送和接收緩沖區(qū)大小。接收緩沖區(qū)通常用作另一個(gè)流  T: |+ n, ~7 G" C7 }
//緩沖存儲(chǔ)傳入的塊來處理Grbl當(dāng)它準(zhǔn)備好了,。最流
, q& U, F# v6 A7 d' D//接口將字符計(jì)數(shù)和跟蹤每一塊發(fā)送給每個(gè)塊的回應(yīng),。所以,+ R: V! b9 E7 ]2 M
//增加接收緩沖區(qū)如果需要更深層次的接收緩沖區(qū)為流,、
' h3 }, L1 {" O, J& q2 s2 O  j5 ~//內(nèi)存允許,。Grbl發(fā)送緩沖主要處理消息,。只會(huì)增加如果大
( O. \: k/ B: o! |//消息發(fā)送和Grbl開始停滯,等待發(fā)送其余的消息。: e1 {0 I- C: a+ ]0 _
//注意:緩沖區(qū)大小值必須大于零,小于256,。; ~9 r2 Y6 s4 d% q) Q: |
// # define RX_BUFFER_SIZE 128 / /取消serial.h覆蓋默認(rèn)值% ^( R! j; E2 Q: A7 A. D& k
; P, j1 z7 d& }5 X& A) w
: N- y+ L. l. d7 W, l- _
// #define TX_BUFFER_SIZE 64+ V" h, i1 G' I0 U" K
  
( ^- r3 O. o: F0 g1 n: @1 G2 f// Toggles XON/XOFF software flow control for serial communications. Not officially supported; X; B5 P& Z& w. a  p, C; _
// due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware
0 S( k& W) g6 d* Z$ j7 e// on these chips do not support XON/XOFF flow control characters and the intermediate buffer ! Z- D$ s5 j- ?) b, E( z& V) v! b. z/ j
// in the chips cause latency and overflow problems with standard terminal programs. However, " s/ N: w7 |# e
// using specifically-programmed UI's to manage this latency problem has been confirmed to work.
2 Q, L0 g$ h" k5 ~  b: D// As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard$ H  }- c# {( I4 l) k; b$ ~) n; y
// terminal programs since their firmware correctly manage these XON/XOFF characters. In any
0 N. B, B! I' `3 r/ N) S// case, please report any successes to grbl administrators!
/ D! z" p/ D/ ?% V1 D/ t! {, l) u//切換為串行通信發(fā)送樸通/發(fā)送葡開軟件流控制,。不是官方支持
9 ~* e, _9 b0 A  a0 Y7 k//由于問題涉及Atmega8U2 USB-to-serial當(dāng)前arduino芯片。固件' Z. G/ ^; v7 D% n+ M* g- @
//在這些芯片不支持發(fā)送樸通/發(fā)送葡開流控制字符和中間緩沖區(qū)) |: p' ^3 |# ]* I% H
//芯片導(dǎo)致延遲和溢出問題的標(biāo)準(zhǔn)終端程序,。然而," f4 k8 p/ Y& M9 y% t
//使用specifically-programmed UI的管理這個(gè)延遲問題已經(jīng)確認(rèn)工作,。
6 m" B; m$ X; U+ `  e5 B8 O//以及老FTDI FT232RL-based arduino(Duemilanove)是已知的標(biāo)準(zhǔn)
4 \+ W) y% o' f: D* G//終端程序因?yàn)樗麄冋_的固件管理這些發(fā)送樸通/發(fā)送葡開的角色。在任何2 j  G6 N4 U, `* N7 L
//情況,請(qǐng)報(bào)告任何成功grbl管理員!9 E2 D" x: ~  E" P- S  g% W
. j& C* t3 s7 f! G& B& H. s$ U
// #define ENABLE_XONXOFF // Default disabled. Uncomment to enable.
# |6 M" @% @% h5 _) G
7 O. y# q$ Z. H4 O// A simple software debouncing feature for hard limit switches. When enabled, the interrupt $ p! {2 o' p  l$ G
// monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check
* a4 E; R6 h( X+ F& L$ C// the limit pin state after a delay of about 32msec. This can help with CNC machines with . d" V* K+ {/ k. N! H/ K$ z
// problematic false triggering of their hard limit switches, but it WILL NOT fix issues with ' J  K0 O8 m0 L8 K% b4 q
// electrical interference on the signal cables from external sources. It's recommended to first
" Y/ S" R; E& v9 E5 Z6 H// use shielded signal cables with their shielding connected to ground (old USB/computer cables " }) `' n+ R" ?- t, O
// work well and are cheap to find) and wire in a low-pass circuit into each limit pin.
, U& U. M5 J/ u; ~2 v# T//一個(gè)簡(jiǎn)單的軟件消除抖動(dòng)特性硬限位開關(guān),。當(dāng)啟用時(shí),中斷: E4 o/ d8 ?8 {  s5 m
//監(jiān)控硬限位開關(guān)針將使Arduino的看門狗定時(shí)器重新審視
8 y4 Z- o4 p- j2 F( F+ n6 c//銷的極限狀態(tài)后約32毫秒的延遲,。這可以幫助與數(shù)控機(jī)器
. @" q  e1 u9 |6 P& g//問題錯(cuò)誤引發(fā)的硬限位開關(guān),但是它不會(huì)解決問題0 z) B% m) X3 i% b  ^: i
//電干擾信號(hào)電纜從外部來源。首先它的建議
+ c! O, a- n5 p8 X( }8 N//使用屏蔽信號(hào)電纜的屏蔽連接到地面(老USB /計(jì)算機(jī)電纜% t  R! G! S- d3 c$ |) Y
//工作得很好,很便宜)和線低通電路到每個(gè)限位銷,。
" j0 x3 v7 \8 S. ]% i1 m* c9 r6 _
/ K% [5 J0 F4 g* N/ d/ K: o6 \// #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable.
) Q* a% H9 `1 x0 p4 @1 ]
6 R' r" C' p+ ^+ j  ?% X# ~9 t// Force Grbl to check the state of the hard limit switches when the processor detects a pin. j6 Y! Y- _, N- {  W
// change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits
3 a' G* a7 v- _// alarm upon any pin change, since bouncing switches can cause a state check like this to " R* z7 S$ d# O0 f( h& E
// misread the pin. When hard limits are triggered, they should be 100% reliable, which is the
  \. g9 |7 z) u// reason that this option is disabled by default. Only if your system/electronics can guarantee
5 G7 }# x* ~; K3 [0 r// that the switches don't bounce, we recommend enabling this option. This will help prevent
# c- d2 B0 J) G6 |8 B7 T// triggering a hard limit when the machine disengages from the switch.6 I+ ]. Y: s5 d
// NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled.
/ G6 o9 M, i1 v# p& m7 F) T3 W8 s( U//力Grbl檢查硬限位開關(guān)的狀態(tài),當(dāng)處理器檢測(cè)到一個(gè)銷
( x; T6 M" z  L' q+ k4 ^" D//改變內(nèi)部硬限制ISR例行公事,。默認(rèn)情況下,Grbl將觸發(fā)硬限制
) ]' J% I4 \8 M) Z' y$ k//報(bào)警在任何銷更改,因?yàn)樘_關(guān)可以導(dǎo)致這樣的狀態(tài)檢查7 p. z9 z% U, b7 X) |6 S8 z
//誤讀了銷。硬限制觸發(fā)時(shí),他們應(yīng)該100%可靠,這是( V2 x2 T8 {5 _5 U4 U/ J. z
//原因,這個(gè)選項(xiàng)默認(rèn)是禁用的,。只有在你的系統(tǒng)/電子產(chǎn)品可以保證4 }) s  A7 E3 G2 d2 B" u9 h3 x3 F
//開關(guān)不反彈,我們建議啟用這個(gè)選項(xiàng),。這將有助于防止3 ]4 X; j# ?  d, ^" T+ t
//觸發(fā)機(jī)退出時(shí)硬限制開關(guān)。1 X/ i& f. ~+ \& |7 v. j
//注意:這個(gè)選項(xiàng)如果啟用了SOFTWARE_DEBOUNCE沒有影響,。
' o8 w+ h& ^; [, ]. U0 U. {# f/ M
; R3 m' c. T: X// #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable.# M1 J, K3 l' \9 U" b

/ _$ f+ `( J4 X) }
* Z% O. A7 W6 {6 f& x// ---------------------------------------------------------------------------------------
' ^6 W  T4 k9 c0 M6 f: D// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:
2 ?7 E/ n& I' \* @( ]0 `0 w, W$ L4 D0 N7 n! ]9 t  Z
#ifndef HOMING_CYCLE_0
$ {) D# ?/ a3 W  w  #error "Required HOMING_CYCLE_0 not defined."5 Y& @: P4 _' L* @5 z$ @
#endif
  S' Z2 T. U8 m1 u. O" n
+ k! a: r4 w6 ^1 F#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)4 c8 ^& M1 n% \0 u& j
  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled": T! E3 v) P2 B* }  x0 ]
#endif
% E0 b# Y) v3 D6 k
* d0 B& R* x' B/ R/ A#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
: g, K8 v' g- a/ {. z  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"8 g( y1 B4 c7 y- k% D
#endif- n8 j, o) z$ l( B) |0 f8 Y

" t- j" c, ~0 ?( D2 @# o6 E// ---------------------------------------------------------------------------------------
  Q* ^, t0 H% m6 f, F$ L+ f
, F) [6 ~' n' W9 J# z+ R% V' `: V% {, M0 K( B- L6 Z
#endif
# Q+ I% K2 ^% ~3 I' Y; Q& L, e/ L7 o, H5 p  e) ?& z

* M! {1 A1 h2 t  @7 U
7 {- V0 [; g3 u4 \9 g, d2 i  d+ a$ _# o/ j
8 i$ F/ j9 i2 S& g. O7 c! U* j8 b
9 U4 w( ^/ ^7 w5 M8 l( ~5 r) ^

# J) d; J' Q, [
- O" p/ ^3 j5 @
+ w9 b  X. o8 n7 f% w% T5 S/ p

$ y/ ?, ?5 P, {/ h* [6 a  K+ f
# ]# K: ]* H0 q8 C; J  p% e( @
; H7 d; q# v7 ~% Y3 t7 L, w% f9 j: k' t' B. K2 p- j

4 [# r9 X; \% l, u1 D3 h3 w4 G! v6 @/ B6 j% b+ k

本帖子中包含更多資源

您需要 登錄 才可以下載或查看,,沒有帳號(hào)?注冊(cè)會(huì)員

x

評(píng)分

參與人數(shù) 2威望 +201 收起 理由
mrplplplpl + 1 思想深刻,,見多識(shí)廣,!
管理團(tuán)隊(duì) + 200

查看全部評(píng)分

2#
 樓主| 發(fā)表于 2016-8-21 00:11:42 | 只看該作者
那些沒有用的照片不知道怎么就上去了好討厭,。
3#
 樓主| 發(fā)表于 2016-8-21 00:14:16 | 只看該作者

) `$ q6 l# [8 ~  h' g" }3 Q1 ^4 r' x
4#
發(fā)表于 2016-8-21 05:50:22 | 只看該作者
      樓主厲害,!
5#
發(fā)表于 2016-8-21 08:22:05 | 只看該作者
謝謝樓主,先收藏一下,,慢慢學(xué)習(xí)
6#
發(fā)表于 2016-8-23 15:11:25 | 只看該作者
這是什么寶貝,?
7#
發(fā)表于 2016-8-23 15:11:47 | 只看該作者
換了個(gè)瀏覽器Chrome,試試能否發(fā)言了,。
8#
發(fā)表于 2016-8-23 20:12:33 | 只看該作者
樓主厲害
9#
 樓主| 發(fā)表于 2016-8-23 23:03:17 | 只看該作者
補(bǔ)充% l% {4 U5 B7 B$ [' D2 ^& n% O
程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令,。
: B( k% o* I3 d4 ^+ |// Executes run-time commands, when required. This is called from various check points in the main
* V1 Q% v8 [* O$ N// program, primarily where there may be a while loop waiting for a buffer to clear space or any& p! X5 K9 Q: {" @) D- P0 b
// point where the execution time from the last check point may be more than a fraction of a second.8 j1 ?9 ^; m8 [/ c
// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code7 a* }5 X5 G/ h; @/ \& V# k0 G
// parsing and planning functions. This function also serves as an interface for the interrupts to
% m, l- J7 H3 A, D' V// set the system realtime flags, where only the main program handles them, removing the need to
8 N# t+ ?( W+ E; r% ?// define more computationally-expensive volatile variables. This also provides a controlled way to
; H$ X- x3 W. W  x* _! K// execute certain tasks without having two or more instances of the same task, such as the planner1 F0 ^) c+ D; l8 F) Q6 I+ f
// recalculating the buffer upon a feedhold or override.
4 O- l# G' e9 m/ h8 m// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
1 @0 ]0 W" P% c) z* p  j: D// limit switches, or the main program.
8 \/ ]1 p; W4 k3 b9 r1 |
! r0 \4 V& ~) u: t' r//執(zhí)行運(yùn)行時(shí)間命令,在需要時(shí)。這就是所謂的從各種主程序要檢查站7 Z  e1 b2 j. n" @# D
//,主要是那里可能是一個(gè)while循環(huán)等待緩沖區(qū)空間或任何! Z) n, L$ {) e- n( `
//執(zhí)行時(shí)間從過去的止點(diǎn)可以超過幾分之一秒,。, y8 `( n4 l, F8 M3 n" |: `
//這是一種異步執(zhí)行實(shí)時(shí)命令(又名多任務(wù))grbl的刀位點(diǎn)
' S. |; y& _6 F7 |+ C$ K//解析和規(guī)劃功能,。這個(gè)函數(shù)也可以作為一個(gè)接口,用于中斷1 s6 _' Y$ _# Y5 \  K) i
//設(shè)置系統(tǒng)實(shí)時(shí)的旗幟,只有主程序處理,消除的需要
. C9 {3 E% {/ @* A) P//定義更多的計(jì)算昂貴volatile變量。這也提供了一種控制方法- S4 m, W% F# M( g+ Y
//執(zhí)行某些任務(wù)不相同的兩個(gè)或多個(gè)實(shí)例的任務(wù),比如計(jì)劃
' F. q- s/ L* j0 f9 ^3 o8 z  S0 K//重新計(jì)算緩沖feedhold或覆蓋,。
) s0 [0 W; J" e//注意:sys_rt_exec_state變量標(biāo)志設(shè)置任何過程,步驟或串行中斷,插腳引線,+ S5 _8 ]# ?1 m( a& @
//限位開關(guān)或主程序,。
6 a! X) L% X2 w4 _7 E) B  lvoid protocol_execute_realtime(), Y5 g- [+ v/ m, f
{. C/ z$ ]# o7 M: i- R
        // Temp variable to avoid calling volatile multiple times.8 N$ C# w/ L9 ~
        // 臨時(shí)變量來避免多次調(diào)用不穩(wěn)定。) U  U8 T2 ]4 T0 q4 `% n$ V9 ^
        uint8_t rt_exec;
$ ~% z' {: Z  i  g2 e0 B0 x        do{
8 L; T# E% Q0 W5 A5 V& l          if (rt_exec) {                 // 有標(biāo)志位置位進(jìn)入
3 o/ X9 p- \! Y4 E        & |0 [2 D7 ]" p; ^
            sys.state = STATE_ALARM; // 設(shè)置系統(tǒng)為報(bào)警狀態(tài)5 L+ q& C9 u9 I) U8 Y$ X
      report_alarm_message(ALARM_HARD_LIMIT_ERROR);        //報(bào)告報(bào)警信息為接近極限值
  A# S2 _: Y8 h; `8 v    } else if (rt_exec & EXEC_ALARM_SOFT_LIMIT) {                        //報(bào)告執(zhí)行軟件限位報(bào)警
" v; \2 D/ M8 A- s  o      report_alarm_message(ALARM_SOFT_LIMIT_ERROR);        //報(bào)告出現(xiàn)軟件限位報(bào)警+ v1 X, ]2 f! }& A" t$ N
    } else if (rt_exec & EXEC_ALARM_ABORT_CYCLE) {                //執(zhí)行停止循環(huán)報(bào)警      
7 L$ Z; Y3 g5 Q( B$ G5 T      report_alarm_message(ALARM_ABORT_CYCLE);                //出現(xiàn)終止循環(huán)報(bào)警8 K& q/ p4 V: S: h3 w
    } else if (rt_exec & EXEC_ALARM_PROBE_FAIL) {                        //執(zhí)行探查失敗報(bào)警
6 E5 |$ l; F3 X      report_alarm_message(ALARM_PROBE_FAIL);                        //出現(xiàn)探查失敗報(bào)警
! s* t# M8 ]% x% r    } else if (rt_exec & EXEC_ALARM_HOMING_FAIL) {                //執(zhí)行返回原點(diǎn)失敗報(bào)警8 Y+ M% U) G, e9 E, k5 ^2 J+ B
      report_alarm_message(ALARM_HOMING_FAIL);                //出現(xiàn)返回原點(diǎn)失敗報(bào)警
0 g" F2 j! ^/ P    }
& N8 ^" r8 a6 P5 u( q2 A
8 Q" j+ E) n" ?0 Z* v. P    // Halt everything upon a critical event flag. Currently hard and soft limits flag this.- i3 `0 `; X6 J& M% g1 q  s% e
    // 停止一切在一個(gè)關(guān)鍵事件標(biāo)志,。目前硬和軟限制標(biāo)志: k; d5 G% [1 w8 g5 H/ ?' z
           if (rt_exec & EXEC_CRITICAL_EVENT) {                //如果系統(tǒng)是循環(huán)事件進(jìn)入
4 v# J) Y7 [7 [9 D" |5 ]             report_feedback_message(MESSAGE_CRITICAL_EVENT);        //報(bào)告反饋信息
9 f, Q' `; B( p  @' N/ r8 K1 }              bit_false_atomic(sys_rt_exec_state,EXEC_RESET);                         //清除目前的復(fù)位狀態(tài)6 t! {, L* s: Y5 e6 u

+ V* D. }; b+ ?9 `        bit_false_atomic(sys_rt_exec_alarm,0xFF);                                 // 清除所有報(bào)警標(biāo)志
1 @3 m% c* d5 \$ ]" P        }       
# {  A3 z* X; P; ]+ e7 F' o1 b0 t* {) c3 _$ \
上面代碼將rt_exec = sys_rt_exec_alarm ,,如果rt_exec為真,打印不同報(bào)警信息% m' O" K2 o$ I2 s0 W
和限位保護(hù)信息,,然后清除報(bào)警狀態(tài). |  o+ G2 e# q" Y/ h, X- l9 N
___________________________________________________________________________
, x1 w7 c2 ^& \沒有報(bào)警進(jìn)行執(zhí)行下面代碼,執(zhí)行了終止命令,,串口打印命令
0 Q, O" v; n% F4 Y# w6 g# U7 f         // Check amd execute realtime commands        校驗(yàn)和執(zhí)行實(shí)時(shí)命令: u  y/ L8 o. n$ Z6 _( V: ?  \
          rt_exec = sys_rt_exec_state; // Copy volatile sys_rt_exec_state
3 O- z9 h' S, v6 \9 c
7 N' t+ h" Z$ D+ U1 x; v        if (rt_exec) { // 輸入標(biāo)志是正確的執(zhí)行$ W* |" I# o. @% w6 f
9 `" ?1 N5 a& f% b8 T7 T
            // Execute system abort. 執(zhí)行系統(tǒng)終止命令
$ N9 |# u8 l. C1 i2 y$ `            if (rt_exec & EXEC_RESET) {
# L# z( m- j0 Q2 l              sys.abort = true;  // Only place this is set true.0 S4 G# b  \% m) b9 j9 c
              return; // Nothing else to do but exit., f& M7 v+ b9 K) l
        }
7 Q8 e; E$ X+ h3 W. E# o8 o8 t3 x9 p: x6 }- v
            // Execute and serial print status 執(zhí)行和串口打印狀態(tài)& o. k& \8 V% X5 w3 N* c9 S
            if (rt_exec & EXEC_STATUS_REPORT) { + n3 f  [: e( u& F' z7 R4 ~  n: `
              report_realtime_status();        //報(bào)告實(shí)時(shí)狀態(tài)0 ?8 y$ d7 P( ?- p. W  H9 h
              bit_false_atomic(sys_rt_exec_state,EXEC_STATUS_REPORT);        //清除報(bào)告狀態(tài)清零
7 y3 V( _* j/ J) @! p; b5 V            }4 ^( R0 `9 C/ b: w  g7 t, g
_____________________________________________________________________________$ h4 v  F$ ~5 z5 O. r& \
下面代碼
8 q! Z1 O# `" r7 X6 g+ S//執(zhí)行狀態(tài)。7 J* h9 E1 n& s/ w+ A% E
//注意:所涉及的數(shù)學(xué)計(jì)算持有應(yīng)該足夠低對(duì)大多數(shù)人來說,即使不是全部,; f1 y5 g( J2 ?
//操作場(chǎng)景,。一旦啟動(dòng),系統(tǒng)進(jìn)入暫停狀態(tài)
; p; P1 U4 H( B# C9 P1 m8 H  [//主程序流程,直到重置或恢復(fù),。- l% P1 [4 Z* G4 u, g9 d8 \
待辦事項(xiàng):檢查模式?如何處理呢?可能沒有,因?yàn)樗粫?huì)在空閑,然后重置Grbl。' b3 ]7 F- P4 N
狀態(tài)檢查容許狀態(tài)的方法,。
7 E& J: ~1 L2 t5 q. Z
7 S' j, M% X: c        //如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入4 K: ^! P* ?1 {) t4 l0 j7 u
            if (rt_exec & (EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR)) {       
: K1 T1 E  Q- f' N; o7 J* o2 _* i. ?0 b! v; w: Z% J  C
        //如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)# q) c8 f5 b7 a
        if (sys.state == STATE_CYCLE) {' f" M# L. V0 J8 u8 p
        st_update_plan_block_parameters(); //通知stepper module驗(yàn)算減速,。
/ _6 `, U$ x' y( f" s1 p8 I" \        sys.suspend = SUSPEND_ENABLE_HOLD; // 開始暫停標(biāo)志5 P1 e; m8 L- j7 Y0 n" @
        }
0 F1 B: ^2 v  {/ V7 {
, ?* g2 g( U, {7 B" N& Z+ T        // 如果,Grbl空閑不在運(yùn)動(dòng)。簡(jiǎn)單的指示暫停就緒狀態(tài),。) I" i3 `5 e5 J0 u/ @) H( K5 c
        if (sys.state == STATE_IDLE) { sys.suspend = SUSPEND_ENABLE_READY; }& W6 E. b; H9 B6 _; P# ^) S

! N) P7 C/ J7 T( \2 D
- [; d& h% y5 u* n        //執(zhí)行和標(biāo)志和減速運(yùn)動(dòng)取消并返回空閑,。主要由探測(cè)使用周期1 K; L8 l$ K5 B& f& z% B2 l5 W! Z) p
        //停止和取消剩余的運(yùn)動(dòng)。       ' V  M* f- e: f3 O" D
        if (rt_exec & EXEC_MOTION_CANCEL) {. D8 z/ Q$ s1 H3 e. B
          if (sys.state == STATE_CYCLE) { sys.state = STATE_MOTION_CANCEL; }$ y6 z% J" }+ w* t! L1 G# f9 p
          sys.suspend |= SUSPEND_MOTION_CANCEL;
6 K# c1 W" |# o5 f        }2 y; F1 i4 ?* r( B- q+ T2 X5 M

* n, N7 r2 j" C% {        // 只在循環(huán)時(shí)執(zhí)行進(jìn)給保持減速
4 C- d/ K8 v8 l+ r" B6 J         if (rt_exec & EXEC_FEED_HOLD) {' \5 e. }$ m1 c, X) Z3 G, {6 W
        //只有安全門為1才執(zhí)行保持進(jìn)給狀態(tài)賦值
7 [. k3 g- \( {! P1 s$ n3 i! U          if (bit_isfalse(sys.state,STATE_SAFETY_DOOR)) { sys.state = STATE_HOLD; }
0 e- q1 c# X4 _; Q& A2 G8 B        }2 Y7 W3 y# W  x1 p) d6 R
7 y$ J1 A& E" n
        if (rt_exec & EXEC_SAFETY_DOOR) {
. Q  F8 l$ D/ Z$ U$ B, _          report_feedback_message(MESSAGE_SAFETY_DOOR_AJAR); , s. k7 u; K! y$ [8 K
/ /如果已經(jīng)活躍,準(zhǔn)備好重新開始,CYCLE_STOP標(biāo)志設(shè)置為強(qiáng)制斷開,。0 s  e& t& h  G; E, r
/ /注意:只是暫時(shí)設(shè)置“rt_exec”變量,不是動(dòng)蕩的“rt_exec_state”變量,。1 L. a  j6 x& G& D" ~
          if (sys.suspend & SUSPEND_ENABLE_READY) { bit_true(rt_exec,EXEC_CYCLE_STOP); }3 X' V/ T( F+ Q/ b8 Q( D" W
          sys.suspend |= SUSPEND_ENERGIZE;
6 B8 u2 X  A5 Q7 V, B& C+ i          sys.state = STATE_SAFETY_DOOR;
+ N- k+ l: M# k5 {$ O0 |        }
; J7 ^9 g5 |, z! C+ b& A2 C0 D& V  `, d* R! ?7 t$ D( R' c
bit_false_atomic(sys_rt_exec_state,(EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR));    / N7 s2 _4 l# u# Z+ x
8 B1 y3 M1 X/ J/ a$ Q. {# T" r
}6 C1 k* O+ `" m
以上代碼執(zhí)行了5 y- ~* v: H: i' t
1.如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入
0 a# G7 T8 R$ N( f& ~3 J' `1 V2.系統(tǒng)為閑著狀態(tài),, 開始循環(huán)狀態(tài), 回原點(diǎn)狀態(tài),, 控制取消狀態(tài),, 開始保持狀態(tài), 開始安全門狀態(tài)時(shí)進(jìn)入8 I. n! s% T2 t  ^1 f" P% j$ Z
3.如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)$ x) e; W( a$ b) w  _  U+ H; G
4.如果系統(tǒng)閑置狀態(tài)執(zhí)行暫停就緒狀態(tài)7 a( {" C, @# R4 t
5.執(zhí)行動(dòng)作取消
4 P2 b1 F1 c' @$ P6.如果是保持進(jìn)給狀態(tài),,執(zhí)行保持進(jìn)給狀態(tài)  E1 f8 I" q1 x) f. f- L
7.執(zhí)行安全門狀態(tài)' `/ }* p+ f2 j7 }2 U5 p
最后執(zhí)行bit_false_atomic清標(biāo)志清除(執(zhí)行取消動(dòng)作)(執(zhí)行進(jìn)給保持)(執(zhí)行安全門)標(biāo)志位                  + x* L: c- F" R  A( k) q
_____________________________________________________________________________7 u0 d1 J8 [8 [/ w0 U5 g
! `! g: O9 }* m
    // Execute a cycle start by starting the stepper interrupt to begin executing the blocks in queue.1 k1 o* i& z! ^6 X
    // 執(zhí)行一個(gè)循環(huán)開始啟動(dòng)步進(jìn)開始執(zhí)行中斷隊(duì)列的街區(qū)
0 f9 E: h) w& K8 v    if (rt_exec & EXEC_CYCLE_START) {        //循環(huán)開始狀態(tài)進(jìn)入  l9 Y' v9 y5 w! u2 O2 a
      // Block if called at same time as the hold commands: feed hold, motion cancel, and safety door.: `$ |/ L, h) v" l" U5 c
      // Ensures auto-cycle-start doesn't resume a hold without an explicit user-input.
1 z9 Y0 E1 Z8 V/ H          //塊如果在同時(shí)舉行的命令:保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門,。 //確保auto-cycle-start沒有簡(jiǎn)歷沒有顯式的用戶輸入。7 H9 U& u/ X5 s
          
3 F6 R  ], P9 u' L. b      if (!(rt_exec & (EXEC_FEED_HOLD | EXEC_MOTION_CANCEL | EXEC_SAFETY_DOOR))) {   //狀態(tài)機(jī)如果不是保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門,。
" d1 q$ ?1 g/ v3 y        // Cycle start only when IDLE or when a hold is complete and ready to resume.
) |3 o/ e5 [* u% X5 a3 ?3 v0 _        // NOTE: SAFETY_DOOR is implicitly blocked. It reverts to HOLD when the door is closed." n4 M6 T% x# k% U# K% @" d
                //循環(huán)開始時(shí)只有當(dāng)閑置或持有完成并準(zhǔn)備簡(jiǎn)歷。, P; j3 F: P/ N8 _3 r, s& e
                //注意:SAFETY_DOOR是隱式地屏蔽,。它返回的時(shí)候門是關(guān)閉的,。    . }, _. x' g2 b+ e6 I" w- T
9 ?- X* Q3 v! L  J
                // 如果系統(tǒng)狀態(tài)為閑著狀態(tài),系統(tǒng)狀態(tài)為開始進(jìn)給或運(yùn)動(dòng)取消,,暫停標(biāo)志為位重新開始
4 ~4 ^$ G0 F. ^1 U9 C% D        if ((sys.state == STATE_IDLE) || ((sys.state & (STATE_HOLD | STATE_MOTION_CANCEL)) && (sys.suspend & SUSPEND_ENABLE_READY))) {
. E! _0 T% p8 {, z, K5 U          // Re-energize powered components, if disabled by SAFETY_DOOR.
1 N! n, g- J' X8 E          //        由SAFETY_DOOR重振組件供電,如果禁用,。
0 f$ O; ^/ k. _1 ]          if (sys.suspend & SUSPEND_ENERGIZE) { & ?8 w) c6 O0 l: T
            // Delayed Tasks: Restart spindle and coolant, delay to power-up, then resume cycle./ F" e4 o- L. t* J- w0 U
            //延遲任務(wù):重新啟動(dòng)主軸和冷卻劑,延遲升高,然后恢復(fù)周期。# F. _6 X+ K  ~7 q
            if (gc_state.modal.spindle != SPINDLE_DISABLE) {   //主軸模式不是失能進(jìn)入
6 A* L4 T  s+ W  x# y& [4 ?              spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); //設(shè)置狀態(tài)和速度
" u8 C9 {, l! H+ t# u              //待辦事項(xiàng):阻塞函數(shù)調(diào)用,。最終需要一個(gè)非阻塞,。
9 D5 \* I  L9 b1 i6 g- D' {                delay_ms(SAFETY_DOOR_SPINDLE_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.$ H1 T) P+ f) u- I7 ~5 A
            }5 ^4 y. ]& V( T3 S  B. V# E: n& ?& C
            if (gc_state.modal.coolant != COOLANT_DISABLE) {
, q* o8 \5 S6 Z% A4 z. d              coolant_set_state(gc_state.modal.coolant); 2 G$ C# f9 }3 H" h
              delay_ms(SAFETY_DOOR_COOLANT_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
( }6 K: }: N- S3 q! M            }
. |8 r! {$ j+ Q' M, I1 U            // TODO: Install return to pre-park position.+ |% J8 {1 r, P
          }  M+ c* f' s% V$ Z* R8 s
______________________________________________________________________________________________________________
! i' |! D4 d" }  }! F, u          // Start cycle only if queued motions exist in planner buffer and the motion is not canceled.
' S1 S6 I+ F; E8 n! B                  # ]& a% M0 ?7 U7 d* C6 d; R8 e
                  //只有在隊(duì)列馬達(dá)存在規(guī)定的緩沖,并且動(dòng)機(jī)沒有讓取消,,才會(huì)循環(huán)
. ^. b7 j, I* G                  # M% Z" [( m$ K, g
          if (plan_get_current_block() && bit_isfalse(sys.suspend,SUSPEND_MOTION_CANCEL)) {' k/ ~' u( R8 @# z3 S8 d1 _
            sys.state = STATE_CYCLE;' r+ H& \9 D' }- r
            st_prep_buffer(); // Initialize step segment buffer before beginning cycle.初始化步開始循環(huán)之前# g+ M+ A% r7 N5 L% U2 D
            st_wake_up();; J9 _  ]* h+ d& A" O
          } else { // Otherwise, do nothing. Set and resume IDLE state.否則,,什么也不做,設(shè)置和復(fù)位空閑模式* K6 }$ N1 _$ |: P3 b, x
            sys.state = STATE_IDLE;. Q9 O$ R# ~5 L
          }
* E. C) q- }: H9 V0 j5 J% I          sys.suspend = SUSPEND_DISABLE; // Break suspend state.
' H% @( y$ y9 X* j  S- ]        }
! o) A' z* }2 N0 {4 f/ V( o2 ?      }   
7 }0 V& y: ?  T; H( h+ n/ s$ O  q9 U      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_START);        9 `1 F/ V" x: P8 G; B1 P
    }
9 K, D" I, g8 r2 g
5 n# g& T( ?. t( ~2 n8 L_______________________________________________________________________________________________________" B7 C0 Z  |  O4 `# x* n
    // Reinitializes the cycle plan and stepper system after a feed hold for a resume. Called by " i2 t+ x6 T' B7 |0 O. F
    // realtime command execution in the main program, ensuring that the planner re-plans safely.; c( N) C# f8 T0 m( a
    // NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper
4 a8 {8 x, M" F, I    // cycle reinitializations. The stepper path should continue exactly as if nothing has happened.   
/ i4 L/ ^- n# R4 |1 r3 l    // NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
$ |3 K* i" p' t# ~# S/ @
9 h; M5 H# J8 M/ D) ?" C        //重新啟動(dòng)后循環(huán)計(jì)劃和步進(jìn)系統(tǒng)的進(jìn)給保持簡(jiǎn)歷,。通過實(shí)時(shí)命令執(zhí)行主程序,確保安全計(jì)劃重新計(jì)劃,。
* w# x) ^1 ]$ @( `        //注意:畫線算法變量仍保持通過規(guī)劃師和步進(jìn)) K$ Y5 Y9 C5 ~4 x- h; `
        //循環(huán)僅。步進(jìn)路徑應(yīng)該繼續(xù),好像什么都沒發(fā)生一樣,。       
+ f7 x0 x" s" O- {        //注意:EXEC_CYCLE_STOP由步進(jìn)子系統(tǒng)周期或進(jìn)給保持時(shí)完成,。
4 l/ W  }& `* q" M; E2 h4 s1 z- l8 D: V; O
    if (rt_exec & EXEC_CYCLE_STOP) {                         //如果是循環(huán)停止?fàn)顟B(tài)進(jìn)入
. q* {* p1 n( k+ O% B      if (sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) {0 L, N8 }9 S9 J8 R( R; z1 j( V
        // Hold complete. Set to indicate ready to resume.  Remain in HOLD or DOOR states until user
1 B4 _  |+ U  `) \        // has issued a resume command or reset.
0 h+ F5 B! X5 \
/ u7 n/ E/ x  j- i0 @                //保存完整。設(shè)置為指示準(zhǔn)備簡(jiǎn)歷,。繼續(xù)持有或門狀態(tài),直到用戶
7 E7 Q1 S* ]$ M/ K" d: n5 P' Q                //已發(fā)布了一份簡(jiǎn)歷命令或重置,。
1 H% [7 e3 E. Y) I& m# o               
2 J: |" V  O2 J: K4 a7 |        if (sys.suspend & SUSPEND_ENERGIZE) { // De-energize system if safety door has been opened. 如果安全的門已被打開。斷開系統(tǒng); r0 `5 Q7 B0 \4 w: C
          spindle_stop();
' L+ s) Q/ L8 M) r, h          coolant_stop();: t$ m/ O  T0 J2 D/ S7 F- W
          // TODO: Install parking motion here. 安裝停車動(dòng)作,。' I( o1 w8 J) `$ Y: p
        }
, L1 P% _0 ~( t/ u, x' {        bit_true(sys.suspend,SUSPEND_ENABLE_READY);
$ U# s6 W! z9 u, D& O; b      } else { // Motion is complete. Includes CYCLE, HOMING, and MOTION_CANCEL states. 電機(jī)完成,,循環(huán),回原點(diǎn),,,MOTION_CANCEL& v% E/ I  c( f! g
        sys.suspend = SUSPEND_DISABLE;: P) F7 d6 E. i/ i( c
        sys.state = STATE_IDLE;8 ?- o5 Z9 i+ a. F7 a) ]: q; G, N
      }
- H* s0 Y3 Z- k: `      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);
; A6 I9 E; Q& ^# M1 K    }( P3 ^8 U; F1 l  C* u2 x
    0 t0 {* X5 w- A2 \9 k, Z
  }. ]' b+ u/ _7 c" N( r* ?
___________________________________________________________________________________________________0 ^/ c. f( y' E, S$ x+ y* ?  i" L) r
% P7 ]* _, p8 V  T$ V
  // Overrides flag byte (sys.override) and execution should be installed here, since they
! A5 Y7 F, }$ ~$ O) Z  // are realtime and require a direct and controlled interface to the main stepper program.
! q9 W) f; h9 c; g3 f0 t1 w) E- ]
( n$ f( [) z6 Y5 Q& Z7 }* Z  //重寫標(biāo)志字節(jié)(sys.override)和執(zhí)行應(yīng)該安裝在這里,因?yàn)樗麄?font class="jammer">; F) U  O! a; }$ K+ F
  //實(shí)時(shí)和需要直接和控制接口的主要步進(jìn)程序,。& R+ ]. Y2 O3 |$ f- W5 a

7 m* ?' F7 D; q- l1 S$ E
, P( @- t$ u( h- G9 V6 i' H. l9 v* C# @  // Reload step segment buffer 重新加載步段緩沖$ g5 N( B) h5 l9 q
  if (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_MOTION_CANCEL | STATE_SAFETY_DOOR | STATE_HOMING)) { st_prep_buffer(); }
5 T: @5 _$ A$ {1 U, w7 x) _
; j  U/ b8 e/ x4 N  F4 J$ b. B  // If safety door was opened, actively check when safety door is closed and ready to resume.( d' n4 O5 Z2 G1 V
  // NOTE: This unlocks the SAFETY_DOOR state to a HOLD state, such that CYCLE_START can activate a resume.       
4 h% P) V2 L7 v" }3 t) j% M) S# j1 y+ P! C, o; a& g2 U
//如果安全的門被打開,積極檢查當(dāng)安全門關(guān)閉,準(zhǔn)備簡(jiǎn)歷。
+ E3 a$ O" H, h4 s8 y2 Q8 b$ Y  //注意:這解鎖SAFETY_DOOR狀態(tài)保持狀態(tài),這樣CYCLE_START可以激活一個(gè)簡(jiǎn)歷,。$ [+ E. [: c) t* L. ?% u! W5 f
% f6 o0 q3 @% I; y7 W8 D& c
  if (sys.state == STATE_SAFETY_DOOR) {                 //安全門狀態(tài)進(jìn)入+ G% r/ J: G  u4 w/ q
    if (bit_istrue(sys.suspend,SUSPEND_ENABLE_READY)) { ) _) q" P! O3 B. \; ^3 ]2 v0 m
      if (!(system_check_safety_door_ajar())) {
% V9 v7 A3 ]5 P+ B* Y* T        sys.state = STATE_HOLD; // Update to HOLD state to indicate door is closed and ready to resume. 更新保存狀態(tài)指示門關(guān)閉,準(zhǔn)備簡(jiǎn)歷,。
: u" u3 P! e* ?& V; d) m9 @0 n      }  R! J) y) L' v6 P7 _8 o! D! f
    }
5 L0 x' q- O2 B  }
  N1 o5 Y: s8 G( b1 @, _
1 }; i, q' s& D8 a8 S7 {4 Y/ {  } while(sys.suspend); // Check for system suspend state before exiting.2 @- A5 S/ L* H, r
  
9 }* Y  N; ?. d3 @$ m}  
10#
發(fā)表于 2016-8-25 09:31:12 | 只看該作者
樓主這些代碼,。是網(wǎng)上搜來,然后自己組合的嗎,?全是自己想的,,那是牛逼了

點(diǎn)評(píng)

外國的開源軟件grbl,在研究它,,將打注釋了下而已,,研究透徹了好移植的其他平臺(tái)應(yīng)用,學(xué)習(xí)階段,。 https://github.com/grbl/grbl  詳情 回復(fù) 發(fā)表于 2016-8-25 22:19

本版積分規(guī)則

小黑屋|手機(jī)版|Archiver|機(jī)械社區(qū) ( 京ICP備10217105號(hào)-1,京ICP證050210號(hào),,浙公網(wǎng)安備33038202004372號(hào) )

GMT+8, 2024-12-30 00:16 , Processed in 0.070806 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回復(fù) 返回頂部 返回列表