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

 找回密碼
 注冊會員

QQ登錄

只需一步,快速開始

搜索
查看: 19078|回復(fù): 15

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

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

( C2 q* j% T* i5 v" w. Z7 I
# ?6 H% L; z- f% n5 G, [$ j( ~7 |
    下面介紹小這個些主控程序主要干的事,通過串口PC和主控板通訊,PC命令給控制板,控制板接收命令做不同的響應(yīng),PC可以發(fā)G代碼給主控板,接收完成后可以自動開始雕刻任務(wù)。
9 j& Q. s& m% \1 w( {          在介紹下G代碼因為G代碼是雕刻機(jī)的核心部分
: A& W4 s' f1 cG代碼是數(shù)控程序中的指令。一般都稱為G指令。: V$ k3 r: g2 v; t2 Y4 A1 F
G00------快速定位
* J  k! \" x$ Q5 J+ x! |* @G01------直線插補(bǔ)
1 G* z3 O" H) t: t% E# n0 RG02------順時針方向圓弧插補(bǔ)
6 {; w! b' R. A& t, t2 ^# ZG03------逆時針方向圓弧插補(bǔ)4 m+ j& [! Q8 n$ R7 X
G04------定時暫停
( m2 B6 d& p" j- X! W; a1 \G05------通過中間點圓弧插補(bǔ)! Y8 z$ v( V1 R% n4 b# e- C
G06------拋物線插補(bǔ)7 \" _7 @: t, r0 v  t  R
G07------Z 樣條曲線插補(bǔ), z9 X; h5 @0 Q) P
G08------進(jìn)給加速
1 ?5 ~% k! V9 \0 ]3 G4 a0 \7 aG09------進(jìn)給減速, M: F3 `$ U- z. M' A' P
G10------數(shù)據(jù)設(shè)置  B, g2 ~4 s% n7 ^# `4 y
G16------極坐標(biāo)編程
) o2 H( _' I& W: `G17------加工XY平面
! X; z5 U" a4 i1 B0 ?# AG18------加工XZ平面, |2 T. V+ Q- G2 l. J% b
G19------加工YZ平面

/ I( C5 ]3 c- W核心就是解析G代碼,完成步進(jìn)電機(jī)驅(qū)動,和控制主軸開啟關(guān)閉,還有插補(bǔ)算法,直線插補(bǔ),圓弧插補(bǔ),還有一些步進(jìn)電機(jī)的加減速算法。3 k" t+ A" @& k1 H/ M+ D
下面對grbl主結(jié)構(gòu)做介紹
  Z. b6 Y  r) N+ @: r/ g; qmain()主函數(shù)首先執(zhí)行下面初始化函數(shù)8 C% y* k. {6 x( P8 b
        serial_init();                           // 設(shè)置串口波特率和中斷" o/ Z( |! w6 a3 ?6 V/ e( ~& J
        settings_init();                         // 從ROM加載grbl設(shè)置
2 }9 _9 |8 H4 \. \        stepper_init();                          // 配置步進(jìn)方向和中斷定時器
- U+ F- S( N* E# H" V        system_init();                           // 配置引腳分配別針和pin-change中斷
! o7 f3 I( n5 _7 h        memset(&sys, 0, sizeof(system_t));          // 清除所有系統(tǒng)變量$ s4 g2 e. q, z+ I
        sys.abort = true;                           // 中止標(biāo)識位置位! _! {3 V0 n7 M+ Y  D
        sei();                                         // 使能中斷/ S6 `' w" e% ^& c9 d
  #ifdef HOMING_INIT_LOCK                        // 宏運(yùn)算(settings.flags & (1 << 4)) != 0結(jié)果flags等于執(zhí)行sys.state = STATE_ALARM
: O1 z- E3 O- v7 e* X2 D                                                // 系統(tǒng)狀態(tài)賦值為報警狀態(tài)
2 O% w( ~- z0 t; N% W: {            if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
+ ~- c' i% ]/ f; y# Y  #endif3 x9 `) p7 a$ B- b
_____________________________________________________________________________________________________________________________________
; m# Q# t' l' P9 L1 |! C4 w接下來是一些主要部分初始化" K3 H# ~/ [' A5 I$ K1 b9 R
for(;;) {
% C. h+ G; y' v2 P9 T        serial_reset_read_buffer();         //清除串口讀緩沖區(qū)- l: T* P8 s' i6 W1 R
        gc_init();                         //初始化G代碼功能函數(shù). |4 ]7 g7 b  S8 V8 ~" b1 b3 H
        spindle_init();                        //主軸初始化% [4 L3 r0 K" g, r) r* ?! k
        coolant_init();                        //冷卻液初始化
; E9 g" n5 h" t# S0 a% L        limits_init();                         //極限開關(guān)初始化  x4 c9 u/ h8 x# h7 b2 z: Z
        probe_init();                        //探測部件初始化
8 G( F7 o/ I- j        plan_reset();                         //清除塊緩沖區(qū)和規(guī)劃師變量+ N. M. {* g8 Y- _
        st_reset();                         //清除步進(jìn)系統(tǒng)變量。1 X, S9 H- x* Z% d, _9 V. _

0 `4 P9 S! f0 k( K7 N5 d& q
4 O" i* V8 i4 ?8 u& L        //下面兩行清除同步gcode和策劃師職位當(dāng)前系統(tǒng)位置。! C* K- I# Z" y& H5 n
        plan_sync_position();! ?6 A1 w6 {  c, q& G
        gc_sync_position();
4 H  D; q; N+ [9 Z$ D. m, W6 {- D$ u' ?

9 V" x* I" |- r; x. x9 L        //復(fù)位系統(tǒng)變量
, H$ C, d/ D$ Z- ^3 |' o8 ]0 D. F8 U        sys.abort = false;                //系統(tǒng)中止標(biāo)志
+ w% b7 ~2 y% h' C% U        sys_rt_exec_state = 0;                //系統(tǒng)標(biāo)志位變量狀態(tài)管理。看到EXEC位掩碼。5 z# w. C) s0 p6 e6 _, T
        sys_rt_exec_alarm = 0;                //系統(tǒng)標(biāo)志位變量設(shè)置不同的警報。
; w/ n& q! n& [  M8 l% y        sys.suspend = false;                //系統(tǒng)暫停標(biāo)志位變量管理,取消,和安全保護(hù)。
0 Z; q8 D: L& W4 @) u        sys.soft_limit = false;                //限位開關(guān)限制狀態(tài)機(jī)錯誤。(布爾)
7 A5 Z3 y4 U* s) J  H* u% j. G
" v/ ?* s7 G* `/ a+ p8 A/ C. D* y4 M- ~) e+ y
        protocol_main_loop();                //主協(xié)議循環(huán), @& o+ D( D' G. j9 C6 E
}        //
6 f/ J4 U' ^: {4 ?8 u' R' ?_____________________________________________________________________________________________________________________________
' R0 S0 ~9 N$ U! `6 C' _" A進(jìn)入void protocol_main_loop()函數(shù)
; R: O. g# F4 _( v) l{
$ z0 |5 P" q, W9 I        report_init_message();                // 打印歡迎信息
5 t8 z$ Y% z" v/ Q" H! m        //重啟后檢驗和報告報警狀態(tài)如果錯誤重啟初始化。
* \; W  P! z5 [. g! J
        if (sys.state == STATE_ALARM) {
% o4 T% @1 F! N2 h            report_feedback_message(MESSAGE_ALARM_LOCK); //打印信息
: z% u! M$ V' l. t4 O8 }
          } else {! w$ `2 S/ ^* v4 j, z7 _
            // 如果沒有報警說明一切正常!但還是要檢查安全門.
& b5 ?# {: }, C+ G' `            if (system_check_safety_door_ajar()) {# Y3 f0 [: {" @9 W- S, m- u
                     bit_true(sys_rt_exec_state, EXEC_SAFETY_DOOR);+ W1 A% N- Z( P. q2 L
                     protocol_execute_realtime(); // 進(jìn)入安全模式。應(yīng)該返回空閑狀態(tài)。7 D: H9 d% p7 K. |& M4 T
            }         else {
% g! u: j: R3 f              sys.state = STATE_IDLE; // .設(shè)置系統(tǒng)做好準(zhǔn)備。清除所有國家國旗。7 \0 z0 w/ l( {% V! b
            } 2 I5 Z" P  T* ^# H
            system_execute_startup(line);    //開始執(zhí)行系統(tǒng)腳本7 _/ Q- v; D, S
  } $ l( P9 \0 U; ~/ ?( y5 B
+ K8 g! |# n( z. h  q' f
+ F( p6 S3 k. ~  e  x" H6 @& H* }
  // 這是主循環(huán)!在系統(tǒng)中止時這是出口回到主函數(shù)來重置系統(tǒng)。
$ R% d: O5 }! r: Q# I( r; C  // ---------------------------------------------------------------------------------  5 X3 \: M8 I1 c
  3 x  b" }2 w$ }* |- R8 z4 n9 S
        uint8_t comment = COMMENT_NONE;, E6 m7 X& _+ d, A' S3 f
        uint8_t char_counter = 0;" R  C2 ]/ X; H4 B5 O! Y
        uint8_t c;
% ~; h8 @: p' C: ]( E_______________________________________________________________________________________________________________________________" m9 b' K/ G4 t8 e  x0 C2 I1 R
接下來進(jìn)入for(;;)循環(huán)                //下面代碼是G代碼解析核心部分,程序中comment(注釋)變量會被賦不同值,代表發(fā)符號有‘(’‘)’‘;’
1 {( l: I5 Q0 A+ g2 X{: S" t: C# t+ u& |9 R
//串行數(shù)據(jù)輸入一行的的過程,作為數(shù)據(jù)。執(zhí)行一個
' t0 y% l( m% G+ k/ f  Y//所有數(shù)據(jù)初始過濾去除空格和注釋。
" `1 n8 M1 Z: u- e//注意:注釋,空格和程序段刪除(如果支持的話)處理技術(shù)6 X5 W. u! T: c, _% t* e
//在G代碼解析器,它有助于壓縮到Grbl傳入的數(shù)據(jù)1 l' ^4 w  Q8 D7 `9 M& @
//線緩沖區(qū),這是有限的。刀位點標(biāo)準(zhǔn)實際上州一行不行
1 l. P9 o! F( i+ C6 ?( X//不能超過256個字符,Arduino Uno沒有更多內(nèi)存空間。3 I* M  V, V. P
//有更好的處理器,它會很容易把這個初步解析的
0 ~) k% P9 T! q2 M//分離任務(wù)共享的刀位點解析器和Grbl系統(tǒng)命令。                                                                : `1 D  Y( g  o
    while((c = serial_read()) != SERIAL_NO_DATA) {                             //讀取串口數(shù)據(jù),有數(shù)據(jù)執(zhí)行下面代碼
7 S; g* ?/ o0 C' s3 n- _      if ((c == '\n') || (c == '\r')) { // End of line reached                //如果數(shù)據(jù)是/r,/n代表一行結(jié)束, [+ G4 {* W8 g
        line[char_counter] = 0; // Set string termination character.        //設(shè)置結(jié)束標(biāo)志2 e% e, Z  E/ k! K, R3 r- r# D
        protocol_execute_line(line); // Line is complete. Execute it!        //一行完成執(zhí)行此函數(shù)  v) g: v/ o1 M6 s  p
        comment = COMMENT_NONE;                                                //注釋清零: u: C2 w7 N% m8 {( S
        char_counter = 0;                                                    //字符計數(shù)清零
. ^' A" c% t+ Z/ ^$ ]6 |3 q6 t    D7 c" {9 X; z$ i
        else {
* D  T+ D  I1 V' o( x. M. F* N        if (comment != COMMENT_NONE) {3 n! |+ i# Z+ d* d
                                                     //扔掉所有注釋字符  Q0 {5 z. g+ p& w/ i& b( ?! {+ s9 o
          if (c == ')') {
8 T1 Y6 s6 [& b( w1 x            //最后注釋。重新開始。但是如果有分號類型的注釋。
, B* f  Q. {0 O. z, P            if (comment == COMMENT_TYPE_PARENTHESES) { comment = COMMENT_NONE; }
6 j( o+ F9 f  [5 a) q          }# w1 {/ }6 C' B; E, a& m6 T
      } else {
8 j9 W9 A% A4 T* G* P          if (c <= ' ') {
0 J# W9 p- o- b- y" B& |0 W, l            //扔掉whitepace和控制字符
2 T* S; `* `- O6 t, ~$ T          } else if (c == '/') {
# a, N) a5 Y6 h2 C3 f1 S            //塊刪除不支持將忽略字符。
6 M- l. y  b& P            //注意:如果支持,只需要檢查系統(tǒng)是否啟用了塊刪除。- o0 T2 @9 m* a4 T: M" `
          } else if (c == '(') {% h$ v0 H9 B) B$ l5 x- Z; p
            // Enable comments flag and ignore all characters until ')' or EOL.0 s% T# x* u6 ~4 `% M2 f* n
            // NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.
# l; F* o  G4 t            // In the future, we could simply remove the items within the comments, but retain the4 B4 z! j$ @; z3 ?6 {/ L
            // comment control characters, so that the g-code parser can error-check it.
. q/ w' y3 V1 P* _5 ]" u; ^            comment = COMMENT_TYPE_PARENTHESES;
& J( |; \; a- t7 |          } else if (c == ';') {% |' L+ t9 i9 m. ?
            //注意:','注釋EOL LinuxCNC定義。沒有國家標(biāo)準(zhǔn)。
$ s* ^0 j, D. k- [7 ?+ }. N            comment = COMMENT_TYPE_SEMICOLON;
! b0 i( W6 B& C; w$ i: a, U" r3 |  x$ |* A! B+ Q
( z; A' Y. E  g' V) L4 J
_____________________________________________________________________________________________________________________________________
2 t! D- x9 I" _$ r          } else if (char_counter >= (LINE_BUFFER_SIZE-1)) {                        //串口接收數(shù)據(jù)大于80字符時. ^+ y' I# l, W
            // Detect line buffer overflow. Report error and reset line buffer.        檢測緩沖區(qū)溢出。報告錯誤和復(fù)位線緩沖區(qū)。
/ c) E1 Y: g9 |! Z            report_status_message(STATUS_OVERFLOW);                                //打印溢出信息
1 T4 f2 X9 ~5 a6 p) f            comment = COMMENT_NONE;
* \4 r  X8 Q% a) B            char_counter = 0;
# B; @5 D* g- k9 p: d          } else if (c >= 'a' && c <= 'z') { // Upcase lowercase                        //小寫改大寫1 u0 X  R2 t, n2 o( }6 D. i
            line[char_counter++] = c-'a'+'A';6 [( l, S+ ?: j% z1 u/ D4 o3 |2 s, `
          } else {6 O) l6 A7 L* b% \# U; _
            line[char_counter++] = c;
; k2 l2 z' Q: h$ y$ z+ K( Y/ m1 [          }
* b& D) B, ?: H: b  b% \        }
9 _) w, Q; M2 G- d      }
2 Z) V& w3 W0 n& n3 d    }
' A9 ^/ j3 P; V6 R8 [____________________________________________________________________________________________________________________________________
  I5 k# W& z7 r# |        //如果沒有其他字符在串行處理讀取緩沖區(qū)和執(zhí)行,這表明以完成,自動啟動,如果啟用,任何隊列動作。
. M1 a8 t# e7 |3 A        protocol_auto_cycle_start();                //自動開始協(xié)議循環(huán)
; p  S! s5 u1 f% S) O        
- e3 V# T/ |3 M8 O; l5 L            protocol_execute_realtime();                  //運(yùn)行實時命令。
4 m% L, D0 M1 }6 H$ e  d( {            if (sys.abort) { return; }                 //中止標(biāo)識置位程序循環(huán)重置系統(tǒng)。            
& B& p3 ?5 \5 ], q6 b  }
) ]# N* G$ |" R  return;                         //一般程序不會執(zhí)行到這里; T2 t& ]" \. s
}
( u4 d  e5 W9 H, l; ~  h# G0 J, a+ i____________________________________________________________________________________________________________________________________
' x4 y2 @( N2 m; O0 C, ?* _: W- ^正常情況下,讀取完G代碼程序會進(jìn)入protocol_auto_cycle_start();//自動開始協(xié)議循環(huán) 函數(shù)下面介紹此函數(shù)
/ e4 T/ w! u0 O2 W// Auto-cycle start has two purposes: 1. Resumes a plan_synchronize() call from a function that
: Q1 ]0 b% {* y% U2 D// requires the planner buffer to empty (spindle enable, dwell, etc.) 2. As a user setting that ! G: A: N9 U9 ]. f: Z' D
// automatically begins the cycle when a user enters a valid motion command manually. This is
$ l6 l2 h  F9 k" f! D4 H# y// intended as a beginners feature to help new users to understand g-code. It can be disabled
  [2 V6 B0 ?- k+ x// as a beginner tool, but (1.) still operates. If disabled, the operation of cycle start is
  X- a% r8 a$ }, u// manually issuing a cycle start command whenever the user is ready and there is a valid motion * N9 L. X1 w) i" F' W; X
// command in the planner queue.
8 s# b7 }# K! p  `" i: B// NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes ( ~) H5 w* K: j% f+ H
// when one of these conditions exist respectively: There are no more blocks sent (i.e. streaming
9 w8 `* d: i' q3 e// is finished, single commands), a command that needs to wait for the motions in the buffer to
# v" V$ ~8 P/ c. @' ?// execute calls a buffer sync, or the planner buffer is full and ready to go.
# v( B0 }' _0 V8 D0 ?//自動開始有兩個目的:1。回復(fù)一個plan_synchronize()調(diào)用的函數(shù)
8 y! a% T; Y) {+ P# f//需要規(guī)劃師緩沖區(qū)空(主軸啟用、住等)2。作為一個用戶設(shè)置& V# z! e- J7 x4 `# X* B. j
//自動循環(huán)開始當(dāng)一個用戶輸入一個有效的運(yùn)動命令手動。這是
! N* X+ a# {  H0 E9 `( _5 o//作為一個初學(xué)者的特性來幫助新用戶了解刀位點。它可以被禁用
, Q' R+ |, p( ~, Z' @7 w6 v9 J//作為一個初學(xué)者工具,但(1)仍然運(yùn)作。如果禁用,運(yùn)行周期開始
: {4 \( C) _( e7 U$ N3 w//手動發(fā)出一個周期開始命令每當(dāng)用戶準(zhǔn)備好,有一個有效的運(yùn)動
% r3 l% _. p( e; v; L0 `0 ?//命令的規(guī)劃師隊列。8 T( }; D. f- v4 }/ J- K; i9 d0 B
//注意:這個函數(shù)被稱為從主循環(huán)緩沖區(qū)同步,mc_line只()并執(zhí)行
0 k- x- n; _3 s; t; f% D$ t//當(dāng)其中一個條件分別存在:沒有更多的塊(即流發(fā)送
* B2 ?0 W* b$ W- N//完成后,單一的命令),一個命令,需要等待緩沖的動作
4 e$ B3 w0 k" t! l) S//執(zhí)行調(diào)用一個緩沖區(qū)同步,或規(guī)劃師緩沖區(qū)滿了,準(zhǔn)備好了。; L6 J; {/ i# k9 ?6 X0 E3 R+ @
void protocol_auto_cycle_start() { bit_true_atomic(sys_rt_exec_state, EXEC_CYCLE_START); } # ?! O9 j5 j; I0 E1 F  D
_______________________________________________________________________________________________
/ s; ?' m/ y9 V0 U! G- s* c接下來程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實時命令。
  l2 _4 v/ i9 O) c3 e// Executes run-time commands, when required. This is called from various check points in the main
5 H* l/ N( f( h' x7 [0 n// program, primarily where there may be a while loop waiting for a buffer to clear space or any7 ~, K- K* d, o. `& f1 S
// point where the execution time from the last check point may be more than a fraction of a second.
$ Q' [; [7 h: W$ v// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code% Z* w2 ?, C- ?. M6 A3 s" V9 |' ]! r
// parsing and planning functions. This function also serves as an interface for the interrupts to
; r1 K( h: ~  b. v" S  L// set the system realtime flags, where only the main program handles them, removing the need to
3 m8 K9 _0 R  n// define more computationally-expensive volatile variables. This also provides a controlled way to 3 _5 B0 _% @7 i6 V" g$ V
// execute certain tasks without having two or more instances of the same task, such as the planner
& k* V- a8 V4 W& a7 g// recalculating the buffer upon a feedhold or override.7 @( c+ G$ ~% f+ I8 n
// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
/ d2 V) c( ~' u# I6 h3 D' G/ W// limit switches, or the main program.
( O# p' G# E( U6 S' k4 f3 [, Gvoid protocol_execute_realtime()
: ^3 `  g6 Y  @+ X4 t uint8_t rt_exec; // Temp variable to avoid calling volatile multiple times.臨時變量來避免多次調(diào)用不穩(wěn)定。
0 _4 F  ]& Y) Z2 W2 T就先分享到這吧!
5 e2 ~! S" d4 c  \) x( z7 B7 r$ l- T" ~0 y$ J

; _! Q& o9 D2 S, y2 ?! s4 o! ^5 y/ j5 o) I; y! H! s* Y& \

* K4 Y( e( `# `+ V7 M/ M5 g3 a/ i& f& J6 R

7 X( \! R1 D/ [' l1 S  z$ e5 l- ?' V; d& z
% f) ?; q* H) W6 j2 _4 V4 P+ l

8 `# n9 u+ t, J- B; Q* h* p2 W& s2 `; ?, V6 ]! [

) K8 F0 x8 V" |- c/ E! A
3 X% _" _- [2 S' R2 s9 W2 F8 h: _2 u. h9 v
4 C/ T: z2 H# P; U! I  Z; h

- U8 c3 z% C% {( j2 q. Z1 ^% X( i# J# r3 ~4 h' Y* F
, E; ~' ?, i# y

. r3 i  X0 N8 S8 s$ g: E
& W$ X3 c4 q0 p- |. r* e
- c1 w  n, {) M: t

/ H  k) b0 `& Y! W2 g+ \
. {$ Q8 Z$ m! ]" v2 `" E% B
; V- w8 |) F$ Z7 ?' B2 ?補(bǔ)充內(nèi)容 (2016-8-25 22:40):& m3 t0 |# _* S2 F! g
配置說明$ w% t& q% z( g7 T
//這個文件包含編譯時配置Grbl的內(nèi)部系統(tǒng)。在大多數(shù)情況下,3 e! i1 ]" L4 x0 j/ ?
//用戶不需要直接修改這些,但是他們在這里為特定的需求,即。
; r% u, E$ d6 L, ?, U* S  L//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。7 a0 R- c2 G+ |' l2 d4 ]3 _. `
主要配置項:
/ a8 N7 B  ^) f1.#define DEFAULTS_GENERIC        //在重置eepm時使用。在defaults.h改變想要的名字& }6 j8 s* Z6 d- E6 O% c
2.#define BAUD_RATE 115200        //配置串口波特率115200
. O2 c$ E* I+ _% k3 H# c' |3.#define CPU_MAP_ATMEGA328P         // Arduino Uno CPU# E7 J' E1 S5 a2 o% k+ w6 l6 p
4.#define CMD_STATUS_REPORT '?'        //定義實時命令特殊字符
$ v# m% E1 ^6 A. j5.#define HOMING_INIT_LOCK         //回原點保護(hù)鎖
9 x( ?7 d$ z0 l; R5 x9 R6.#define HOMING_CYCLE_0 (1<<Z_AXIS)              // 第一步Z清除工作區(qū)。
! [* H- Z$ Q  ^; t2 ?) Z9 x4 M  #define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // 然后X,Y在同一時間。
2 |" S6 i% G9 d' l; C) ^7.#define N_HOMING_LOCATE_CYCLE 1 //回原點循環(huán)次數(shù)
  U2 b1 s1 b* P8.#define HOMING_FORCE_SET_ORIGIN //取消這定義迫使Grbl總是在這時候位置設(shè)置機(jī)器原點盡管開關(guān)方向。$ U* ^2 l* f  ]4 E. c7 U' w
9.#define N_STARTUP_LINE 2 //塊Grbl啟動時執(zhí)行的數(shù)量。
. q, `) V9 l, J- b0 |7 a10.#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價值英寸) y) n! H" x, n2 h9 x7 C
   #define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價值
( h1 E3 l5 Y, p3 w/ N. a/ L9 Y" X8 G   #define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
* r4 m1 Q5 }: V) _* r8 O   #define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘( Q8 y( s! Z* D- _: x, i) R. K
   #define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對浮點小數(shù)設(shè)置值; r7 h" ?9 ~7 ?' S
11.#define LIMITS_TWO_SWITCHES_ON_AXES //如果你的機(jī)器有兩個極限開關(guān)連接在平行于一個軸,您需要啟用這個特性) q. J& ~+ C5 z5 L6 H  y1 n8 p9 F
12.#define USE_LINE_NUMBERS         //允許GRBL跟蹤和報告gcode行號6 t1 r* L  i: s" g. i$ |
13.#define REPORT_REALTIME_RATE //允許GRBL報告實時進(jìn)給速率
9 h6 v. m; V) w14.#define MESSAGE_PROBE_COORDINATES  //坐標(biāo)通過Grbl $ #的打印參數(shù)?: ^) V  a: t0 M9 U
15.#define SAFETY_DOOR_SPINDLE_DELAY 4000 //安全門主軸延時
& v1 a# Z6 G$ M. f16.#define SAFETY_DOOR_COOLANT_DELAY 1000 //安全門冷卻液延時
8 V" G' I2 u7 {17.#define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS) //啟用CoreXY運(yùn)動學(xué)。
4 ^- {9 D8 J) x18.#define COREXY // Default disabled. Uncomment to enable.改變X和Y軸的運(yùn)動原理5 N2 e. \. x. L8 Q$ T$ A  C
19.#define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.反轉(zhuǎn)針銷邏輯的控制命令
! }" S; R& L$ D: l. ?# X: i, h0 n! q20.#define INVERT_SPINDLE_ENABLE_PIN // 反轉(zhuǎn)主軸使銷從low-disabled
5 \, G) Z8 b+ y! ~( p21.#define REPORT_CONTROL_PIN_STATE //啟用控制銷狀態(tài)反饋狀態(tài)報告。
6 H: i6 `0 w; X+ b: P22.#define FORCE_INITIALIZATION_ALARM //啟用和用戶安裝限位開關(guān),Grbl將啟動報警狀態(tài)指示
  U4 P7 n" |2 v7 \8 m23.#define REPORT_GUI_MODE // gui允許最小的報告反饋模式
+ n. y6 @' l4 `/ p24.#define ACCELERATION_TICKS_PER_SECOND 100 //加速度的時間分辨率管理子系統(tǒng)。
; [) w9 x! {* I$ k& q  j6 X25.#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING //自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能
, p) a- t+ V* Y# o: r' v26.#define MAX_STEP_RATE_HZ 30000 //設(shè)置最大一步速率可以寫成Grbl設(shè)置1 B4 G: N: e5 h% A4 q+ L  y5 u/ d
27.#define DISABLE_LIMIT_PIN_PULL_UP //以下選項禁用內(nèi)部上拉電阻
* p+ d! v. l/ }  \, h# Y28.#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS //設(shè)置哪個軸長度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與選擇軸工具面向負(fù)方向$ Y5 q. |! G" e# _# R$ J
29.#define VARIABLE_SPINDLE //允許變量軸輸出電壓不同的轉(zhuǎn)速值。
0 a) H! F* D" [- }5 n0 Z( m30.#define SPINDLE_MAX_RPM 1000.0  // Max spindle RPM. This value is equal to 100% duty cycle on the PWM.4 J9 s2 L8 c& }: j6 U$ l$ f2 T8 C
   #define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM./ Q( L0 Z: l$ g9 ?
31.#define MINIMUM_SPINDLE_PWM 5 //使用的變量軸輸出。這迫使PWM輸出最小占空比時啟用。- A6 z. J- v; \3 u
32.#define USE_SPINDLE_DIR_AS_ENABLE_PIN //主軸方向使能M4被刪除- D! x( r  s7 E% l( o$ r
33.#define REPORT_ECHO_LINE_RECEIVED //應(yīng)該對所有正常線路送到Grbl* y# \! e4 s# n1 [# \
34.#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min) //最小規(guī)劃師結(jié)速度。設(shè)置默認(rèn)最小連接速度規(guī)劃計劃5 U2 f( G$ _- Y: o! m( v
35.#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計劃將允許的最小進(jìn)給速率5 j- x* r* p% _
36.#define N_ARC_CORRECTION 12 //弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡
: Q( R7 c3 N# F4 m2 w" F6 l37.#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)//定義值設(shè)置機(jī)器ε截止來確定電弧是一個原點了?
+ G0 v2 H! M$ e) I5 z" B38.#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds) //延時增加表現(xiàn)在住。默認(rèn)值設(shè)置為50毫秒
2 {4 {( E+ P, V% u39.#define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.
; z! N' g+ Q" B  ]5 U40.#define BLOCK_BUFFER_SIZE 18  //線性運(yùn)動規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時間計劃
3 Q9 J* A+ T: J4 k2 W41.#define SEGMENT_BUFFER_SIZE 6 //控制之間的中間段緩沖大小的步驟執(zhí)行算法
& t. E- l! D) Z! ]1 q42.#define LINE_BUFFER_SIZE 80 //行執(zhí)行串行輸入流的緩沖區(qū)大小。) o0 ]% X% v& T4 _9 R. c: l' u
43.define RX_BUFFER_SIZE 128 //串行發(fā)送和接收緩沖區(qū)大小* s5 @/ l3 \- w& W# @
44.#define TX_BUFFER_SIZE 64
9 u# C. C3 l7 Q# P4 w8 D0 F6 T; L) |9 j45.#define ENABLE_XONXOFF        ////切換為串行通信發(fā)送流軟件流控制。; @6 N% Q7 U+ M  C& c$ z# z7 n
46.#define ENABLE_SOFTWARE_DEBOUNCE //一個簡單的軟件消除抖動特性硬限位開關(guān)。
2 p- P$ F6 D( ~, y# a2 m0 I47.#define HARD_LIMIT_FORCE_STATE_CHECK        //Grbl檢查硬限位開關(guān)的狀態(tài)' @" R) H/ w, \4 O  [5 x" I- [$ c* X
48.// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時錯誤檢查的定義值:
& b& d8 K7 x$ I3 f/ g" \0 j  E* h9 J( F5 G3 E) ^2 ^% }, G
___________________________________________________________________________________________________6 i* l% Y$ K0 V& o7 c4 j
/*) m0 R( e; u' e' ]) G
  config.h - compile time configuration
% N+ s  [; Q! I6 ^9 v* H. K  Part of Grbl
2 J3 @7 u3 a3 h4 a1 o
+ M8 v# s' @" p9 N- T( x  Copyright (c) 2012-2015 Sungeun K. Jeon3 N0 R. W: {6 f- {" H3 I
  Copyright (c) 2009-2011 Simen Svale Skogsrud
2 k' O2 x/ q9 p, s. _" \( E8 j: d6 V& G
  Grbl is free software: you can redistribute it and/or modify
& [' m9 c; x: ~  I! @  it under the terms of the GNU General Public License as published by+ W5 W6 f' s' q/ [% z4 e$ s
  the Free Software Foundation, either version 3 of the License, or
' Y0 e2 {1 O* y  }% a' Q( x  (at your option) any later version.* H% |% Q' t* a, O
+ g% r: h+ U4 }' F7 C: r
  Grbl is distributed in the hope that it will be useful,5 z! k- U* j4 ]& ]# u' x
  but WITHOUT ANY WARRANTY; without even the implied warranty of7 [2 S& Z! n$ y. H$ X, C
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! @2 {1 N0 _/ P% N# ]. h
  GNU General Public License for more details.
, P: }" x% s& R' n' v, ]; ^8 o. o" [1 `5 T( j/ X7 S9 i
  You should have received a copy of the GNU General Public License
- R* v7 J& a! s6 b2 P$ X  along with Grbl.  If not, see <http://www.gnu.org/licenses/>.
9 E. f' I5 X& Nconfig.h  -編譯時配置,Grbl的一部分9 g+ {. r9 w" r* p7 p; x) q

" P5 t- i3 [6 _' L0 W版權(quán)(c)2012 - 2015 Sungeun K. Jeon
% P8 E3 m, V* e: R9 D! G! k+ o8 i8 c版權(quán)(c)2009 - 2011 Simen Svale Skogsrud
% S- Z, j% f7 r" ^8 _
- }. W9 ?0 O9 s( J7 ]/ uGrbl是免費軟件:可以重新分配和/或修改
* v3 \2 k, s* GGNU通用公共許可證的條款下發(fā)布的自由軟件基金會,版本3的許可,或(任您選)其后的版本。
1 k3 @: W) @3 t. W
1 n% W2 x1 F) y2 DGrbl分布,希望這將是有用的,但是沒有任何保證;沒有即使的默示保證適銷性或健身為特定目的??吹?font class="jammer">% L8 N& X4 L& J' L, |, w' H' {
GNU通用公共許可證的更多細(xì)節(jié)。
8 _' _. L+ c3 J) q; M) M3 j$ U) s( e4 H1 F7 \9 @6 G* b
你應(yīng)該收到了GNU通用公共許可證的副本/ N6 ]9 k) w# Q+ C, d: Q) K
連同Grbl。如果沒有,看< http://www.gnu.org/licenses/ >。  ?1 L/ V2 V9 _) G2 L( \4 G

& ]2 D1 x; C( k( Z, p  ~*/$ M" X2 g) \; z/ b8 K) S: D; V* n
  3 V0 x. Z+ m8 X
// This file contains compile-time configurations for Grbl's internal system. For the most part,# N% }" F. n7 Y. `0 s! D
// users will not need to directly modify these, but they are here for specific needs, i.e./ m* H& j/ b, E$ A: a/ M. V
// performance tuning or adjusting to non-typical machines.  u9 ]  D, n, ^5 ?
//這個文件包含編譯時配置Grbl的內(nèi)部系統(tǒng)。在大多數(shù)情況下,
6 ~  Z  I* O1 Y5 y//用戶不需要直接修改這些,但是他們在這里為特定的需求,即。6 F9 i5 ]/ C" K7 J7 e
//性能調(diào)優(yōu)或適應(yīng)非典型的機(jī)器。
/ q5 z  E. _$ ?
, y% Z) ?( m# b1 C6 y8 P  Y5 r// IMPORTANT: Any changes here requires a full re-compiling of the source code to propagate them.
, ]  J  \( a+ ]5 o//重要:任何變化需要一個完整的基于源代碼的傳播。) U7 S# H/ J1 I" m! Y% E% e5 T* W

7 s) ]5 r6 Z2 J6 I* l( F#ifndef config_h
0 T/ B. j. p: S$ J# k#define config_h3 [- f7 ~8 D+ g3 e
#include "grbl.h" // For Arduino IDE compatibility.$ @0 o! g: l/ F) N  `# i4 K: ~) E

) i8 g# O" d4 n9 X// Default settings. Used when resetting EEPROM. Change to desired name in defaults.h5 Y0 J! J# o- T* E: I5 U8 p# v
// 默認(rèn)設(shè)置。在重置eepm時使用。在defaults.h改變想要的名字3 o6 A1 t) B' K+ h
+ y! |$ I: g/ E, g! I
#define DEFAULTS_GENERIC- E2 h  G1 R8 O! A% Z

* o( f* x' B0 K// Serial baud rate% _/ |: B0 q+ R
#define BAUD_RATE 115200                //配置串口波特率115200
6 v2 f7 s, h3 q$ F1 L) A: {! T+ Y; d/ e9 j
// Default cpu mappings. Grbl officially supports the Arduino Uno only. Other processor types9 C; A6 Q: i; W( l' P! Y
// may exist from user-supplied templates or directly user-defined in cpu_map.h
8 V. F8 H5 R+ I6 }//默認(rèn)cpu映射。Grbl正式支持Arduino Uno。其他類型的處理器可能存在cpu_map.h直接從用戶提供的模板或用戶定義的
0 Y2 _& m) F% C: n3 t4 }0 B3 `7 h: D1 B) R% X
#define CPU_MAP_ATMEGA328P // Arduino Uno CPU
1 i) q  _$ M: {& S9 ?: l( U+ R# j! R8 T: H( ]- c* Y8 Z- c+ b
// Define realtime command special characters. These characters are 'picked-off' directly from the
+ ]8 m% Q+ L& Z( G6 I// serial read data stream and are not passed to the grbl line execution parser. Select characters, s  V8 K8 {$ [% K! T, J# `
// that do not and must not exist in the streamed g-code program. ASCII control characters may be
$ y8 {0 {+ ]" e6 }" R- `// used, if they are available per user setup. Also, extended ASCII codes (>127), which are never in 4 n5 l/ m- O) {; N# A
// g-code programs, maybe selected for interface programs.& n" a* y0 a# j  p3 T
// NOTE: If changed, manually update help message in report.c.
' a0 V6 `- ~# M: T) D* n' Y: h, U
//定義實時命令特殊字符。這些字符是直接從“各個擊破”串口讀取數(shù)據(jù)流并沒有傳遞到grbl行執(zhí)行解析器。選擇角色
! K* {5 o, E2 m5 k" i//不,不能存在于程序流刀位點。ASCII控制字符- f" |- R/ ~2 C5 @$ j; ^
//使用,如果他們是可用的每個用戶設(shè)置。同時,擴(kuò)展的ASCII碼(> 127),從來沒有3 p1 L# V2 X; V( p
//刀位點的程序,也許選擇界面程序。6 `# @; ]+ k% b; i( g
//注意:如果改變,手動更新report.c幫助信息。" \+ ~+ M* a. K

- V0 _1 _& K3 x4 L#define CMD_STATUS_REPORT '?'
; a( v7 h' D0 \: Z3 M% Q8 h. R#define CMD_FEED_HOLD '!'6 {$ V$ B  k1 h; o: r
#define CMD_CYCLE_START '~'
. f, L; B. I4 A#define CMD_RESET 0x18 // ctrl-x.* @4 ~; |: w, \. W# S  p
#define CMD_SAFETY_DOOR '@') `( v- A* U/ h9 d+ Q5 J

5 Y6 Z4 w, P0 m- ]" b& B$ W# g. k// If homing is enabled, homing init lock sets Grbl into an alarm state upon power up. This forces
9 n! @" @1 X& E, y4 b// the user to perform the homing cycle (or override the locks) before doing anything else. This is
3 K; G! \4 b* ~+ N// mainly a safety feature to remind the user to home, since position is unknown to Grbl.
4 X- A) s5 T" E" N$ X  N. V. D: _) ~- T3 U
//如果啟用了回原點,導(dǎo)航初始化鎖集Grbl進(jìn)入警報狀態(tài)啟動。這就迫使) e" b0 b) C5 E: }% r5 y- o  ^
//用戶執(zhí)行歸航周期(或覆蓋鎖)在做任何其他事情之前。這是
' `- t3 P4 Y3 k! l$ y" x3 x//主要安全功能,提醒用戶家里,因為Grbl位置是未知的。
! C6 Y, H4 @% ~; R7 Y( m' P1 O4 f. ]" s7 b6 w
#define HOMING_INIT_LOCK // Comment to disable) g0 @7 c: [  i

# T6 }) Q4 s9 X% B! T1 N// Define the homing cycle patterns with bitmasks. The homing cycle first performs a search mode
2 R( M6 r( ^- Z' d) i+ y$ V// to quickly engage the limit switches, followed by a slower locate mode, and finished by a short6 u+ Z+ ?4 ?& j7 N
// pull-off motion to disengage the limit switches. The following HOMING_CYCLE_x defines are executed % n1 H+ U( D4 w1 m5 s* ~
// in order starting with suffix 0 and completes the homing routine for the specified-axes only. If0 H" q& T4 g! f- i  O7 `$ K/ f
// an axis is omitted from the defines, it will not home, nor will the system update its position.. q3 B! c  f7 I' s) H1 R
// Meaning that this allows for users with non-standard cartesian machines, such as a lathe (x then z,% e, m8 Y8 T+ p' w6 S, |8 n
// with no y), to configure the homing cycle behavior to their needs. , y! @7 d8 K3 s6 L( m
// NOTE: The homing cycle is designed to allow sharing of limit pins, if the axes are not in the same
* G9 U/ ^+ |6 \  @) `& m3 v) s/ ?// cycle, but this requires some pin settings changes in cpu_map.h file. For example, the default homing
$ s, ]( h# a8 |( I$ m$ M+ m2 k9 ~# ]// cycle can share the Z limit pin with either X or Y limit pins, since they are on different cycles." T1 Y; }$ i5 f, Z- M
// By sharing a pin, this frees up a precious IO pin for other purposes. In theory, all axes limit pins. J3 K7 `. M( p5 @
// may be reduced to one pin, if all axes are homed with seperate cycles, or vice versa, all three axes) I6 P' Z% ^! ^7 F1 V. b" |
// on separate pin, but homed in one cycle. Also, it should be noted that the function of hard limits 1 B: g+ G% o7 G! p
// will not be affected by pin sharing.
3 q' a5 }* J/ G7 V//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個搜索模式0 [/ b8 C2 r8 g* _0 ~7 a
//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個短0 Z  B' ]: v  s! \& ?
//拖出運(yùn)動脫離限位開關(guān)。以下HOMING_CYCLE_x定義執(zhí)行% Z* P$ M/ m$ g1 E) X
//為了與后綴0開始并完成specified-axes只尋的例程。如果
6 I- s1 ~( F5 V; h/ J3 B% t7 ]//定義省略一個軸,它會不在家,也不會系統(tǒng)更新它的位置。
" F$ f8 E5 B1 x//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,
  G  M; A2 B+ ^  S$ j//沒有y),配置導(dǎo)航循環(huán)行為對他們的需求。# g: I- L- E3 B8 y7 m% n5 |3 @
//注意:歸航周期允許共享限制針,如果軸不相同) _" ~( D/ _) \/ F& ?: t
//循環(huán),但這需要一些銷設(shè)置cpu_map的變化。h文件。例如,默認(rèn)的導(dǎo)航1 d* K" [- }0 K' B# `4 }2 V
//循環(huán)可以分享Z限位銷X或Y限制針,因為它們是在不同的周期。
# |) A1 W6 b+ T$ _4 R& ]" x//通過共享一個銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針% g2 h6 @+ K$ W+ `* r& L2 u; ~
//可能會減少到一個銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個軸
2 _) z# h* S, l//在不同銷,但這時候一個周期。同時,應(yīng)該注意的是,硬限制的功能: Q/ l9 e6 @8 w" D" ?) q) |
//將不會影響銷共享。1 t, G3 N% Y6 w& h
//注意:默認(rèn)設(shè)置為一個傳統(tǒng)的硬件數(shù)控機(jī)器。z軸首次明確,其次是X和Y。
0 \9 x; p/ h) u7 Q3 R. v' a
9 a/ O5 l* y2 v" R& H, c// NOTE: Defaults are set for a traditional 3-axis CNC machine. Z-axis first to clear, followed by X & Y.& w$ Z8 e  x0 |2 w) s
#define HOMING_CYCLE_0 (1<<Z_AXIS)                // REQUIRED: First move Z to clear workspace. 第一步Z清除工作區(qū)。$ ~) J0 B, [: S1 i# i4 v- @
#define HOMING_CYCLE_1 ((1<<X_AXIS)|(1<<Y_AXIS))  // OPTIONAL: Then move X,Y at the same time.然后X,Y在同一時間。
/ p2 R* O- p. |7 }! ?// #define HOMING_CYCLE_2                         // OPTIONAL: Uncomment and add axes mask to enable( Z6 K6 E& X7 \3 A+ l

8 j% B! @1 \6 q- I$ }// Number of homing cycles performed after when the machine initially jogs to limit switches.
$ c0 v: O* _5 a6 N- d3 K// This help in preventing overshoot and should improve repeatability. This value should be one or
, z) E! H/ R& }8 {0 U// greater.
* k6 @( b  G  p, M. S7 ]//執(zhí)行回原點循環(huán)次數(shù)后,當(dāng)機(jī)器最初慢跑限位開關(guān)。這個幫助防止過度,應(yīng)該提高重復(fù)性。這個值應(yīng)該是一個或大。$ u& d5 R7 H: r( P8 {/ p
, H! S) f, Y3 M0 K2 e6 P
#define N_HOMING_LOCATE_CYCLE 1 // Integer (1-128)
& J! |" ~5 f# G8 x# y( @7 A9 ]% h/ v& v" P9 B+ Q" Y- D4 }
// After homing, Grbl will set by default the entire machine space into negative space, as is typical8 ^2 @$ N" J; t+ V- Z
// for professional CNC machines, regardless of where the limit switches are located. Uncomment this / i' }+ y' l( Q0 ^; ?. x" e+ ~7 `
// define to force Grbl to always set the machine origin at the homed location despite switch orientation.9 z4 o2 [9 R9 o* X7 g6 |* f
* Q% K, ^! f+ v  z2 ^
//導(dǎo)航后,默認(rèn)Grbl將整個機(jī)器空間留白,是典型的專業(yè)數(shù)控機(jī)器,不管限位開關(guān)所在的地方。/ l: _, y" `9 A0 ?, H
//取消這定義迫使Grbl總是在這時候位置設(shè)置機(jī)器原點盡管開關(guān)方向。$ q& z9 }) O) s3 {
$ k3 _2 _$ {6 {7 r" S- M7 n
// #define HOMING_FORCE_SET_ORIGIN // Uncomment to enable.6 y& f- D' `0 M8 Q; y

5 X  {4 Q+ G& v1 Z& t3 f# O" @; p; i# r2 Z* w/ `
// Number of blocks Grbl executes upon startup. These blocks are stored in EEPROM, where the size
. }2 A. V9 A* U0 q; L" Y' n// and addresses are defined in settings.h. With the current settings, up to 2 startup blocks may
' W3 o0 q( W) U# s  T& C7 @& B// be stored and executed in order. These startup blocks would typically be used to set the g-code
; A+ D$ ^, m$ B) G# Y// parser state depending on user preferences.
7 \/ u* [& i+ C. c
) m  H* E1 w- O1 R( m' b& A//塊Grbl啟動時執(zhí)行的數(shù)量。這些塊存儲在eepm,大小- F" r7 N1 o% T" g# T7 C" I& o
//和地址在settings.h中定義。與當(dāng)前設(shè)置,可能2啟動塊: _% o# _. f) Q5 m' r- D" g+ T
//存儲和執(zhí)行。這些啟動塊通常被用來設(shè)置刀位點
  D) Y0 Y7 d8 R" o! `//解析器的狀態(tài)取決于用戶首選項。
# S, Y  H" A( k: ~5 x) ^$ G5 o  [
" Y9 t" d, {1 p; g#define N_STARTUP_LINE 2 // Integer (1-2)# O9 J3 y* L- \4 N; K* k6 x/ ^  A

( O9 j2 I- T; F; \. j8 b// Number of floating decimal points printed by Grbl for certain value types. These settings are ( O: c" ]( ~4 v. S  `$ ?+ f
// determined by realistic and commonly observed values in CNC machines. For example, position8 q# G& ]" X- D
// values cannot be less than 0.001mm or 0.0001in, because machines can not be physically more
( J. l( _+ x) d$ w) M// precise this. So, there is likely no need to change these, but you can if you need to here.% b8 G, G4 F- d" p1 k- h
// NOTE: Must be an integer value from 0 to ~4. More than 4 may exhibit round-off errors., j+ J& s$ X2 q- u' r; ~
9 v- n) e9 `% @: V1 \9 R! B1 `+ W
// Grbl浮動小數(shù)點的數(shù)字印刷的特定的值類型。這些設(shè)置是
1 W1 O8 T7 {5 D2 r/ b9 S//一般由現(xiàn)實和觀測值在數(shù)控機(jī)器。例如,位置7 Z% h8 F! |) C6 d
//值不能小于0.001毫米或0.0001,因為機(jī)器不能身體更多8 f% h/ s9 |& s- c$ k" F1 k" b
//精確。因此,有可能不需要改變這些,但你可以在這里如果你需要。
1 U9 `  I( j# H) h//注意:必須是一個整數(shù)值從0 ~ 4。超過4可能出現(xiàn)舍入錯誤。
- D  v& S; Y$ o$ V* T' i
1 @) e- \/ G" o#define N_DECIMAL_COORDVALUE_INCH 4 // Coordinate or position value in inches 協(xié)調(diào)或位置價值英寸
8 W) `( b/ F! V0 t0 e+ T7 M#define N_DECIMAL_COORDVALUE_MM   3 // Coordinate or position value in mm 協(xié)調(diào)在毫米或位置價值6 s1 h# G3 j: h; D4 E7 m; K9 \$ L
#define N_DECIMAL_RATEVALUE_INCH  1 // Rate or velocity value in in/min 率或/分鐘的速度值
0 g. X5 P. p8 _) z( G#define N_DECIMAL_RATEVALUE_MM    0 // Rate or velocity value in mm/min 速率或速度值在毫米/分鐘. L# P; X! |6 x" c
#define N_DECIMAL_SETTINGVALUE    3 // Decimals for floating point setting values 對浮點小數(shù)設(shè)置值
; Z5 w! h0 C  u- j
$ R- u& l. z1 m% V! M, l1 Z// If your machine has two limits switches wired in parallel to one axis, you will need to enable
' R/ j2 T& {$ _, H# |% p8 Z// this feature. Since the two switches are sharing a single pin, there is no way for Grbl to tell
) S4 }: Z' k: t// which one is enabled. This option only effects homing, where if a limit is engaged, Grbl will $ H+ {, D9 z+ Q  {& L. r% [
// alarm out and force the user to manually disengage the limit switch. Otherwise, if you have one; K6 E; B& B3 o( l
// limit switch for each axis, don't enable this option. By keeping it disabled, you can perform a& r3 }9 a$ F8 R" j& i3 y* W* I
// homing cycle while on the limit switch and not have to move the machine off of it.
. F; a' L: u/ _6 o+ o: E' y" B5 W6 u8 p/ K
//如果你的機(jī)器有兩個極限開關(guān)連接在平行于一個軸,您需要啟用
# ]/ Z2 j, p: G( O//這個特性。自從兩個交換機(jī)共享一個銷,沒有辦法Grbl告訴
" {: W, l4 p- ^" |//啟用哪一個。此選項僅影響歸航,如果限制,Grbl意志
$ n# }4 O! s7 N; w8 N! N; U  N//報警,迫使用戶手動松開限位開關(guān)。否則,如果你有一個
, A5 W" U5 ?  p# t. H5 j( ^//為每個軸限位開關(guān),不啟用該選項。通過保持禁用,您可以執(zhí)行
- s! ^4 P. C* @/ ]) z//導(dǎo)航循環(huán)在限位開關(guān)并沒有將這臺機(jī)器。5 N" ^# R# z6 f

2 j$ z2 D/ s! {// #define LIMITS_TWO_SWITCHES_ON_AXES9 n2 U5 l& m9 W' @4 b9 G+ W" o
5 z/ D1 y4 x7 o) e
// Allows GRBL to track and report gcode line numbers.  Enabling this means that the planning buffer1 P9 i! r: u* R, O1 n
// goes from 18 or 16 to make room for the additional line number data in the plan_block_t struct$ B# r. f5 Y/ C1 ~& w5 T0 E8 \
" [; n( w6 P) a2 X
//允許GRBL跟蹤和報告gcode行號。使這意味著計劃緩沖從18歲或16歲,為額外的行號plan_block_t結(jié)構(gòu)中的數(shù)據(jù); i* C6 y6 r2 B, g: p( F& g$ O4 x' u/ H
+ |: V+ m7 [& N3 d; p2 h
// #define USE_LINE_NUMBERS // Disabled by default. Uncomment to enable.' R# w1 t) }$ Y% p6 w
" z9 X) |' \4 o6 ^
// Allows GRBL to report the real-time feed rate.  Enabling this means that GRBL will be reporting more ) ~, _- T6 F$ ]
// data with each status update.
- v0 N* O1 N- j// NOTE: This is experimental and doesn't quite work 100%. Maybe fixed or refactored later.
, h* N' k( |" X* Q2 S( @! y- m& M1 J//允許GRBL報告實時進(jìn)給速率。使這意味著GRBL將報告數(shù)據(jù)和狀態(tài)更新。
5 w9 T: Z! S6 o6 S/ U//注意:這是實驗和100%沒有工作。也許以后固定或重構(gòu)。3 ?" \' R1 Y# a) K

4 c8 w0 x. P& v2 i: w. w# e  a7 t// #define REPORT_REALTIME_RATE // Disabled by default. Uncomment to enable.
4 Q4 Y# ]1 @' N  s
5 s( [' T  p( c6 g  P8 E// Upon a successful probe cycle, this option provides immediately feedback of the probe coordinates
4 b7 a6 G! c3 U8 S" e// through an automatically generated message. If disabled, users can still access the last probe
' g5 U' N+ \' N6 ?7 `  Z3 h7 V// coordinates through Grbl '$#' print parameters.& g2 D) @0 r6 P' S' y
//在一個成功的調(diào)查周期,這個選項提供立即反饋的探測器坐標(biāo)
6 G( O9 w- p5 u* M//通過一個自動生成的消息。如果禁用,用戶仍然能夠訪問調(diào)查
. U  [$ U( d9 |( a; V+ \//坐標(biāo)通過Grbl $ #的打印參數(shù)。! V4 x3 k) I* H. `1 u( n

- b: |+ b1 g+ _8 m4 [2 \#define MESSAGE_PROBE_COORDINATES // Enabled by default. Comment to disable.
, R; {4 Z8 l- t2 \- |
. r2 D. K6 z$ u  b1 }// Enables a second coolant control pin via the mist coolant g-code command M7 on the Arduino Uno
4 T1 |* {; G, y8 f( I6 E// analog pin 5. Only use this option if you require a second coolant control pin.
: |" H: r$ q7 ]// NOTE: The M8 flood coolant control pin on analog pin 4 will still be functional regardless.
8 I" v, Z0 {: T// #define ENABLE_M7 // Disabled by default. Uncomment to enable." r5 ^0 Y7 H! u5 {9 K/ S

1 n. H5 `) ^$ p% u// This option causes the feed hold input to act as a safety door switch. A safety door, when triggered,
2 i: C) h7 |9 W% q2 {0 ~// immediately forces a feed hold and then safely de-energizes the machine. Resuming is blocked until( c: G7 M" j! M- E9 R, q4 g0 y9 ]
// the safety door is re-engaged. When it is, Grbl will re-energize the machine and then resume on the. }6 R6 V. y5 L
// previous tool path, as if nothing happened.
& Y. E0 o9 W# F// #define ENABLE_SAFETY_DOOR_INPUT_PIN // Default disabled. Uncomment to enable.( W: Q) F0 P. E) c& }

' @% ?0 k' Q2 _- I% s! F// After the safety door switch has been toggled and restored, this setting sets the power-up delay, k9 i) C3 }8 |+ Y. o, Z
// between restoring the spindle and coolant and resuming the cycle.
9 s0 R0 f* z7 N  M' E// NOTE: Delay value is defined in milliseconds from zero to 65,535.
4 c+ g  s* G/ @) T6 M1 i* Q! `0 z3 F( I3 s1 C, [4 R
//定義導(dǎo)航循環(huán)模式的位掩碼。歸航周期首先執(zhí)行一個搜索模式
1 g* e' {( G: r) ^! e$ f% _//快速進(jìn)行限位開關(guān),其次是較慢的定位模式,完成了由一個短+ {7 p- V1 h4 ~" F- D
//拖出運(yùn)動脫離限位開關(guān)。以下HOMING_CYCLE_x定義執(zhí)行
# k4 g6 j) E* ~) o8 M/ S: E//為了與后綴0開始并完成specified-axes只尋的例程。如果/ r* V4 X$ C. W& v# @  ^
//定義省略一個軸,它會不在家,也不會系統(tǒng)更新它的位置。
) H/ _, u1 w1 T3 f1 ?. t//意義,這允許用戶與非標(biāo)準(zhǔn)笛卡爾的機(jī)器,比如車床(x,z,
9 L- Z9 I5 I2 k$ F8 b8 K//沒有y),配置導(dǎo)航循環(huán)行為對他們的需求。+ Y6 g3 T% f" o, @+ x( p
//注意:歸航周期允許共享限制針,如果軸不相同8 u, n- p) E: x" D1 D& X
//循環(huán),但這需要一些銷設(shè)置cpu_map的變化。h文件。例如,默認(rèn)的導(dǎo)航
. v; K  u. r5 m6 q//循環(huán)可以分享Z限位銷X或Y限制針,因為它們是在不同的周期。
$ G; e- C( a, l1 p+ I//通過共享一個銷,這騰出寶貴的IO銷用于其他目的。從理論上講,所有軸限制別針
& K; M, w! Q: z+ O* o+ B2 U2 p//可能會減少到一個銷,如果所有軸與分離周期居住的地方,反之亦然,所有三個軸5 F. ~( b5 R' Y
//在不同銷,但這時候一個周期。同時,應(yīng)該注意的是,硬限制的功能/ B" q* P+ U) K: v* J3 b; C6 v+ s' ?2 p
//將不會影響銷共享。5 E, t! w( V  {0 k! o  S
//注意:默認(rèn)設(shè)置為一個傳統(tǒng)的硬件數(shù)控機(jī)器。z軸首次明確,其次是X和Y。
6 l6 [' r1 V& i/ o
; g' H8 k0 F' S: p6 O  E: [9 E" _( v
#define SAFETY_DOOR_SPINDLE_DELAY 4000; i$ x9 i" W* e/ D4 f% n
#define SAFETY_DOOR_COOLANT_DELAY 1000
# N+ I% U9 f9 Q3 z
* k; l$ t9 e) E, v// Enable CoreXY kinematics. Use ONLY with CoreXY machines.
: x: c, B+ ?' Z5 q2 d/ I// IMPORTANT: If homing is enabled, you must reconfigure the homing cycle #defines above to 1 y2 D5 e; E* u, T  D
//啟用CoreXY運(yùn)動學(xué)。只使用與CoreXY機(jī)器。( a  y1 ]6 ]- V: r
//重要:如果啟用了自動尋的,你必須重新配置導(dǎo)航循環(huán)#定義上面
5 s7 A  f" y2 x% M1 N. w4 b0 D7 h* z/ q
// #define HOMING_CYCLE_0 (1<<X_AXIS) and #define HOMING_CYCLE_1 (1<<Y_AXIS): g4 C: p+ l- w( Q% D1 @

, L2 Y, l' I5 J6 U+ ]// NOTE: This configuration option alters the motion of the X and Y axes to principle of operation
- c- P, f1 B$ K; V// defined at (http://corexy.com/theory.html). Motors are assumed to positioned and wired exactly as
( a+ e! B9 m9 @1 i+ z- b9 w// described, if not, motions may move in strange directions. Grbl assumes the CoreXY A and B motors5 U& }# l7 T/ t& x& t! \
// have the same steps per mm internally.
; n/ C2 `& |/ i; W# h//注意:這種配置選項改變X和Y軸的運(yùn)動原理,操作+ B. k! S! J: Y+ `
//定義(http://corexy.com/theory.html)。汽車被認(rèn)為定位和連接一樣
( g& d/ x* D. q0 M4 P% s# ~3 |  }//描述,如果沒有,運(yùn)動可能會奇怪的方向移動。A和B Grbl假設(shè)CoreXY馬達(dá)" i1 A) A9 A. W+ R9 Z4 B
//每毫米內(nèi)部有相同的步驟。0 K: I8 k% J1 X: k9 T
+ b6 ^/ D+ N( u  F& X
// #define COREXY // Default disabled. Uncomment to enable.' x  E, F2 Q5 a7 F6 u0 z
. u, O( O! I! ?) N+ w5 O
// Inverts pin logic of the control command pins. This essentially means when this option is enabled
1 _' m' C3 X+ f// you can use normally-closed switches, rather than the default normally-open switches.
- _+ d: }+ N3 Q  W// NOTE: Will eventually be added to Grbl settings in v1.0.
+ `  a/ T+ p2 Y9 C7 `' [: P//反轉(zhuǎn)針銷邏輯的控制命令。這實質(zhì)上意味著當(dāng)啟用這個選項0 h) b) B' _9 Q7 ?9 l
//可以使用閉合開關(guān),而不是默認(rèn)的常開開關(guān)。
4 A6 s" c: |  I0 t/ w//注意:最終將被添加到在v1.0 Grbl設(shè)置。
3 a3 f% K5 X4 ?' e0 K" D8 a) Z5 q  U. ^4 v
// #define INVERT_CONTROL_PIN // Default disabled. Uncomment to enable.
9 H3 z( P$ x4 N
, S1 ~3 p% E! M3 a/ u& E( ^$ j// Inverts the spindle enable pin from low-disabled/high-enabled to low-enabled/high-disabled. Useful- Y# @3 b( O4 ]  C$ L: L3 m
// for some pre-built electronic boards.
' L( W8 r( g& E$ B// NOTE: If VARIABLE_SPINDLE is enabled(default), this option has no effect as the PWM output and
% S4 ]: G3 B" r* T) P! A// spindle enable are combined to one pin. If you need both this option and spindle speed PWM, 3 S8 i& m6 n3 W) u$ I0 b  V0 v
// uncomment the config option USE_SPINDLE_DIR_AS_ENABLE_PIN below.7 F9 Q' [# W6 C% w3 F
//反轉(zhuǎn)主軸使銷從low-disabled / high-enabled low-enabled / high-disabled。有用的# b: M# N# t" M
//預(yù)構(gòu)建的電子板。
: y& c8 e+ I$ v* T) U/ y  J//注意:如果啟用了VARIABLE_SPINDLE(默認(rèn)),這個選項作為PWM輸出并沒有影響
' c, o4 f/ W0 N//銷軸使結(jié)合。如果你需要這個選項和主軸轉(zhuǎn)速PWM,
. F$ E- v+ N; W5 |2 o//取消注釋以下配置選項USE_SPINDLE_DIR_AS_ENABLE_PIN& u, O8 g: `  w' i
. H+ H$ B" m4 w+ }- U9 p) N2 o: Q
// #define INVERT_SPINDLE_ENABLE_PIN // Default disabled. Uncomment to enable.
- Q/ P6 R# m0 f2 \. r8 Y, Y
2 l( Q0 j: R  c' b& N& Y// Enable control pin states feedback in status reports. The data is presented as simple binary of0 K" u. \  U! S- J( X
// the control pin port (0 (low) or 1(high)), masked to show only the input pins. Non-control pins on the
" k" i. o5 K/ ~. R7 ^% W- m// port will always show a 0 value. See cpu_map.h for the pin bitmap. As with the limit pin reporting,6 A1 y0 ~: }2 C2 N) h
// we do not recommend keeping this option enabled. Try to only use this for setting up a new CNC.+ @+ C7 @4 o9 l6 H& Y& r
//啟用控制銷狀態(tài)反饋狀態(tài)報告。作為簡單的二進(jìn)制數(shù)據(jù)
% {% o5 H9 R$ G# G$ d5 [//控制針端口(0(低)或1(高)),蒙面,只顯示輸入插腳。非控制性針上0 S, X- T5 C* C
//端口總是顯示0值??吹絚pu_map。針位圖h。與限制銷報告,
3 N' Y. `7 Y7 @  \//我們不推薦保持啟用這個選項。盡量只使用這個設(shè)置一個新的數(shù)控。
# k7 v" j8 O( R7 Q. f0 h/ L/ t; C# ^+ F" d
// #define REPORT_CONTROL_PIN_STATE // Default disabled. Uncomment to enable.
! {+ T  p2 i" F& s( U- |6 {2 f: Y; t% V; ?+ q1 Q2 p
// When Grbl powers-cycles or is hard reset with the Arduino reset button, Grbl boots up with no ALARM
. l( T8 n. a0 o* B' W2 ^5 C// by default. This is to make it as simple as possible for new users to start using Grbl. When homing
9 K! @, ]7 h  r( `// is enabled and a user has installed limit switches, Grbl will boot up in an ALARM state to indicate
, W% A. N4 d+ q6 k4 j2 R1 F// Grbl doesn't know its position and to force the user to home before proceeding. This option forces8 W( ^4 [3 p. d8 j& \
// Grbl to always initialize into an ALARM state regardless of homing or not. This option is more for! u' [$ b& }4 W. Y
// OEMs and LinuxCNC users that would like this power-cycle behavior.
( G2 e2 O; W+ ?" V- |5 T4 j* S//當(dāng)Grbl powers-cycles還是硬重置Arduino復(fù)位按鈕,Grbl啟動沒有報警% t9 Z! n* ?4 I4 y# W. [* ?
//默認(rèn)情況下。這是為了讓新用戶盡可能簡單使用Grbl開始。當(dāng)歸航
- b" P$ W! C5 S8 M* _+ T' K' d' Y//啟用和用戶安裝限位開關(guān),Grbl將啟動報警狀態(tài)指示. [' L$ p8 L$ m# }' U+ c
// Grbl不知道它的位置,迫使用戶在繼續(xù)之前回家。這個選項部隊( Z! J0 @8 Q) a7 T, S. s0 ~5 f& V
// Grbl總是初始化進(jìn)入警報狀態(tài)不管歸航。這個選項是更多  i7 o4 L% R$ Q
//原始設(shè)備制造商和LinuxCNC用戶這樣的控制行為。+ s4 K. ^" Y9 \3 U5 I

& }/ y( n# s: S/ a// #define FORCE_INITIALIZATION_ALARM // Default disabled. Uncomment to enable.
3 G& M# W, ?1 c( ~+ z8 M
7 a9 Y+ g. z. k9 z7 c% u// ---------------------------------------------------------------------------------------8 P1 u, Q1 F2 o# X: M# |
// ADVANCED CONFIGURATION OPTIONS://高級配置選項:1 i' Z  |5 ?3 S) v

( l% h$ L8 o# u! N, e8 w6 m3 ?// Enables minimal reporting feedback mode for GUIs, where human-readable strings are not as important.
% m+ R1 l& P* m7 g) E// This saves nearly 2KB of flash space and may allow enough space to install other/future features.
6 `! |) `+ v1 C' ~7 V1 r// GUIs will need to install a look-up table for the error-codes that Grbl sends back in their place.4 L. L% P/ [) D
// NOTE: This feature is new and experimental. Make sure the GUI you are using supports this mode.
: e1 n+ J) f  c
% b6 |3 ^. J7 q0 F: V; g& G$ P/ A8 M// gui允許最小的報告反饋模式,人類可讀的字符串在哪里不重要。6 T6 M' X; M" f2 `
//這個節(jié)省近2 kb的閃存空間,允許足夠的空間來安裝其他/未來的功能。
# }3 P9 A# e% X2 {, O: N, X4 V// gui需要安裝一個查找表的錯誤代碼Grbl發(fā)回。$ {% Y4 j/ J3 j. o/ l) K" M
//注意:此功能是新的和實驗。確保您使用的GUI支持這種模式。
' N$ c! ~0 v# s: h3 o0 h! n/ Q6 ]6 v5 t
! O$ I* h- l/ m, h! B0 a2 x8 s8 C// #define REPORT_GUI_MODE // Default disabled. Uncomment to enable.8 u0 K3 l$ }. Z) c: d
) d; Q/ ^7 i# ?( J' d0 }, i
// The temporal resolution of the acceleration management subsystem. A higher number gives smoother
8 Q" R6 W, T, L9 A  d/ ^/ b// acceleration, particularly noticeable on machines that run at very high feedrates, but may negatively5 c9 z" v4 v5 e6 `6 `
// impact performance. The correct value for this parameter is machine dependent, so it's advised to
% R8 m1 @9 ]5 h) @; D- J// set this only as high as needed. Approximate successful values can widely range from 50 to 200 or more.. J4 X  _0 C! z5 |# V* o
// NOTE: Changing this value also changes the execution time of a segment in the step segment buffer. 2 S  R$ O, s! t. {& m' _
// When increasing this value, this stores less overall time in the segment buffer and vice versa. Make! P1 x4 Z. J- \6 g3 M1 ]+ a' ]
// certain the step segment buffer is increased/decreased to account for these changes./ E4 d: Z$ ~# h
//加速度的時間分辨率管理子系統(tǒng)。更多更平穩(wěn)$ R3 X% Q5 |2 R6 Y0 e
//加速度,特別明顯的機(jī)器上,運(yùn)行在非常高的進(jìn)料速度,但可能負(fù)面9 n( s: Z; L7 V" G0 C7 X$ ?
//影響性能。正確的值為這個參數(shù)是依賴于機(jī)器的,所以建議/ ?" v! `2 a+ W8 E  l" V
//這只設(shè)置為高。近似成功的價值觀可以廣泛的范圍從50到200或者更多。
( V' O+ p+ _0 C. h//注意:改變這個值也變化的部分步驟的執(zhí)行時間緩沖。8 {/ O" c  j3 c
//增加這個值時,這個商店部分緩沖區(qū)的總時間減少,反之亦然。使! Y, {. c  Y, }7 }
//特定步驟段緩沖是考慮這些變化增加/減少。! y- [/ Y' J' q; j$ O
" B- ]7 _/ j+ g( u& g
#define ACCELERATION_TICKS_PER_SECOND 100  //加速度的時間分辨率管理子系統(tǒng)。更多更平穩(wěn)
" ?8 D; E* s) t# b& S$ k' z
: N  H, ?0 P  I! O, q. j// Adaptive Multi-Axis Step Smoothing (AMASS) is an advanced feature that does what its name implies, , e/ t8 }0 d; j. b( z: c
// smoothing the stepping of multi-axis motions. This feature smooths motion particularly at low step+ Y* u' E* [& S: m
// frequencies below 10kHz, where the aliasing between axes of multi-axis motions can cause audible ! T' w" S) m' R# t* J
// noise and shake your machine. At even lower step frequencies, AMASS adapts and provides even better
$ k, U6 {) `/ |7 P7 x// step smoothing. See stepper.c for more details on the AMASS system works.
  ~  @! P; x$ K; I1 m" s9 K//自適應(yīng)多軸步平滑(積累)是一種先進(jìn)的功能,它的名字所暗示的那樣,; \" C6 M7 `( M7 K
//平滑的多軸步進(jìn)運(yùn)動。這個特性平滑運(yùn)動尤其是在低一步7 P$ N2 }+ S5 n' g
//頻率低于10 khz,軸之間的混疊的多軸運(yùn)動可能導(dǎo)致音響/ T8 P( D' e; y1 G- y& W. X, A
//噪音和震動你的機(jī)器。在更低的頻率步,積累適應(yīng)并提供更好( B" q' P; A9 b" }3 h
//步驟平滑。看到步進(jìn)。c更多細(xì)節(jié)的積累系統(tǒng)的工作原理。
9 i2 }+ K3 `, t6 g; I
/ Y/ O7 q, h1 `% d#define ADAPTIVE_MULTI_AXIS_STEP_SMOOTHING  // Default enabled. Comment to disable.//自適應(yīng)多軸步平滑
6 N2 h3 s) `0 d
! Z! q& U- d# s& m3 Y// Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error 7 y9 b8 N* Y3 W$ h
// check in the settings module to prevent settings values that will exceed this limitation. The maximum3 f6 D4 `! o4 r+ ^6 n/ G" I- a
// step rate is strictly limited by the CPU speed and will change if something other than an AVR running
* [& ]- X, e2 U2 _; |// at 16MHz is used.' B& H0 U" C( t' [- r
// NOTE: For now disabled, will enable if flash space permits.
: L/ H- i, Y' L5 C; d3 y( H2 `//設(shè)置最大一步速率可以寫成Grbl設(shè)置。這個選項可以使一個錯誤
) p* k2 r% ^* H' o3 B3 G9 N//設(shè)置模塊中檢查,防止設(shè)置值將超過這個限制。的最大
( a: {+ v/ d, c- Y, x//步驟嚴(yán)格限制的CPU速度也會改變?nèi)绻瞧渌鸄VR運(yùn)行
7 w3 b! a/ {! d! J/ M0 g; p) ~//使用16兆赫。
) P% f: t2 T( z! j; o, G. X//注意:現(xiàn)在殘疾,將使如果flash空間許可。
" k0 F9 g5 X( u6 [
8 u* r" v0 a/ l8 ]; ]- q// #define MAX_STEP_RATE_HZ 30000 // Hz 設(shè)置最大一步速率; o: x( J( q9 J9 |3 L3 g5 c
3 t! P* K  i/ ~0 t8 Q& E
// By default, Grbl sets all input pins to normal-high operation with their internal pull-up resistors
3 K: R" H- i4 e8 f( W- g% s2 x// enabled. This simplifies the wiring for users by requiring only a switch connected to ground, ; V# e! V$ E# R$ U# i
// although its recommended that users take the extra step of wiring in low-pass filter to reduce; ]: F1 E. X: Q' Y. P+ {
// electrical noise detected by the pin. If the user inverts the pin in Grbl settings, this just flips
! h) v: [& j7 x9 P. x) p// which high or low reading indicates an active signal. In normal operation, this means the user
0 a/ ]% K  c; e# n; b// needs to connect a normal-open switch, but if inverted, this means the user should connect a
. X( }( d0 E3 h* _// normal-closed switch.
" L: {! _  E- r5 Q- a3 w! i// The following options disable the internal pull-up resistors, sets the pins to a normal-low + p* g/ D8 }/ y2 w! |7 V
// operation, and switches must be now connect to Vcc instead of ground. This also flips the meaning + r3 ^6 e4 P6 J( ^
// of the invert pin Grbl setting, where an inverted setting now means the user should connect a
' E' q# m0 b# ^) h" [8 W; w- j3 V// normal-open switch and vice versa.
: P2 ?+ c- i- |5 K// NOTE: All pins associated with the feature are disabled, i.e. XYZ limit pins, not individual axes.
) ^9 O+ X  g6 d% \// WARNING: When the pull-ups are disabled, this requires additional wiring with pull-down resistors!
* q% K7 b0 i4 y! o% N) ?//默認(rèn)情況下,Grbl所有輸入引腳設(shè)置為正常高操作的內(nèi)部上拉電阻
% ~$ l& _5 g- w3 |/ T2 L//啟用。這簡化了布線為用戶只需要一個開關(guān)連接到地面,
& ]) ~( @; t4 i4 d" s, \. g8 Q; M( R& Y//雖然其建議用戶采取額外的步驟,在低通濾波器來減少布線
4 |$ D4 N! u  G/ e' Z//電噪音檢測銷。如果用戶反轉(zhuǎn)的銷Grbl設(shè)置,這只是翻轉(zhuǎn)
6 B: A) Y  t; a9 O2 C( j4 `//讀高或低表明一個積極的信號。在正常操作中,這意味著用戶" I! k6 X1 f6 O; O8 W
//需要連接一個常開開關(guān),但如果倒,這意味著用戶應(yīng)該連接( x! {9 [$ \5 C  N0 @6 _
// normal-closed開關(guān)。
, P  W% A" L* {" F- \. H! ?//以下選項禁用內(nèi)部上拉電阻,一般低設(shè)置別針! d; V2 j0 E3 G; w
//操作,現(xiàn)在開關(guān)必須連接到Vcc代替地面。這也掀的意思
9 m5 M1 S9 h' L- s2 Q0 e1 T' X0 f3 T/ \8 A//反銷Grbl設(shè)置,一個倒置的設(shè)置現(xiàn)在意味著用戶應(yīng)該連接
8 W# V0 T' u( _# I# V//常開開關(guān),反之亦然。
# }' m* ]* J- I2 v$ A& B//注意:所有針與功能被禁用,例如XYZ限制針,而不是單獨的軸。
4 c' D* f2 r+ g. v9 E9 J  Z//警告:引體向上被禁用時,這需要額外的布線與下拉電阻!8 y7 D5 X6 [. q5 h! w

5 }% V* {$ Q( w, K# v$ I8 `//#define DISABLE_LIMIT_PIN_PULL_UP //以下選項禁用內(nèi)部上拉電阻( E4 H% k; x/ A, n( U0 T' }
//#define DISABLE_PROBE_PIN_PULL_UP
* s# D, X8 h/ \% O1 O) t6 H//#define DISABLE_CONTROL_PIN_PULL_UP" d" [) H% w2 K; i

7 L; ~- \3 q' p+ ]2 d! |5 O// Sets which axis the tool length offset is applied. Assumes the spindle is always parallel with - E+ B& ~5 O7 a% w1 u  S
// the selected axis with the tool oriented toward the negative direction. In other words, a positive: I/ l, I" p' [: v
// tool length offset value is subtracted from the current location.
, }2 a1 K6 i7 o! H4 m, p* K& I" r2 g- K//設(shè)置哪個軸長度補(bǔ)償應(yīng)用的工具。假設(shè)軸總是與
$ ?9 X0 O6 h  V//選擇軸工具面向負(fù)方向。換句話說,一個積極的
$ s% P0 p6 A! ]' n0 b//工具長度偏移值減去從當(dāng)前位置。
$ k$ _( T- _( g4 ]6 r% q: N/ c# y; d3 s7 ?
#define TOOL_LENGTH_OFFSET_AXIS Z_AXIS // Default z-axis. Valid values are X_AXIS, Y_AXIS, or Z_AXIS.設(shè)置哪個軸長度補(bǔ)償應(yīng)用的工具9 }" k$ u8 ~, d

- ]- }  `' a1 ]; R! _" @, j// Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle0 f  V! I+ ~2 G# b" L- W3 l
// enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
8 Q; Q% f9 H9 D. M; W// NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
. F" G7 i+ Q1 k+ m! Q// The hardware PWM output on pin D11 is required for variable spindle output voltages.+ _2 `  R! w' ?! Y5 T- S
//允許變量軸輸出電壓不同的轉(zhuǎn)速值。Arduino Uno,主軸
5 J: j$ c3 g* t/ i3 H; f5 i, y% q//啟用銷將輸出5 v的最高轉(zhuǎn)速256中級水平和0 v時禁用。9 d: q# B* U- i9 M; j
//注意:重要Arduino凱澤本人!當(dāng)啟用時,Z-limit銷這里和軸銷D12開關(guān)!( v% ]7 Q7 x( g0 b. J/ n2 L' j
//硬件PWM輸出銷這里需要變量軸輸出電壓。
$ g- ?, n4 y) A) X3 ?8 _: m3 i6 C/ y$ D7 \! C2 F
#define VARIABLE_SPINDLE // Default enabled. Comment to disable.//允許主軸輸出電壓不同的轉(zhuǎn)速值
) d4 o7 M( ~. ?1 u7 |9 e3 B5 Y: z
3 [( |/ K* ?% c# @9 F! S// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed/ \/ T+ L2 y8 e( S# r- E7 {- B
// "S" g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
# M" L! J6 I" O( J5 ~// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 1000
6 g4 }& g  x' S( U, Y0 L// max rpm, and 250 min rpm, the spindle output voltage would be set for the following "S" commands:
% Q  r7 ?# h  U// "S1000" @ 5V, "S250" @ 0.02V, and "S625" @ 2.5V (mid-range). The pin outputs 0V when disabled.
$ k) |9 k/ ]* o8 _/ Y  ~1 p7 V//使用的變量軸輸出。這些參數(shù)設(shè)置最大和最小軸轉(zhuǎn)速
8 p5 P9 F( K4 N: M1 \//“S”刀位點值對應(yīng)于銷電壓的最大值和最小值。有256個離散和9 O6 G' K+ u9 x- a  ~* L+ o
//電壓平均分配箱主軸速度的最大值和最小值之間。所以對于一個5 v銷,1000
5 h& k$ F. U3 k' V! x( A2 _9 f// max rpm,250分鐘rpm,主軸輸出電壓將為以下“S”命令:
. t+ D' E) M! S, X+ A) I( u& \// @“S1000 5 v,“S250”@ 0.02 v,“S625”@ 2.5 v(中檔)。銷輸出0 v時禁用。( j1 ?8 D' [/ x# R$ @
3 }6 ?- }6 b( Y$ O/ a6 |5 D5 V
#define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM." d, K% `  O, O+ ^* H
#define SPINDLE_MIN_RPM 0.0    // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.& W( A- ]( j" ?2 E

' g5 g, h! A6 o9 w" c& b! v0 d// Used by variable spindle output only. This forces the PWM output to a minimum duty cycle when enabled.
; U, d/ W! @! N3 l, n// When disabled, the PWM pin will still read 0V. Most users will not need this option, but it may be 1 ?! }- a5 c' o
// useful in certain scenarios. This setting does not update the minimum spindle RPM calculations. Any, o4 e* e2 I. k" ?( R
// spindle RPM output lower than this value will be set to this value.
6 k6 ?) J& C% N4 `6 g8 @//使用的變量軸輸出。這迫使PWM輸出最小占空比時啟用。9 h) Y5 y( @9 E* @: @0 ~% }# {
//當(dāng)禁用,PWM銷仍讀0 v。大多數(shù)用戶不需要這個選項,但是它可能是/ D! D5 K& P4 M* r8 }' x& I7 y
//在某些情況下很有用。這個設(shè)置不會更新最小主軸轉(zhuǎn)速計算。任何
& J" X' @2 T2 t6 i1 a5 O//輸出軸轉(zhuǎn)速低于這個值將被設(shè)置為這個值。
" y- S' d  X) f6 z+ a' `% b) {0 D
0 L: J/ F, d& Y* n$ D$ U2 q6 H// #define MINIMUM_SPINDLE_PWM 5 // Default disabled. Uncomment to enable. Integer (0-255): A* c; H0 a0 N- q' g, y) {0 i

5 Y2 {9 |0 P- b, g" l, `// By default on a 328p(Uno), Grbl combines the variable spindle PWM and the enable into one pin to help - J5 F' x/ A: ^
// preserve I/O pins. For certain setups, these may need to be separate pins. This configure option uses% j4 B4 ~! M9 E7 n( P6 J3 s
// the spindle direction pin(D13) as a separate spindle enable pin along with spindle speed PWM on pin D11.
+ f5 g6 p/ K0 h8 w& c// NOTE: This configure option only works with VARIABLE_SPINDLE enabled and a 328p processor (Uno).
  C' V5 ?6 n8 R// NOTE: With no direction pin, the spindle clockwise M4 g-code command will be removed. M3 and M5 still work.1 e& w& m5 I  P0 _
// NOTE: BEWARE! The Arduino bootloader toggles the D13 pin when it powers up. If you flash Grbl with8 \- Y5 ^  O7 ^! q& O
// a programmer (you can use a spare Arduino as "Arduino as ISP". Search the web on how to wire this.), # j2 B5 V9 w% P* d0 _# N; M4 I
// this D13 LED toggling should go away. We haven't tested this though. Please report how it goes!
) a0 i& y2 Z0 C, Q! G9 X$ S& o2 x+ H//默認(rèn)ATmega328 p(Uno),Grbl結(jié)合變量軸PWM和使到一個銷的幫助
* z( i' ]5 Q% v6 p& X" H0 m4 ~//保存I / O管腳。對于某些設(shè)置,這些可能需要單獨的別針。這個配置選項使用
, w+ h$ r& P: Z( _( O  G# v  g//方向軸銷(D13)作為一個單獨的軸銷上啟用銷以及主軸轉(zhuǎn)速PWM這里。
' E' C4 ^' z, b& t( d//注意:該配置選項僅適用于VARIABLE_SPINDLE啟用和328 p處理器(Uno)。$ ?; V% r) y5 z" V& n
//注意:沒有方向銷,主軸順時針M4刀位點命令將被刪除。M3和M5仍然工作。- `7 P! W1 j# j' f
//注意:小心!Arduino引導(dǎo)裝載程序切換D13銷的權(quán)力。如果flash Grbl
8 @$ s$ E: R, P  b( p) c4 k5 G//程序員(您可以使用一個備用Arduino“Arduino ISP”。搜索網(wǎng)絡(luò)如何線),$ K) L/ F' O  Y' y) P& Q% ]
//這D13導(dǎo)致切換應(yīng)該消失。我們還沒有測試這個。請報告將會怎樣!- K4 R- `* x4 p) n) Z: m8 `

9 N$ H  G# l1 {5 x" j# E9 s& p; P// #define USE_SPINDLE_DIR_AS_ENABLE_PIN // Default disabled. Uncomment to enable.9 I. K! P% s" d

, D" N" _1 G, |2 X. F: S6 V$ B// With this enabled, Grbl sends back an echo of the line it has received, which has been pre-parsed (spaces5 w' a! k, e, i! X0 o
// removed, capitalized letters, no comments) and is to be immediately executed by Grbl. Echoes will not be 7 ?" w: s4 n4 D) X! U- d
// sent upon a line buffer overflow, but should for all normal lines sent to Grbl. For example, if a user
5 u# W* [/ ?5 _2 `, ?3 X// sendss the line 'g1 x1.032 y2.45 (test comment)', Grbl will echo back in the form '[echo: G1X1.032Y2.45]'.
! S: t& E, [! D  J# l// NOTE: Only use this for debugging purposes!! When echoing, this takes up valuable resources and can effect
6 A& I5 f* A. m8 Y: u// performance. If absolutely needed for normal operation, the serial write buffer should be greatly increased& C9 t8 D+ n5 y
// to help minimize transmission waiting within the serial write protocol.
9 ~3 |, R6 G7 q! s$ n" N: L$ u
# W( `+ J. w: f- ~5 L0 f* g//啟用,Grbl發(fā)回的回聲線已收到,已預(yù)編譯(空間/ N1 n6 N+ s, F: {
//移除,大寫字母,沒有評論),由Grbl立即執(zhí)行?;芈晫⒉粫?br />   m0 ~% ~  g+ i9 l' m//發(fā)送一個線緩沖區(qū)溢位,但應(yīng)該對所有正常線路送到Grbl。例如,如果一個用戶
/ x* }# t; S1 i4 l//發(fā)送線的g1 x1.032 y2.45(測試評論)形式”,Grbl將回聲”(回聲:G1X1.032Y2.45]”。7 J* O) _! Q9 A* C- p( q8 J
//注意:只使用這個調(diào)試! !當(dāng)呼應(yīng),這占用了寶貴的資源,可以影響9 s; J* x9 y5 W7 V9 s# }
//性能。如果正常運(yùn)行所需的絕對,串行寫入緩沖器應(yīng)該大大增加
" x- e5 K7 H, O//幫助最小化傳輸?shù)认盗袃?nèi)寫協(xié)議。& R/ C2 e9 H% y5 E: w
4 R! n$ U( R" |0 t
// #define REPORT_ECHO_LINE_RECEIVED // Default disabled. Uncomment to enable.4 O$ u) q9 C, X. |' ?1 w, ~3 y% A

$ O4 L. A& v# }// Minimum planner junction speed. Sets the default minimum junction speed the planner plans to at3 ]( P. Q7 P2 E( v
// every buffer block junction, except for starting from rest and end of the buffer, which are always) \/ @: [4 S* `
// zero. This value controls how fast the machine moves through junctions with no regard for acceleration
; w& S$ n' I% i) f// limits or angle between neighboring block line move directions. This is useful for machines that can't+ Z' l8 |8 e6 O) x4 @7 x' F
// tolerate the tool dwelling for a split second, i.e. 3d printers or laser cutters. If used, this value
- O$ |" R  U1 v! _- b! h$ r1 S// should not be much greater than zero or to the minimum value necessary for the machine to work.. x/ J' A) e! w0 D8 J, M1 _
& e) ]; t1 b# x/ E0 l5 K
//最小規(guī)劃師結(jié)速度。設(shè)置默認(rèn)最小連接速度規(guī)劃計劃
5 z! p- @# ~# f. j  [( K% u//每一個緩沖塊接頭,除了從結(jié)束休息和緩沖區(qū),它總是0 q7 W& B# ]0 U' O5 x& ^
// 0。這個值控制機(jī)器的速度穿過路口,沒有考慮加速度
0 U3 a" ~: ]( b//限制或相鄰塊之間的角線方向移動。這是有用的機(jī)器,不能2 l9 S: f* Q" x/ N: L6 }- {
//容忍工具居住某一剎那,即3 d打印機(jī)或激光切割機(jī)。如果使用這個值
! V4 M0 a; g; D/ ^//不應(yīng)大于零或機(jī)器工作所需的最小值。
7 X; `# F, u' C, X8 Q% i; A; H4 W( ?4 e- s/ @6 y- F& _5 c
#define MINIMUM_JUNCTION_SPEED 0.0 // (mm/min)- G7 o8 Z' P2 B5 s) c. O: Y
2 Q/ H9 n' Y$ B0 `
// Sets the minimum feed rate the planner will allow. Any value below it will be set to this minimum; c5 w- z$ [) }" {/ `: m
// value. This also ensures that a planned motion always completes and accounts for any floating-point
1 I: k9 {0 ?. {9 U* y) ?# x// round-off errors. Although not recommended, a lower value than 1.0 mm/min will likely work in smaller4 W+ j* [8 b, u& x, i8 x6 o* ~
// machines, perhaps to 0.1mm/min, but your success may vary based on multiple factors.
! \+ ~* n/ X9 R# p6 n1 X& |//設(shè)置計劃將允許的最小進(jìn)給速率。任何價值低于它將被設(shè)置為最低值。這也保證了運(yùn)動計劃總是完成,占任何浮點( l% c. _* P6 K) T- t9 o
//舍入錯誤。雖然不推薦,價值低于1.0毫米/分鐘可能會在較小的工作
0 w( e  ]! ?3 s# r, F: m//機(jī)器,也許到0.1毫米/分鐘,但你的成功基于多種因素可能會有所不同。3 W# L" h1 Y+ Y, ~% V! F
, ?- i# k& I7 O4 n. q
#define MINIMUM_FEED_RATE 1.0 // (mm/min)//設(shè)置計劃將允許的最小進(jìn)給速率3 Q# b; Q, ?6 b
% _0 j5 D- E% H: B2 u
// Number of arc generation iterations by small angle approximation before exact arc trajectory 6 z( F6 R" l. e5 \" u/ y
// correction with expensive sin() and cos() calcualtions. This parameter maybe decreased if there 2 r0 @: M1 m) u) x- j: ]
// are issues with the accuracy of the arc generations, or increased if arc execution is getting
0 U0 U, G6 L3 l3 c8 i6 g// bogged down by too many trig calculations.
+ P9 u0 b! D3 b: I2 d  d! W//弧生成迭代次數(shù)之前小角度近似精確的弧線軌跡% F( O# Q* i- h
//修正與昂貴的sin()和cos()calcualtions。如果有這個參數(shù)可能減少9 m+ n& Z) ~4 u$ N0 j0 @; ]$ @
//與弧一代又一代的準(zhǔn)確性問題,或如果電弧執(zhí)行得到增加
! s3 \/ o8 H" }9 @1 G4 e//太多的三角計算的泥潭。
; V# n( v/ U, F
( F- K8 O( R+ n3 p) P0 u9 F#define N_ARC_CORRECTION 12 // Integer (1-255)5 e) f4 O+ k1 [

  R# \2 N' b5 O: M) u// The arc G2/3 g-code standard is problematic by definition. Radius-based arcs have horrible numerical # q4 G7 N3 \5 X8 [* x0 F/ n
// errors when arc at semi-circles(pi) or full-circles(2*pi). Offset-based arcs are much more accurate 9 B' O7 W( ], N) o2 t) Z+ y
// but still have a problem when arcs are full-circles (2*pi). This define accounts for the floating % [5 Q) f' ~. ]3 R! f. u) B
// point issues when offset-based arcs are commanded as full circles, but get interpreted as extremely9 l+ s. \  i+ I  _; q2 Z8 z
// small arcs with around machine epsilon (1.2e-7rad) due to numerical round-off and precision issues.
. i9 F- D) U' T// This define value sets the machine epsilon cutoff to determine if the arc is a full-circle or not.  r  d/ P. E0 w2 `6 N
// NOTE: Be very careful when adjusting this value. It should always be greater than 1.2e-7 but not too
, D  R) N( |- l4 b) F" u3 B// much greater than this. The default setting should capture most, if not all, full arc error situations.
. j0 e+ m2 B0 s$ n# l" q% h//弧G2/3刀位點的標(biāo)準(zhǔn)定義是有問題的。Radius-based弧有可怕的數(shù)值
, O! d  A! [$ k4 M5 R//錯誤當(dāng)電弧在半圓(π)或原點(2 *π)。Offset-based弧更準(zhǔn)確, n1 _& i8 g8 `# }
//但仍有一個問題當(dāng)弧原點(2 *π)。這個定義占浮動
: U7 S4 k& H" G//當(dāng)offset-based弧吩咐點問題完整的圓,但解釋為極# r& E7 W# I+ a% D* X- F
//小弧機(jī)周圍ε(1.2 e-7rad)由于數(shù)字舍入和精度問題。
% i0 O# l8 P: a/ |* ^//定義值設(shè)置機(jī)器ε截止來確定電弧是一個原點了。
* t  M) r+ B% f' f" ]0 V: N& D//注意:調(diào)整這個值時非常小心。它應(yīng)該總是大于1.2 e -但不要太# O! ]; p0 `1 e% w) L; l$ o. ?
//比這大得多。默認(rèn)設(shè)置應(yīng)該捕獲大部分,如果不是全部,全部錯誤的情況。
& P7 ^7 G7 n+ H2 h
* Z0 I+ M1 G1 R8 \4 d7 W  c- B#define ARC_ANGULAR_TRAVEL_EPSILON 5E-7 // Float (radians)- E# [' n/ y7 ]$ Y; I. G4 ]

) N2 C. u6 z/ f1 m' E; a2 e6 }// Time delay increments performed during a dwell. The default value is set at 50ms, which provides2 ~9 `3 {( ]# e& b( B# ]) t* h
// a maximum time delay of roughly 55 minutes, more than enough for most any application. Increasing8 B( O/ Q6 V  v8 O# C
// this delay will increase the maximum dwell time linearly, but also reduces the responsiveness of
# q/ y; Y2 H8 e3 `// run-time command executions, like status reports, since these are performed between each dwell 1 o' m+ D9 W6 m. W9 g. s
// time step. Also, keep in mind that the Arduino delay timer is not very accurate for long delays.  H1 r% r) ?' r7 L
//延時增加表現(xiàn)在住。默認(rèn)值設(shè)置為50毫秒,它提供了9 x3 b) i0 e9 @9 v7 y
//最大延時約55分鐘,足夠?qū)Υ蠖鄶?shù)任何應(yīng)用程序。增加" T% Y: O; {0 ^& c
//這種延遲將增加線性最大停留時間,也減少了響應(yīng)能力' O8 {0 ^0 A% j0 [
//運(yùn)行命令執(zhí)行狀態(tài)報告一樣,因為這些每個住之間執(zhí)行
/ Z8 Q5 {5 e$ Y- I+ r: g//時間步。還有,記住,Arduino延遲計時器不是很準(zhǔn)確的長時間延誤。6 h" l$ h' h& F. f

" U+ b; }! _' K& {) @3 g. }#define DWELL_TIME_STEP 50 // Integer (1-255) (milliseconds); ]4 s/ I  _. z# ?. K" u2 M, C

) O( s6 I* [& W. ^. l8 R/ L. `7 r// Creates a delay between the direction pin setting and corresponding step pulse by creating8 F8 K  ^9 t4 q2 \; f4 u
// another interrupt (Timer2 compare) to manage it. The main Grbl interrupt (Timer1 compare) ) e/ _: l6 o& n" Z& O( O2 u8 e
// sets the direction pins, and does not immediately set the stepper pins, as it would in
# z( i0 S1 {- p# X- a1 h6 @// normal operation. The Timer2 compare fires next to set the stepper pins after the step ; h  @6 ]/ x5 }# l* R- _& [, r
// pulse delay time, and Timer2 overflow will complete the step pulse, except now delayed
/ g& z+ B% r/ W2 z+ p8 d. l! M0 X0 ~// by the step pulse time plus the step pulse delay. (Thanks langwadt for the idea!)
2 p' s. w3 ]# u: H6 J3 q// NOTE: Uncomment to enable. The recommended delay must be > 3us, and, when added with the# ~; }3 q; ^  V" }2 v; _
// user-supplied step pulse time, the total time must not exceed 127us. Reported successful
3 p) d3 ?/ i0 {. W9 g// values for certain setups have ranged from 5 to 20us.
1 f3 T) D) ]% {; n" k//創(chuàng)建一個方向銷之間的延遲脈沖通過創(chuàng)建設(shè)置和相應(yīng)的步驟
+ p6 I. Y2 O6 a: U//另一個中斷(Timer2比較)來管理它。主要Grbl中斷(Timer1比較)* Y& a; o" j( q1 B9 b  Z
//設(shè)置方向針,不立即設(shè)置步進(jìn)針,因為它會在) {( d" k& e0 k, t4 g$ ]) y
//正常操作。Timer2比較火旁邊設(shè)置步進(jìn)針后一步, m; M" J1 R; D* o  A
//脈沖延遲時間,Timer2溢出脈沖將完成的步驟,現(xiàn)在延遲除外9 ]- h4 ]1 n9 i3 N8 q2 [
//脈沖時間加上的一步一步脈沖延遲。(感謝langwadt主意!)
$ M) K$ j- G7 I//注意:取消啟用。必須> 3,建議延遲,當(dāng)添加的- A8 s, G: r- u- t$ S% `
//用戶提供的步驟脈沖時間,總時間不得超過127美元。成功的報道
; l0 G% |+ v7 p! C* Y3 D7 x//值對某些設(shè)置范圍從5到20。0 G  {" {5 Q# }# k

# o) D, `" T2 s( n// #define STEP_PULSE_DELAY 10 // Step pulse delay in microseconds. Default disabled.+ e; b3 t0 R& Y# \) p6 `
2 O0 e/ L9 K0 ^+ x5 Z2 H) U
// The number of linear motions in the planner buffer to be planned at any give time. The vast
) M1 B3 J/ @9 ]7 G6 b  K% w// majority of RAM that Grbl uses is based on this buffer size. Only increase if there is extra
2 S/ B# k0 ^1 V" P' Q! r// available RAM, like when re-compiling for a Mega or Sanguino. Or decrease if the Arduino3 q/ N1 N2 J5 g3 D0 ]  z
// begins to crash due to the lack of available RAM or if the CPU is having trouble keeping8 d6 @. \( P1 {! \  v% `8 E
// up with planning new incoming motions as they are executed.
  G3 K- _8 N% z. `//線性運(yùn)動規(guī)劃師緩沖區(qū)的數(shù)量在任何給出時間計劃。絕大- t/ w5 z" e( o/ H' a
//多數(shù)RAM Grbl使用基于這個緩沖區(qū)的大小。如果有額外的只會增加( l# J7 s7 B; P; C2 y% N* F! a
//可用內(nèi)存,比如當(dāng)基于大型或Sanguino。如果Arduino或減少
% v1 W8 P! L8 `3 P( i//開始崩潰由于缺乏可用的RAM或者CPU是難以保持
% Y  ~" Y* H* z9 `6 v2 T. I8 c//與規(guī)劃新傳入的動作執(zhí)行。
$ k7 ?$ Z7 e& E0 \1 T1 g
9 i3 V9 K  v& c// #define BLOCK_BUFFER_SIZE 18  // Uncomment to override default in planner.h.
3 q( R8 H( \: I: {& x
/ z( n1 h  s4 X/ l7 m1 s, T3 m  |// Governs the size of the intermediary step segment buffer between the step execution algorithm
) Q$ o# ~" u8 F$ R// and the planner blocks. Each segment is set of steps executed at a constant velocity over a7 Q; }7 s9 M5 [2 A
// fixed time defined by ACCELERATION_TICKS_PER_SECOND. They are computed such that the planner2 U2 j% i: c  E! ?8 z
// block velocity profile is traced exactly. The size of this buffer governs how much step
: F; ~. ]2 ]2 I7 C0 g  E// execution lead time there is for other Grbl processes have to compute and do their thing
& T7 O) X  ^% Z7 U5 C( y  M// before having to come back and refill this buffer, currently at ~50msec of step moves.# {/ u5 ]% _4 ?3 _7 [3 Z2 m9 [
//控制之間的中間段緩沖大小的步驟執(zhí)行算法
1 _/ h% X4 T" J+ |  e7 v* G//和規(guī)劃師塊。每一部分的步驟執(zhí)行在一個恒定的速度
$ U" ]2 h# F. o//固定的時間由ACCELERATION_TICKS_PER_SECOND定義的。他們計算的計劃  [! S9 J: q4 ?1 ]8 ], r3 H
//塊速度剖面追蹤到底。這個緩沖區(qū)的大小控制多少步驟. a# D& _$ \8 ~1 @  t( B
//執(zhí)行時間有其他Grbl過程需要計算和做他們的事情
- T, \) x% {" O& h0 B//之前必須回來重新填充這個緩沖區(qū),目前移動~ 50毫秒的一步。8 e$ E# t, \/ q5 J' j7 G; x+ c) Z3 U
% y. V) F; G! n
// #define SEGMENT_BUFFER_SIZE 6 // Uncomment to override default in stepper.h.; t. y" `  m  q' A2 H

; K/ e9 }& P0 `+ F// Line buffer size from the serial input stream to be executed. Also, governs the size of
, _$ v. X* ?2 [# S) D// each of the startup blocks, as they are each stored as a string of this size. Make sure$ g( |$ ~5 ~: d2 {0 k. P" t" Q
// to account for the available EEPROM at the defined memory address in settings.h and for8 `; v2 z4 y9 n/ T
// the number of desired startup blocks.5 z0 c% S+ g# L$ Q
// NOTE: 80 characters is not a problem except for extreme cases, but the line buffer size ; h+ A8 _) f& W; k5 G1 T5 n
// can be too small and g-code blocks can get truncated. Officially, the g-code standards ! p) g/ B% v" o* x) p
// support up to 256 characters. In future versions, this default will be increased, when * N) }! P. E6 P# R+ g& D
// we know how much extra memory space we can re-invest into this.
4 p3 z4 h& \. m% g# q//行執(zhí)行串行輸入流的緩沖區(qū)大小。同時,大小的控制
, q& I) n& n; n" {2 e! F9 ^1 E//每個啟動模塊,它們分別存儲為字符串的大小。確保
0 j. B$ @# x7 {# |' i2 N" i7 @! v//占可用eepm定義內(nèi)存地址的設(shè)置。h和
* s# K% m4 c0 p5 H4 g4 @//需要啟動塊的數(shù)量。6 l) K- b" C' B2 T
//注意:80個字符不是一個問題,除了極端的情況下,但線緩沖區(qū)大小/ h  Q) o/ T9 B
//可以太小和刀位點塊可以截斷。正式,刀位點標(biāo)準(zhǔn)# W) R. e0 B3 D& _, a
//支持多達(dá)256個字符。在未來的版本中,這個違約將會增加,當(dāng)7 h. s/ h3 S1 N
//我們知道多少額外內(nèi)存空間的時候我們可以再投資。
+ s! {' h$ |' A+ W* H7 v# N- p  D9 J8 ]/ E$ G( I
// #define LINE_BUFFER_SIZE 80  // Uncomment to override default in protocol.h& E7 F- I# x' N  J  k
  
0 S% w  _: Y, b# Z& ]! {2 @// Serial send and receive buffer size. The receive buffer is often used as another streaming
! X. E" w) Z/ g0 U# ?9 k1 Y// buffer to store incoming blocks to be processed by Grbl when its ready. Most streaming
$ n! p- `) [. D+ C: X// interfaces will character count and track each block send to each block response. So,
( f+ w4 j  c: D( O, g* S; W// increase the receive buffer if a deeper receive buffer is needed for streaming and avaiable
. d3 N& a5 V% J5 ?; k# ^// memory allows. The send buffer primarily handles messages in Grbl. Only increase if large
3 b' B, A& V' Z// messages are sent and Grbl begins to stall, waiting to send the rest of the message.6 x, V# x+ H% P5 {9 ~
// NOTE: Buffer size values must be greater than zero and less than 256.
# ^# p$ \/ R9 R* S// #define RX_BUFFER_SIZE 128 // Uncomment to override defaults in serial.h
( j* G/ I. D3 X4 i7 a) q//串行發(fā)送和接收緩沖區(qū)大小。接收緩沖區(qū)通常用作另一個流% p. T, v* x3 r- l3 w
//緩沖存儲傳入的塊來處理Grbl當(dāng)它準(zhǔn)備好了。最流* m9 K- O1 p: N5 U
//接口將字符計數(shù)和跟蹤每一塊發(fā)送給每個塊的回應(yīng)。所以,9 Q1 H) y. v! W* y- N4 n
//增加接收緩沖區(qū)如果需要更深層次的接收緩沖區(qū)為流,、& b7 t& Y  V* K% i9 o
//內(nèi)存允許。Grbl發(fā)送緩沖主要處理消息。只會增加如果大0 y& g- ]: |7 R
//消息發(fā)送和Grbl開始停滯,等待發(fā)送其余的消息。
: c0 }+ v6 f6 F# W//注意:緩沖區(qū)大小值必須大于零,小于256。( {. n2 a  i( Z4 ?, R) e! M
// # define RX_BUFFER_SIZE 128 / /取消serial.h覆蓋默認(rèn)值
. W- t: ~0 ~- s# U7 T: `* y) Q+ k9 ~( {5 q8 z6 U4 }

5 R; f) u0 F/ J& z/ e// #define TX_BUFFER_SIZE 64
5 V6 i' J- h+ V+ K+ f  9 n. J4 D$ h9 V' Y* `
// Toggles XON/XOFF software flow control for serial communications. Not officially supported
% V' u" o% k; ~! v2 O$ x// due to problems involving the Atmega8U2 USB-to-serial chips on current Arduinos. The firmware
* }2 f. L# N2 w% r// on these chips do not support XON/XOFF flow control characters and the intermediate buffer   O4 M: j* b- y* ?! f0 @. v) z( K
// in the chips cause latency and overflow problems with standard terminal programs. However,   i; o% d& u8 M$ X
// using specifically-programmed UI's to manage this latency problem has been confirmed to work.
3 y. C( L% m! P' ]7 N& c- m// As well as, older FTDI FT232RL-based Arduinos(Duemilanove) are known to work with standard$ a& @- g; I6 \: ]5 s- g
// terminal programs since their firmware correctly manage these XON/XOFF characters. In any
. d5 ~: i% V/ J// case, please report any successes to grbl administrators!
& K5 b! G* L+ F- Y& \2 I( q//切換為串行通信發(fā)送樸通/發(fā)送葡開軟件流控制。不是官方支持
2 ]9 X8 k7 M* {6 m//由于問題涉及Atmega8U2 USB-to-serial當(dāng)前arduino芯片。固件
7 T6 n! U7 P- _% t' k0 d//在這些芯片不支持發(fā)送樸通/發(fā)送葡開流控制字符和中間緩沖區(qū)
9 c  V; |1 C$ |3 F1 S//芯片導(dǎo)致延遲和溢出問題的標(biāo)準(zhǔn)終端程序。然而,/ @4 |: B" @, H% P. ?
//使用specifically-programmed UI的管理這個延遲問題已經(jīng)確認(rèn)工作。
4 \' K4 K/ M! t. o) h- J7 C//以及老FTDI FT232RL-based arduino(Duemilanove)是已知的標(biāo)準(zhǔn)
/ T/ O" d% R& N4 S//終端程序因為他們正確的固件管理這些發(fā)送樸通/發(fā)送葡開的角色。在任何
% c% H1 f2 }0 q+ t. K/ q: [# h//情況,請報告任何成功grbl管理員!
& y1 ~# d+ `2 {( \; |% a0 b% R8 s/ M* b% P8 s
// #define ENABLE_XONXOFF // Default disabled. Uncomment to enable.- D1 ]* V6 U4 E6 l; `

3 L1 Y/ W/ ~$ Q// A simple software debouncing feature for hard limit switches. When enabled, the interrupt
6 L: `, T; E$ b% ?9 C9 B// monitoring the hard limit switch pins will enable the Arduino's watchdog timer to re-check # q, ]& T; c* M
// the limit pin state after a delay of about 32msec. This can help with CNC machines with
4 y: D( d. D% w- g// problematic false triggering of their hard limit switches, but it WILL NOT fix issues with 1 X4 P7 _, c! `$ s5 I* n' E
// electrical interference on the signal cables from external sources. It's recommended to first
% ?8 V- A9 P2 O* z# w. _4 i7 k// use shielded signal cables with their shielding connected to ground (old USB/computer cables
0 V2 h! n* B1 Q! T8 m6 h4 Y// work well and are cheap to find) and wire in a low-pass circuit into each limit pin.9 {# ?% i" ~3 E. O
//一個簡單的軟件消除抖動特性硬限位開關(guān)。當(dāng)啟用時,中斷: V/ Y  w7 L7 l$ }. \
//監(jiān)控硬限位開關(guān)針將使Arduino的看門狗定時器重新審視
* U0 I7 E9 k: E, Z, |0 L! z//銷的極限狀態(tài)后約32毫秒的延遲。這可以幫助與數(shù)控機(jī)器- _& A! i$ _, d
//問題錯誤引發(fā)的硬限位開關(guān),但是它不會解決問題
5 H5 t9 s2 G0 Q/ v& x0 l2 U//電干擾信號電纜從外部來源。首先它的建議
+ X4 H8 `1 B" _4 ?" R1 X: Y: x7 L0 q//使用屏蔽信號電纜的屏蔽連接到地面(老USB /計算機(jī)電纜
, w: E  R% x' |, f6 ~. x& L//工作得很好,很便宜)和線低通電路到每個限位銷。
6 q: j* F0 I0 z, Q! t) Y5 v0 z6 W& k
// #define ENABLE_SOFTWARE_DEBOUNCE // Default disabled. Uncomment to enable.6 u, R  B3 j+ v! X
- z* c0 F1 ~2 V
// Force Grbl to check the state of the hard limit switches when the processor detects a pin: |! B7 g; |2 n/ A5 T/ C* w1 ?
// change inside the hard limit ISR routine. By default, Grbl will trigger the hard limits
1 J5 G8 f( E4 x; K: e) R) P6 `// alarm upon any pin change, since bouncing switches can cause a state check like this to
+ H9 c3 i" d1 {0 F0 @// misread the pin. When hard limits are triggered, they should be 100% reliable, which is the
# b7 P/ |* A1 N! W; _/ S7 J// reason that this option is disabled by default. Only if your system/electronics can guarantee
5 H" H6 q* [4 i+ ~// that the switches don't bounce, we recommend enabling this option. This will help prevent/ e! k5 ?& z0 E1 H, k* z
// triggering a hard limit when the machine disengages from the switch.
: M5 K2 H" Z1 q+ Y6 o' {- ^// NOTE: This option has no effect if SOFTWARE_DEBOUNCE is enabled.
9 r) E3 q) ]3 v0 S1 D/ O& f//力Grbl檢查硬限位開關(guān)的狀態(tài),當(dāng)處理器檢測到一個銷
( V( \, Z: C8 u& \# K! f7 M//改變內(nèi)部硬限制ISR例行公事。默認(rèn)情況下,Grbl將觸發(fā)硬限制: a9 U! J8 X9 r5 e' g2 e# o5 {& g
//報警在任何銷更改,因為跳開關(guān)可以導(dǎo)致這樣的狀態(tài)檢查/ g; A+ P! G6 E4 F
//誤讀了銷。硬限制觸發(fā)時,他們應(yīng)該100%可靠,這是& i& {2 l5 a, j- {5 Q
//原因,這個選項默認(rèn)是禁用的。只有在你的系統(tǒng)/電子產(chǎn)品可以保證9 |( \. C' M1 r. w' A8 P2 k5 `
//開關(guān)不反彈,我們建議啟用這個選項。這將有助于防止  R- [8 R( Z( L( N6 D+ H
//觸發(fā)機(jī)退出時硬限制開關(guān)。0 @  r0 C7 c8 ?+ `: Y: V
//注意:這個選項如果啟用了SOFTWARE_DEBOUNCE沒有影響。' R7 z0 H6 f% H
- G8 w" @, |/ G9 [; ]
// #define HARD_LIMIT_FORCE_STATE_CHECK // Default disabled. Uncomment to enable.
% m2 X, {: o( h: W# N8 r" c/ e. j/ g9 ^  G* I) i% n

3 C3 ^) E2 ~" N' y5 D// ---------------------------------------------------------------------------------------
' W! t2 }- O! t# W0 m3 Z  C# I3 G// COMPILE-TIME ERROR CHECKING OF DEFINE VALUES:編譯時錯誤檢查的定義值:, W' U3 E4 ]* d: K: L; H
' x9 d, a" c: b  z" f
#ifndef HOMING_CYCLE_0
9 T  @7 C% z* m4 S8 z9 W5 x1 P  #error "Required HOMING_CYCLE_0 not defined."
3 A# t+ m  `4 p, g4 ~#endif
: p' k( T) {; Y8 d# R1 U
* n0 M1 }1 r. l: S0 |5 o; y1 x#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE)
+ Y7 R# K; {- W, c( g8 W  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled"* G5 {3 g: f3 Q9 ?1 a. p; `' [
#endif, [, B7 ^# h) [* }$ C( Q

* g& ]3 [' t, d+ d2 ?3 B#if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P)
% k- L- G9 @& w1 z- q  #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor"
% f# W+ C( v4 \0 o) C* V6 _8 ~, A  y#endif
% _/ ]/ ]* N: F$ Y, Y, Y# V* a+ E
( T& j/ `3 F9 o$ K, m7 P. a" p// ---------------------------------------------------------------------------------------1 P7 y# g; N% q- q1 S: H3 ^0 t$ d

+ v. m" C8 c. P
: S- ?" m8 ]! Y7 Y, D#endif
; L  ^5 w8 Q# c3 Y' A8 y% P6 T; A9 p. ?+ P

2 f% u/ V3 J# A- m( M
8 e' C2 ^7 B! Z0 t! ^; |! Y0 ~2 M4 _7 L

1 i& f; m% \- `/ r+ r9 h5 e5 x5 a6 r- {5 x# z4 P$ Z& |
. [$ D9 j) j, u8 x3 N3 J% v, W) G
0 x7 S9 q- U1 N- e2 P5 o, `

! M, e2 N" {5 b0 z! C
# x( C$ C9 G8 H6 G7 s4 Q
5 {. K' Y+ N" s! n, q. x/ s$ p& Q1 v( E- E& V6 |+ _2 O

# _5 m0 y% N. G* H8 X9 e% [" B# _+ u+ ?5 ^1 u

2 i& v9 z" H0 ^1 z# B- O& R$ T
  {: d5 E2 Z, H2 T

本帖子中包含更多資源

您需要 登錄 才可以下載或查看,沒有賬號?注冊會員

×

評分

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

查看全部評分

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

8 e3 @; ^% I$ E+ v/ P" X) T1 W
4#
發(fā)表于 2016-8-21 05:50:22 | 只看該作者
      樓主厲害!
5#
發(fā)表于 2016-8-21 08:22:05 | 只看該作者
謝謝樓主,先收藏一下,慢慢學(xué)習(xí)
6#
發(fā)表于 2016-8-23 15:11:25 | 只看該作者
這是什么寶貝?
7#
發(fā)表于 2016-8-23 15:11:47 | 只看該作者
換了個瀏覽器Chrome,試試能否發(fā)言了。
8#
發(fā)表于 2016-8-23 20:12:33 | 只看該作者
樓主厲害
9#
 樓主| 發(fā)表于 2016-8-23 23:03:17 | 只看該作者
補(bǔ)充  z+ D. z+ S' k2 g- x4 W6 K
程序運(yùn)行protocol_execute_realtime(); /運(yùn)行實時命令。% b2 w) s) ]; V: j- a# Y$ e
// Executes run-time commands, when required. This is called from various check points in the main0 `% n7 K, G+ u  W5 I) k
// program, primarily where there may be a while loop waiting for a buffer to clear space or any1 B0 N  [" \( p
// point where the execution time from the last check point may be more than a fraction of a second." L# ]3 W3 I/ A
// This is a way to execute realtime commands asynchronously (aka multitasking) with grbl's g-code% c2 D; y7 t7 S0 Q5 @
// parsing and planning functions. This function also serves as an interface for the interrupts to   w% ~9 f, ]) O! L7 ?6 M' D
// set the system realtime flags, where only the main program handles them, removing the need to
& B. a0 i3 E2 s6 B- m; p, q// define more computationally-expensive volatile variables. This also provides a controlled way to
- l7 [3 U6 N+ M% r3 K* ]3 f! m// execute certain tasks without having two or more instances of the same task, such as the planner
2 v1 ?! \7 E0 B) X' E// recalculating the buffer upon a feedhold or override.* ?3 c: C2 z* B2 l  O! @( w
// NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,  h; u3 N1 D3 [0 d
// limit switches, or the main program.6 W! ]( {$ D) P/ [1 ~7 E6 e
- M2 H5 m2 O9 f4 y" P2 b+ t
//執(zhí)行運(yùn)行時間命令,在需要時。這就是所謂的從各種主程序要檢查站
" ~' u3 g# ?; l  k' i8 U3 m7 a//,主要是那里可能是一個while循環(huán)等待緩沖區(qū)空間或任何
6 q3 H9 z$ z) n: p+ h//執(zhí)行時間從過去的止點可以超過幾分之一秒。& w# ^. C! u. i" f
//這是一種異步執(zhí)行實時命令(又名多任務(wù))grbl的刀位點/ P) t* ?& z1 {3 \
//解析和規(guī)劃功能。這個函數(shù)也可以作為一個接口,用于中斷3 y5 y2 v4 b) z& T! K. e
//設(shè)置系統(tǒng)實時的旗幟,只有主程序處理,消除的需要8 Q) I- |5 G9 |0 U
//定義更多的計算昂貴volatile變量。這也提供了一種控制方法7 d0 n2 m8 a. `( `3 Y2 z2 i7 D
//執(zhí)行某些任務(wù)不相同的兩個或多個實例的任務(wù),比如計劃$ M0 Z! _" M: C' f9 f
//重新計算緩沖feedhold或覆蓋。
8 A6 |, l" O2 h6 l" _: a0 x//注意:sys_rt_exec_state變量標(biāo)志設(shè)置任何過程,步驟或串行中斷,插腳引線,4 \0 s* p' d5 w9 V9 o
//限位開關(guān)或主程序。7 E" z% ~% q: n8 e/ W% w
void protocol_execute_realtime()
/ Y. m& G  q; O% I  K{& p5 `6 G% j0 X2 X& i( i" [
        // Temp variable to avoid calling volatile multiple times., X3 H; W" k7 j3 S" X
        // 臨時變量來避免多次調(diào)用不穩(wěn)定。  Z2 T1 M1 g; N+ v; d: p
        uint8_t rt_exec; 3 C7 _+ r8 J, J" l4 _$ h, j- K+ N) B
        do{
) J1 T3 Q( u) K1 j6 ?          if (rt_exec) {                 // 有標(biāo)志位置位進(jìn)入0 B, M, ~' G) |, f! g% f7 @
       
* K: @  v& J& Z+ s* V0 h* ~            sys.state = STATE_ALARM; // 設(shè)置系統(tǒng)為報警狀態(tài)( e' a2 c2 {+ B0 I; M
      report_alarm_message(ALARM_HARD_LIMIT_ERROR);        //報告報警信息為接近極限值$ P) i6 r1 u' R2 n  E% Z" _
    } else if (rt_exec & EXEC_ALARM_SOFT_LIMIT) {                        //報告執(zhí)行軟件限位報警
# T  B+ h" ], I) T% g9 [  ^% B      report_alarm_message(ALARM_SOFT_LIMIT_ERROR);        //報告出現(xiàn)軟件限位報警$ q+ C& L* G) x( ]
    } else if (rt_exec & EXEC_ALARM_ABORT_CYCLE) {                //執(zhí)行停止循環(huán)報警      2 ?+ d- S. [# g; k1 ]
      report_alarm_message(ALARM_ABORT_CYCLE);                //出現(xiàn)終止循環(huán)報警* `8 g! I4 U4 }5 C* G: v6 o
    } else if (rt_exec & EXEC_ALARM_PROBE_FAIL) {                        //執(zhí)行探查失敗報警
9 l4 Z  v! F8 \) D4 ?3 M3 ^      report_alarm_message(ALARM_PROBE_FAIL);                        //出現(xiàn)探查失敗報警
+ I9 Z- G# {" S0 p& z$ t    } else if (rt_exec & EXEC_ALARM_HOMING_FAIL) {                //執(zhí)行返回原點失敗報警3 o" {  {4 g' v+ [  j$ G4 E9 N  X- X
      report_alarm_message(ALARM_HOMING_FAIL);                //出現(xiàn)返回原點失敗報警4 I- o/ a6 V- I. g' ?  P" ~
    }# D1 {; R* z) Q: r- ]

) \0 p+ Z6 X9 V' Q    // Halt everything upon a critical event flag. Currently hard and soft limits flag this.4 U  v/ [; w8 N: _# Z9 u* Q( `- ?
    // 停止一切在一個關(guān)鍵事件標(biāo)志。目前硬和軟限制標(biāo)志
* q; z) W8 l% @. E           if (rt_exec & EXEC_CRITICAL_EVENT) {                //如果系統(tǒng)是循環(huán)事件進(jìn)入
: O/ M  G, |! n3 ~+ n$ |             report_feedback_message(MESSAGE_CRITICAL_EVENT);        //報告反饋信息
& ?4 J, R5 _; ~$ U; E              bit_false_atomic(sys_rt_exec_state,EXEC_RESET);                         //清除目前的復(fù)位狀態(tài)6 G  W  B5 c0 N, q& ^
5 }& e" J1 q8 g* F0 ?, W( \. t* g  z# r
        bit_false_atomic(sys_rt_exec_alarm,0xFF);                                 // 清除所有報警標(biāo)志* U4 }" z  u: D, h& {1 @+ t: u, W
        }       
5 H: ^& o9 m3 w4 r1 X! a4 _: o; j
3 C: W/ Z  b7 q上面代碼將rt_exec = sys_rt_exec_alarm ,如果rt_exec為真,打印不同報警信息
9 V8 B3 O6 h+ ~+ A% y- h; U* b和限位保護(hù)信息,然后清除報警狀態(tài)
. b) ^8 D/ V: b1 d6 U: ~: T4 F, ], x___________________________________________________________________________
! v6 G2 K% p" o沒有報警進(jìn)行執(zhí)行下面代碼,執(zhí)行了終止命令,串口打印命令
% Z( m: `( L' R5 S$ |- `% S0 s         // Check amd execute realtime commands        校驗和執(zhí)行實時命令
6 M& f* D" |) J4 O) c          rt_exec = sys_rt_exec_state; // Copy volatile sys_rt_exec_state6 c! S% S# e) _& A/ S2 `
/ x' \! b5 T/ @* t# t- v1 k* F
        if (rt_exec) { // 輸入標(biāo)志是正確的執(zhí)行
5 {( `  X! {! x7 s# y/ u
. U6 r. W4 o- j2 ~/ h/ |$ A            // Execute system abort. 執(zhí)行系統(tǒng)終止命令- U/ V& R' `8 U- a
            if (rt_exec & EXEC_RESET) {
' _9 f! F0 V( X! l, z4 a              sys.abort = true;  // Only place this is set true.3 B$ C9 R  M3 R# h7 y! _
              return; // Nothing else to do but exit.7 U3 T: Q& v& U1 i5 O$ M8 L
        }7 F6 v: }6 K2 T! E. u
/ |5 D" S( J" Z) G2 K! L
            // Execute and serial print status 執(zhí)行和串口打印狀態(tài)" H8 Z+ v/ m3 s% A/ \
            if (rt_exec & EXEC_STATUS_REPORT) { + ]! R. V" ^8 W; n
              report_realtime_status();        //報告實時狀態(tài)
# |" K# V1 B7 c/ v( l. H2 p              bit_false_atomic(sys_rt_exec_state,EXEC_STATUS_REPORT);        //清除報告狀態(tài)清零$ ^) `. t" f3 Z7 {# K! [% p2 ]' q& n5 z
            }( W4 b, X5 P! ?% R5 ~6 F3 y
_____________________________________________________________________________2 |2 E8 x9 U: C" s% A! n
下面代碼! D$ h" |3 T$ V# h  k9 @
//執(zhí)行狀態(tài)。7 w$ Y# `* ^1 y9 U: K
//注意:所涉及的數(shù)學(xué)計算持有應(yīng)該足夠低對大多數(shù)人來說,即使不是全部,
4 e1 q: g# b( j//操作場景。一旦啟動,系統(tǒng)進(jìn)入暫停狀態(tài)
2 u, U* ?/ ?% L% h  _//主程序流程,直到重置或恢復(fù)。6 s5 s* ?! ~1 ~8 B3 {8 R- f
待辦事項:檢查模式?如何處理呢?可能沒有,因為它只會在空閑,然后重置Grbl。  p7 [  V# F& h9 a0 A$ u' U/ Q
狀態(tài)檢查容許狀態(tài)的方法。
4 [; C" L- C, H( S1 F. f
6 k9 p2 t$ k3 q5 |9 s; q        //如果全局各自報警標(biāo)志位其中(執(zhí)行取消動作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入6 |$ O5 ^. d; ?0 r5 H6 z
            if (rt_exec & (EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR)) {       
& `5 [; l/ m# p# J. U& f9 f5 Q- {+ x/ B- G. S
        //如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)
( f  M. D# ]* W, ^) D        if (sys.state == STATE_CYCLE) {
# k4 p% F: M4 v, a$ c7 d3 d5 z        st_update_plan_block_parameters(); //通知stepper module驗算減速。* W! c6 ?& M2 h- [  K# C* R2 r
        sys.suspend = SUSPEND_ENABLE_HOLD; // 開始暫停標(biāo)志
* @+ A4 G4 f0 a% w$ k. P/ i        }" h9 Q8 V. @. Z1 o8 u/ r
) F5 Y8 k- y7 c9 X' E3 r8 j
        // 如果,Grbl空閑不在運(yùn)動。簡單的指示暫停就緒狀態(tài)。
, j% g: `$ B) O; N" ?: O        if (sys.state == STATE_IDLE) { sys.suspend = SUSPEND_ENABLE_READY; }
, X0 c9 Q3 [/ F1 y) g& v) a/ A4 H( i

5 D% f, _! N2 W2 q+ |        //執(zhí)行和標(biāo)志和減速運(yùn)動取消并返回空閑。主要由探測使用周期
8 c% I7 x  X. y        //停止和取消剩余的運(yùn)動。      
$ o( m* z. n0 O8 b  w0 o        if (rt_exec & EXEC_MOTION_CANCEL) {
1 v" [+ B" e3 L$ x0 E) t          if (sys.state == STATE_CYCLE) { sys.state = STATE_MOTION_CANCEL; }
: S6 U/ Z8 z3 O, b* g$ P" ?          sys.suspend |= SUSPEND_MOTION_CANCEL; / f/ U- l3 D: x: k+ H
        }
7 u, d! p, k# v1 u' d1 j  n$ P
        // 只在循環(huán)時執(zhí)行進(jìn)給保持減速
; O8 t0 W* F3 O) N         if (rt_exec & EXEC_FEED_HOLD) {  [7 z6 g- x# a' _
        //只有安全門為1才執(zhí)行保持進(jìn)給狀態(tài)賦值
  Q, z# s# v9 w- B          if (bit_isfalse(sys.state,STATE_SAFETY_DOOR)) { sys.state = STATE_HOLD; }
) Z4 \; T4 s7 X  J$ o! P) n7 c        }
& L( ]% y" b+ ?. q) @- B9 F
, Z; z) R) R7 o        if (rt_exec & EXEC_SAFETY_DOOR) {
. ]  ~/ U. ^( l/ g7 \' Y; g          report_feedback_message(MESSAGE_SAFETY_DOOR_AJAR);
$ g8 u- d" p" }/ /如果已經(jīng)活躍,準(zhǔn)備好重新開始,CYCLE_STOP標(biāo)志設(shè)置為強(qiáng)制斷開。
. E0 ]. K4 ~' q; F) l2 W" B  F/ /注意:只是暫時設(shè)置“rt_exec”變量,不是動蕩的“rt_exec_state”變量。
! i+ g6 S6 b7 D          if (sys.suspend & SUSPEND_ENABLE_READY) { bit_true(rt_exec,EXEC_CYCLE_STOP); }
" G1 F$ z+ S0 S2 d- \$ O6 ]! B          sys.suspend |= SUSPEND_ENERGIZE;
" H, M8 H; ^) D5 a1 U2 O          sys.state = STATE_SAFETY_DOOR;
3 d1 u" M* ?3 s( O1 O; \2 Y6 `6 }        }
$ b1 O! W- z& m$ s; Z* U' T5 I
1 Z# o  A, U2 D" o7 Vbit_false_atomic(sys_rt_exec_state,(EXEC_MOTION_CANCEL | EXEC_FEED_HOLD | EXEC_SAFETY_DOOR));   
3 z$ Y8 X8 Z! H7 {
" T* O# S  ~  R* [8 Y  `}
9 O& a- q, f2 A' J3 I4 |9 N- L以上代碼執(zhí)行了- A* ?2 |2 Z( e- G
1.如果全局各自報警標(biāo)志位其中(執(zhí)行取消動作) | (執(zhí)行進(jìn)給保持) | (執(zhí)行安全門)任意一位為真進(jìn)入4 c  g! M" w% u3 b, E/ a
2.系統(tǒng)為閑著狀態(tài), 開始循環(huán)狀態(tài), 回原點狀態(tài), 控制取消狀態(tài), 開始保持狀態(tài), 開始安全門狀態(tài)時進(jìn)入: y0 p8 O' `( L7 Z: @
3.如果是循環(huán)狀態(tài)執(zhí)行暫停狀態(tài)
* p0 t$ f! ^; R4.如果系統(tǒng)閑置狀態(tài)執(zhí)行暫停就緒狀態(tài)/ y; X- f; U* V
5.執(zhí)行動作取消4 v3 b% S" r' k& W4 n
6.如果是保持進(jìn)給狀態(tài),執(zhí)行保持進(jìn)給狀態(tài)' }9 {3 a) q! [5 W8 Y! `  a4 W
7.執(zhí)行安全門狀態(tài)
. R; q' U6 Q% ~最后執(zhí)行bit_false_atomic清標(biāo)志清除(執(zhí)行取消動作)(執(zhí)行進(jìn)給保持)(執(zhí)行安全門)標(biāo)志位                 
! @+ Y' y! _7 v* x/ [- {_____________________________________________________________________________
1 q- k4 J1 @0 _5 _
/ v  q, e* `0 N& B: U& T: z    // Execute a cycle start by starting the stepper interrupt to begin executing the blocks in queue.
; n0 K* H, q3 b" E2 f) l' N2 d: x    // 執(zhí)行一個循環(huán)開始啟動步進(jìn)開始執(zhí)行中斷隊列的街區(qū)
6 x  N# F0 \( W; D6 ~4 s* T    if (rt_exec & EXEC_CYCLE_START) {        //循環(huán)開始狀態(tài)進(jìn)入4 d' R. _# f. z* `4 G4 q; K0 j
      // Block if called at same time as the hold commands: feed hold, motion cancel, and safety door.
: k' L8 H/ M) N. y2 l2 o      // Ensures auto-cycle-start doesn't resume a hold without an explicit user-input./ c+ M6 d, z4 |* C/ Z% P" @4 R' V
          //塊如果在同時舉行的命令:保持進(jìn)給,運(yùn)動取消,和安全的門。 //確保auto-cycle-start沒有簡歷沒有顯式的用戶輸入。
! {* Q' R; f/ S) E/ `! k- c% b           ; y! U- y( ]* R, }6 G8 w0 m+ W- _
      if (!(rt_exec & (EXEC_FEED_HOLD | EXEC_MOTION_CANCEL | EXEC_SAFETY_DOOR))) {   //狀態(tài)機(jī)如果不是保持進(jìn)給,運(yùn)動取消,和安全的門。 ) E% ^! C% k# P  ]( i; s- B5 Z8 f3 x
        // Cycle start only when IDLE or when a hold is complete and ready to resume.4 m; T  }+ J9 i' `# G& P" w* ^$ P
        // NOTE: SAFETY_DOOR is implicitly blocked. It reverts to HOLD when the door is closed.; W) |: J6 f- ^! ^
                //循環(huán)開始時只有當(dāng)閑置或持有完成并準(zhǔn)備簡歷。& b' F2 a* g2 q" C/ ~' `5 [
                //注意:SAFETY_DOOR是隱式地屏蔽。它返回的時候門是關(guān)閉的。   
% [0 `0 q, q( r; v8 Z2 @; ]' w3 P0 y
; U0 u7 }) c. m. z+ Q+ Q& P$ B" _% F                // 如果系統(tǒng)狀態(tài)為閑著狀態(tài),系統(tǒng)狀態(tài)為開始進(jìn)給或運(yùn)動取消,暫停標(biāo)志為位重新開始% m" C( j+ h# u  o& G1 y2 M! N% Q# ^
        if ((sys.state == STATE_IDLE) || ((sys.state & (STATE_HOLD | STATE_MOTION_CANCEL)) && (sys.suspend & SUSPEND_ENABLE_READY))) {
; x4 V! e. G# b          // Re-energize powered components, if disabled by SAFETY_DOOR.! m, C; M7 E7 B6 y4 N
          //        由SAFETY_DOOR重振組件供電,如果禁用。' A- g8 Z* \9 j6 v
          if (sys.suspend & SUSPEND_ENERGIZE) {
& M4 E, g/ ~* }            // Delayed Tasks: Restart spindle and coolant, delay to power-up, then resume cycle.2 k( u" z( d! {! z% {! ?
            //延遲任務(wù):重新啟動主軸和冷卻劑,延遲升高,然后恢復(fù)周期。
% l1 W, ?8 ~9 x' d7 ?; T' {            if (gc_state.modal.spindle != SPINDLE_DISABLE) {   //主軸模式不是失能進(jìn)入
3 f- @# }$ Y) C: U- k- }' L$ D              spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); //設(shè)置狀態(tài)和速度
& ]5 b% K$ V4 p; ?( I- u. O              //待辦事項:阻塞函數(shù)調(diào)用。最終需要一個非阻塞。
# X# h. a0 P; G3 N3 N$ R7 u/ _                delay_ms(SAFETY_DOOR_SPINDLE_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.8 v$ W2 ^$ ~$ |
            }
2 L3 s* W( i3 r0 {6 Z            if (gc_state.modal.coolant != COOLANT_DISABLE) { + O7 ?( Z! S- g9 |
              coolant_set_state(gc_state.modal.coolant); 0 Z9 G+ G' E5 b
              delay_ms(SAFETY_DOOR_COOLANT_DELAY); // TODO: Blocking function call. Need a non-blocking one eventually.
) J, O7 u" Q! p% ]            }/ @' i* ~9 B: V9 j! y% n; G  r
            // TODO: Install return to pre-park position.% [9 t2 e) N+ b- s3 z/ c) Y
          }
% n+ r- Q' Q( ~4 y. c______________________________________________________________________________________________________________, c( N/ h( W7 X+ v5 o3 y
          // Start cycle only if queued motions exist in planner buffer and the motion is not canceled.- g3 s# h5 z0 s5 P! B0 d8 ]
                  
! }1 |2 l1 X, m* G! c, o; {; m                  //只有在隊列馬達(dá)存在規(guī)定的緩沖,并且動機(jī)沒有讓取消,才會循環(huán)
, z0 P: I7 q3 S- a                  
6 I2 P$ l5 r% s2 Z2 O) z          if (plan_get_current_block() && bit_isfalse(sys.suspend,SUSPEND_MOTION_CANCEL)) {
& Y! G$ k+ n9 z$ u4 a            sys.state = STATE_CYCLE;3 ^# Z- \7 m/ U: u9 E9 O
            st_prep_buffer(); // Initialize step segment buffer before beginning cycle.初始化步開始循環(huán)之前7 J; o- v9 I/ E" ^) J7 H. ?, W+ S
            st_wake_up();' c+ R+ [8 o$ S7 x; w
          } else { // Otherwise, do nothing. Set and resume IDLE state.否則,什么也不做,設(shè)置和復(fù)位空閑模式
5 I" t( s% M* Z9 G  {$ @# L( O$ W            sys.state = STATE_IDLE;0 S) a7 C* ^( w+ O
          }
7 M$ ^$ Y( q% `          sys.suspend = SUSPEND_DISABLE; // Break suspend state.
  R, R% g/ M- B        }
" `4 q3 @; h* b2 e5 K% v      }   
$ C7 A5 H) }. ]5 i5 X      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_START);        ) u6 _' K; g" P! k
    }( ?0 D& W9 T: w, `* @5 E; M
/ D, O  y! E" P4 x1 h1 W
_______________________________________________________________________________________________________4 f$ H! d0 S# u6 ]( `) d
    // Reinitializes the cycle plan and stepper system after a feed hold for a resume. Called by
5 _. \' M3 E) k3 t, L  t9 t    // realtime command execution in the main program, ensuring that the planner re-plans safely.
* f+ }- r5 F; d6 s; k- c0 j$ Z# Z    // NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper: T6 Z2 v) f7 S4 f2 _+ K
    // cycle reinitializations. The stepper path should continue exactly as if nothing has happened.   ; g/ W* d8 @4 R$ d& ]; z
    // NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
) v, @# S) w/ W8 k6 }, \" z& @: b, v: J' w3 G
        //重新啟動后循環(huán)計劃和步進(jìn)系統(tǒng)的進(jìn)給保持簡歷。通過實時命令執(zhí)行主程序,確保安全計劃重新計劃。) R/ {5 a$ ~$ F# [- @; K
        //注意:畫線算法變量仍保持通過規(guī)劃師和步進(jìn)
; ^/ ?' u3 H" f: G        //循環(huán)僅。步進(jìn)路徑應(yīng)該繼續(xù),好像什么都沒發(fā)生一樣。       
3 o; f7 x* o1 B' s2 ]2 B        //注意:EXEC_CYCLE_STOP由步進(jìn)子系統(tǒng)周期或進(jìn)給保持時完成。& n/ i1 V, T# c9 Z5 ~! s7 v

- G0 k- v' g7 z& Z) l    if (rt_exec & EXEC_CYCLE_STOP) {                         //如果是循環(huán)停止?fàn)顟B(tài)進(jìn)入  F/ V$ u+ d; v& v) f
      if (sys.state & (STATE_HOLD | STATE_SAFETY_DOOR)) {# i' |4 _) G/ B7 W
        // Hold complete. Set to indicate ready to resume.  Remain in HOLD or DOOR states until user( V6 a# O; x; g7 l8 f9 }6 k5 H
        // has issued a resume command or reset.
7 n9 m  Y8 @& L2 e: t1 c4 ^# q; L, q, X" Y5 E+ E* u8 O
                //保存完整。設(shè)置為指示準(zhǔn)備簡歷。繼續(xù)持有或門狀態(tài),直到用戶# {5 P/ H3 P1 K
                //已發(fā)布了一份簡歷命令或重置。! M7 Z! _* ]1 ^6 l. D# C& s
                $ z  O) u& X" q
        if (sys.suspend & SUSPEND_ENERGIZE) { // De-energize system if safety door has been opened. 如果安全的門已被打開。斷開系統(tǒng)
" ^3 W' B5 I5 [. P" t0 t          spindle_stop();
! `3 W$ N! n7 |, N8 _( V8 ^8 F2 ~1 E) Z          coolant_stop();5 A, W, r- Y. Z* K$ t9 V' G! g- b
          // TODO: Install parking motion here. 安裝停車動作。
1 L% N3 i! p3 v* l; X8 g        }1 ^" T: [3 u3 z( B- @
        bit_true(sys.suspend,SUSPEND_ENABLE_READY);; b: E; z. E& B1 l5 F
      } else { // Motion is complete. Includes CYCLE, HOMING, and MOTION_CANCEL states. 電機(jī)完成,循環(huán),回原點,,MOTION_CANCEL8 v. U4 A6 j7 O' ~! ]8 f1 I
        sys.suspend = SUSPEND_DISABLE;
9 X% S/ m9 M6 ^0 Y. C        sys.state = STATE_IDLE;# ~+ B$ W, w( r6 t' d3 v
      }4 r$ t6 p; f' ~" l
      bit_false_atomic(sys.rt_exec_state,EXEC_CYCLE_STOP);
) C- B) f/ Z  L& T7 o+ m# P    }
3 q7 v+ _. @+ O/ {/ A( e# }   
$ b2 I% g# i9 q$ I% K- ?0 z  }! C3 b) ]. c3 a( h
___________________________________________________________________________________________________
) K$ @# g! R# B/ J" [8 M7 ~
, d3 p: I; N3 L: f% ^2 |  // Overrides flag byte (sys.override) and execution should be installed here, since they ; u8 K2 a6 F* C( k$ p  K$ x8 t6 J
  // are realtime and require a direct and controlled interface to the main stepper program.
) k/ \5 |8 `; i$ H
) n/ T" u* }4 t  n  //重寫標(biāo)志字節(jié)(sys.override)和執(zhí)行應(yīng)該安裝在這里,因為他們
- s3 f! ]! t8 @! V( J  //實時和需要直接和控制接口的主要步進(jìn)程序。
* r5 V7 E/ U. Z7 _/ U$ r0 L) D6 m5 f6 d4 e& j: d' s( @, {
$ o' m+ j/ }9 @7 X6 e3 i/ G, D: S) s
  // Reload step segment buffer 重新加載步段緩沖
* {6 y! B9 v2 K' Z0 t: E7 w/ p7 _  if (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_MOTION_CANCEL | STATE_SAFETY_DOOR | STATE_HOMING)) { st_prep_buffer(); } + D. z; Z3 T; }  N" C

% k% {6 p$ E* y# o" p; ~  // If safety door was opened, actively check when safety door is closed and ready to resume.8 d8 s1 k3 c  b9 K: J, j) u4 U
  // NOTE: This unlocks the SAFETY_DOOR state to a HOLD state, such that CYCLE_START can activate a resume.       
# i% p! `0 H2 ]7 u) q( |. {& n# J
/ ~* n! |$ s! h- u/ q3 v//如果安全的門被打開,積極檢查當(dāng)安全門關(guān)閉,準(zhǔn)備簡歷。
' N9 }1 G2 g  J# F( S. J  //注意:這解鎖SAFETY_DOOR狀態(tài)保持狀態(tài),這樣CYCLE_START可以激活一個簡歷。6 X2 A: B0 R0 s5 g
9 S$ U2 k) a- ?2 m' ?
  if (sys.state == STATE_SAFETY_DOOR) {                 //安全門狀態(tài)進(jìn)入
* t- W. u/ J" c& q2 n3 U1 C0 u    if (bit_istrue(sys.suspend,SUSPEND_ENABLE_READY)) {
% K. X# i: o4 Q  o  M0 c- s      if (!(system_check_safety_door_ajar())) {
. M3 E# _. B( ]$ x7 M! C6 w        sys.state = STATE_HOLD; // Update to HOLD state to indicate door is closed and ready to resume. 更新保存狀態(tài)指示門關(guān)閉,準(zhǔn)備簡歷。2 E2 A6 B7 N9 J: N  t* U( F
      }( k7 \, K7 ^  W2 p' t2 R( B
    }! n! N; c* [; d' d4 G
  }
5 G! U# U8 B1 `9 D3 V& h
0 N6 m3 r; P4 ]% r5 L7 e  } while(sys.suspend); // Check for system suspend state before exiting.
/ C$ u- Q3 C+ d/ c9 N& A1 A  ' d2 l+ q# W& C8 R
}  
10#
發(fā)表于 2016-8-25 09:31:12 | 只看該作者
樓主這些代碼。是網(wǎng)上搜來,然后自己組合的嗎?全是自己想的,那是牛逼了

點評

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

本版積分規(guī)則

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

GMT+8, 2025-7-5 20:50 , Processed in 0.133769 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

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