人妻暴雨中被强制侵犯在线,亚洲国产欧美日韩精品一区二区三区,四虎影免看黄,国产无人区二卡三卡四卡不见星空

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

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

作者: 1五湖四海1    時(shí)間: 2016-8-20 23:56
標(biāo)題: 單片機(jī)MCP制作數(shù)控雕刻機(jī)3D打印機(jī)
本帖最后由 1五湖四海1 于 2016-8-21 00:09 編輯
( e! I2 w$ ~1 c, L5 L# P7 V+ D3 ?% E4 r2 O; 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)在分享給大家。
+ K! t! ]5 \, k( @. _   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)彎。很棒吧!開始玩起。: A0 ], U% R4 I% ?& H8 @
    還沒有雕刻機(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ī)呀!
# [% B, e( o3 P9 c. e; r
5 e7 K. F. T" x7 f

% Y  i% b2 f' A9 u. V    下面介紹小這個(gè)些主控程序主要干的事,通過串口PC和主控板通訊,PC命令給控制板,控制板接收命令做不同的響應(yīng),PC可以發(fā)G代碼給主控板,接收完成后可以自動(dòng)開始雕刻任務(wù)。+ r$ l5 ]# l) L2 O5 |* H
          在介紹下G代碼因?yàn)镚代碼是雕刻機(jī)的核心部分
5 w# e' o/ e4 t; zG代碼是數(shù)控程序中的指令。一般都稱為G指令。0 T/ B' w; k6 k. n# \+ q0 J
G00------快速定位9 E( |: v3 _2 m: ~6 D* c4 L: R* v
G01------直線插補(bǔ)4 J' }; s) u) ], U) b
G02------順時(shí)針方向圓弧插補(bǔ)5 F* X7 A$ X" Y% Z6 E
G03------逆時(shí)針方向圓弧插補(bǔ)
% b7 ^& V4 V/ F. |% P& x) G/ SG04------定時(shí)暫停
' k4 J" n; ^. L% `G05------通過中間點(diǎn)圓弧插補(bǔ)7 j/ i8 d$ _! l& V2 L" r  H- ^
G06------拋物線插補(bǔ)
7 C- C  t+ K9 v3 R2 ~5 j9 L6 {( qG07------Z 樣條曲線插補(bǔ)
- P+ K- ?1 h' V% |+ U6 MG08------進(jìn)給加速' M1 k) {' E0 P* n
G09------進(jìn)給減速
9 X; d: l8 Q  R/ HG10------數(shù)據(jù)設(shè)置
5 p9 b4 K0 ^: sG16------極坐標(biāo)編程
1 \" c6 z$ e, t7 B: J8 G+ B: R8 P) {. zG17------加工XY平面
* r: t7 v  j3 m) D4 X) |$ BG18------加工XZ平面
3 I: X% }0 e, b3 f1 y1 SG19------加工YZ平面

! X4 x8 e7 a$ Q2 z. u核心就是解析G代碼,完成步進(jìn)電機(jī)驅(qū)動(dòng),和控制主軸開啟關(guān)閉,還有插補(bǔ)算法,直線插補(bǔ),圓弧插補(bǔ),還有一些步進(jìn)電機(jī)的加減速算法。
8 s" o. m6 z+ r1 Z% z下面對(duì)grbl主結(jié)構(gòu)做介紹
4 B" b; Z/ [8 i- P& K* U3 o. E+ gmain()主函數(shù)首先執(zhí)行下面初始化函數(shù)! i' E; {/ M; s
        serial_init();                           // 設(shè)置串口波特率和中斷; p0 y  ~# V! \2 V8 t( ~. X% z
        settings_init();                         // 從ROM加載grbl設(shè)置
' T5 H  ^% i( D5 I* [3 g& T! a8 u        stepper_init();                          // 配置步進(jìn)方向和中斷定時(shí)器
2 s$ U6 ~9 @, A/ G. i        system_init();                           // 配置引腳分配別針和pin-change中斷
2 w, N' i; n' _4 g4 s        memset(&sys, 0, sizeof(system_t));          // 清除所有系統(tǒng)變量
6 M( L( A2 y" y) @8 W        sys.abort = true;                           // 中止標(biāo)識(shí)位置位
! V% [6 S' D3 o; Y        sei();                                         // 使能中斷
# q3 y- I4 F: B9 X  #ifdef HOMING_INIT_LOCK                        // 宏運(yùn)算(settings.flags & (1 << 4)) != 0結(jié)果flags等于執(zhí)行sys.state = STATE_ALARM
7 K* I- L- ^: I/ H+ s                                                // 系統(tǒng)狀態(tài)賦值為報(bào)警狀態(tài)
  d6 p! g% p: O* h            if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }8 o* H. P0 S  ]  R; x
  #endif& i1 L! x8 I; G0 O- E% Q9 ?; R
_____________________________________________________________________________________________________________________________________8 ]% ?! E: z5 O# w$ _. {
接下來是一些主要部分初始化
3 ~6 U$ y. k; {for(;;) {
/ ^: u7 {! V- |5 F6 c4 F( A+ ?        serial_reset_read_buffer();         //清除串口讀緩沖區(qū)
, N9 C6 t  E: f7 [$ Y$ [4 U        gc_init();                         //初始化G代碼功能函數(shù)
4 h) b5 H5 P; v) w( p' P1 G7 |6 S        spindle_init();                        //主軸初始化& B" z, I$ U. Q
        coolant_init();                        //冷卻液初始化
3 x* Y% |3 k: ^: J" H2 Z9 |        limits_init();                         //極限開關(guān)初始化
5 T' m- ]$ D: r, N9 \        probe_init();                        //探測(cè)部件初始化! A8 _3 H" R6 H
        plan_reset();                         //清除塊緩沖區(qū)和規(guī)劃師變量
6 U+ o. S9 X/ n0 V* {& a+ r        st_reset();                         //清除步進(jìn)系統(tǒng)變量。
' C& I+ B, h) t6 y& Z% P: M; N' n" _- e& v

# J$ R1 C% z/ ^        //下面兩行清除同步gcode和策劃師職位當(dāng)前系統(tǒng)位置。
4 D1 O/ s. Z4 \+ M, R
        plan_sync_position();5 F! u! R: o& E7 A2 n
        gc_sync_position();0 G9 n! O2 Q4 S  Y

( N$ L3 q% N5 Q. c7 J: U
$ m( q9 Z2 _; t5 {+ L0 ?- ^) ]        //復(fù)位系統(tǒng)變量6 H# U" B  y4 q% O  U# j! K! ^9 H
        sys.abort = false;                //系統(tǒng)中止標(biāo)志
' F+ Q8 R6 \* `' E2 e2 x        sys_rt_exec_state = 0;                //系統(tǒng)標(biāo)志位變量狀態(tài)管理。看到EXEC位掩碼。
8 W6 r9 T8 `6 H/ `6 L" i) H        sys_rt_exec_alarm = 0;                //系統(tǒng)標(biāo)志位變量設(shè)置不同的警報(bào)。% X  U8 `* `0 w# ]% |
        sys.suspend = false;                //系統(tǒng)暫停標(biāo)志位變量管理,取消,和安全保護(hù)。
8 _+ n2 W- G7 w6 \3 _' e! k$ Z/ w" G; O        sys.soft_limit = false;                //限位開關(guān)限制狀態(tài)機(jī)錯(cuò)誤。(布爾)& Q; \9 k; o( ^
0 U1 o. w6 i$ x

* L! Q% ~& T7 A! o        protocol_main_loop();                //主協(xié)議循環(huán)% M+ @) o4 b+ c& n0 H. O
}        //# K5 a7 D( b$ {4 q
_____________________________________________________________________________________________________________________________
4 B1 j% d! d- i- p2 _, E進(jìn)入void protocol_main_loop()函數(shù)7 t4 E9 W" [& G$ m, ~
{
9 w; V0 m0 J8 `8 d0 M0 `7 l7 R        report_init_message();                // 打印歡迎信息
0 Y8 }' g$ f6 i3 y3 D) F' |        //重啟后檢驗(yàn)和報(bào)告報(bào)警狀態(tài)如果錯(cuò)誤重啟初始化。7 i1 l; G: A+ Y3 E6 p+ g
        if (sys.state == STATE_ALARM) {* |3 f# ?" ], U
            report_feedback_message(MESSAGE_ALARM_LOCK); //打印信息
4 ~2 O8 S/ f( T9 O# A  N+ p
          } else {0 X; u  l+ u) Q$ x
            // 如果沒有報(bào)警說明一切正常!但還是要檢查安全門.
; p% r/ ^% e% ?+ }7 y- I            if (system_check_safety_door_ajar()) {
1 r7 w' V1 k! n- A  T) w" S                     bit_true(sys_rt_exec_state, EXEC_SAFETY_DOOR);
2 @' [: u, j# F- _% f                     protocol_execute_realtime(); // 進(jìn)入安全模式。應(yīng)該返回空閑狀態(tài)。8 d9 ~2 B( ~  k6 x1 i2 ~
            }         else {5 V( h/ Q2 o2 ^! K8 v0 o: Z
              sys.state = STATE_IDLE; // .設(shè)置系統(tǒng)做好準(zhǔn)備。清除所有國(guó)家國(guó)旗。' i( Z" M' u* }  j4 a) a
            }
* q2 v/ j0 h; L2 p, x3 L1 |            system_execute_startup(line);    //開始執(zhí)行系統(tǒng)腳本1 p6 Y: i. K! z3 b$ O' ^6 K
  }
! ?) q2 t' Q  c& }+ _, N# d* p9 }# i$ i

2 P- q7 _' T2 |0 W  // 這是主循環(huán)!在系統(tǒng)中止時(shí)這是出口回到主函數(shù)來重置系統(tǒng)。* N9 A, l- a1 }1 n
  // ---------------------------------------------------------------------------------  + j' u; r* S; p/ o/ _
  
. W" [% X4 c* L) V% T0 g        uint8_t comment = COMMENT_NONE;' W- i/ x$ {( t) m6 n. ~
        uint8_t char_counter = 0;
8 D. U$ u. B2 B3 J        uint8_t c;
# W% c& g3 ^7 E: T8 \: P_______________________________________________________________________________________________________________________________
1 R! H+ l- c+ W* @$ m2 ^接下來進(jìn)入for(;;)循環(huán)                //下面代碼是G代碼解析核心部分,程序中comment(注釋)變量會(huì)被賦不同值,代表發(fā)符號(hào)有‘(’‘)’‘;’
* O  _) A" Q! c8 L. C" i{5 B$ u' Q. a* h, \" u
//串行數(shù)據(jù)輸入一行的的過程,作為數(shù)據(jù)。執(zhí)行一個(gè)
5 ^$ K1 I, w& Y; q//所有數(shù)據(jù)初始過濾去除空格和注釋。
6 [4 k) N; Q% A8 T9 F7 j& Z//注意:注釋,空格和程序段刪除(如果支持的話)處理技術(shù)
( g) H, S/ _" g' B1 B' |' `//在G代碼解析器,它有助于壓縮到Grbl傳入的數(shù)據(jù)
- M) E, E4 h$ V1 O% X% n//線緩沖區(qū),這是有限的。刀位點(diǎn)標(biāo)準(zhǔn)實(shí)際上州一行不行$ g9 G6 n4 B. m9 U" A& `
//不能超過256個(gè)字符,Arduino Uno沒有更多內(nèi)存空間。
% m$ d% {  R- q) r: X, q1 c6 ~//有更好的處理器,它會(huì)很容易把這個(gè)初步解析的
# d+ v% W" j' Y6 s//分離任務(wù)共享的刀位點(diǎn)解析器和Grbl系統(tǒng)命令。                                                               
3 D/ N7 @7 o, T1 W7 a( U    while((c = serial_read()) != SERIAL_NO_DATA) {                             //讀取串口數(shù)據(jù),有數(shù)據(jù)執(zhí)行下面代碼) Z0 D8 v4 F3 a+ x
      if ((c == '\n') || (c == '\r')) { // End of line reached                //如果數(shù)據(jù)是/r,/n代表一行結(jié)束
9 K9 ~: k. ~% e. D- @        line[char_counter] = 0; // Set string termination character.        //設(shè)置結(jié)束標(biāo)志
" F( j9 j6 A7 \        protocol_execute_line(line); // Line is complete. Execute it!        //一行完成執(zhí)行此函數(shù)
8 }4 x3 x. o/ i, `2 f; P3 t        comment = COMMENT_NONE;                                                //注釋清零
7 V: A6 Q6 o2 l$ Y* |, E        char_counter = 0;                                                    //字符計(jì)數(shù)清零
. j8 l0 y% Z$ b  W- b2 [  
6 N2 x- [3 n7 B& G9 f7 G        else {
1 O4 a# v$ X, M/ s        if (comment != COMMENT_NONE) {
! P( j/ h- D0 L, e7 n" V8 r                                                     //扔掉所有注釋字符
- u* s7 }8 U% A5 t          if (c == ')') {
" s" n- s( t. e9 ~            //最后注釋。重新開始。但是如果有分號(hào)類型的注釋。5 h5 f8 Y) p( l2 b
            if (comment == COMMENT_TYPE_PARENTHESES) { comment = COMMENT_NONE; }
6 n) W4 Q% E8 G0 I) l" O/ B          }
) |& |8 _6 ~% o& @5 Q, o$ A      } else {0 s4 ?0 }( |. O5 o9 e: H  x; `7 x
          if (c <= ' ') { ' D/ K0 j; |: P' A8 o1 c
            //扔掉whitepace和控制字符
6 M7 H5 |" {* h3 L  Y' Z; M          } else if (c == '/') {
$ j! R/ [! {; ?' `$ i            //塊刪除不支持將忽略字符。7 o! n: D. K/ u" x1 L+ J
            //注意:如果支持,只需要檢查系統(tǒng)是否啟用了塊刪除。
7 x; A+ j2 V1 |4 N) j4 E          } else if (c == '(') {- u- H3 u4 j( h& q: g
            // Enable comments flag and ignore all characters until ')' or EOL.0 ^6 ^6 X  g1 y6 G+ F
            // NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.- h. F/ `: P$ I6 N# p2 g& r
            // In the future, we could simply remove the items within the comments, but retain the
7 p0 A. t2 r3 [/ D/ ^( e. v* S0 m            // comment control characters, so that the g-code parser can error-check it.2 H/ Y% r0 A' b7 D# b
            comment = COMMENT_TYPE_PARENTHESES;
5 R* V3 K8 \6 W# D: K  [9 Q          } else if (c == ';') {
2 {! Y8 P7 S  Y& u            //注意:','注釋EOL LinuxCNC定義。沒有國(guó)家標(biāo)準(zhǔn)。) ~+ G- w6 N/ B2 |% J
            comment = COMMENT_TYPE_SEMICOLON;) ]: _8 h* l# y% ^. n& K

1 h( s' h# L9 y! H% H
! I( W1 N% d$ d, U  w_____________________________________________________________________________________________________________________________________
& {9 C, A6 X; I          } else if (char_counter >= (LINE_BUFFER_SIZE-1)) {                        //串口接收數(shù)據(jù)大于80字符時(shí)
" S2 I# V/ P! y8 @: n; s  h6 e            // Detect line buffer overflow. Report error and reset line buffer.        檢測(cè)緩沖區(qū)溢出。報(bào)告錯(cuò)誤和復(fù)位線緩沖區(qū)。
' S! _2 }6 \0 Z: i            report_status_message(STATUS_OVERFLOW);                                //打印溢出信息
# D4 P7 W  L4 a% S5 I4 q            comment = COMMENT_NONE;
  l+ k  }: B  c& {            char_counter = 0;! i8 U, c# D; @8 O
          } else if (c >= 'a' && c <= 'z') { // Upcase lowercase                        //小寫改大寫5 G/ T1 k. I4 Z* e$ k. P* n- f
            line[char_counter++] = c-'a'+'A';& l, e( j/ o  t) ~* P0 Q& H
          } else {& p7 T; t1 _& I
            line[char_counter++] = c;
  w  _1 {3 }. z% M# k          }
( d; N3 |3 n7 J5 c+ m7 F1 C        }4 g0 }7 }. ?1 c$ L9 l
      }9 b0 C  `1 y6 _
    }) p+ |/ X1 b! S, o& Z/ W
____________________________________________________________________________________________________________________________________
  W) `4 b7 ^9 K& Y+ `% ^        //如果沒有其他字符在串行處理讀取緩沖區(qū)和執(zhí)行,這表明以完成,自動(dòng)啟動(dòng),如果啟用,任何隊(duì)列動(dòng)作。% N& O+ C7 d( P8 Q# z' N6 V
        protocol_auto_cycle_start();                //自動(dòng)開始協(xié)議循環(huán), O& j0 ]0 j7 h( B- v1 T' K
        * k* K3 v! `* F% @: I7 C' E
            protocol_execute_realtime();                  //運(yùn)行實(shí)時(shí)命令。
0 G+ }1 L; Y# H            if (sys.abort) { return; }                 //中止標(biāo)識(shí)置位程序循環(huán)重置系統(tǒng)。            ! g0 z- J5 T: e, F
  }
$ _7 b: o6 |: _( Y; g  y( [* |  return;                         //一般程序不會(huì)執(zhí)行到這里5 ^' K& s- j; k. @/ J: G4 H
}
7 ?: X/ Z; W* b5 R  Z  w____________________________________________________________________________________________________________________________________4 g/ ]! U' Z0 N! s' _& n" O
正常情況下,讀取完G代碼程序會(huì)進(jìn)入protocol_auto_cycle_start();//自動(dòng)開始協(xié)議循環(huán) 函數(shù)下面介紹此函數(shù)
& t, E: [; `) S- I4 O, O* o  y// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that( R5 q6 w3 J) F. z
// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that 5 n% z. |, F, V2 {3 Z
// automatically begins the cycle when a user enters a valid motion command manually. This is
7 w" y6 V+ W0 @% `2 b  y// intended as a beginners feature to help new users to understand g-code. It can be disabled
! c9 |& E& n. R9 ~  V// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is
3 d" o" @) f, F3 Z// manually issuing a cycle start command whenever the user is ready and there is a valid motion , Y4 u" Z, \: L, h8 X
// command in the planner queue.
; K8 z0 ]& e3 _8 z- X// NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes # T" j1 L9 _4 ?( i8 d* ?
// when one of these conditions exist respectively: There are no more blocks sent (i.e. streaming 8 O( z* b5 m6 x0 O
// is finished, single commands), a command that needs to wait for the motions in the buffer to ' R4 w" Z/ S3 V: `
// execute calls a buffer sync, or the planner buffer is full and ready to go.- y. K9 k2 c  J$ W4 P) \
//自動(dòng)開始有兩個(gè)目的:1?;貜?fù)一個(gè)plan_synchronize()調(diào)用的函數(shù)# i5 ^) t8 n$ v9 G8 R; K
//需要規(guī)劃師緩沖區(qū)空(主軸啟用、住等)2。作為一個(gè)用戶設(shè)置3 I# m$ E  G# t* _( X; b( S" M' G
//自動(dòng)循環(huán)開始當(dāng)一個(gè)用戶輸入一個(gè)有效的運(yùn)動(dòng)命令手動(dòng)。這是- [4 u6 @$ O# A/ B( d
//作為一個(gè)初學(xué)者的特性來幫助新用戶了解刀位點(diǎn)。它可以被禁用4 e( r# O8 S/ h4 j, s! u
//作為一個(gè)初學(xué)者工具,但(1)仍然運(yùn)作。如果禁用,運(yùn)行周期開始
$ N1 `- P) ^% D. W8 a, |% j7 x//手動(dòng)發(fā)出一個(gè)周期開始命令每當(dāng)用戶準(zhǔn)備好,有一個(gè)有效的運(yùn)動(dòng)
6 J8 \6 O* f- \- i//命令的規(guī)劃師隊(duì)列。  b; E! Q0 |0 x9 I- i2 a" w
//注意:這個(gè)函數(shù)被稱為從主循環(huán)緩沖區(qū)同步,mc_line只()并執(zhí)行
2 C* ^3 m( t5 M3 r! u7 ]# B//當(dāng)其中一個(gè)條件分別存在:沒有更多的塊(即流發(fā)送: b$ g5 h& s: `% H8 a
//完成后,單一的命令),一個(gè)命令,需要等待緩沖的動(dòng)作$ d7 u6 w0 K2 ~
//執(zhí)行調(diào)用一個(gè)緩沖區(qū)同步,或規(guī)劃師緩沖區(qū)滿了,準(zhǔn)備好了。0 E% v* h- o+ r& Q0 Z6 {* A
void protocol_auto_cycle_start() { bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START); } 9 D+ N! n9 ]8 M: T2 {
_______________________________________________________________________________________________
6 ~. j5 b/ d+ ^+ @6 [& A: k6 y接下來程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令。
/ D' T* ~3 B9 |$ @// Executes run-time commands, when required. This is called from various check points in the main2 d6 d3 u8 u& w7 ~7 D
// program, primarily where there may be a while loop waiting for a buffer to clear space or any4 y$ [, _, C* b: M/ s
// point where the execution time from the last check point may be more than a fraction of a second.
) s& j$ S" u: W- B// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code  p- B& j- @5 m. a5 t$ a( W8 O; ~
// parsing and planning functions. This function also serves as an interface for the interrupts to
+ Y0 ^+ R# ~9 @: y* J// set the system realtime flags, where only the main program handles them, removing the need to9 F& b3 U3 ~7 x
// define more computationally-expensive volatile variables. This also provides a controlled way to 4 ]9 _4 R' j$ x5 ?' r4 c* H
// execute certain tasks without having two or more instances of the same task, such as the planner
( E# [! T0 V  N3 d5 S// recalculating the buffer upon a feedhold or override.
% a' J4 W/ V6 V: h5 g// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
+ L' `6 F, h! h$ q2 u: i2 A// limit switches, or the main program.$ i9 d, s+ H. o7 D3 u. m+ w
void protocol_execute_realtime()
1 \) F' w1 Z1 x4 f! M. ? uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.臨時(shí)變量來避免多次調(diào)用不穩(wěn)定。* J4 {6 f0 M% G9 @1 n7 j
就先分享到這吧!
" S1 _! e# y8 N, ^6 m5 w* f  y& [( W/ h6 [" j% i3 F
9 V8 O7 G8 ^5 q. B/ _
$ E4 b' o1 Q9 B' p: T, \; i
" Z3 O. [5 T+ B. h
5 N* g3 T" w* d/ N7 C3 b6 v

$ b7 ^9 c) s. E) i. A
/ D8 W1 O: `0 ^2 w$ j$ y5 s" D0 H( T4 C

/ G. _) o! u; T* F+ J3 ?6 n/ v) g3 z) V& O9 G9 @: x  ]6 e
# |. z1 b. B- ?" i- k3 l
7 _4 E1 @% @3 d1 F+ {
: Q& R# @2 i& v2 U  k4 y

( T7 m5 o4 ~( c. z; U/ V* H9 @
+ M8 b0 i: x3 p) v3 q' v. X
) Z2 K# r+ h) D# b1 g+ k7 d: d7 k+ j; ^' ?; S7 q

. e) ^+ R/ i" H7 s  _1 z4 G) m+ ?9 f6 r5 ]1 o7 _% I
9 s7 u8 O( l9 E% W

9 I6 i2 s$ V7 @8 S
. V: f8 V( k& y: W% r. ^
; b9 q; v% Y+ C- K, a補(bǔ)充內(nèi)容 (2016-8-25 22:40):
9 }0 Q/ t3 [/ R0 j配置說明) J8 Q- {1 |4 ]# Y
//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng)。在大多數(shù)情況下,6 Q! n. W: T' y& T% `
//用戶不需要直接修改這些,但是他們?cè)谶@里為特定的需求,即。
; H* C0 h2 s1 r- z+ H//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。% W, \  s; P* s) [1 z# f
主要配置項(xiàng):
: o1 P+ X* F9 i1 y, ?1.#define DEFAULTS_GENERIC        //在重置eepm時(shí)使用。在defaults.h改變想要的名字- u, l/ a1 U! z
2.#define BAUD_RATE 115200        //配置串口波特率115200
/ _' B& q* ~& m. i' O3.#define CPU_MAP_ATMEGA328P         // Arduino Uno CPU: R' L) W- \& o& L
4.#define CMD_STATUS_REPORT '?'        //定義實(shí)時(shí)命令特殊字符
6 D, k' y4 Z! o) w3 I1 }, S4 }6 L5.#define HOMING_INIT_LOCK         //回原點(diǎn)保護(hù)鎖  W& h: G0 @4 W+ ~# x
6.#define HOMING_CYCLE_0 (1<<Z_AXIS)              // 第一步Z清除工作區(qū)。
; H' s  Y* P! b9 {, J) R' t$ a3 i  #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // 然后X,Y在同一時(shí)間。
1 a$ F2 J5 t; r6 k7.#define N_HOMING_LOCATE_CYCLE 1 //回原點(diǎn)循環(huán)次數(shù)
  J3 R2 I( i0 @- W* @4 F- h1 ~8 X8.#define HOMING_FORCE_SET_ORIGIN //取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向。
# _: x5 M! y; p" r9.#define N_STARTUP_LINE 2 //塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量。! `9 R) D% U0 m' }( z) s
10.#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸3 K: ^; f( h* H1 u" S7 K6 W  o
   #define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值0 ~  E/ e8 W0 ~1 j- m4 z
   #define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
: W" d  |( Q- s/ _   #define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘
, x6 {8 _; h9 i( t   #define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對(duì)浮點(diǎn)小數(shù)設(shè)置值+ O4 C, H6 ]: V! `) S
11.#define LIMITS_TWO_SWITCHES_ON_AXES //如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用這個(gè)特性
" n1 J8 s" o' Z. Q7 @7 p5 o12.#define USE_LINE_NUMBERS         //允許GRBL跟蹤和報(bào)告gcode行號(hào)8 A9 ^; p5 }) L; i
13.#define REPORT_REALTIME_RATE //允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率
0 y1 W% `7 n% }6 }14.#define MESSAGE_PROBE_COORDINATES  //坐標(biāo)通過Grbl $ #的打印參數(shù)?
4 i% A# Z6 P  y4 L$ o15.#define SAFETY_DOOR_SPINDLE_DELAY 4000 //安全門主軸延時(shí)& I4 _! [& o' L
16.#define SAFETY_DOOR_COOLANT_DELAY 1000 //安全門冷卻液延時(shí)
/ j! x9 a5 k: _5 \17.#define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS) //啟用CoreXY運(yùn)動(dòng)學(xué)。
" N6 d4 H1 m  s; x18.#define COREXY // Default disabled. Uncomment to enable.改變X和Y軸的運(yùn)動(dòng)原理- E5 c/ v& e1 L! l/ j% `3 ~2 c+ _
19.#define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.反轉(zhuǎn)針銷邏輯的控制命令4 {. A! G! P, X! E( y- y( ?
20.#define INVERT_SPINDLE_ENABLE_PIN // 反轉(zhuǎn)主軸使銷從low-disabled
& x, K3 _; F( Z, e7 S1 x' I21.#define REPORT_CONTROL_PIN_STATE //啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告。
! d+ j, w7 Q7 a- b22.#define FORCE_INITIALIZATION_ALARM //啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示
. k$ \' w+ U3 Q23.#define REPORT_GUI_MODE // gui允許最小的報(bào)告反饋模式
, w" i; L% y8 m, i6 ^2 k7 t24.#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時(shí)間分辨率管理子系統(tǒng)。# v! {) q7 z6 C9 w1 y
25.#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING //自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能
( ~3 J# H* ~% g4 H$ U26.#define MAX_STEP_RATE_HZ 30000 //設(shè)置最大一步速率可以寫成Grbl設(shè)置
( |$ [+ {" U1 Z$ g+ a! K& p27.#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻
1 K0 [' q+ a# G8 T; z- g28.#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS //設(shè)置哪個(gè)軸長(zhǎng)度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與選擇軸工具面向負(fù)方向7 {) q- G+ B# w( a4 z, t2 G
29.#define VARIABLE_SPINDLE //允許變量軸輸出電壓不同的轉(zhuǎn)速值。
" W6 I. \9 l8 [7 D30.#define SPINDLE_MAX_RPM 1000.0  // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
  D6 w: ~! @: M. Y; d  s   #define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM./ I$ O2 _/ Z8 D, }/ u- r& o
31.#define MINIMUM_SPINDLE_PWM 5 //使用的變量軸輸出。這迫使PWM輸出最小占空比時(shí)啟用。) J% ?& B! B5 j! `/ j; [9 s3 ?
32.#define USE_SPINDLE_DIR_AS_ENABLE_PIN //主軸方向使能M4被刪除  h+ \8 [8 t3 [$ y( d: {
33.#define REPORT_ECHO_LINE_RECEIVED //應(yīng)該對(duì)所有正常線路送到Grbl" y+ y) X3 L8 Y9 J
34.#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min) //最小規(guī)劃師結(jié)速度。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃$ W/ q9 I) o) i# P! F: z- d
35.#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率
' y3 j4 d) a; u/ e36.#define N_ARC_CORRECTION 12 //弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡
9 T0 `- n, S5 x- i/ C37.#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了?: z5 G: X4 k8 |. W
38.#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) //延時(shí)增加表現(xiàn)在住。默認(rèn)值設(shè)置為50毫秒
8 @6 h4 t, _% v8 M39.#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
. t  y9 s% S3 y3 p# g40.#define BLOCK_BUFFER_SIZE 18  //線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃
3 j6 k1 S# P9 O+ i41.#define SEGMENT_BUFFER_SIZE 6 //控制之間的中間段緩沖大小的步驟執(zhí)行算法( ?8 D  `/ x' R. E4 b4 F
42.#define LINE_BUFFER_SIZE 80 //行執(zhí)行串行輸入流的緩沖區(qū)大小。
, z( y$ h- A4 H7 B# r43.define RX_BUFFER_SIZE 128 //串行發(fā)送和接收緩沖區(qū)大小4 Q8 Y7 c4 O& x. x
44.#define TX_BUFFER_SIZE 64$ f0 k6 i7 [/ X& I& ?: a
45.#define ENABLE_XONXOFF        ////切換為串行通信發(fā)送流軟件流控制。
9 M3 E( J& D+ @" i- o# |46.#define ENABLE_SOFTWARE_DEBOUNCE //一個(gè)簡(jiǎn)單的軟件消除抖動(dòng)特性硬限位開關(guān)。) ^; L$ A! _) |0 S% c' @3 w9 N
47.#define HARD_LIMIT_FORCE_STATE_CHECK        //Grbl檢查硬限位開關(guān)的狀態(tài)) e* @. Z' P7 s6 J
48.// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:, G. k5 T$ g: Q. C

9 E- M( J4 K" r___________________________________________________________________________________________________
1 O8 z* j  O5 W/*! i7 d' X( c; p+ l5 k
  config.h - compile time configuration
( G) a# j: N; I7 A4 {  Part of Grbl
9 a0 Z' ^8 j8 t. E' E3 k) _. ?4 A. K. i$ Q0 V* x
  Copyright (c) 2012-2015 Sungeun K. Jeon
9 \+ s1 p# H' a" l  k  Copyright (c) 2009-2011 Simen Svale Skogsrud8 P) u( v: g' X+ Q- ]
/ p/ i% R. \" e" y& R& i* h
  Grbl is free software: you can redistribute it and/or modify
- n0 \& X( F2 D' Y9 x' t  it under the terms of the GNU General Public License as published by: s( \0 M- H7 V' ^
  the Free Software Foundation, either version 3 of the License, or
+ y/ Q0 L4 n0 Q! _% S0 a  (at your option) any later version.2 t" j3 l5 G3 M+ {

5 C7 ^8 r& j7 O6 a* P9 E+ A, l' ?  Grbl is distributed in the hope that it will be useful,
. s/ [5 ?' t% r0 j  but WITHOUT ANY WARRANTY; without even the implied warranty of5 B4 z0 a1 b) J: n- O& k
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
, v" n: |+ o! t4 J: C# ]7 G  GNU General Public License for more details.
3 ?* j& o0 R3 \; S3 s. n; D
7 d1 W+ Q7 j. a1 x  You should have received a copy of the GNU General Public License
" b3 U3 k) D8 ]1 Y! A8 w! }0 S  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.2 b. {0 }* |: E* ]' e2 G
config.h  -編譯時(shí)配置,Grbl的一部分
* h1 c+ L' m1 A
6 T; B: ]3 f; Z, d& ?8 z( e版權(quán)(c)2012 - 2015 Sungeun K. Jeon# n. T7 q" U( x, D
版權(quán)(c)2009 - 2011 Simen Svale Skogsrud& X0 u& [* D3 Q& k  Y* u- ]1 D

- L- E7 v7 n; N/ zGrbl是免費(fèi)軟件:可以重新分配和/或修改
: R& E0 u3 i: c5 ~GNU通用公共許可證的條款下發(fā)布的自由軟件基金會(huì),版本3的許可,或(任您選)其后的版本。
8 `% W5 E; M% ^+ M. C
+ I0 `0 a3 D# [4 v; z9 ?/ HGrbl分布,希望這將是有用的,但是沒有任何保證;沒有即使的默示保證適銷性或健身為特定目的??吹?font class="jammer">) w8 t) G  j  @2 Y
GNU通用公共許可證的更多細(xì)節(jié)。) V* R# e3 _& Q! Z

7 |  J  c, U! W* F你應(yīng)該收到了GNU通用公共許可證的副本& s) A( t) v; H* E$ d+ W# M
連同Grbl。如果沒有,看< http://www.gnu.org/licenses/ >。
1 u7 h% s+ R, g/ i* N; g2 P
: D( [- O1 ^' a' p*/
4 x4 P$ b0 @) [( T9 L6 u: @& V  1 ^( m* |5 P1 r' q6 v
// This file contains compile-time configurations for Grbl's internal system. For the most part,* W& H& t# l/ I" |% D: J
// users will not need to directly modify these, but they are here for specific needs, i.e.( K8 `; [8 _- u# y
// performance tuning or adjusting to non-typical machines.( a2 `  ?. x! G0 F2 ^
//這個(gè)文件包含編譯時(shí)配置Grbl的內(nèi)部系統(tǒng)。在大多數(shù)情況下,: R: w- C" _0 y& B# g
//用戶不需要直接修改這些,但是他們?cè)谶@里為特定的需求,即。: ^6 ?) Y/ L. r
//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。7 {& n8 }+ y2 S6 q+ F- b

; i# h* ]6 s2 c// IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them.2 Z4 D: K: T& Z4 h
//重要:任何變化需要一個(gè)完整的基于源代碼的傳播。
0 m0 u. k$ z9 @
5 T5 e' D6 X4 n  u0 h#ifndef config_h2 V1 @. ?0 U9 M; H  T  |
#define config_h
& m; R3 g' a7 p0 s: u1 f4 q( J#include "grbl.h" // For Arduino IDE compatibility.1 D0 Z6 d/ R) e- p( I

; V1 H) Q( P# g3 k5 D" ?2 j0 r// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h
9 r+ x# j' o2 |1 B* U// 默認(rèn)設(shè)置。在重置eepm時(shí)使用。在defaults.h改變想要的名字: |) }* f* J4 C
. w! o' |  z1 Q9 y& F. [7 x
#define DEFAULTS_GENERIC3 w: \. t! E1 G% {0 _
; p' N  u# J) E, ^
// Serial baud rate$ u/ C- E4 J0 i9 [. F. i+ T: F
#define BAUD_RATE 115200                //配置串口波特率115200! `0 k0 z! l  R2 B: Q

% s  S% X3 v, Z$ k+ c  K0 V// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types8 R& r! v# g- C# Y- E
// may exist from user-supplied templates or directly user-defined in cpu_map.h
  K( [0 I. \0 p0 Q//默認(rèn)cpu映射。Grbl正式支持Arduino Uno。其他類型的處理器可能存在cpu_map.h直接從用戶提供的模板或用戶定義的' \, X: {9 E7 r; R

1 `- v  v3 F/ `  t' n#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
! g6 u  m' r9 P; y5 j9 {- r9 o0 A: k4 c+ V
// Define realtime command special characters. These characters are 'picked-off' directly from the
3 n' c* a& |2 L* d! ]5 Z// serial read data stream and are not passed to the grbl line execution parser. Select characters- V' ^' a) E" e" u  c$ A  R
// that do not and must not exist in the streamed g-code program. ASCII control characters may be 4 M9 c+ H7 g6 _2 V0 }6 _' p: Z
// used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in $ A6 M$ i; O1 n/ X- T4 ^
// g-code programs, maybe selected for interface programs.
0 [0 V  @# D/ \* l// NOTE: If changed, manually update help message in report.c.1 j, ~* ]! {3 @! G1 t4 G$ F
% e4 d/ h3 m" s$ }1 R! X. J2 C
//定義實(shí)時(shí)命令特殊字符。這些字符是直接從“各個(gè)擊破”串口讀取數(shù)據(jù)流并沒有傳遞到grbl行執(zhí)行解析器。選擇角色9 d3 Z! _  j: M, ?
//不,不能存在于程序流刀位點(diǎn)。ASCII控制字符' L1 @' P) |% \8 R' |$ x
//使用,如果他們是可用的每個(gè)用戶設(shè)置。同時(shí),擴(kuò)展的ASCII碼(> 127),從來沒有" K) l3 q1 r0 \6 t  |
//刀位點(diǎn)的程序,也許選擇界面程序。0 j) m5 L; H" O# q5 _7 m
//注意:如果改變,手動(dòng)更新report.c幫助信息。/ q+ ^) `- C+ u* B

  i8 I& }  J  t5 I#define CMD_STATUS_REPORT '?'6 ^8 @: ~% T; R: u* A: v% P: i
#define CMD_FEED_HOLD '!'
2 G) C  k3 C- Q: f0 j#define CMD_CYCLE_START '~'
8 g  r* c2 t8 |% N; |# Y#define CMD_RESET 0x18 // ctrl-x.) K4 v. U9 p! Y* ^5 ?+ w) E: o
#define CMD_SAFETY_DOOR '@'
: N1 l% \1 G- @: l7 U/ u, @+ K7 r! W' B
// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces8 {. L6 A4 L. P  K; X
// the user to perform the homing cycle (or override the locks) before doing anything else. This is
' |8 I8 d6 J- L" z$ V// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
" k7 A/ t/ C" }; E( h9 d8 G0 h  |& j* W9 o: `( Z, d3 |0 U  {
//如果啟用了回原點(diǎn),導(dǎo)航初始化鎖集Grbl進(jìn)入警報(bào)狀態(tài)啟動(dòng)。這就迫使) ]7 ^0 k3 R# s  Q
//用戶執(zhí)行歸航周期(或覆蓋鎖)在做任何其他事情之前。這是  o( V& H* {* j. C9 p" f. Q
//主要安全功能,提醒用戶家里,因?yàn)镚rbl位置是未知的。7 p0 M% K  [4 E
" J$ X5 H0 ]. i  l" [
#define HOMING_INIT_LOCK // Comment to disable: Q) _) z/ J. I" t) V: Z

1 U& t1 A% o0 g' L" R" c& C// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
  A' O) j! X/ q; j5 Q// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short' q+ f; x& n/ o# L/ D, g
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed $ u: {3 o5 z5 J1 o" v' ]! M
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If& Q! A0 h9 J. a; _3 k3 ~
// an axis is omitted from the defines, it will not home, nor will the system update its position., `. b9 h# k! f+ B' j& y
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,
' `( V+ R8 `; A: z2 e// with no y), to configure the homing cycle behavior to their needs.
% E1 q, s  H( R/ s, [9 A/ o7 m// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
4 |- v, \7 {) Z7 k// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
- j1 `2 J' \/ t9 N4 I  f// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles./ ^' D( o6 R6 s/ g5 m& Y
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins
0 w7 D" `1 U& S/ x* m  q& g7 \// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes
9 p5 K; O: ~3 C" c// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits % L/ b& ~( N+ c$ f9 p" O, n
// will not be affected by pin sharing.8 W% p5 v. D" i0 J
//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個(gè)搜索模式4 o8 V7 Z- @5 l5 q4 o7 d
//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短
. C2 }8 H2 v" Z" r7 |  o9 _* D//拖出運(yùn)動(dòng)脫離限位開關(guān)。以下HOMING_CYCLE_x定義執(zhí)行
3 i$ b9 v; x! B1 e7 \//為了與后綴0開始并完成specified-axes只尋的例程。如果9 {# _' }& C6 ]
//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置。
7 F3 f7 U: F. y# r. }//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,0 C4 w- a0 f. F3 g" W9 O/ E
//沒有y),配置導(dǎo)航循環(huán)行為對(duì)他們的需求。
6 \. h9 [+ h1 z# [  \$ h//注意:歸航周期允許共享限制針,如果軸不相同
/ v9 s6 _# [. d$ A( E+ N8 k. D//循環(huán),但這需要一些銷設(shè)置cpu_map的變化。h文件。例如,默認(rèn)的導(dǎo)航( P" z+ Z# v' U, H/ r3 X0 g7 P
//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?font class="jammer">. F1 J* a2 B! M  w; g7 e/ O4 x" e
//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針: O* V6 w7 T1 U, v' x
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸3 z$ c+ ]% g* z1 \
//在不同銷,但這時(shí)候一個(gè)周期。同時(shí),應(yīng)該注意的是,硬限制的功能0 o6 u, |0 @9 g+ W
//將不會(huì)影響銷共享。
3 u$ V0 a- }* ~4 ~//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器。z軸首次明確,其次是X和Y。, ?; n& Y( `7 t5 t! Q
' ~7 v+ E  U2 i5 z8 F
// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.
$ H. |' w; X/ n#define HOMING_CYCLE_0 (1<<Z_AXIS)                // REQUIRED: First move Z to clear workspace. 第一步Z清除工作區(qū)。
& ?. }) `' L$ o, q#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // OPTIONAL: Then move X,Y at the same time.然后X,Y在同一時(shí)間。2 y7 x" O8 B! k- e  |
// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable9 u* u. k" y1 f/ l. K
) i% {0 f$ ?& s  v/ Q; b5 U
// Number of homing cycles performed after when the machine initially jogs to limit switches.# e5 _- ]; m9 m' ^
// This help in preventing overshoot and should improve repeatability. This value should be one or
) A% U2 _1 U' D* t# @// greater.0 D, @) b  u6 a7 K" k( a
//執(zhí)行回原點(diǎn)循環(huán)次數(shù)后,當(dāng)機(jī)器最初慢跑限位開關(guān)。這個(gè)幫助防止過度,應(yīng)該提高重復(fù)性。這個(gè)值應(yīng)該是一個(gè)或大。# J/ Z3 j) D$ O+ N8 \; z; o

. [  q+ l) S) y1 Q( S, T# r#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128). z+ O1 Q. m% t, o
! F+ s% R$ J% B4 C, K. r
// After homing, Grbl will set by default the entire machine space into negative space, as is typical
" K7 [+ t' z& K0 G// for professional CNC machines, regardless of where the limit switches are located. Uncomment this
* R; S0 Z9 D% N0 {3 V1 D// define to force Grbl to always set the machine origin at the homed location despite switch orientation.
0 P0 r6 b; O, |# Q4 C) n0 E9 n3 J% h7 `
//導(dǎo)航后,默認(rèn)Grbl將整個(gè)機(jī)器空間留白,是典型的專業(yè)數(shù)控機(jī)器,不管限位開關(guān)所在的地方。. T3 j& B4 w) V. B+ J
//取消這定義迫使Grbl總是在這時(shí)候位置設(shè)置機(jī)器原點(diǎn)盡管開關(guān)方向。
3 ^' y4 b; w6 Z
/ H# U1 B- \  A. m// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.
% a) K7 a! J+ t" Q/ ]: ]0 b- D+ ]) |* H& g) |- u5 t& B: \3 P
/ j% `  n6 Q, {5 _+ D; x6 x/ w, _
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size) ]; h/ }, G* c
// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may7 ]( ^8 _) K* V. L3 Z0 P$ b
// be stored and executed in order. These startup blocks would typically be used to set the g-code
5 F# {3 I1 d5 |& g8 K. Y( ~) O// parser state depending on user preferences.
) P4 @' n) M0 Z: Z2 ~3 d, |" U! R! _& l8 |/ k6 C( |5 a2 p0 F1 k5 Z
//塊Grbl啟動(dòng)時(shí)執(zhí)行的數(shù)量。這些塊存儲(chǔ)在eepm,大小
% q2 j1 {# u: j3 n& G) f) m4 H//和地址在settings.h中定義。與當(dāng)前設(shè)置,可能2啟動(dòng)塊
  [+ B2 E& j6 v3 k7 S) c//存儲(chǔ)和執(zhí)行。這些啟動(dòng)塊通常被用來設(shè)置刀位點(diǎn)
" _% h' ?# ]1 `$ J//解析器的狀態(tài)取決于用戶首選項(xiàng)。
# w4 Z. A- R9 y
3 @, ~  Y6 r7 H2 _! y#define N_STARTUP_LINE 2 // Integer (1-2)1 J5 ]3 ~# X9 v: I3 Z0 C; `

+ C/ T7 M: ]9 \// Number of floating decimal points printed by Grbl for certain value types. These settings are
5 B$ d8 u! ?7 Q0 b' T) P// determined by realistic and commonly observed values in CNC machines. For example, position
0 W1 X! T' Z8 S: b// values cannot be less than 0.001mm or 0.0001in, because machines can not be physically more
" M" R) d  s$ W& H/ p// precise this. So, there is likely no need to change these, but you can if you need to here.
1 M2 Z% F4 Y4 Q$ |) `0 b// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors.
! [3 c' n/ E/ O  q. L
7 z: F1 V& a8 ]8 R// Grbl浮動(dòng)小數(shù)點(diǎn)的數(shù)字印刷的特定的值類型。這些設(shè)置是
. s# E. S! p$ w- B//一般由現(xiàn)實(shí)和觀測(cè)值在數(shù)控機(jī)器。例如,位置! r( Q- u+ w5 |5 v4 f+ h- U
//值不能小于0.001毫米或0.0001,因?yàn)闄C(jī)器不能身體更多
% G, |- \* c7 U//精確。因此,有可能不需要改變這些,但你可以在這里如果你需要。
0 C3 _6 j! d1 ~( a/ I. G0 T//注意:必須是一個(gè)整數(shù)值從0 ~ 4。超過4可能出現(xiàn)舍入錯(cuò)誤。
1 T  _$ s6 _. l( e; t) [
" A3 }7 j9 F9 w" T9 V( M; b( d9 n" {6 b#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價(jià)值英寸8 Y& `6 J* p2 H+ t6 y& c% g! m
#define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價(jià)值: V7 Z& P  L$ W  }: P+ C
#define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值* l0 x9 ?' l3 O$ J0 s9 F% r' R% d: k
#define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘! K( b7 @$ c# ]/ n9 U" ^: c, X2 V
#define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對(duì)浮點(diǎn)小數(shù)設(shè)置值
' ~, v3 ^' A. x0 r2 E4 q3 y2 c& {" T' n% V/ x% a7 l
// If your machine has two limits switches wired in parallel to one axis, you will need to enable7 d6 F7 |9 q: t: k
// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
, ]' E0 ^( J, t6 z; z/ d1 T& @! ?// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will 7 x, p. W2 r8 ~8 A& h% F
// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one
6 v- A) Y1 X6 f2 D+ j6 F+ Q$ S" \// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a% }1 G. c% u' y" y9 u
// homing cycle while on the limit switch and not have to move the machine off of it.
; T, @+ P2 g& R+ R* H' ~  H  i( r' B. \" _6 H, X9 w8 K
//如果你的機(jī)器有兩個(gè)極限開關(guān)連接在平行于一個(gè)軸,您需要啟用
) M% v9 J7 T1 v+ x//這個(gè)特性。自從兩個(gè)交換機(jī)共享一個(gè)銷,沒有辦法Grbl告訴
% N5 N) ^0 ^# [6 ?" r( V//啟用哪一個(gè)。此選項(xiàng)僅影響歸航,如果限制,Grbl意志# E) [1 J# J1 p4 `5 w0 l0 j; Q9 G6 A
//報(bào)警,迫使用戶手動(dòng)松開限位開關(guān)。否則,如果你有一個(gè)
/ d7 V. ^) }7 a1 Z8 Q//為每個(gè)軸限位開關(guān),不啟用該選項(xiàng)。通過保持禁用,您可以執(zhí)行+ R. o$ L) P! P! G' Y. ^
//導(dǎo)航循環(huán)在限位開關(guān)并沒有將這臺(tái)機(jī)器。
& ?# ]/ p" \. Z2 ?. L; c9 y( ]7 }6 b
// #define LIMITS_TWO_SWITCHES_ON_AXES
! Z9 k* |8 K: X- P$ N' ^- u
# d; K3 Z0 J5 J. Y0 T2 d/ U, {// Allows GRBL to track and report gcode line numbers.  Enabling this means that the planning buffer3 i* n% p  {  b$ F/ g
// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct3 ~# [- v4 p- m. J7 R* K! e% y
. m% C  `1 J, \+ i
//允許GRBL跟蹤和報(bào)告gcode行號(hào)。使這意味著計(jì)劃緩沖從18歲或16歲,為額外的行號(hào)plan_block_t結(jié)構(gòu)中的數(shù)據(jù)
" ~4 n6 l1 r! r! j/ t
6 q3 y& U( J, U# u. k. v6 S// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable.3 U5 T4 i" F  @6 @. q& ^* E7 Z2 @
/ [% y% ]9 ^0 [. R+ @% u
// Allows GRBL to report the real-time feed rate.  Enabling this means that GRBL will be reporting more , G7 C* O1 F6 L2 C
// data with each status update.9 [5 i) O) \$ Y7 [# l% A
// NOTE: This is experimental and doesn't quite work 100%. Maybe fixed or refactored later.( U8 p  F; ?6 b3 V
//允許GRBL報(bào)告實(shí)時(shí)進(jìn)給速率。使這意味著GRBL將報(bào)告數(shù)據(jù)和狀態(tài)更新。  x" u9 R0 w4 ]: x
//注意:這是實(shí)驗(yàn)和100%沒有工作。也許以后固定或重構(gòu)。
, y" P- E8 c0 k  h# _% @: W, w6 |# ^
// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable.
, N' ^/ X5 J/ y) O4 T) l* Y4 u
& p6 J& C7 P2 H8 K! }9 \// Upon a successful probe cycle, this option provides immediately feedback of the probe coordinates% i7 l: A9 S) G# F1 Y8 i
// through an automatically generated message. If disabled, users can still access the last probe
' J4 y" W- Q* x3 i4 X. e// coordinates through Grbl '$#' print parameters.
' T/ ^3 e$ B) g: ?! K3 N3 \  {; {4 ^//在一個(gè)成功的調(diào)查周期,這個(gè)選項(xiàng)提供立即反饋的探測(cè)器坐標(biāo)
& j2 f( \# {2 @% _+ B8 Z) G//通過一個(gè)自動(dòng)生成的消息。如果禁用,用戶仍然能夠訪問調(diào)查
! L6 P) T; M- r1 b% |* \5 H//坐標(biāo)通過Grbl $ #的打印參數(shù)。& k% Q3 Y% Z" Q7 S0 p5 A
6 r9 W  I' z7 O% @3 [& S- ~
#define MESSAGE_PROBE_COORDINATES // Enabled by default. Comment to disable., d' X) X( S# _7 U

. m( h+ ?6 A. [8 H$ A- \# T// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
, {% f7 m- G, G, N$ X& `+ X9 K// analog pin 5. Only use this option if you require a second coolant control pin.
& p5 @  M! {! C, V// NOTE: The M8 flood coolant control pin on analog pin 4 will still be functional regardless.
' S6 ^, {" D: K' c4 W: {// #define ENABLE_M7 // Disabled by default. Uncomment to enable.7 ~1 V7 ?' _2 @! F- t
4 s3 T* h' g* h; _
// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,
3 G% |) ]( j! _: L  \0 ~7 K// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until
2 |3 C+ r. Z5 L2 [8 {+ @4 \// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the3 I# e4 K; ?0 `1 o3 ^
// previous tool path, as if nothing happened.7 D) V% i! f/ u5 ]7 Q. ]8 M
// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.9 t6 }3 a" `1 C% d8 ^" G

& p1 z- S3 t0 H( d// After the safety door switch has been toggled and restored, this setting sets the power-up delay! i) x0 U* y8 N% A
// between restoring the spindle and coolant and resuming the cycle.* c9 u" G: e* f1 D* b1 J1 A) b5 z' Q9 B
// NOTE: Delay value is defined in milliseconds from zero to 65,535.
3 Q0 F9 @: C1 l4 ~8 H# o6 x. ?0 z& Q! b. M# z1 q5 S' i
//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個(gè)搜索模式7 _& w" }2 C% s; }3 O! P
//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個(gè)短: C! Y6 {+ r' _$ m: Y
//拖出運(yùn)動(dòng)脫離限位開關(guān)。以下HOMING_CYCLE_x定義執(zhí)行! G4 p7 T  H4 n2 [& v
//為了與后綴0開始并完成specified-axes只尋的例程。如果
% G8 f' e+ o$ ^' B1 z6 M; a//定義省略一個(gè)軸,它會(huì)不在家,也不會(huì)系統(tǒng)更新它的位置。1 d# X: u5 E- c% d. F
//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,
+ V' @) T1 `# {6 x& f( D//沒有y),配置導(dǎo)航循環(huán)行為對(duì)他們的需求。
5 B& {$ {2 O) }& m# P5 u! k//注意:歸航周期允許共享限制針,如果軸不相同4 h, J7 |: J4 c3 n4 `
//循環(huán),但這需要一些銷設(shè)置cpu_map的變化。h文件。例如,默認(rèn)的導(dǎo)航$ \# V" I& L# I7 ^1 \
//循環(huán)可以分享Z限位銷X或Y限制針,因?yàn)樗鼈兪窃诓煌闹芷凇?font class="jammer">! e8 z% ~. |+ B6 w4 d: W& Q
//通過共享一個(gè)銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針; A- t7 q8 `& [" u) f
//可能會(huì)減少到一個(gè)銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個(gè)軸" M" d2 [0 h6 M* \, F
//在不同銷,但這時(shí)候一個(gè)周期。同時(shí),應(yīng)該注意的是,硬限制的功能. B9 P1 G( T6 T/ Y
//將不會(huì)影響銷共享。+ F( c- @1 }' ?; Q9 }+ |
//注意:默認(rèn)設(shè)置為一個(gè)傳統(tǒng)的硬件數(shù)控機(jī)器。z軸首次明確,其次是X和Y。
0 v5 b" z% J) _' u' U
) b+ F! m: U, x6 S* W9 e9 }* M5 l# f1 h+ b9 o  e
#define SAFETY_DOOR_SPINDLE_DELAY 4000
% _5 \- e% r! G& q. N$ H: n#define SAFETY_DOOR_COOLANT_DELAY 1000- T, @0 `8 `8 z  V: N* S. M- h7 ?
+ Q" J& K  u% D3 N5 t) X
// Enable CoreXY kinematics. Use ONLY with CoreXY machines. 7 s+ k2 c4 X$ r1 s
// IMPORTANT: If homing is enabled, you must reconfigure the homing cycle #defines above to
3 \3 Q: v$ S8 f! f& X% ^//啟用CoreXY運(yùn)動(dòng)學(xué)。只使用與CoreXY機(jī)器。5 p# B5 q! p6 L" Z% v1 i
//重要:如果啟用了自動(dòng)尋的,你必須重新配置導(dǎo)航循環(huán)#定義上面
8 b& M/ T4 P% [" B% o1 D- \+ I% ]
// #define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS)
( p% L/ q2 C" H) N$ K2 ^# Y/ d  N7 E3 @
// NOTE: This configuration option alters the motion of the X and Y axes to principle of operation6 }  B1 B, [/ t" h; Q
// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as" B! Y$ a  J6 \7 [6 ]$ u- s
// described, if not, motions may move in strange directions. Grbl assumes the CoreXY A and B motors
" J7 [) V+ v0 l* t% p- ?// have the same steps per mm internally.# R0 J( ?' g- d5 g
//注意:這種配置選項(xiàng)改變X和Y軸的運(yùn)動(dòng)原理,操作
! }0 @. z- J# O//定義(http://corexy.com/theory.html)。汽車被認(rèn)為定位和連接一樣
, W! g9 g$ W' ~//描述,如果沒有,運(yùn)動(dòng)可能會(huì)奇怪的方向移動(dòng)。A和B Grbl假設(shè)CoreXY馬達(dá)
' y; u6 i4 Z6 U/ c//每毫米內(nèi)部有相同的步驟。
2 |# d# L* e4 ^2 h0 v' |
  o; G6 R2 z& \7 W# a# Y  [* w// #define COREXY // Default disabled. Uncomment to enable.
9 I+ B6 Q$ f5 K! g
4 f" m* ]/ E: l: }2 H// Inverts pin logic of the control command pins. This essentially means when this option is enabled
7 Q4 [3 h1 N$ p+ n// you can use normally-closed switches, rather than the default normally-open switches.
- Z+ B6 G% J/ R( ]  |// NOTE: Will eventually be added to Grbl settings in v1.0.6 c  p: n' @9 W8 I/ u
//反轉(zhuǎn)針銷邏輯的控制命令。這實(shí)質(zhì)上意味著當(dāng)啟用這個(gè)選項(xiàng)$ L% @  M: F8 I' w  D# G. E/ a
//可以使用閉合開關(guān),而不是默認(rèn)的常開開關(guān)。( l- Z  g3 D% T- n9 C6 e# H: \
//注意:最終將被添加到在v1.0 Grbl設(shè)置。9 A! }- T0 d; S: ]$ Y
" q. W2 Q7 ~8 f( s; Q% r  F# E
// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.. F9 @: g& p- U
/ @# [9 G& |& V! G
// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful
9 g7 d: S) L- p' U- d& i// for some pre-built electronic boards.
8 ~% A) ]! ^) h9 [! R// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
' {0 n3 H- j  N+ m3 h: ]1 s7 Y0 U// spindle enable are combined to one pin. If you need both this option and spindle speed PWM,
) F' V1 a4 `) m0 h0 @, M5 C, ]  S// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.
$ Y* [& }1 p/ I//反轉(zhuǎn)主軸使銷從low-disabled / high-enabled low-enabled / high-disabled。有用的: N" x! C/ P. V% \0 l( E3 k& J
//預(yù)構(gòu)建的電子板。! b4 N/ f" @8 L$ r7 ^4 M7 U
//注意:如果啟用了VARIABLE_SPINDLE(默認(rèn)),這個(gè)選項(xiàng)作為PWM輸出并沒有影響
) u$ z' J4 r9 H% F) }//銷軸使結(jié)合。如果你需要這個(gè)選項(xiàng)和主軸轉(zhuǎn)速PWM,
( U8 \! U5 \8 o% P$ {' o1 n; p//取消注釋以下配置選項(xiàng)USE_SPINDLE_DIR_AS_ENABLE_PIN
4 L* F3 t% v0 p" w
& j5 p! t7 ^; b3 S# l// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.; g7 }% e' |/ s6 u8 a3 F

; I0 p" G" c, P// Enable control pin states feedback in status reports. The data is presented as simple binary of
+ A0 c) `  l* E2 g// the control pin port (0 (low) or 1(high)), masked to show only the input pins. Non-control pins on the
4 A! T0 i+ s. L8 g// port will always show a 0 value. See cpu_map.h for the pin bitmap. As with the limit pin reporting,
) z( H/ B* _# Z6 i4 Y. H// we do not recommend keeping this option enabled. Try to only use this for setting up a new CNC.! W$ [8 A& v8 v1 u( ^
//啟用控制銷狀態(tài)反饋狀態(tài)報(bào)告。作為簡(jiǎn)單的二進(jìn)制數(shù)據(jù)
3 n% U; A  M; R//控制針端口(0(低)或1(高)),蒙面,只顯示輸入插腳。非控制性針上
6 Y8 P$ Y, P$ B//端口總是顯示0值。看到cpu_map。針位圖h。與限制銷報(bào)告,7 t8 H/ ~% y& U: i1 m& U/ Y
//我們不推薦保持啟用這個(gè)選項(xiàng)。盡量只使用這個(gè)設(shè)置一個(gè)新的數(shù)控。9 C0 q. G6 |* f. A

  ~/ f7 l% s+ z) H// #define REPORT_CONTROL_PIN_STATE // Default disabled. Uncomment to enable.
9 ~' Z) Z8 P/ a$ T: I4 `  Z4 s& }0 s$ \: R) ]  R2 v
// When Grbl powers-cycles or is hard reset with the Arduino reset button, Grbl boots up with no ALARM; m* f% m9 N! J! Z% R. F; P3 ~4 F2 u
// by default. This is to make it as simple as possible for new users to start using Grbl. When homing
" [7 M1 w5 ]& D+ {// is enabled and a user has installed limit switches, Grbl will boot up in an ALARM state to indicate ; h$ x" ~& C4 \- _! t* y$ s8 _7 |
// Grbl doesn't know its position and to force the user to home before proceeding. This option forces
3 f: X* s% |& f& P* y// Grbl to always initialize into an ALARM state regardless of homing or not. This option is more for8 l" V% Y5 |. X) ?9 C
// OEMs and LinuxCNC users that would like this power-cycle behavior.4 x# [% N" `5 A4 n% T! x. Z
//當(dāng)Grbl powers-cycles還是硬重置Arduino復(fù)位按鈕,Grbl啟動(dòng)沒有報(bào)警- x. M7 j8 r$ g- F) Z4 ^
//默認(rèn)情況下。這是為了讓新用戶盡可能簡(jiǎn)單使用Grbl開始。當(dāng)歸航* G" E. A' i: f, o" f8 ]
//啟用和用戶安裝限位開關(guān),Grbl將啟動(dòng)報(bào)警狀態(tài)指示
" t, z9 d! p. m) n5 t6 `# e// Grbl不知道它的位置,迫使用戶在繼續(xù)之前回家。這個(gè)選項(xiàng)部隊(duì)
6 R  W. i! U$ |+ c  ~- X' L% u  M// Grbl總是初始化進(jìn)入警報(bào)狀態(tài)不管歸航。這個(gè)選項(xiàng)是更多
" J8 T% f* T; i& w7 o//原始設(shè)備制造商和LinuxCNC用戶這樣的控制行為。
1 ], G  \& S9 w' p
0 L# `  R" F, n8 c! F// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.
6 ~1 w) t0 r) ?4 v  H" I4 w
) K) Z; k* r) G8 R# J6 [" b// ---------------------------------------------------------------------------------------1 {: B2 ?  _- T' o9 D3 @2 ?; w
// ADVANCED CONFIGURATION OPTIONS://高級(jí)配置選項(xiàng):* p) C. |4 z) }& @
" W+ F) Q' d* N1 V
// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important.+ x9 |" e; r* N
// This saves nearly 2KB of flash space and may allow enough space to install other/future features.
1 V4 @( K. }! P: ~+ _% m) y// GUIs will need to install a look-up table for the error-codes that Grbl sends back in their place.: A7 V/ [) K( P5 `: I
// NOTE: This feature is new and experimental. Make sure the GUI you are using supports this mode.
; n0 h3 X' r* w+ C! l, y
; K$ R/ O. a) c! b2 J; d. |// gui允許最小的報(bào)告反饋模式,人類可讀的字符串在哪里不重要。7 J" i" ~& e5 z. ]2 \7 G
//這個(gè)節(jié)省近2 kb的閃存空間,允許足夠的空間來安裝其他/未來的功能。
3 N( u$ F1 F: }+ ?9 l% x// gui需要安裝一個(gè)查找表的錯(cuò)誤代碼Grbl發(fā)回。2 r) g# c: @* M. _7 `
//注意:此功能是新的和實(shí)驗(yàn)。確保您使用的GUI支持這種模式。
. q' n1 Z4 I/ y  T- ~1 M0 U3 f; p  f0 z- ?  e3 a8 q. v
// #define REPORT_GUI_MODE // Default disabled. Uncomment to enable.
( }1 }8 F8 w! [+ g. O; s' e- e
// The temporal resolution of the acceleration management subsystem. A higher number gives smoother
; x/ z* K1 @: W" \: S# M% i// acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively
$ W% R! c) s. f$ N. a% |. r/ }// impact performance. The correct value for this parameter is machine dependent, so it's advised to+ E) `  T8 q% ]# m1 _  f7 z7 o
// set this only as high as needed. Approximate successful values can widely range from 50 to 200 or more.
# z* m" Z( N+ o/ K, g// NOTE: Changing this value also changes the execution time of a segment in the step segment buffer. * M4 G- Z+ Y# p5 g" R. n  C
// When increasing this value, this stores less overall time in the segment buffer and vice versa. Make& S" I% E: g6 I: w+ c4 p; T  q
// certain the step segment buffer is increased/decreased to account for these changes.
& T& P2 S& v7 U3 y7 [2 s( U& c//加速度的時(shí)間分辨率管理子系統(tǒng)。更多更平穩(wěn)8 m7 E1 `! H0 k: ?, x/ ]* z  \
//加速度,特別明顯的機(jī)器上,運(yùn)行在非常高的進(jìn)料速度,但可能負(fù)面- F% w- i) x2 u+ N' \  ]/ A- r
//影響性能。正確的值為這個(gè)參數(shù)是依賴于機(jī)器的,所以建議5 H' v7 _$ @" z: C* m" u: s
//這只設(shè)置為高。近似成功的價(jià)值觀可以廣泛的范圍從50到200或者更多。
4 P- j: p7 V$ H9 R) F//注意:改變這個(gè)值也變化的部分步驟的執(zhí)行時(shí)間緩沖。6 Q* e7 z. f1 `. L: D2 S7 Q
//增加這個(gè)值時(shí),這個(gè)商店部分緩沖區(qū)的總時(shí)間減少,反之亦然。使1 g; Q- H) u: ]# I3 @3 H
//特定步驟段緩沖是考慮這些變化增加/減少。8 R# N. B+ v  z
2 u. M1 Z8 s( K
#define ACCELERATION_TICKS_PER_SECOND 100  //加速度的時(shí)間分辨率管理子系統(tǒng)。更多更平穩(wěn)  x0 `( o; Z7 Y

/ W2 |. J; z6 D) _// Adaptive Multi-Axis Step Smoothing (AMASS) is an advanced feature that does what its name implies,
2 F" n0 h& o$ Q7 e1 j- z// smoothing the stepping of multi-axis motions. This feature smooths motion particularly at low step' @- {7 {* Z, ]1 p
// frequencies below 10kHz, where the aliasing between axes of multi-axis motions can cause audible 7 G# J' s) f" ]6 o4 {
// noise and shake your machine. At even lower step frequencies, AMASS adapts and provides even better6 A8 Y; M0 @1 W1 A5 O
// step smoothing. See stepper.c for more details on the AMASS system works.+ M( \2 z: g0 s* n  s+ b
//自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能,它的名字所暗示的那樣,! C4 J6 l7 @1 Y1 M& q( \- g
//平滑的多軸步進(jìn)運(yùn)動(dòng)。這個(gè)特性平滑運(yùn)動(dòng)尤其是在低一步) \6 \" s. s" F+ b: C$ D
//頻率低于10 khz,軸之間的混疊的多軸運(yùn)動(dòng)可能導(dǎo)致音響0 h, Z0 L9 i1 R% K( d
//噪音和震動(dòng)你的機(jī)器。在更低的頻率步,積累適應(yīng)并提供更好
1 ^/ I: Z. p- `7 V! w//步驟平滑??吹讲竭M(jìn)。c更多細(xì)節(jié)的積累系統(tǒng)的工作原理。
: Z, W( y8 ?, H/ ?) v' n  B9 z. ]% `, K3 D$ Q: H
#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING  // Default enabled. Comment to disable.//自適應(yīng)多軸步平滑4 W9 J2 {  v5 n0 f* E* I0 Y$ L' A
2 d6 K# n: W3 e; M% ~1 t
// Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error
5 z6 x' D  L% [( w3 ^/ ^& [// check in the settings module to prevent settings values that will exceed this limitation. The maximum6 d, A; l! _8 b" Z
// step rate is strictly limited by the CPU speed and will change if something other than an AVR running9 X; S: }; p" b7 d( [
// at 16MHz is used.( l$ F0 I+ i! r$ E
// NOTE: For now disabled, will enable if flash space permits.
, w/ d" Y2 U1 [2 B0 O7 w//設(shè)置最大一步速率可以寫成Grbl設(shè)置。這個(gè)選項(xiàng)可以使一個(gè)錯(cuò)誤
: V' _+ S1 I5 ?, l, H, V//設(shè)置模塊中檢查,防止設(shè)置值將超過這個(gè)限制。的最大
9 k  H) s- x+ S) ~. t//步驟嚴(yán)格限制的CPU速度也會(huì)改變?nèi)绻瞧渌鸄VR運(yùn)行
, a4 A5 [5 A8 m$ d; R4 ^//使用16兆赫。+ `0 i$ a1 T# e5 n( f7 B
//注意:現(xiàn)在殘疾,將使如果flash空間許可。
; Y/ _) q) m- w5 o3 g$ P9 q  E4 T- |2 _7 @* e- d6 U" ]# J4 I" U2 p
// #define MAX_STEP_RATE_HZ 30000 // Hz 設(shè)置最大一步速率
; c5 ^2 @5 E, n9 _- v
4 h& T. p6 G$ A; j* R// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors
* {# m" |: e2 [" t; K+ G. L1 K// enabled. This simplifies the wiring for users by requiring only a switch connected to ground,
% \) d# ?% K2 H% M! g4 n// although its recommended that users take the extra step of wiring in low-pass filter to reduce8 [3 \8 V& l  I1 S+ M+ b$ x
// electrical noise detected by the pin. If the user inverts the pin in Grbl settings, this just flips
" v0 o4 x7 d' n. ^" W1 ]' t) `" P// which high or low reading indicates an active signal. In normal operation, this means the user
) k# T( x0 O  ~, M. S// needs to connect a normal-open switch, but if inverted, this means the user should connect a ; g. @3 Y5 K! K' y) E# R+ i* G9 M
// normal-closed switch.
% P! ?, y; N* w& A1 t// The following options disable the internal pull-up resistors, sets the pins to a normal-low
7 x, W3 y; Y5 k// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning
! Q- |7 R/ i) }2 @% e2 u// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
, P' H7 c" ~6 {; J( e& O' ~// normal-open switch and vice versa.0 L& p5 m& I8 ^
// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.
0 Y5 x0 y5 E" e3 L1 c// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
0 F0 ^! P1 o) J//默認(rèn)情況下,Grbl所有輸入引腳設(shè)置為正常高操作的內(nèi)部上拉電阻
* M& v6 N' j" L//啟用。這簡(jiǎn)化了布線為用戶只需要一個(gè)開關(guān)連接到地面,
! I+ b  c( B7 d1 e4 W& O//雖然其建議用戶采取額外的步驟,在低通濾波器來減少布線6 u  Y& k  x+ \, G6 q% U
//電噪音檢測(cè)銷。如果用戶反轉(zhuǎn)的銷Grbl設(shè)置,這只是翻轉(zhuǎn)
2 [- G# L/ y+ q- i4 T7 k0 n( k//讀高或低表明一個(gè)積極的信號(hào)。在正常操作中,這意味著用戶
  K' V8 t5 ~+ y( E7 _& q0 D2 y//需要連接一個(gè)常開開關(guān),但如果倒,這意味著用戶應(yīng)該連接
0 ?6 e6 c; v: W( V' s; T* y7 v$ ~// normal-closed開關(guān)。1 J+ V8 E) ]0 x3 U5 l1 C/ L) M/ a
//以下選項(xiàng)禁用內(nèi)部上拉電阻,一般低設(shè)置別針
; J4 ]! T! f- q$ n5 Q//操作,現(xiàn)在開關(guān)必須連接到Vcc代替地面。這也掀的意思' V+ O' m7 N. j/ M
//反銷Grbl設(shè)置,一個(gè)倒置的設(shè)置現(xiàn)在意味著用戶應(yīng)該連接, J' J! k- r9 I( L! g
//常開開關(guān),反之亦然。$ X( a4 Y9 s% B. Z
//注意:所有針與功能被禁用,例如XYZ限制針,而不是單獨(dú)的軸。
# y5 t! M% }1 @( M//警告:引體向上被禁用時(shí),這需要額外的布線與下拉電阻!
' F. R2 T5 ?4 m- Q: x, ^- _$ o  O
& E& S) M" O# {- N- ?//#define DISABLE_LIMIT_PIN_PULL_UP //以下選項(xiàng)禁用內(nèi)部上拉電阻  O9 f3 e  L% ?: f6 \
//#define DISABLE_PROBE_PIN_PULL_UP8 [* s3 T7 p0 U- t( f$ Z
//#define DISABLE_CONTROL_PIN_PULL_UP
+ [4 m4 s, v6 E: w: u" J% |( R) D/ W3 w: `, l+ X
// Sets which axis the tool length offset is applied. Assumes the spindle is always parallel with & B* C8 Q- M* X$ t+ i+ l/ h4 C
// the selected axis with the tool oriented toward the negative direction. In other words, a positive
9 |% e, e) U4 V: v2 f7 W// tool length offset value is subtracted from the current location.
" o2 s' H1 I4 f- p//設(shè)置哪個(gè)軸長(zhǎng)度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與
! b2 l' Z4 ^/ y4 d1 A2 F3 w//選擇軸工具面向負(fù)方向。換句話說,一個(gè)積極的- y, N8 T0 P2 P( m* P1 h  ?- T
//工具長(zhǎng)度偏移值減去從當(dāng)前位置。7 c0 J/ v/ A: R0 Z8 ]+ e

9 K3 u& Y' K% W" N- @/ C7 u" O9 {#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)用的工具
! ?4 r* M8 O4 ^( [0 }% S
, v- Y4 M9 e7 }9 x5 e// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
6 r( ~0 ]2 r% N+ L% b3 z# @2 g* h+ [8 \// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
6 f8 }3 K& \- }& C" Y// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
/ |( g0 h! T9 R7 F// The hardware PWM output on pin D11 is required for variable spindle output voltages.
* O+ L& U. j, L; g/ L+ x//允許變量軸輸出電壓不同的轉(zhuǎn)速值。Arduino Uno,主軸
7 ?. x( j/ t8 x! @//啟用銷將輸出5 v的最高轉(zhuǎn)速256中級(jí)水平和0 v時(shí)禁用。* y1 a" F. z( Y8 p
//注意:重要Arduino凱澤本人!當(dāng)啟用時(shí),Z-limit銷這里和軸銷D12開關(guān)!+ q# Q1 Q) h+ a
//硬件PWM輸出銷這里需要變量軸輸出電壓。
- {6 H+ s/ u1 D4 e6 D9 u
7 _  z" I+ a0 m  x#define VARIABLE_SPINDLE // Default enabled. Comment to disable.//允許主軸輸出電壓不同的轉(zhuǎn)速值) T  x4 P- {% Z" L2 z: p, O( P8 K& Z
( E% D( R* V# s1 c
// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed5 w$ l9 Y2 o3 E
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
% i! N( }+ b* L$ N2 e  i// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 10007 y! x! `, ~" I
// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands:
$ r0 h; Y$ A, \4 O" U  G& p! {// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled.
* S# y% U- j) Z0 W0 t6 ]7 `5 Q7 j//使用的變量軸輸出。這些參數(shù)設(shè)置最大和最小軸轉(zhuǎn)速- {9 @5 c! q/ X3 p- I% O
//“S”刀位點(diǎn)值對(duì)應(yīng)于銷電壓的最大值和最小值。有256個(gè)離散和
9 T- x' G6 H& P4 G& F' Y: r' [( N$ H//電壓平均分配箱主軸速度的最大值和最小值之間。所以對(duì)于一個(gè)5 v銷,1000
% n' f/ H$ i7 J7 |// max rpm,250分鐘rpm,主軸輸出電壓將為以下“S”命令:
- ?  ?! i+ K5 h5 N5 M! P5 X// @“S1000 5 v,“S250”@ 0.02 v,“S625”@ 2.5 v(中檔)。銷輸出0 v時(shí)禁用。- e# J. H# m( }9 M1 @* s

+ C6 N" L( H7 W$ L) V% ?#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.
# Y' B9 l: Y5 q8 T#define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.
( ?  J4 c9 T0 g
+ m: m+ H& {- p3 _9 h7 B// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
, k# L. _" v2 U: g, Z! U// When disabled, the PWM pin will still read 0V. Most users will not need this option, but it may be
! q, k5 n- P0 p5 {6 G6 Z  C// useful in certain scenarios. This setting does not update the minimum spindle RPM calculations. Any  Y! [5 [3 B+ k
// spindle RPM output lower than this value will be set to this value.
/ R( A. Y4 i& P$ Q//使用的變量軸輸出。這迫使PWM輸出最小占空比時(shí)啟用。# t; O( y( q) p: l
//當(dāng)禁用,PWM銷仍讀0 v。大多數(shù)用戶不需要這個(gè)選項(xiàng),但是它可能是
2 v& W" q, [% l3 M//在某些情況下很有用。這個(gè)設(shè)置不會(huì)更新最小主軸轉(zhuǎn)速計(jì)算。任何. U8 x" \9 r3 ^8 M& k
//輸出軸轉(zhuǎn)速低于這個(gè)值將被設(shè)置為這個(gè)值。) f, H' J+ }. K. l" B
& q/ Y& c, B. V! q( a, C/ a
// #define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable. Integer (0-255)
; k* D- z% L; A
* \, z1 ?) c, A4 n// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help
# c. f2 T2 I2 c1 U5 h: r7 \  L' W' n// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses
% @8 p" `1 l! R( i- g- a+ ?9 Y// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11. % S$ Q- A. t' i4 d+ e
// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
/ M0 h( e% Z+ z- `* Q// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.
( G3 [8 U( P( t. }) J// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with* `' X. \3 B( m; z/ E0 y6 h
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.),
* U1 a& U3 x2 C' N// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
! W6 c. ?% N) ]( h; g% ]$ O2 G) ^//默認(rèn)ATmega328 p(Uno),Grbl結(jié)合變量軸PWM和使到一個(gè)銷的幫助
& g8 S& B; {, J4 s//保存I / O管腳。對(duì)于某些設(shè)置,這些可能需要單獨(dú)的別針。這個(gè)配置選項(xiàng)使用9 m  x: ]. [) U2 u
//方向軸銷(D13)作為一個(gè)單獨(dú)的軸銷上啟用銷以及主軸轉(zhuǎn)速PWM這里。& }5 J$ l8 l3 N
//注意:該配置選項(xiàng)僅適用于VARIABLE_SPINDLE啟用和328 p處理器(Uno)。( p7 b, [! c* S
//注意:沒有方向銷,主軸順時(shí)針M4刀位點(diǎn)命令將被刪除。M3和M5仍然工作。9 Y1 n+ Q1 s6 D7 U
//注意:小心!Arduino引導(dǎo)裝載程序切換D13銷的權(quán)力。如果flash Grbl
9 F# R; _# ^9 U6 M8 l& E, Y" h//程序員(您可以使用一個(gè)備用Arduino“Arduino ISP”。搜索網(wǎng)絡(luò)如何線),
0 j* [; d! b, I) |" H1 N2 B7 D! }//這D13導(dǎo)致切換應(yīng)該消失。我們還沒有測(cè)試這個(gè)。請(qǐng)報(bào)告將會(huì)怎樣!
  W. L- ?4 s' ?  C" q
9 L  m# B- m3 S  M$ k& L& b8 o8 }// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.: i6 V0 d( l7 W
8 f& K% v( H# j" v! b1 X+ k
// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces
6 A2 u2 N$ U. L: y8 S( @// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be
3 e( }1 h9 r1 _; m( d// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user * q" W' Z- u1 J5 F+ h
// sendss the line 'g1 x1.032 y2.45 (test comment)', Grbl will echo back in the form '[echo: G1X1.032Y2.45]'.
0 c+ ?& V, e. `// NOTE: Only use this for debugging purposes!! When echoing, this takes up valuable resources and can effect
' |1 k1 ~* d; D( G( K5 k// performance. If absolutely needed for normal operation, the serial write buffer should be greatly increased4 I- X2 v1 |0 u6 d
// to help minimize transmission waiting within the serial write protocol.: Z' V8 ]. c% [8 R* T

/ R5 Q& I: h1 p//啟用,Grbl發(fā)回的回聲線已收到,已預(yù)編譯(空間
8 E7 {9 E9 `7 d& ]5 _+ y& D% N1 \//移除,大寫字母,沒有評(píng)論),由Grbl立即執(zhí)行?;芈晫⒉粫?huì)
- v' Y; h; J$ A  B! n7 h//發(fā)送一個(gè)線緩沖區(qū)溢位,但應(yīng)該對(duì)所有正常線路送到Grbl。例如,如果一個(gè)用戶
7 z5 j  w6 T: ~//發(fā)送線的g1 x1.032 y2.45(測(cè)試評(píng)論)形式”,Grbl將回聲”(回聲:G1X1.032Y2.45]”。
' _" a" c% h' M, e3 o0 {//注意:只使用這個(gè)調(diào)試! !當(dāng)呼應(yīng),這占用了寶貴的資源,可以影響. F/ P& X) U! g% s9 v  _7 h
//性能。如果正常運(yùn)行所需的絕對(duì),串行寫入緩沖器應(yīng)該大大增加1 ?# c9 q4 M! q) L* s" ~- R
//幫助最小化傳輸?shù)认盗袃?nèi)寫協(xié)議。2 P8 v, Z5 p, ?4 ]' g
+ [6 Y# i, u; E( \: z
// #define REPORT_ECHO_LINE_RECEIVED // Default disabled. Uncomment to enable.
' [& q2 c* e' {9 f. D
" U) C' H  O! i+ b. j// Minimum planner junction speed. Sets the default minimum junction speed the planner plans to at, V5 `2 \" [+ o& o, |  U" m2 b/ f
// every buffer block junction, except for starting from rest and end of the buffer, which are always
# {" u; F, i; r8 g$ ^1 g! F// zero. This value controls how fast the machine moves through junctions with no regard for acceleration! s! B6 n; B; p; y( p
// limits or angle between neighboring block line move directions. This is useful for machines that can't5 d+ I* t8 C; c" i
// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value
9 q9 Z2 [, E8 U& X// should not be much greater than zero or to the minimum value necessary for the machine to work.
: @$ h+ B! a4 X4 v1 W7 O/ Y- k/ B& h/ y+ U0 r5 X
//最小規(guī)劃師結(jié)速度。設(shè)置默認(rèn)最小連接速度規(guī)劃計(jì)劃
% e( |1 Q! M' R7 X8 E* r//每一個(gè)緩沖塊接頭,除了從結(jié)束休息和緩沖區(qū),它總是2 Z/ r* |) q5 ]- {  H- Z# c
// 0。這個(gè)值控制機(jī)器的速度穿過路口,沒有考慮加速度. D: f+ A! T7 N7 `- o/ J$ u" Q5 U
//限制或相鄰塊之間的角線方向移動(dòng)。這是有用的機(jī)器,不能
8 l5 [- K# ~; z//容忍工具居住某一剎那,即3 d打印機(jī)或激光切割機(jī)。如果使用這個(gè)值% d8 e; F; d& w" c
//不應(yīng)大于零或機(jī)器工作所需的最小值。
; H4 F8 \$ p2 W* e: D9 Q
- M$ `+ Y- e( i  K* Q7 D! W/ F#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min)0 p6 ]' ^" P. @. `
. z/ k% f& f5 `
// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum
* k7 {! ^9 R5 C: h// value. This also ensures that a planned motion always completes and accounts for any floating-point
1 X0 y1 `3 s/ _+ M; s: o- v// round-off errors. Although not recommended, a lower value than 1.0 mm/min will likely work in smaller
9 C$ x# h" G, g, a/ X7 o5 H4 k5 T// machines, perhaps to 0.1mm/min, but your success may vary based on multiple factors.3 f7 K' M* I* `
//設(shè)置計(jì)劃將允許的最小進(jìn)給速率。任何價(jià)值低于它將被設(shè)置為最低值。這也保證了運(yùn)動(dòng)計(jì)劃總是完成,占任何浮點(diǎn)
4 S% z% E" k& w+ u& B- g: R" b8 O! C//舍入錯(cuò)誤。雖然不推薦,價(jià)值低于1.0毫米/分鐘可能會(huì)在較小的工作/ T4 i2 x& C- s, w
//機(jī)器,也許到0.1毫米/分鐘,但你的成功基于多種因素可能會(huì)有所不同。4 o- n; c6 Y. g8 Z0 q
% J' h5 p$ {$ U) P* X' d9 @
#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計(jì)劃將允許的最小進(jìn)給速率; ]. j4 D) W9 Y1 _# g. W# m

, q- a' t3 {+ K/ J# m: \// Number of arc generation iterations by small angle approximation before exact arc trajectory
. B( C- a. U5 v  S; k7 P& Y// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there 6 s9 M+ ]2 A7 z8 d8 ^1 t  |
// are issues with the accuracy of the arc generations, or increased if arc execution is getting9 M- K( x2 X- j* g( o
// bogged down by too many trig calculations. 8 h1 g' i6 N6 d7 U/ {
//弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡: {# C9 E5 t; i, h0 |
//修正與昂貴的sin()和cos()calcualtions。如果有這個(gè)參數(shù)可能減少# T' R* k1 J+ d9 |" R) w
//與弧一代又一代的準(zhǔn)確性問題,或如果電弧執(zhí)行得到增加+ H. }# d1 n* ^# t# j, V
//太多的三角計(jì)算的泥潭。
  N- n' e7 F: b6 a# {/ v) t4 E2 o6 y0 u9 `2 f
#define N_ARC_CORRECTION 12 // Integer (1-255): P1 V8 `% Q8 ?$ ?4 ^1 E
  h9 J# O5 U0 A
// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical ! |; ~: x1 s. M
// errors when arc at semi-circles(pi) or full-circles(2*pi). Offset-based arcs are much more accurate
" k1 Y' f. ^  ?3 r6 _' M// but still have a problem when arcs are full-circles (2*pi). This define accounts for the floating
% }/ u# S$ M: B- Y% [2 P// point issues when offset-based arcs are commanded as full circles, but get interpreted as extremely% J5 g1 l. r% w+ @
// small arcs with around machine epsilon (1.2e-7rad) due to numerical round-off and precision issues.
4 W) ], d2 M. K9 v0 B( i// This define value sets the machine epsilon cutoff to determine if the arc is a full-circle or not., h% u; `$ {4 G* D
// NOTE: Be very careful when adjusting this value. It should always be greater than 1.2e-7 but not too& N' l8 J7 l+ }8 b
// much greater than this. The default setting should capture most, if not all, full arc error situations.
# d5 ^3 X: F$ p( _( m//弧G2/3刀位點(diǎn)的標(biāo)準(zhǔn)定義是有問題的。Radius-based弧有可怕的數(shù)值. p" l3 d# x) S$ f. s( s
//錯(cuò)誤當(dāng)電弧在半圓(π)或原點(diǎn)(2 *π)。Offset-based弧更準(zhǔn)確# z& i; n/ Y6 m5 i
//但仍有一個(gè)問題當(dāng)弧原點(diǎn)(2 *π)。這個(gè)定義占浮動(dòng)4 \; |5 }! Y( b
//當(dāng)offset-based弧吩咐點(diǎn)問題完整的圓,但解釋為極. ?- c* T' U, \' n
//小弧機(jī)周圍ε(1.2 e-7rad)由于數(shù)字舍入和精度問題。
7 Z+ c: x% Q9 Q+ q//定義值設(shè)置機(jī)器ε截止來確定電弧是一個(gè)原點(diǎn)了。2 m" H0 G( U! ?' ^
//注意:調(diào)整這個(gè)值時(shí)非常小心。它應(yīng)該總是大于1.2 e -但不要太
# q7 @+ X0 }& G2 G( l( X//比這大得多。默認(rèn)設(shè)置應(yīng)該捕獲大部分,如果不是全部,全部錯(cuò)誤的情況。
* M& a: B' p( V6 o
0 G" y& J, e" D9 ]6 B( l5 k#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)+ ~$ M& M3 T. x4 C) \. D) u% P$ i& g

0 s0 i% j% X4 {8 A" i1 R" J. D; J// Time delay increments performed during a dwell. The default value is set at 50ms, which provides
. l4 C9 Q0 r+ @// a maximum time delay of roughly 55 minutes, more than enough for most any application. Increasing
2 C* T& _# i8 g8 Q  W// this delay will increase the maximum dwell time linearly, but also reduces the responsiveness of
$ \# l% q4 s8 F& i% V3 l& t// run-time command executions, like status reports, since these are performed between each dwell & T, X0 J5 b8 _1 _& M5 \
// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.
* m( `9 Y- K5 E//延時(shí)增加表現(xiàn)在住。默認(rèn)值設(shè)置為50毫秒,它提供了
  h7 |1 s# L# }4 f: d, r//最大延時(shí)約55分鐘,足夠?qū)Υ蠖鄶?shù)任何應(yīng)用程序。增加
! \( b4 w; E6 e' d; {* o/ F//這種延遲將增加線性最大停留時(shí)間,也減少了響應(yīng)能力
: [8 D( R3 i/ v* p- K1 r//運(yùn)行命令執(zhí)行狀態(tài)報(bào)告一樣,因?yàn)檫@些每個(gè)住之間執(zhí)行" n9 {3 O6 W* T7 N& |3 T
//時(shí)間步。還有,記住,Arduino延遲計(jì)時(shí)器不是很準(zhǔn)確的長(zhǎng)時(shí)間延誤。
/ T% E- `3 G0 F) E# f3 k* F* K! f7 I+ N' v# V8 c& f
#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds)
% k" K+ W. w2 A6 j& b: x: }) M5 U2 m4 g
// Creates a delay between the direction pin setting and corresponding step pulse by creating
2 ]/ W% t" Z% S" i// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare) % R2 s% C2 ~- Y% b/ E, a1 L+ {
// sets the direction pins, and does not immediately set the stepper pins, as it would in
, {+ P+ u* |# l, A: ]& M// normal operation. The Timer2 compare fires next to set the stepper pins after the step
# |& m9 G$ @. l; M// pulse delay time, and Timer2 overflow will complete the step pulse, except now delayed ) u$ [# F/ i" [$ }6 u; z9 X1 S
// by the step pulse time plus the step pulse delay. (Thanks langwadt for the idea!)
) s; c1 i7 D0 A: \: a* H// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the
+ l# S* f" M( N$ v; U// user-supplied step pulse time, the total time must not exceed 127us. Reported successful9 u; C3 _& Q' G5 P( `+ A
// values for certain setups have ranged from 5 to 20us.
: \1 a* I- `! R, ]  w6 h6 i9 ?//創(chuàng)建一個(gè)方向銷之間的延遲脈沖通過創(chuàng)建設(shè)置和相應(yīng)的步驟
5 h4 s; ?) N- m% G/ @* }  g//另一個(gè)中斷(Timer2比較)來管理它。主要Grbl中斷(Timer1比較)
2 d4 L5 E, }7 l" v8 _- `2 q//設(shè)置方向針,不立即設(shè)置步進(jìn)針,因?yàn)樗鼤?huì)在
. j$ R* h3 h' c/ i//正常操作。Timer2比較火旁邊設(shè)置步進(jìn)針后一步# C4 `/ B0 P8 E; g& a4 ^( p% L3 s. m$ {
//脈沖延遲時(shí)間,Timer2溢出脈沖將完成的步驟,現(xiàn)在延遲除外
2 |8 B3 R/ e' \# e* t( R& P//脈沖時(shí)間加上的一步一步脈沖延遲。(感謝langwadt主意!)
3 F% w: e! h2 q4 B3 E7 [2 Q" U" M//注意:取消啟用。必須> 3,建議延遲,當(dāng)添加的# |0 @1 Y5 ]7 L
//用戶提供的步驟脈沖時(shí)間,總時(shí)間不得超過127美元。成功的報(bào)道2 U4 N# `. S7 p+ S. ~& B2 M
//值對(duì)某些設(shè)置范圍從5到20。
; S7 `4 g( f- r: z$ N
5 v8 r  g' x7 |3 S2 \// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
5 U/ p& Y$ y9 C# R4 p: q
; m! C( }0 W: C0 i* Y, F) n, x// The number of linear motions in the planner buffer to be planned at any give time. The vast
( _" t' x! ?) Y& I- y// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra 2 R% i; M: a8 J/ w  [
// available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino
* b) h) C' O& n* F; t. f8 q. G// begins to crash due to the lack of available RAM or if the CPU is having trouble keeping
9 w5 C9 |+ ?1 k# \7 g// up with planning new incoming motions as they are executed. % @" U* Q) J8 a. l% y" |! N3 N8 }
//線性運(yùn)動(dòng)規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時(shí)間計(jì)劃。絕大
: @" E$ I( m  A* U8 u7 ^//多數(shù)RAM Grbl使用基于這個(gè)緩沖區(qū)的大小。如果有額外的只會(huì)增加
8 Y7 u1 z9 k* R0 O$ J5 a1 l: `//可用內(nèi)存,比如當(dāng)基于大型或Sanguino。如果Arduino或減少8 ~: q# Y- E9 _
//開始崩潰由于缺乏可用的RAM或者CPU是難以保持
& x3 J" l' D; C% I//與規(guī)劃新傳入的動(dòng)作執(zhí)行。
" o2 B. v: H# W2 N8 V2 W4 R! r3 Q1 l% z$ `, o
// #define BLOCK_BUFFER_SIZE 18  // Uncomment to override default in planner.h.
9 Y/ O6 G1 i  u4 t
2 S! z7 B" X! s( ]// Governs the size of the intermediary step segment buffer between the step execution algorithm/ h! ?0 W8 [, H' Y' K1 D
// and the planner blocks. Each segment is set of steps executed at a constant velocity over a
. i& l" @. v& H  Z0 T8 _  ?: a// fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner  ?6 D) T7 O' {1 S: z2 }
// block velocity profile is traced exactly. The size of this buffer governs how much step
+ L% ^4 }) x$ f// execution lead time there is for other Grbl processes have to compute and do their thing
& j2 l7 `" G  t. P- Y# Q// before having to come back and refill this buffer, currently at ~50msec of step moves.
1 t5 p9 s" S, {' I0 M4 C//控制之間的中間段緩沖大小的步驟執(zhí)行算法3 v! w1 t1 k9 m9 j/ n  M9 L# G
//和規(guī)劃師塊。每一部分的步驟執(zhí)行在一個(gè)恒定的速度9 S. L6 u! W! J  {; w. @
//固定的時(shí)間由ACCELERATION_TICKS_PER_SECOND定義的。他們計(jì)算的計(jì)劃6 ]' v0 G. [5 f  D+ |; X
//塊速度剖面追蹤到底。這個(gè)緩沖區(qū)的大小控制多少步驟
% A3 O, i" Q- u; _2 q9 {7 O( v//執(zhí)行時(shí)間有其他Grbl過程需要計(jì)算和做他們的事情
( A+ h/ Q# r" L) H) c$ t//之前必須回來重新填充這個(gè)緩沖區(qū),目前移動(dòng)~ 50毫秒的一步。
& w1 C5 S- A; T1 ~7 z' m1 a; r0 r# p4 P( S6 i
// #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h.
; g% s) }# M+ w: f* b
$ T+ o0 Y0 x, M/ r# Z. V// Line buffer size from the serial input stream to be executed. Also, governs the size of
/ ^* J' a4 W1 Z// each of the startup blocks, as they are each stored as a string of this size. Make sure
* b2 c: R. T3 ^7 d/ u0 g* ~1 o// to account for the available EEPROM at the defined memory address in settings.h and for
5 C$ p- D& h5 H! B// the number of desired startup blocks.
4 m2 ^  z" {6 Z6 t5 K8 E, O9 ^// NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size
) ]# g3 e+ p7 |// can be too small and g-code blocks can get truncated. Officially, the g-code standards ' x4 \( [2 n0 q( ], @: i6 P
// support up to 256 characters. In future versions, this default will be increased, when
% M: c9 E" u/ `8 o// we know how much extra memory space we can re-invest into this.
1 W* c0 @: c% o* G$ C% r//行執(zhí)行串行輸入流的緩沖區(qū)大小。同時(shí),大小的控制) Z- i. G( p0 M4 a& U5 u4 j. C' ]
//每個(gè)啟動(dòng)模塊,它們分別存儲(chǔ)為字符串的大小。確保
+ U3 j/ v' O2 D//占可用eepm定義內(nèi)存地址的設(shè)置。h和
- l/ ]. i) {  l//需要啟動(dòng)塊的數(shù)量。, i' n1 y- L" L1 J8 q0 b( X7 {
//注意:80個(gè)字符不是一個(gè)問題,除了極端的情況下,但線緩沖區(qū)大小
4 T2 b  P% @1 }3 Z; Q+ N//可以太小和刀位點(diǎn)塊可以截?cái)?。正?刀位點(diǎn)標(biāo)準(zhǔn)
% c3 C! y! [& A% f  e2 I- X9 w, O//支持多達(dá)256個(gè)字符。在未來的版本中,這個(gè)違約將會(huì)增加,當(dāng)9 c+ x8 i; B/ @. [6 a' ]+ A3 Q
//我們知道多少額外內(nèi)存空間的時(shí)候我們可以再投資。
7 P5 L9 i! L% [5 P5 q+ w8 g" Q
% y% ^/ B$ `. O8 d: J" d// #define LINE_BUFFER_SIZE 80  // Uncomment to override default in protocol.h4 w# m. y/ Y6 D* _9 m
  
3 L5 B) C" w. L2 a/ j) Z// Serial send and receive buffer size. The receive buffer is often used as another streaming. X0 l7 b7 e5 \; ~3 E
// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming* `0 m* K8 t& C, G$ p# m: [! u2 s* ]
// interfaces will character count and track each block send to each block response. So,
, t8 }5 ^! e; ?- b. S" q) ]// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
; [9 @6 j  T3 K0 m+ u// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large3 `7 @2 S9 P; [6 G% F! H
// messages are sent and Grbl begins to stall, waiting to send the rest of the message.8 N. |1 v& o6 L! H( k! S5 V
// NOTE: Buffer size values must be greater than zero and less than 256./ u  I7 `9 M2 `5 }
// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h
1 v7 ^5 X# g4 H//串行發(fā)送和接收緩沖區(qū)大小。接收緩沖區(qū)通常用作另一個(gè)流9 _/ i+ f* C4 i5 @* z7 ?" H- J1 A
//緩沖存儲(chǔ)傳入的塊來處理Grbl當(dāng)它準(zhǔn)備好了。最流$ S: b, h( a+ P5 J
//接口將字符計(jì)數(shù)和跟蹤每一塊發(fā)送給每個(gè)塊的回應(yīng)。所以,) c. `! J7 m* x! p2 z: n
//增加接收緩沖區(qū)如果需要更深層次的接收緩沖區(qū)為流,、5 k. L1 A7 ^# y$ f
//內(nèi)存允許。Grbl發(fā)送緩沖主要處理消息。只會(huì)增加如果大2 H3 r$ i1 o4 `" w
//消息發(fā)送和Grbl開始停滯,等待發(fā)送其余的消息。9 X+ G% |: L; r9 b4 `# H
//注意:緩沖區(qū)大小值必須大于零,小于256。
# e$ M5 Q; V  J+ t- x& R// # define RX_BUFFER_SIZE 128 / /取消serial.h覆蓋默認(rèn)值
3 h2 F' c+ P3 E% |. h$ I' D
: p+ E1 A, M* L% D. [! I' [" Y
) F# v& k' U; E. E7 b// #define TX_BUFFER_SIZE 647 K* ~5 E8 T  _6 F
  
( [& `  ^5 ]  s8 F// Toggles XON/XOFF software flow control for serial communications. Not officially supported% n7 n4 h; H: S& ]* |! q4 N$ A2 R
// due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware
& q9 X7 }/ @$ @+ x// on these chips do not support XON/XOFF flow control characters and the intermediate buffer
6 ~' N3 P$ y& m; G; h# m' \// in the chips cause latency and overflow problems with standard terminal programs. However,
7 @4 G1 T9 p* f6 X// using specifically-programmed UI's to manage this latency problem has been confirmed to work.
% ]1 @: Y0 x4 c0 A+ [% S2 F// As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard* ~& B/ P; n) j' s- Z9 {
// terminal programs since their firmware correctly manage these XON/XOFF characters. In any3 K$ [  j7 @# M, q3 T7 q
// case, please report any successes to grbl administrators!
, n# E9 }2 @& J/ Y; H//切換為串行通信發(fā)送樸通/發(fā)送葡開軟件流控制。不是官方支持2 e. l+ |/ `" }; K6 y/ g% o/ ]) x5 j
//由于問題涉及Atmega8U2 USB-to-serial當(dāng)前arduino芯片。固件
' B1 L# ?, G) `$ C6 a8 p2 {4 Z//在這些芯片不支持發(fā)送樸通/發(fā)送葡開流控制字符和中間緩沖區(qū)
& T9 B6 Z; a. C% k//芯片導(dǎo)致延遲和溢出問題的標(biāo)準(zhǔn)終端程序。然而,& v) ?) K8 \0 A) {/ O" ]6 R
//使用specifically-programmed UI的管理這個(gè)延遲問題已經(jīng)確認(rèn)工作。8 d5 Z' E. m  T2 w  Q
//以及老FTDI FT232RL-based arduino(Duemilanove)是已知的標(biāo)準(zhǔn)
& j3 L* c7 }& F; t, S' t//終端程序因?yàn)樗麄冋_的固件管理這些發(fā)送樸通/發(fā)送葡開的角色。在任何1 m) a6 v% {) v6 s4 f6 a. L
//情況,請(qǐng)報(bào)告任何成功grbl管理員!% P, o. \( o$ B2 n. X( ^

9 h+ ?, A+ A' s/ H4 ^' I  ~// #define ENABLE_XONXOFF // Default disabled. Uncomment to enable.5 Y' U7 `4 J0 g) S
4 l6 r  R! o5 h5 u. g. Q" V! W4 M
// A simple software debouncing feature for hard limit switches. When enabled, the interrupt
( F) H  D. {& e4 F8 }// monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check
; L  Q5 m4 Z- c4 r9 q// the limit pin state after a delay of about 32msec. This can help with CNC machines with
* v2 P  g% A" T, H1 e6 K// problematic false triggering of their hard limit switches, but it WILL NOT fix issues with
/ O, N9 I9 C7 f/ m; a8 ?) \6 l" E// electrical interference on the signal cables from external sources. It's recommended to first
& \3 M" C" B5 A1 @/ I/ ~' l// use shielded signal cables with their shielding connected to ground (old USB/computer cables
' f7 z& B: ]: M% q: j# S9 }// work well and are cheap to find) and wire in a low-pass circuit into each limit pin.( b( v* b7 B) Y
//一個(gè)簡(jiǎn)單的軟件消除抖動(dòng)特性硬限位開關(guān)。當(dāng)啟用時(shí),中斷9 ^$ x$ d" w7 g# [
//監(jiān)控硬限位開關(guān)針將使Arduino的看門狗定時(shí)器重新審視
/ c" o$ l: Q1 Q" o* H: n$ C6 g0 |//銷的極限狀態(tài)后約32毫秒的延遲。這可以幫助與數(shù)控機(jī)器0 ?" L0 d0 ~8 R
//問題錯(cuò)誤引發(fā)的硬限位開關(guān),但是它不會(huì)解決問題  E: ?# f# m. q, s- Y
//電干擾信號(hào)電纜從外部來源。首先它的建議
" Q4 E# S" h  y1 K. h% ^3 T7 A//使用屏蔽信號(hào)電纜的屏蔽連接到地面(老USB /計(jì)算機(jī)電纜( W) d# T" B, p* i( c+ `
//工作得很好,很便宜)和線低通電路到每個(gè)限位銷。
& g! G/ ~; e8 }! m, \
+ S; _' h; H7 }; S; A// #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable.% b+ e! i# x$ P- F! @6 c
3 E+ ]% [/ ~4 t1 b
// Force Grbl to check the state of the hard limit switches when the processor detects a pin: x( b5 @% ?- q
// change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits
6 }2 j( w) p! A! r% U1 o6 S// alarm upon any pin change, since bouncing switches can cause a state check like this to # G- g) z7 R5 d
// misread the pin. When hard limits are triggered, they should be 100% reliable, which is the- L3 m: r( ~- b' y) _
// reason that this option is disabled by default. Only if your system/electronics can guarantee
7 l- \# s7 u2 k, b// that the switches don't bounce, we recommend enabling this option. This will help prevent
8 P7 o2 z5 h" h# m// triggering a hard limit when the machine disengages from the switch.
4 H# }: Q* O# F) ]7 M- e// NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled.
9 g2 P% m! N# I/ M( O9 r, S, W' B6 o//力Grbl檢查硬限位開關(guān)的狀態(tài),當(dāng)處理器檢測(cè)到一個(gè)銷
! s, M5 `# O2 f& Q: N//改變內(nèi)部硬限制ISR例行公事。默認(rèn)情況下,Grbl將觸發(fā)硬限制9 V5 J/ e: W' o3 g, [+ k5 {
//報(bào)警在任何銷更改,因?yàn)樘_關(guān)可以導(dǎo)致這樣的狀態(tài)檢查
$ Z( |; j4 n3 _( {" h) W: P/ F  S//誤讀了銷。硬限制觸發(fā)時(shí),他們應(yīng)該100%可靠,這是* R, T1 j+ c0 ~
//原因,這個(gè)選項(xiàng)默認(rèn)是禁用的。只有在你的系統(tǒng)/電子產(chǎn)品可以保證
/ B9 W6 |) O% O. {3 n9 _- d//開關(guān)不反彈,我們建議啟用這個(gè)選項(xiàng)。這將有助于防止
, ?- Z1 \1 b0 W  g( O+ S//觸發(fā)機(jī)退出時(shí)硬限制開關(guān)。, n$ h9 k4 @% ]" i; j5 \: {  E
//注意:這個(gè)選項(xiàng)如果啟用了SOFTWARE_DEBOUNCE沒有影響。
' c6 l1 g$ W/ F) G6 ]7 P9 \( B! @
// #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable.- a) A, |1 i/ [: r0 B
6 ^9 D, t) i0 i/ A" g& C/ }
0 z& ?2 ]  J3 T/ z  Y% c
// ---------------------------------------------------------------------------------------, P& E# C5 ?3 D& Q  v' D! ?1 ?
// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時(shí)錯(cuò)誤檢查的定義值:, _0 \* v7 ]3 D
; s0 B8 V$ B" D' z
#ifndef HOMING_CYCLE_01 \7 }' V# K5 }+ q- x! }$ Q! u
  #error "Required HOMING_CYCLE_0 not defined."
% M( Z: P" G7 ~6 v$ f/ K/ X1 H#endif1 ?2 s# r9 h- I; [) T' T

) ]& H% z& I$ }6 u1 ?. \#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
0 R* V2 w3 r: I1 p$ A2 b  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"9 O/ A& U8 y( D( p
#endif' j% k1 p, Z, y4 h

; j) _3 \5 u+ `* Z#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
! x8 ?! I0 y" u0 [  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"6 E9 C9 h! N! {
#endif1 S+ M- e7 K  j7 U, @0 {2 T4 ~, J
7 s4 g/ s2 f# w' k6 V
// ---------------------------------------------------------------------------------------
" A( M2 ~2 j: k/ ]3 I, @5 `$ |
$ y0 e0 E# Z$ a$ l
" q/ E+ d, A0 N. g5 T) b. s#endif
; S  i- f) V; U  ]/ E
; `7 B; ?3 X6 t- b
& O/ V5 \8 `- `# a. s. [; d5 s7 q
& V3 ?6 C+ Y. o- A/ I( N. {7 J! ^4 ]3 H' t8 n

& N: B( c. Y  n' N' s6 e
! e" u3 o/ |, C& {
; Z. y5 y0 x9 w7 p3 X
+ R. {8 ]3 R5 m: A2 N- ?
3 V  `6 T) m& O% E5 L$ H
# U. K! W/ u2 ^1 f8 |+ u! y4 x* c. G

* V; T2 s9 b3 e/ Z  o! i  e* J3 t: `3 w' v- c2 g

4 n+ H( b* _( o
5 s; A9 V+ j! d# M
% O* k, j( a+ V, J
作者: 1五湖四海1    時(shí)間: 2016-8-21 00:11
那些沒有用的照片不知道怎么就上去了好討厭。
作者: 1五湖四海1    時(shí)間: 2016-8-21 00:14

1 A- Z  I* K3 u8 a; @6 q
作者: 凸輪設(shè)計(jì)與加工    時(shí)間: 2016-8-21 05:50
      樓主厲害!
作者: mrplplplpl    時(shí)間: 2016-8-21 08:22
謝謝樓主,先收藏一下,慢慢學(xué)習(xí)
作者: 通行證    時(shí)間: 2016-8-23 15:11
這是什么寶貝?
作者: 通行證    時(shí)間: 2016-8-23 15:11
換了個(gè)瀏覽器Chrome,試試能否發(fā)言了。
作者: w247442603    時(shí)間: 2016-8-23 20:12
樓主厲害
作者: 1五湖四海1    時(shí)間: 2016-8-23 23:03
補(bǔ)充, L) m* V5 S" j  S5 H% A% H
程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實(shí)時(shí)命令。
$ S* w  h. ]4 {' m1 R; `+ O3 v) ?// Executes run-time commands, when required. This is called from various check points in the main
7 W- t1 o* F! @) q( p, ^// program, primarily where there may be a while loop waiting for a buffer to clear space or any
  Q5 K6 N0 U" p7 d// point where the execution time from the last check point may be more than a fraction of a second.
- I5 s+ ^7 E" F, P7 a* J% t' Y// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code( o9 p* V0 f# G% a& K! Y  S9 k5 k
// parsing and planning functions. This function also serves as an interface for the interrupts to
0 ]/ h" R8 w# a$ g4 |3 W4 T  `// set the system realtime flags, where only the main program handles them, removing the need to4 R9 v+ s8 c3 s7 y
// define more computationally-expensive volatile variables. This also provides a controlled way to
. {4 ?+ _2 l) A0 w9 [4 r% b, g// execute certain tasks without having two or more instances of the same task, such as the planner- ]& [4 F! E0 M( s3 i
// recalculating the buffer upon a feedhold or override.
0 X4 n+ K: E# B1 d& b+ C) }, A5 G. i' c// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,3 k9 A+ `. g3 G- Q0 q6 L/ S
// limit switches, or the main program.
8 H' U0 _* [6 Y( R) C) c9 ?0 c
) z9 P, Z- ]1 E  O* o) o+ k6 W//執(zhí)行運(yùn)行時(shí)間命令,在需要時(shí)。這就是所謂的從各種主程序要檢查站+ z3 k/ g, E/ D7 g6 v/ B
//,主要是那里可能是一個(gè)while循環(huán)等待緩沖區(qū)空間或任何5 C; ~9 L$ _- h& X1 H- v& a. X7 F
//執(zhí)行時(shí)間從過去的止點(diǎn)可以超過幾分之一秒。, [5 Q4 H! f6 e" X
//這是一種異步執(zhí)行實(shí)時(shí)命令(又名多任務(wù))grbl的刀位點(diǎn)
" K" U6 c) N  Q//解析和規(guī)劃功能。這個(gè)函數(shù)也可以作為一個(gè)接口,用于中斷: N8 n0 N8 o0 i  k: n
//設(shè)置系統(tǒng)實(shí)時(shí)的旗幟,只有主程序處理,消除的需要- P; c: p% \: K; d3 M  Y
//定義更多的計(jì)算昂貴volatile變量。這也提供了一種控制方法
  _- c  O; m& o8 U//執(zhí)行某些任務(wù)不相同的兩個(gè)或多個(gè)實(shí)例的任務(wù),比如計(jì)劃
6 r) C+ X% I  N$ [0 D" J//重新計(jì)算緩沖feedhold或覆蓋。6 x+ ]# i" Y+ I% \
//注意:sys_rt_exec_state變量標(biāo)志設(shè)置任何過程,步驟或串行中斷,插腳引線,# K, ?* ]' Q% {" f8 w+ t8 P
//限位開關(guān)或主程序。4 V/ _2 t) J2 C$ o( m
void protocol_execute_realtime()
/ _8 `  g# v- Z/ s: f6 f{+ }! j+ [% }" K# h- f& r# D, v* \- ]
        // Temp variable to avoid calling volatile multiple times.
9 e$ O" Z0 I1 {: S- N        // 臨時(shí)變量來避免多次調(diào)用不穩(wěn)定。
4 a1 a4 J$ c* K, I, h        uint8_t rt_exec;
1 T  P; Y' b( N8 ~6 }        do{
" D$ |: T' e" P; \          if (rt_exec) {                 // 有標(biāo)志位置位進(jìn)入
( r; C7 \2 G; c* ]* ~1 p        + q+ l: o7 Y! A. a9 e: q0 ^# Q
            sys.state = STATE_ALARM; // 設(shè)置系統(tǒng)為報(bào)警狀態(tài)! n2 s' t6 X  }7 A
      report_alarm_message(ALARM_HARD_LIMIT_ERROR);        //報(bào)告報(bào)警信息為接近極限值" y% _2 s5 J8 p) ^/ I
    } else if (rt_exec & EXEC_ALARM_SOFT_LIMIT) {                        //報(bào)告執(zhí)行軟件限位報(bào)警
& h  O) W4 f# w! t! {* e$ l3 ]      report_alarm_message(ALARM_SOFT_LIMIT_ERROR);        //報(bào)告出現(xiàn)軟件限位報(bào)警
/ ?' q+ }' e7 o7 t7 E    } else if (rt_exec & EXEC_ALARM_ABORT_CYCLE) {                //執(zhí)行停止循環(huán)報(bào)警      
  y6 o( r' ]) l' s6 ~* _7 x& A+ L      report_alarm_message(ALARM_ABORT_CYCLE);                //出現(xiàn)終止循環(huán)報(bào)警
4 l  F; X0 k. v    } else if (rt_exec & EXEC_ALARM_PROBE_FAIL) {                        //執(zhí)行探查失敗報(bào)警# y0 t4 H* C( V- l
      report_alarm_message(ALARM_PROBE_FAIL);                        //出現(xiàn)探查失敗報(bào)警" e& d  {6 Q$ x/ u+ R* N/ Z: S
    } else if (rt_exec & EXEC_ALARM_HOMING_FAIL) {                //執(zhí)行返回原點(diǎn)失敗報(bào)警' O) @3 W& {2 r- x# _
      report_alarm_message(ALARM_HOMING_FAIL);                //出現(xiàn)返回原點(diǎn)失敗報(bào)警
8 z* i: O0 ]$ g    }
2 f- j+ W9 O' C5 n5 Y. i  A' ?2 v) T2 _
    // Halt everything upon a critical event flag. Currently hard and soft limits flag this.9 f$ I, V1 L9 w  L% o
    // 停止一切在一個(gè)關(guān)鍵事件標(biāo)志。目前硬和軟限制標(biāo)志# f# C! g8 ?$ c- a! T4 }  j
           if (rt_exec & EXEC_CRITICAL_EVENT) {                //如果系統(tǒng)是循環(huán)事件進(jìn)入' g( B' z6 w" S/ a; L8 Q
             report_feedback_message(MESSAGE_CRITICAL_EVENT);        //報(bào)告反饋信息. U# W/ P" x  `" c# i6 ]8 p, y) K
              bit_false_atomic(sys_rt_exec_state,EXEC_RESET);                         //清除目前的復(fù)位狀態(tài)) n: }0 Y; A+ \# U) ~

$ d  I4 t6 N  q6 R/ r        bit_false_atomic(sys_rt_exec_alarm,0xFF);                                 // 清除所有報(bào)警標(biāo)志
' V  y- ?8 Q. A! I6 ~; d% S        }       
  {* q3 ~& b0 H6 m1 k4 e: z) S6 k' h7 V; z
上面代碼將rt_exec = sys_rt_exec_alarm ,如果rt_exec為真,打印不同報(bào)警信息
) d  T& P( H+ s3 Y和限位保護(hù)信息,然后清除報(bào)警狀態(tài)4 G8 z: O9 j7 g
___________________________________________________________________________
' b. a5 g: L7 ~, F沒有報(bào)警進(jìn)行執(zhí)行下面代碼,執(zhí)行了終止命令,串口打印命令
2 T+ ^3 c0 S$ x) H1 d8 E+ m, V- |         // Check amd execute realtime commands        校驗(yàn)和執(zhí)行實(shí)時(shí)命令& p2 C1 _# o) D: n6 H* x
          rt_exec = sys_rt_exec_state; // Copy volatile sys_rt_exec_state
$ F4 s6 {; v/ u4 g) ]% t
2 [: l, V( I) l* y/ J        if (rt_exec) { // 輸入標(biāo)志是正確的執(zhí)行  G, P+ y( X- p: t" c

( V& u' ^2 _$ \7 _3 @+ \            // Execute system abort. 執(zhí)行系統(tǒng)終止命令
- M* [2 K. z: A  A+ T" ?( O            if (rt_exec & EXEC_RESET) {
4 |1 e3 G6 C7 i- ]: ^5 t# n' e              sys.abort = true;  // Only place this is set true.$ D/ A! R8 x6 H- [2 B6 @
              return; // Nothing else to do but exit.
% |; i- _5 [/ T4 t0 O        }0 \: p6 B& L) f+ A+ g1 s( E2 S4 c
  R: D% o3 h4 a" X
            // Execute and serial print status 執(zhí)行和串口打印狀態(tài)
2 z2 W& C% {" ?6 H3 |" ~            if (rt_exec & EXEC_STATUS_REPORT) { ! G2 ]' Y( t* s+ x1 f! f
              report_realtime_status();        //報(bào)告實(shí)時(shí)狀態(tài)
) ~. Z) _2 o; e( M3 I              bit_false_atomic(sys_rt_exec_state,EXEC_STATUS_REPORT);        //清除報(bào)告狀態(tài)清零
2 n9 M8 o1 b2 g- H: Y* z* \            }
7 ^6 Z1 o7 M; f; ?9 X; Y+ k+ d% C3 Z_____________________________________________________________________________0 D, ^! i' c" H5 L/ r8 X
下面代碼
- h7 b1 ^7 X( l6 V1 J7 K//執(zhí)行狀態(tài)。8 u$ z/ Q  I' I0 b: ]; d
//注意:所涉及的數(shù)學(xué)計(jì)算持有應(yīng)該足夠低對(duì)大多數(shù)人來說,即使不是全部,' e  z+ o# b$ z& D" Z7 Q! e
//操作場(chǎng)景。一旦啟動(dòng),系統(tǒng)進(jìn)入暫停狀態(tài)& a+ Q* @4 R; g1 E4 m- t
//主程序流程,直到重置或恢復(fù)。
, \9 [0 l1 ^/ p8 N9 J待辦事項(xiàng):檢查模式?如何處理呢?可能沒有,因?yàn)樗粫?huì)在空閑,然后重置Grbl。+ B9 C4 D7 Y) G, p; D2 w
狀態(tài)檢查容許狀態(tài)的方法。
9 p' V6 Q; l/ y( [8 b  D- Y
7 x6 D4 q8 u$ W" l# ?; O$ X        //如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入9 z8 f# }7 `' [: S/ ~+ j
            if (rt_exec & (EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR)) {        & S, P: k# c) a' p6 v
. T# L5 ]" H6 v: p: a
        //如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)" k0 ~+ J9 g/ D3 {$ E+ Q# Q
        if (sys.state == STATE_CYCLE) {
$ H, F2 Q& p2 m" ?2 E        st_update_plan_block_parameters(); //通知stepper module驗(yàn)算減速。
, d3 w+ A- N3 f5 b" C7 B        sys.suspend = SUSPEND_ENABLE_HOLD; // 開始暫停標(biāo)志
& V+ Y( `# r, ?/ s# ^8 e( Y5 h# t        }
0 k+ B% l4 |4 F, k# U
) K- d8 {( h/ i; {* d& R  l( ^        // 如果,Grbl空閑不在運(yùn)動(dòng)。簡(jiǎn)單的指示暫停就緒狀態(tài)。7 r8 }  t- [. d( w
        if (sys.state == STATE_IDLE) { sys.suspend = SUSPEND_ENABLE_READY; }
2 D( m2 L4 n. `  |1 J( S* a$ o. `7 O1 ]' X9 N; g

2 V, L, U8 o/ t! ?/ I        //執(zhí)行和標(biāo)志和減速運(yùn)動(dòng)取消并返回空閑。主要由探測(cè)使用周期
) A% I- @7 ?, ^1 Z  A        //停止和取消剩余的運(yùn)動(dòng)。       ' Q% {, h3 d) Z5 S, z. S! I" a
        if (rt_exec & EXEC_MOTION_CANCEL) {6 y6 o' k; a& S. B+ n6 L
          if (sys.state == STATE_CYCLE) { sys.state = STATE_MOTION_CANCEL; }
/ Y  r. \; e0 P- x' L: H: Z. Q7 W          sys.suspend |= SUSPEND_MOTION_CANCEL; 0 d1 E0 K3 |9 x
        }
4 j! Q; I) X& u1 h9 ~) L0 k) j) [6 O+ \
9 F" H% T& R+ V! Q  j        // 只在循環(huán)時(shí)執(zhí)行進(jìn)給保持減速
) ?/ l! ?* n+ _" Y$ l7 ~% n         if (rt_exec & EXEC_FEED_HOLD) {
+ Y. C0 O! j4 H5 h        //只有安全門為1才執(zhí)行保持進(jìn)給狀態(tài)賦值2 R# K$ L  V) s- F% g8 q
          if (bit_isfalse(sys.state,STATE_SAFETY_DOOR)) { sys.state = STATE_HOLD; }# Z7 N! ?/ }7 d/ G* s( S2 V# b
        }9 w7 \8 ]; x+ u5 @4 G# p$ J# m

! i/ S2 C1 ]% C        if (rt_exec & EXEC_SAFETY_DOOR) {0 j& Z% ^9 |" Q  F
          report_feedback_message(MESSAGE_SAFETY_DOOR_AJAR); % r- h. F% K" K/ b6 W2 A( R4 k( M
/ /如果已經(jīng)活躍,準(zhǔn)備好重新開始,CYCLE_STOP標(biāo)志設(shè)置為強(qiáng)制斷開。1 J6 l8 e. ?+ ]
/ /注意:只是暫時(shí)設(shè)置“rt_exec”變量,不是動(dòng)蕩的“rt_exec_state”變量。
- v: V/ H7 k, @  A& T; D' }- ~% e          if (sys.suspend & SUSPEND_ENABLE_READY) { bit_true(rt_exec,EXEC_CYCLE_STOP); }- K2 t4 a5 C' g
          sys.suspend |= SUSPEND_ENERGIZE;; M! f' @3 Y3 J: Y& T
          sys.state = STATE_SAFETY_DOOR;
3 r& a) K7 h9 r+ B+ h        }; [9 G0 b9 R# w) _- V/ `3 O
' g) M7 @, ~+ y; l  `7 N
bit_false_atomic(sys_rt_exec_state,(EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR));   
3 a) j$ [+ _& [1 _6 t
" x% S2 m' u2 ~; C% k}( M! a+ O; \) ^- D* I, k3 t. B
以上代碼執(zhí)行了( Z$ z" i& [; {, o6 P
1.如果全局各自報(bào)警標(biāo)志位其中(執(zhí)行取消動(dòng)作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入
" X6 w: y$ D* _6 ], s. @, b1 X+ `$ B* s# A2.系統(tǒng)為閑著狀態(tài), 開始循環(huán)狀態(tài), 回原點(diǎn)狀態(tài), 控制取消狀態(tài), 開始保持狀態(tài), 開始安全門狀態(tài)時(shí)進(jìn)入& G0 c: L5 ~' d& N$ V
3.如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)1 Y# l; K" X' A6 e8 b
4.如果系統(tǒng)閑置狀態(tài)執(zhí)行暫停就緒狀態(tài)
8 K8 H! Y& \1 [1 T& e5.執(zhí)行動(dòng)作取消% O/ q3 d4 q# p
6.如果是保持進(jìn)給狀態(tài),執(zhí)行保持進(jìn)給狀態(tài)8 V; w% h5 W  c1 }2 j" B2 H9 k
7.執(zhí)行安全門狀態(tài)
! p( J4 h! C! Q3 l" _: d最后執(zhí)行bit_false_atomic清標(biāo)志清除(執(zhí)行取消動(dòng)作)(執(zhí)行進(jìn)給保持)(執(zhí)行安全門)標(biāo)志位                 
# \  h' _" t. |) R5 p! M_____________________________________________________________________________
* B- ?) J) {- n) X2 W" c
0 O; U4 M* \1 Y8 h3 y/ s    // Execute a cycle start by starting the stepper interrupt to begin executing the blocks in queue.6 J7 U+ x' s+ {6 G% B$ c8 A5 n( y
    // 執(zhí)行一個(gè)循環(huán)開始啟動(dòng)步進(jìn)開始執(zhí)行中斷隊(duì)列的街區(qū)
% @2 Y. w% l* Q    if (rt_exec & EXEC_CYCLE_START) {        //循環(huán)開始狀態(tài)進(jìn)入# t5 Q- f" Y- N& }. v( j5 p) z6 Q
      // Block if called at same time as the hold commands: feed hold, motion cancel, and safety door.- M, k: Q; Y/ [9 }0 B" X8 ]7 s$ E3 k2 G
      // Ensures auto-cycle-start doesn't resume a hold without an explicit user-input.0 E. `8 w  F7 V; L2 f
          //塊如果在同時(shí)舉行的命令:保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門。 //確保auto-cycle-start沒有簡(jiǎn)歷沒有顯式的用戶輸入。6 B* B+ Y% q2 A5 O( v2 F& J0 J9 [
           4 O! o7 A9 l& H: a6 j' f
      if (!(rt_exec & (EXEC_FEED_HOLD | EXEC_MOTION_CANCEL | EXEC_SAFETY_DOOR))) {   //狀態(tài)機(jī)如果不是保持進(jìn)給,運(yùn)動(dòng)取消,和安全的門。   v4 h) Q' i3 v
        // Cycle start only when IDLE or when a hold is complete and ready to resume.0 I" N$ |) `/ M& E) s) B; H. z
        // NOTE: SAFETY_DOOR is implicitly blocked. It reverts to HOLD when the door is closed.
  w) e1 m) l8 v2 w                //循環(huán)開始時(shí)只有當(dāng)閑置或持有完成并準(zhǔn)備簡(jiǎn)歷。3 u8 d" i5 Z/ L: m, Y# j
                //注意:SAFETY_DOOR是隱式地屏蔽。它返回的時(shí)候門是關(guān)閉的。    , F1 c  a5 Y$ _7 A4 ^

! l: s2 K! ?1 D1 g1 Q$ }' A+ ?; o                // 如果系統(tǒng)狀態(tài)為閑著狀態(tài),系統(tǒng)狀態(tài)為開始進(jìn)給或運(yùn)動(dòng)取消,暫停標(biāo)志為位重新開始
: ?/ P7 a; a" J        if ((sys.state == STATE_IDLE) || ((sys.state & (STATE_HOLD | STATE_MOTION_CANCEL)) && (sys.suspend & SUSPEND_ENABLE_READY))) {; E0 k; Y  c: ]. m) B; ~  ?
          // Re-energize powered components, if disabled by SAFETY_DOOR.2 m# G6 S7 b' L8 k
          //        由SAFETY_DOOR重振組件供電,如果禁用。$ n& L4 K1 K5 }' j9 \! m
          if (sys.suspend & SUSPEND_ENERGIZE) { 2 l) M, q9 g' F- l" g: H, o
            // Delayed Tasks: Restart spindle and coolant, delay to power-up, then resume cycle.
! Q. C4 t1 O6 y. _( q# y5 y: C            //延遲任務(wù):重新啟動(dòng)主軸和冷卻劑,延遲升高,然后恢復(fù)周期。
5 I* U! ]- I! s7 Z            if (gc_state.modal.spindle != SPINDLE_DISABLE) {   //主軸模式不是失能進(jìn)入
- |/ x0 \7 p) f9 h2 ]              spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); //設(shè)置狀態(tài)和速度
4 }, h% |( N4 g              //待辦事項(xiàng):阻塞函數(shù)調(diào)用。最終需要一個(gè)非阻塞。. F* f# T: [6 n6 z6 s; _
                delay_ms(SAFETY_DOOR_SPINDLE_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
- i- R" n7 o/ ^! k$ I/ D  C            }( P* H% F3 Y7 l5 v  Y" o! ]
            if (gc_state.modal.coolant != COOLANT_DISABLE) { 8 g/ F* Y6 m- G7 c/ s
              coolant_set_state(gc_state.modal.coolant); % R, W8 G4 N7 Y0 Z9 w: T" I8 h
              delay_ms(SAFETY_DOOR_COOLANT_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
& a' Y, |2 Z4 @0 ^- J            }) v8 N, u4 q# F8 ~+ G5 j
            // TODO: Install return to pre-park position.3 l0 \. C9 X; e/ w
          }, p# u: I6 W( Z. \& b; |  d
______________________________________________________________________________________________________________
1 ]8 g- F" [6 [+ [- g- s          // Start cycle only if queued motions exist in planner buffer and the motion is not canceled.
2 r' c3 B7 h* R: T. }( m% G" W/ [                  
% }( p5 d/ n' j: ~                  //只有在隊(duì)列馬達(dá)存在規(guī)定的緩沖,并且動(dòng)機(jī)沒有讓取消,才會(huì)循環(huán)
" B1 g- e  I3 l2 |- e9 ?6 K                  7 b+ R; D# Y# e4 O
          if (plan_get_current_block() && bit_isfalse(sys.suspend,SUSPEND_MOTION_CANCEL)) {, k# `& H) T# l* ]" _3 b
            sys.state = STATE_CYCLE;/ l$ c- l. ^9 A; }( P' X/ _5 c2 |+ d
            st_prep_buffer(); // Initialize step segment buffer before beginning cycle.初始化步開始循環(huán)之前  V) H; L) p1 v$ p6 p. m
            st_wake_up();/ I' u( j+ `8 Q$ D
          } else { // Otherwise, do nothing. Set and resume IDLE state.否則,什么也不做,設(shè)置和復(fù)位空閑模式' c6 V- v4 z+ y' ]# {+ S9 \9 G
            sys.state = STATE_IDLE;
# {+ C9 g9 {$ }          }
  @7 b2 l# M5 ]          sys.suspend = SUSPEND_DISABLE; // Break suspend state.
# E" A' T; n6 y        }
9 y# C  u  t5 _3 ^* Y, ~6 ~      }    ( [8 Q2 X2 X" f7 G6 `0 V; H$ N- O
      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_START);          M: o* I. m7 i( s, I
    }
5 C9 X- q1 m4 K. x
$ i, a% c$ V3 l2 V- y_______________________________________________________________________________________________________
9 F6 X) I6 x2 a5 o5 x0 b    // Reinitializes the cycle plan and stepper system after a feed hold for a resume. Called by " K' |2 Z4 ^" `1 ^1 k* g0 m
    // realtime command execution in the main program, ensuring that the planner re-plans safely.
: `( {9 {1 L) B# K    // NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper
4 z4 d# ^$ X% s4 D: u# v* j    // cycle reinitializations. The stepper path should continue exactly as if nothing has happened.   8 c/ |2 W& \* A3 m/ f' p- {6 A
    // NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
  P9 g* m* z8 i/ [1 a
4 H2 @& ?+ M" u6 C- a        //重新啟動(dòng)后循環(huán)計(jì)劃和步進(jìn)系統(tǒng)的進(jìn)給保持簡(jiǎn)歷。通過實(shí)時(shí)命令執(zhí)行主程序,確保安全計(jì)劃重新計(jì)劃。; d  Z3 ^7 K5 F) Y
        //注意:畫線算法變量仍保持通過規(guī)劃師和步進(jìn)/ b2 h9 t7 g9 k
        //循環(huán)僅。步進(jìn)路徑應(yīng)該繼續(xù),好像什么都沒發(fā)生一樣。       
' a/ V: k1 _' Z2 ~% V) O& q        //注意:EXEC_CYCLE_STOP由步進(jìn)子系統(tǒng)周期或進(jìn)給保持時(shí)完成。
) u' S" r: _7 G9 [) |  r& ~4 }
) q0 _- Q4 X; ~    if (rt_exec & EXEC_CYCLE_STOP) {                         //如果是循環(huán)停止?fàn)顟B(tài)進(jìn)入
4 h. g6 L# [/ k' R      if (sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) {
6 o7 R* F: b& [0 n& [; ]% G        // Hold complete. Set to indicate ready to resume.  Remain in HOLD or DOOR states until user3 f2 T4 R1 x9 S4 _+ @
        // has issued a resume command or reset.% I0 t4 x- l7 s, Z% [$ Y+ \

* h. T# L. f( Q* Q' t                //保存完整。設(shè)置為指示準(zhǔn)備簡(jiǎn)歷。繼續(xù)持有或門狀態(tài),直到用戶
% O1 _( H* v! [3 K2 k                //已發(fā)布了一份簡(jiǎn)歷命令或重置。& Z, N8 s% E% J5 q
               
) x7 i- T6 V5 ~, {4 k( P) i        if (sys.suspend & SUSPEND_ENERGIZE) { // De-energize system if safety door has been opened. 如果安全的門已被打開。斷開系統(tǒng)
5 c+ u# Y6 |; L          spindle_stop();
# k: c9 [' L, d. R! h7 N) G          coolant_stop();5 t2 e$ }9 X% ]4 B- D0 s% X. h0 v
          // TODO: Install parking motion here. 安裝停車動(dòng)作。
5 ~9 O' }% Y5 E% p8 t4 K        }
2 W* d6 |* q/ p; Y        bit_true(sys.suspend,SUSPEND_ENABLE_READY);
! P0 B0 Q* \4 {0 S, W# V      } else { // Motion is complete. Includes CYCLE, HOMING, and MOTION_CANCEL states. 電機(jī)完成,循環(huán),回原點(diǎn),,MOTION_CANCEL
% Z0 P8 m1 }0 \+ [        sys.suspend = SUSPEND_DISABLE;9 T3 U1 e9 F" B, }" h
        sys.state = STATE_IDLE;5 f- W# [( O% K
      }# x7 i1 w1 O4 E6 ^( {
      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);7 r; K) P& J) f! ]+ p5 B( d
    }
& N$ _$ M- L$ c& O% @   
* W" d9 X) X# m7 t0 Q  }" b+ w: q8 W) M
___________________________________________________________________________________________________
& f6 X. T  O( H- t; b; f6 N7 e+ C) h1 I
  // Overrides flag byte (sys.override) and execution should be installed here, since they 1 b4 Y7 E4 x9 \/ E7 \$ o* n
  // are realtime and require a direct and controlled interface to the main stepper program.6 z  D/ Y! W: U1 l4 }" U6 N

+ V4 X1 }7 _/ v! u( }  //重寫標(biāo)志字節(jié)(sys.override)和執(zhí)行應(yīng)該安裝在這里,因?yàn)樗麄?br /> 5 H: m$ V! ?, f( y- E  //實(shí)時(shí)和需要直接和控制接口的主要步進(jìn)程序。+ f3 w0 l( f: W9 B" V% Y0 F
3 c0 ?. Z+ ?  x( W8 p
  j* Y5 y" ~- A7 y
  // Reload step segment buffer 重新加載步段緩沖7 J, \! S7 `5 U1 k
  if (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_MOTION_CANCEL | STATE_SAFETY_DOOR | STATE_HOMING)) { st_prep_buffer(); }
  o  l( ~" u% z" e9 \% S1 L" @$ }$ b7 p; S2 v8 K, m
  // If safety door was opened, actively check when safety door is closed and ready to resume.
4 V/ W6 v! l* B5 ^  // NOTE: This unlocks the SAFETY_DOOR state to a HOLD state, such that CYCLE_START can activate a resume.       
1 {" X4 s+ _# e: `1 v2 K" K' m2 k4 Q* M/ N2 _
//如果安全的門被打開,積極檢查當(dāng)安全門關(guān)閉,準(zhǔn)備簡(jiǎn)歷。! [* {& \% ?+ y1 {2 ~8 l
  //注意:這解鎖SAFETY_DOOR狀態(tài)保持狀態(tài),這樣CYCLE_START可以激活一個(gè)簡(jiǎn)歷。4 y1 F* `8 x- C" W4 e
6 {8 q: d6 c7 C& {8 k7 ?- y+ Y
  if (sys.state == STATE_SAFETY_DOOR) {                 //安全門狀態(tài)進(jìn)入
% E  j( ?' x! Y4 @1 }) N7 ]# P    if (bit_istrue(sys.suspend,SUSPEND_ENABLE_READY)) { ' R# M! j; L, p+ y- p8 ~. f" z
      if (!(system_check_safety_door_ajar())) {
2 M* q0 Q: \; V/ g$ o        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)歷。5 L8 H! y8 `7 C; u
      }
6 d; O% v9 d" m- D$ B& n    }
9 r6 x! I. l$ R2 Q4 u  }) k: O) S) i; ]' Q

6 Z7 q# P( X9 P  } while(sys.suspend); // Check for system suspend state before exiting.7 G1 t* m: ]; H* s
  7 O3 R) k# r2 n5 Q7 Q7 [
}  
作者: szg不敗    時(shí)間: 2016-8-25 09:31
樓主這些代碼。是網(wǎng)上搜來,然后自己組合的嗎?全是自己想的,那是牛逼了
作者: 1五湖四海1    時(shí)間: 2016-8-25 22:19
szg不敗 發(fā)表于 2016-8-25 09:31
) ?) w% J( M6 J" K3 H7 {樓主這些代碼。是網(wǎng)上搜來,然后自己組合的嗎?全是自己想的,那是牛逼了
3 Q; E( K  F2 C# g9 |' p1 V5 F5 w
外國(guó)的開源軟件grbl,在研究它,將打注釋了下而已,研究透徹了好移植的其他平臺(tái)應(yīng)用,學(xué)習(xí)階段。
  ~0 q; B: `7 W2 F- zhttps://github.com/grbl/grbl
, S' r8 s% |3 U& f
作者: 1五湖四海1    時(shí)間: 2016-8-25 22:34
本帖最后由 1五湖四海1 于 2016-8-25 22:44 編輯 * J5 O3 [" G7 z; s

" r: Z* v. z) o這個(gè)defaults.h文件作為一個(gè)中央默認(rèn)設(shè)置配置不同的機(jī)器類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器。這里的設(shè)置所列出的文件是由用戶提供的,
1 H! u$ l( o8 J$ t" R3 C所以您的你的需求可能不同。所以應(yīng)該你了解你的機(jī)器和調(diào)整設(shè)置根據(jù)你的個(gè)性的需求,制造機(jī)器。) E" s6 D, k7 |! V5 P
defaults_h文件是選擇是否將一些參數(shù)設(shè)置為默認(rèn)值0 x7 G$ q+ X0 D, y
定義各種參數(shù)3 Y# M- y* V/ n6 {
1.defaults/defaults_generic.h        //Grbl通過通用默認(rèn)設(shè)置就可以在不同的機(jī)器上工作。0 A) ]" z) c3 O+ g- z5 N! o
2.defaults/defaults_sherline.h  //描述:Sherline 5400制造廠三個(gè)NEMA 23客戶KL23H256-21-8B 185扭力步進(jìn)電機(jī)  @$ H1 F$ i8 S/ n0 c$ ~
3.defaults/defaults_shapeoko.h  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的
0 u7 h- M1 {! Z: o) J) b4.defaults/defaults_shapeoko3   //描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 23步進(jìn)電機(jī),由CarbideMotion驅(qū)動(dòng)的+ d) h% @( n9 t
5.defaults/defaults_x_carve_500mm //描述:X-Carve 3 d卡佛數(shù)控機(jī)有三個(gè)200步/汽車由Synthetos牧師grblShield 24 v。
  i4 \, s; E% a$ C6 u7 V6.defaults/defaults_zen_toolworks_7x7         //描述:禪宗Toolworks 7 x7機(jī)有三個(gè)Shinano SST43D2121 65扭力NEMA 17步進(jìn)電機(jī)。導(dǎo)螺桿不同于一些ZTW包,大多數(shù)是1.25毫米/牧師而不是8.0毫米/牧師。由30 v 6電源和TI DRV8811步進(jìn)電機(jī)驅(qū)動(dòng)程序/ H, r. S8 Q, h/ M2 Z" n, r
7.defaults/defaults_oxcnc                 // Grbl設(shè)置OpenBuilds牛數(shù)控機(jī)床
" E/ W8 n0 h2 j1 l8.defaults/defaults_simulator' L$ X% N1 _( e3 t+ w

" m+ K8 x* l0 {4 n/*
$ S9 ^1 I. V7 Z) z) D  defaults.h - defaults settings configuration file  ]6 a' t+ ?( T4 F
  Part of Grbl3 V; p, G# p$ G) O8 D  K
7 \9 j  k7 y' x7 b9 j( p/ o. N
  Copyright (c) 2012-2015 Sungeun K. Jeon
% s! Q0 \. |5 ^' _0 ~% E& `9 U/ ]7 O2 Q
  Grbl is free software: you can redistribute it and/or modify8 b# ]3 [. b1 @: ^: g  g
  it under the terms of the GNU General Public License as published by
, @& v: T0 I. {2 D1 h: E% X  the Free Software Foundation, either version 3 of the License, or; o5 i- L: ^2 f5 m
  (at your option) any later version.& L% A: G: N9 S. j: l$ h+ q
& C0 q  R5 \6 M6 Y- r2 ?% ]: w; d" W
  Grbl is distributed in the hope that it will be useful,
! |& {; M' t2 s( H7 e" I  but WITHOUT ANY WARRANTY; without even the implied warranty of
, V, A4 ~& w" m% {  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% r; k- Z' I5 ?( `, q$ r2 X  GNU General Public License for more details.9 A5 n1 `1 c6 K, g" ?- b
" i( N$ y& \( r( J
  You should have received a copy of the GNU General Public License
% F6 o0 C* `) D* C  R  C/ W  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
2 s$ ~" X+ ^% b: n2 X8 i*/
5 g0 S; }" Z2 b* y; w' H. K5 J* c
/* The defaults.h file serves as a central default settings selector for different machine4 @9 u9 I3 O, u& {, x
   types, from DIY CNC mills to CNC conversions of off-the-shelf machines. The settings ' ?. j3 I# i" ]0 S5 P
   files listed here are supplied by users, so your results may vary. However, this should
5 }( {  y1 v4 _' ?3 ]   give you a good starting point as you get to know your machine and tweak the settings for1 P/ V5 r  c4 H  Z2 C( Z
   your nefarious needs.
; {4 s) p$ \5 ^   Ensure one and only one of these DEFAULTS_XXX values is defined in config.h
# {) c7 ]# X2 C, ~/ o$ \/ ]$ l* T
" }* T4 o. Y3 h8 X   The defaults.h文件作為一個(gè)中央默認(rèn)設(shè)置選擇不同的機(jī)器
' @, f2 G+ h3 D' H   類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器。的設(shè)置! {3 B) i3 S$ v4 V, z
   這里列出的文件是由用戶提供的,所以您的結(jié)果可能不同。然而,這應(yīng)該
+ c6 l- @) \% O& ~/ C5 x   給你一個(gè)很好的起點(diǎn),你了解你的機(jī)器和調(diào)整設(shè)置
. N; ?2 @. n& X   你的個(gè)性的需求。
3 _" r, I2 A# H" q   確保一個(gè)且只有一個(gè)這些DEFAULTS_XXX config.h中定義的值
3 ~5 Z- A% C( p   */
" `/ |1 A$ B, D4 x
" x3 W8 x+ _7 ^* J* b0 q#ifndef defaults_h
6 F7 }/ ?$ n' r: J( F+ a% z! n5 j% r+ ~; r3 M- p% d
// Only define the DEFAULT_XXX with where to find the corresponding default_XXX.h file.
+ |2 _# p+ h! |* d  @1 R// Don't #define defaults_h here, let the selected file do it. Prevents including more than one.
; G$ f& M: _0 F5 z5 T2 q. b; l. l//只有定義DEFAULT_XXX在哪里可以找到相應(yīng)的DEFAULT_XXX。h文件。
5 B0 B7 m2 ^: u9 c, x//別在這里# define defaults_h,讓選中的文件。防止包括不止一個(gè)。
" U( p+ H, f/ i/ T1 \
3 ~  l4 ^  K3 f* Z, P2 v#ifdef DEFAULTS_GENERIC3 \! J0 c6 Q3 p  M
  // Grbl generic default settings. Should work across different machines.
0 U$ R3 s( C& K3 f  a' j  // Grbl通過通用默認(rèn)設(shè)置就可以在不同的機(jī)器上工作。
' k1 D: p/ V0 ?5 Y5 X5 F( w  #include "defaults/defaults_generic.h"9 g& l8 k( c8 u* V2 P
#endif  j9 `- y3 q9 s$ o
/ p. y1 E( R  [+ E' t" O7 O( a
#ifdef DEFAULTS_SHERLINE_5400
: y* I  w' [9 a5 j6 d7 z  // Description: Sherline 5400 mill with three NEMA 23 Keling  KL23H256-21-8B 185 oz-in stepper motors,5 }; n+ {  _5 J# V. U# h+ }
  // driven by three Pololu A4988 stepper drivers with a 30V, 6A power supply at 1.5A per winding.: M! C$ F$ f$ _% s
  //描述:Sherline 5400制造廠三個(gè)NEMA 23客戶KL23H256-21-8B 185扭力步進(jìn)電機(jī),
5 d& I( ?, }3 X  R  //由三個(gè)Pololu A4988步進(jìn)驅(qū)動(dòng)30 v,6在每1.5繞組供電。' y. J' n% G* a& X5 I6 j& k$ L- a

0 G' o! u! \7 y" M7 M7 J8 @( ~  #include "defaults/defaults_sherline.h"
) P0 I  M  p- U; x#endif
! g+ K! U" d' w$ o7 K4 o) [2 h. B4 I9 J  \
#ifdef DEFAULTS_SHAPEOKO( B( E% F. C2 J& C9 I+ B% E
          // Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos/ `& D. S/ o3 m% {) b: W3 }
          // grblShield with a 24V, 4.2A power supply.
* M" Q" f- M7 f$ e$ ^9 w5 u         // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的$ G  O, B7 a, ?" n
        // grblShield 24 v,4.2電源。
8 `$ G, s' r3 R; |6 S( l% f) @# H7 k' K, T
  #include "defaults/defaults_shapeoko.h"
7 f- g2 i! d# Y/ `#endif
, w$ c% v1 i" T& |: a+ {6 r# `. ?2 n% G/ v/ S2 f( J, f* X/ e
#ifdef DEFAULTS_SHAPEOKO_21 T; C% Q4 v( F4 r
  // Description: Shapeoko CNC mill with three NEMA 17 stepper motors, driven by Synthetos
0 ?2 e! C$ \/ \0 Z  // grblShield at 28V.
; C7 j3 z/ O3 V5 v4 ]  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 17步進(jìn)電機(jī),由Synthetos驅(qū)動(dòng)的: l. a: |& e; }, `, ^% {8 W5 {
  // grblShield 28 v。
- [* ]2 k# W1 t$ S4 o; w$ x3 ?. ~; j
+ j- P$ H; I! _! c$ B  #include "defaults/defaults_shapeoko2.h"5 ~& v0 J: ^. h1 H- Y6 M7 q
#endif
" A5 a" |8 u1 g8 i- ~! v
! a4 S% N. z( e  U6 N3 u8 [, ]0 j& M#ifdef DEFAULTS_SHAPEOKO_3  I6 G) U$ T7 \$ o0 I, ~
  // Description: Shapeoko CNC mill with three NEMA 23 stepper motors, driven by CarbideMotion
9 y9 g8 t  k/ F; _  // 描述:Shapeoko數(shù)控機(jī)有三個(gè)NEMA 23步進(jìn)電機(jī),由CarbideMotion驅(qū)動(dòng)的
& C  y1 n, ?( ]) l, N; w
- g$ D& I9 t0 y; v% C4 i  #include "defaults/defaults_shapeoko3.h"% M" G6 c# h/ {8 H6 Q+ v# w
#endif: ~, R- g: Z( _+ A1 `5 k
( d8 r" V* O+ Y8 `* Z* `7 ~
#ifdef DEFAULTS_X_CARVE_500MM
$ Q+ {. v* ?9 U: h0 |4 I  // Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos
. Y0 a5 I1 i9 K7 [7 u; `; a  // grblShield at 24V.: x9 {! w: \9 b7 |- b0 ?; l
  // 描述:X-Carve 3 d卡佛數(shù)控機(jī)有三個(gè)200步/汽車由Synthetos牧師grblShield 24 v。
2 h- l3 Y9 {, }* b. P# ~  #include "defaults/defaults_x_carve_500mm.h"
9 E4 u, f% q8 q#endif9 h* y9 A" K' {
2 p9 t0 j  z: m
#ifdef DEFAULTS_X_CARVE_1000MM
" ^* }" ^) ~  F' y% j1 p9 i1 ]7 d  // Description: X-Carve 3D Carver CNC mill with three 200 step/rev motors driven by Synthetos5 P) u$ L2 S$ z4 }
  // grblShield at 24V.
& O! Z" @, V& C, E5 Z1 }  #include "defaults/defaults_x_carve_1000mm.h"
/ \: ~" [0 }7 a* O. M/ I#endif
5 h- p/ G/ T: }- v$ w  t) w. i; M3 z( w  k
#ifdef DEFAULTS_ZEN_TOOLWORKS_7x79 c5 Z6 d$ E2 `/ w1 X
  // Description: Zen Toolworks 7x7 mill with three Shinano SST43D2121 65oz-in NEMA 17 stepper motors.+ Y7 o: o0 X+ g0 C8 _9 t0 R
  // Leadscrew is different from some ZTW kits, where most are 1.25mm/rev rather than 8.0mm/rev here.5 b* [8 M5 K* E5 p- `
  // Driven by 30V, 6A power supply and TI DRV8811 stepper motor drivers.
# g- b, b# \; [! S, W( Q0 e  //描述:禪宗Toolworks 7 x7機(jī)有三個(gè)Shinano SST43D2121 65扭力NEMA 17步進(jìn)電機(jī)。
, a1 Z/ P3 S4 u  //導(dǎo)螺桿不同于一些ZTW包,大多數(shù)是1.25毫米/牧師而不是8.0毫米/牧師。' X* S$ s& r* e2 B3 A3 F6 i& a1 D4 e/ j
  //由30 v 6電源和TI DRV8811步進(jìn)電機(jī)驅(qū)動(dòng)程序。
1 T- A( a" O/ j7 M2 C
8 s# `) R) d( K( h* C9 J' w  #include "defaults/defaults_zen_toolworks_7x7.h"
* C7 g9 B) _3 P3 {* h/ }0 A#endif
- W  T. v* ?) x4 r: i3 y2 b3 J& u' [$ V0 M, \! N
#ifdef DEFAULTS_OXCNC
% b  \7 Y+ i4 h. k# A  // Grbl settings for OpenBuilds OX CNC Machine
0 p) Z, h' _" X' K! b. F  // http://www.openbuilds.com/builds/openbuilds-ox-cnc-machine.341/0 m. L3 R) E$ x/ A- u! D5 ^

2 h* _; T1 q( P0 E& N7 s5 m  // http://www.openbuilds.com/builds/openbuilds-ox-cnc-machine.341/ - y. ^% C. g) a9 l. Z1 n, ]8 n
  #include "defaults/defaults_oxcnc.h" // Grbl設(shè)置OpenBuilds牛數(shù)控機(jī)床* b# w+ r# S" O. v: v
#endif$ |3 Q. E4 S2 Y

0 R6 b- c1 @- F5 Y( U! E) E#ifdef DEFAULTS_SIMULATOR
4 J5 i% x2 I2 h! Q/ j' b  // Settings only for Grbl Simulator (www.github.com/grbl/grbl-sim)8 J- ?0 ~6 T8 n+ O. Q2 j/ i# Y
  #include "defaults/defaults_simulator.h" //設(shè)置只對(duì)Grbl模擬器(www.github.com/grbl/grbl-sim)* x: A3 S. L+ c: t: U
#endif, g7 x  Z: z! ]
  a( t, D! U  [; G+ ^
#endif& H2 p9 D5 C; P4 @- s/ p

' B8 h6 R# J2 Y__________________________________________________________________________________________________________________
  A6 d! ^/ B; p; `4 b/*$ t$ n+ I; h* n& W8 W4 R
defaults_generic.h -默認(rèn)設(shè)置配置文件Grbl的一部分" `( B# H4 u, ^0 _  ~
版權(quán)(c)2012 - 2015 Sungeun k全7 T4 E+ E$ u# j% W$ A* f
Grbl是免費(fèi)軟件:可以重新分配和/或修改
0 g: A& n5 l, ~GNU通用公共許可證的條款下發(fā)布的. _3 L5 M+ l1 l' d
自由軟件基金會(huì),版本3的許可,或) c* e( B+ Y1 T2 k* p
(任您選)其后的版本。/ _9 r" C( b& W+ v* U% d( k

6 b% z, {+ j; k4 W, aGrbl分布,希望這將是有用的,
- J4 _- W- L; [8 c- ]) \9 f- Y但是沒有任何保證;沒有即使的默示保證
* p6 l( y3 @4 i  _: X& K適銷性或健身為特定目的??吹?br /> 7 O) H7 a; U  Z' u' sGNU通用公共許可證的更多細(xì)節(jié)。
. t2 a$ F* ~8 x! i6 r+ [7 Q% D% {9 C1 }/ s
你應(yīng)該收到了GNU通用公共許可證的副本5 c6 ?' O; z( J& Y' X3 K% H
連同Grbl。如果沒有,看< http://www.gnu.org/licenses/ >。' z( K2 ?1 S. p% t2 g
* /
0 ^% F# I/ h* ]5 p# p
( I7 G( b6 X1 [/ ?% v9 R- n/ *默認(rèn)值。h文件作為一個(gè)中央默認(rèn)設(shè)置文件不同的機(jī)器
/ e2 J; G4 A; k3 Y類型,從DIY米爾斯數(shù)控CNC轉(zhuǎn)換的現(xiàn)成的機(jī)器。的設(shè)置
$ A4 p# F- ?& F% @  P5 X這是由用戶提供,所以您的結(jié)果可能不同。然而,這應(yīng)該給你
2 f# v  R' S5 c; u. l一個(gè)好的起點(diǎn),你了解你的機(jī)器和調(diào)整的設(shè)置
/ C, J6 g; H0 h4 ^邪惡的需求。*/
5 b( @$ u& I" S/ Y; e0 g' C, T) F! L9 |/ H9 F/ I/ c% V
& c4 W( a0 J6 T, S& K! [9 l/ |
#ifndef defaults_h
4 q4 i- j' H, F0 R9 O5 Q1 `+ k#define defaults_h
  @  o# g) E9 g4 {- h9 F) S/ Y8 K( `! h( s( i
  // Grbl generic default settings. Should work across different machines.
' l( \. v+ S6 q0 o3 N  #define DEFAULT_X_STEPS_PER_MM 250.0        //X軸每mm脈沖當(dāng)量        0 N+ j9 C3 B: ?) T
  #define DEFAULT_Y_STEPS_PER_MM 250.0
; G9 M. S8 {$ p7 j" R0 Z  #define DEFAULT_Z_STEPS_PER_MM 250.0% H3 A3 Y" s. P3 U+ b# Z2 J9 X# }
  #define DEFAULT_X_MAX_RATE 500.0 // mm/min 最大速度
& A# c' C( o6 c+ a  #define DEFAULT_Y_MAX_RATE 500.0 // mm/min! s; q$ u% n& Q
  #define DEFAULT_Z_MAX_RATE 500.0 // mm/min  q& }% ]' d3 S  Z
/*這是毫米/秒/秒的加速度。
; m& ^  e, u; v4 \你不需要理解這是什么意思,我只想說,一個(gè)較低的值給smooooother加速度而價(jià)值更高的收益率更嚴(yán)格的措施,達(dá)到所需的進(jìn)料速度更快。
! G0 f" r+ m6 G從技術(shù)角度講,這是您的機(jī)器的點(diǎn)對(duì)點(diǎn)的加速度,獨(dú)立于軸。設(shè)置加速度值高達(dá)你最限制軸可以讓你在不丟失任何步驟。' t* T# ?. Q5 {7 @) I
通常你想給自己一些緩沖,因?yàn)槿绻闶チ瞬襟E,Grbl不知道這發(fā)生了(開環(huán)控制步進(jìn)),并將繼續(xù)。*/3 `, }' j$ P( x& B, w8 r2 Z
  #define DEFAULT_X_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2        加速度* d" J0 x& |2 `( \
  #define DEFAULT_Y_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^22 }/ D- {+ ?" @- K3 z6 b
  #define DEFAULT_Z_ACCELERATION (10.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
% g5 M$ v$ @- ^! y- e  #define DEFAULT_X_MAX_TRAVEL 200.0 // mm                最大步行: t! F1 g( J; d4 h4 S
  #define DEFAULT_Y_MAX_TRAVEL 200.0 // mm               
& `! w6 _, F# e: n0 A! j  #define DEFAULT_Z_MAX_TRAVEL 200.0 // mm               
" J  G$ B# u0 ~3 @  #define DEFAULT_STEP_PULSE_MICROSECONDS 10        //步進(jìn)驅(qū)動(dòng)脈沖長(zhǎng)度
  l" {1 m9 C+ q5 W# ^% q  #define DEFAULT_STEPPING_INVERT_MASK 0                //步進(jìn)是否反轉(zhuǎn)
" f1 b4 L5 w5 V8 v! ^  #define DEFAULT_DIRECTION_INVERT_MASK 0                //方向是否反轉(zhuǎn)) n. |5 h  P7 D8 v6 v
  /*
0 b0 H# @1 X! s: }% h6 I  每次你完成步進(jìn)運(yùn)動(dòng)和停止,Grbl將禁用默認(rèn)步進(jìn)。4 J% P; H  W% U/ x3 f! ~
鎖步進(jìn)空閑時(shí)間時(shí)間長(zhǎng)度Grbl將步進(jìn)鎖之前禁用。. h# m. J2 \4 o- Z' x3 l
根據(jù)系統(tǒng)中,您可以將這個(gè)參數(shù)設(shè)置為零,禁用它。對(duì)他人,你可能需要25 - 50毫秒來確保你的斧子來完成禁用前停止。(我的機(jī)器往往漂移稍微如果我沒有啟用。)& p# D5 L7 K" I7 E! _
或者,你可以讓你的軸在任何時(shí)候啟用通過將這個(gè)值設(shè)置為最大255毫秒。再次重復(fù),你總是可以保持所有軸通過設(shè)置啟用7美元= 255。*/
% a) m( T3 x4 i, Q  #define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 // msec (0-254, 255 keeps steppers enabled)步進(jìn)閑著時(shí)間( ]) t3 k$ N; e1 Q
  #define DEFAULT_STATUS_REPORT_MASK ((BITFLAG_RT_STATUS_MACHINE_POSITION)|(BITFLAG_RT_STATUS_WORK_POSITION)) //是否打印狀態(tài)報(bào)告
/ S2 _* q, t6 m/*一些高低cnc-stepper控制器需要輸入反方向和步驟。
$ f( x$ W7 i+ f$ m/ }  R/ d% X5 B3 u信號(hào)線路通常是高或低信號(hào)方向或高,低了幾微秒一步事件信號(hào)。為了達(dá)到這個(gè)目標(biāo),Grbl可以反轉(zhuǎn)輸出比特來滿足特定的需求。
8 \0 d- m( s" D( @- Q4 F) a反掩碼值是一個(gè)字節(jié),xor的步驟和方向步進(jìn)港數(shù)據(jù)之前發(fā)送。這樣你可以使用這兩個(gè)轉(zhuǎn)化步驟脈沖或轉(zhuǎn)化的一個(gè)或多個(gè)方向的軸。% S5 f  [* P) B8 y! k$ `; I1 m
這個(gè)字節(jié)對(duì)應(yīng)的比特分配給介入config.h別針。請(qǐng)注意,不用于反演位0和1。默認(rèn)比特分配是這樣的:*/9 H  L* c# H9 X: y

( q! z( b% m2 _. O/*  轉(zhuǎn)彎路口偏差使用加速度經(jīng)理決定它如何快速穿過一條路徑。
" i* F0 ?7 W6 F+ F' e: N  數(shù)學(xué)有點(diǎn)復(fù)雜,但總的來說,更高的價(jià)值給一般快,可能的波動(dòng)運(yùn)動(dòng)。低價(jià)值使得加速度經(jīng)理更加謹(jǐn)慎,將導(dǎo)致小心和慢轉(zhuǎn)彎。) `" h; L" _1 s0 r
  如果你遇到問題,你的機(jī)器試圖把一個(gè)角落太快,降低此值使它慢下來。4 I; r6 k+ b# ~& ^! \
  如果你想讓你的機(jī)器通過連接移動(dòng)得更快,增加這個(gè)值速度。+ {. R3 y, A1 ?' r6 N- C& Y
  為技術(shù)人員,點(diǎn)擊這個(gè)鏈接閱讀關(guān)于Grbl轉(zhuǎn)彎算法,速度和結(jié)角占一個(gè)很簡(jiǎn)單,高效和可靠的方法。*/
4 ^% g+ l: w$ u3 i" ~. w7 ^; _4 H
0 W) \% l2 T2 f& j/ }$ S/ P  #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm        //偏差
$ Q9 V5 b2 K- }- {5 x! O  #define DEFAULT_ARC_TOLERANCE 0.002 // mm                //圓弧公差9 u" Y+ [4 \% B  R5 m
  #define DEFAULT_REPORT_INCHES 0 // false                //打印英寸
' q! N3 y1 p) O/ S: J; w  /*默認(rèn)情況下,步進(jìn)使銷是啟用禁用高和低。如果您的設(shè)置需要相反的,只是反步進(jìn)使銷通過輸入15美元= 1。禁用與15美元= 0。(可能需要一個(gè)動(dòng)力循環(huán)加載的變化。)*/" B- V. S1 A2 A8 U) C/ k
  #define DEFAULT_INVERT_ST_ENABLE 0 // false$ N0 J1 `/ ]* x
  #define DEFAULT_INVERT_LIMIT_PINS 0 // false        //反轉(zhuǎn)限位引腳. l! L! ?$ n' L8 U+ Q
  #define DEFAULT_SOFT_LIMIT_ENABLE 0 // false        //軟件限位
& U9 y7 ~8 L; Y% k$ ~  #define DEFAULT_HARD_LIMIT_ENABLE 0  // false        //硬件限位8 p5 ?+ l, Q* r  L7 E
  #define DEFAULT_HOMING_ENABLE 0  // false                //回原點(diǎn)使能
3 c  v& A* e) M: y  O  #define DEFAULT_HOMING_DIR_MASK 0 // move positive dir" o" f( V% J1 S) |9 t: d
  #define DEFAULT_HOMING_FEED_RATE 25.0 // mm/min
; x1 y; |! A! x( D* y# g  #define DEFAULT_HOMING_SEEK_RATE 500.0 // mm/min% u; S4 S9 V' W: |
  #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)防抖動(dòng)延時(shí)3 r- R. H2 O5 D) k/ D1 v! K
  #define DEFAULT_HOMING_PULLOFF 1.0 // mm/ f. c8 _, {3 U6 [9 p& h

, Q, B5 R: o' t: E- w& Q6 I#endif
; h* `5 B) E4 e$ h7 L4 y0 l* i, t* V3 H$ U; x- H1 S% t

% @+ ?5 H7 L( k7 I% _! Z; T: L6 M. m( P$ z0 H0 ?9 _* R) H

4 `/ z6 W# T8 [8 p9 l2 |2 m2 m* d4 d4 F' n$ o9 ]

2 q: r( f% w/ w9 x# Z3 ~0 m9 n7 h' S- E, c* h& H; @2 C
2 }; ~. P+ c. C8 v6 o/ G# V0 T

- X! U& N% Y3 q6 A0 N+ Z: o5 u9 Q  x& M( ?8 e
0 n& T1 L7 p+ |& q8 u& e  P. y4 U

: T: ?  E" o+ h
* Z8 M1 m4 a: g& p+ l) i  g) A# c# `" w$ ^
* F7 G1 [( F! f# f! j/ c

$ Y3 M! U+ ]/ ^  w& s/ d0 ?$ E
* u/ z1 {  T: R) q6 v: b5 Z' J; P$ v2 N7 ~0 V& \" Z0 C0 m

& G) g9 d2 A5 l. X
* B+ _( \5 q% z. v/ v0 O6 v$ m& }, B8 [# B
! ^7 q* K9 X6 @& E* g6 Z

  Q, X4 R' N# T& J' \4 N8 t+ P1 r' p3 K- _" L" p  s
; p; P, `' X9 @/ m) M' k, I( b1 n

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




歡迎光臨 機(jī)械社區(qū) (http://www.xa-space.com/) Powered by Discuz! X3.5