mirror of
https://github.com/synthetos/g2.git
synced 2026-09-22 11:29:24 +08:00
Added spinup and spindown delays for sync’d spindle commands; Added option on PAUSE and RESUME actions; Testing. Still have some work to make the delays work correctly.
This commit is contained in:
@@ -838,8 +838,8 @@ const cfgItem_t cfgArray[] = {
|
||||
// Spindle functions
|
||||
{ "sp","spmo", _fip, 0, sp_print_spmo, sp_get_spmo, sp_set_spmo, (float *)&cs.null, SPINDLE_MODE },
|
||||
{ "sp","spph", _fip, 0, sp_print_spph, sp_get_spph, sp_set_spph, (float *)&cs.null, SPINDLE_PAUSE_ON_HOLD },
|
||||
{ "sp","spde", _fip, 2, sp_print_spde, sp_get_spde, sp_set_spde, (float *)&cs.null, SPINDLE_DWELL_TIME }, // spinup delay
|
||||
// { "sp","spds", _fip, 2, sp_print_spds, sp_get_spds, sp_set_spds, (float *)&cs.null, SPINDLE_DWELL_TIME }, // spindown delay
|
||||
{ "sp","spde", _fip, 2, sp_print_spde, sp_get_spde, sp_set_spde, (float *)&cs.null, SPINDLE_SPINUP_DELAY },
|
||||
{ "sp","spdn", _fip, 2, sp_print_spdn, sp_get_spdn, sp_set_spdn, (float *)&cs.null, SPINDLE_SPINDOWN_DELAY },
|
||||
{ "sp","spsn", _fip, 2, sp_print_spsn, sp_get_spsn, sp_set_spsn, (float *)&cs.null, SPINDLE_SPEED_MIN},
|
||||
{ "sp","spsm", _fip, 2, sp_print_spsm, sp_get_spsm, sp_set_spsm, (float *)&cs.null, SPINDLE_SPEED_MAX},
|
||||
{ "sp","spep", _fip, 0, sp_print_spep, sp_get_spep, sp_set_spep, (float *)&cs.null, SPINDLE_ENABLE_POLARITY },
|
||||
|
||||
@@ -94,11 +94,15 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPINDLE_PAUSE_ON_HOLD
|
||||
#define SPINDLE_PAUSE_ON_HOLD true // {spph:
|
||||
#define SPINDLE_PAUSE_ON_HOLD false // {spph:
|
||||
#endif
|
||||
|
||||
#ifndef SPINDLE_DWELL_TIME
|
||||
#define SPINDLE_DWELL_TIME 1.0 // {spdw:
|
||||
#ifndef SPINDLE_SPINUP_DELAY
|
||||
#define SPINDLE_SPINUP_DELAY 0 // {spde:
|
||||
#endif
|
||||
|
||||
#ifndef SPINDLE_SPINDOWN_DELAY
|
||||
#define SPINDLE_SPINDOWN_DELAY 0 // {spdn:
|
||||
#endif
|
||||
|
||||
#ifndef SPINDLE_DWELL_MAX
|
||||
|
||||
@@ -34,36 +34,39 @@
|
||||
|
||||
// Machine configuration settings
|
||||
|
||||
#define JUNCTION_INTEGRATION_TIME 1.25 // cornering - between 0.10 and 2.00 (higher is faster)
|
||||
#define CHORDAL_TOLERANCE 0.1 // chordal tolerance for arcs (in mm)
|
||||
#define JUNCTION_INTEGRATION_TIME 1.25 // cornering - between 0.10 and 2.00 (higher is faster)
|
||||
#define CHORDAL_TOLERANCE 0.1 // chordal tolerance for arcs (in mm)
|
||||
|
||||
#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on
|
||||
#define HARD_LIMIT_ENABLE 0 // 0=off, 1=on
|
||||
#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on
|
||||
#define SOFT_LIMIT_ENABLE 0 // 0=off, 1=on
|
||||
#define HARD_LIMIT_ENABLE 0 // 0=off, 1=on
|
||||
#define SAFETY_INTERLOCK_ENABLE 1 // 0=off, 1=on
|
||||
|
||||
#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high
|
||||
#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high
|
||||
#define SPINDLE_PAUSE_ON_HOLD true
|
||||
#define SPINDLE_DWELL_TIME 1.0
|
||||
#define SPINDLE_ENABLE_POLARITY 1 // 0=active low, 1=active high
|
||||
#define SPINDLE_DIR_POLARITY 0 // 0=clockwise is low, 1=clockwise is high
|
||||
#define SPINDLE_PAUSE_ON_HOLD true
|
||||
#define SPINDLE_SPINUP_DELAY 2.0
|
||||
#define SPINDLE_SPINDOWN_DELAY 0.0
|
||||
#define SPINDLE_SPEED_MIN 0.0
|
||||
#define SPINDLE_SPEED_MAX 20000.0
|
||||
|
||||
#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high
|
||||
#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high
|
||||
#define COOLANT_PAUSE_ON_HOLD false
|
||||
#define COOLANT_MIST_POLARITY 1 // 0=active low, 1=active high
|
||||
#define COOLANT_FLOOD_POLARITY 1 // 0=active low, 1=active high
|
||||
#define COOLANT_PAUSE_ON_HOLD false
|
||||
|
||||
#define FEEDHOLD_Z_LIFT 10 // mm to lift Z on feedhold
|
||||
#define FEEDHOLD_Z_LIFT 10 // mm to lift Z on feedhold
|
||||
|
||||
// Communications and reporting settings
|
||||
|
||||
#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only!
|
||||
#define USB_SERIAL_PORTS_EXPOSED 1 // Valid options are 1 or 2, only!
|
||||
|
||||
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
|
||||
#define COMM_MODE JSON_MODE // one of: TEXT_MODE, JSON_MODE
|
||||
|
||||
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
|
||||
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
|
||||
#define QUEUE_REPORT_VERBOSITY QR_OFF // one of: QR_OFF, QR_SINGLE, QR_TRIPLE
|
||||
#define TEXT_VERBOSITY TV_VERBOSE // one of: TV_SILENT, TV_VERBOSE
|
||||
#define JSON_VERBOSITY JV_MESSAGES // one of: JV_SILENT, JV_FOOTER, JV_CONFIGS, JV_MESSAGES, JV_LINENUM, JV_VERBOSE
|
||||
#define QUEUE_REPORT_VERBOSITY QR_OFF // one of: QR_OFF, QR_SINGLE, QR_TRIPLE
|
||||
|
||||
#define STATUS_REPORT_VERBOSITY SR_FILTERED // one of: SR_OFF, SR_FILTERED, SR_VERBOSE
|
||||
#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum
|
||||
#define STATUS_REPORT_MIN_MS 100 // milliseconds - enforces a viable minimum
|
||||
#define STATUS_REPORT_INTERVAL_MS 250 // milliseconds - set $SV=0 to disable
|
||||
|
||||
//#define STATUS_REPORT_DEFAULTS
|
||||
|
||||
+12
-5
@@ -225,11 +225,16 @@ stat_t spindle_control_immediate(spControl control)
|
||||
|
||||
stat_t spindle_control_sync(spControl control) // uses spControl arg: OFF, CW, CCW
|
||||
{
|
||||
// skip the PAUSE operation if pause-enable is not enabled (pause-on-hold)
|
||||
if ((control == SPINDLE_PAUSE) && (!spindle.pause_enable)) {
|
||||
return (STAT_OK);
|
||||
}
|
||||
|
||||
float value[] = { (float)control };
|
||||
mp_queue_command(_exec_spindle_control, value, nullptr);
|
||||
|
||||
if (fp_NOT_ZERO(spindle.spinup_delay)) {
|
||||
// mp_queue_command(dwell);
|
||||
mp_dwell(spindle.spinup_delay);
|
||||
}
|
||||
return(STAT_OK);
|
||||
}
|
||||
@@ -380,13 +385,13 @@ stat_t sp_set_spdp(nvObj_t *nv) {
|
||||
return (status);
|
||||
}
|
||||
|
||||
stat_t sp_get_spph(nvObj_t *nv) { return(get_int(nv, spindle.pause_on_hold)); }
|
||||
stat_t sp_set_spph(nvObj_t *nv) { return(set_int(nv, (uint8_t &)spindle.pause_on_hold, 0, 1)); }
|
||||
stat_t sp_get_spph(nvObj_t *nv) { return(get_int(nv, spindle.pause_enable)); }
|
||||
stat_t sp_set_spph(nvObj_t *nv) { return(set_int(nv, (uint8_t &)spindle.pause_enable, 0, 1)); }
|
||||
|
||||
stat_t sp_get_spde(nvObj_t *nv) { return(get_float(nv, spindle.spinup_delay)); }
|
||||
stat_t sp_set_spde(nvObj_t *nv) { return(set_float_range(nv, spindle.spinup_delay, 0, SPINDLE_DWELL_MAX)); }
|
||||
//stat_t sp_get_spdn(nvObj_t *nv) { return(get_float(nv, spindle.spindown_delay)); }
|
||||
//stat_t sp_set_spdn(nvObj_t *nv) { return(set_float_range(nv, spindle.spindown_delay, 0, SPINDLE_DWELL_MAX)); }
|
||||
stat_t sp_get_spdn(nvObj_t *nv) { return(get_float(nv, spindle.spindown_delay)); }
|
||||
stat_t sp_set_spdn(nvObj_t *nv) { return(set_float_range(nv, spindle.spindown_delay, 0, SPINDLE_DWELL_MAX)); }
|
||||
|
||||
stat_t sp_get_spsn(nvObj_t *nv) { return(get_float(nv, spindle.speed_min)); }
|
||||
stat_t sp_set_spsn(nvObj_t *nv) { return(set_float_range(nv, spindle.speed_min, SPINDLE_SPEED_MIN, SPINDLE_SPEED_MAX)); }
|
||||
@@ -418,6 +423,7 @@ const char fmt_spep[] = "[spep] spindle enable polarity%5d [0=active_low,1=activ
|
||||
const char fmt_spdp[] = "[spdp] spindle direction polarity%2d [0=CW_low,1=CW_high]\n";
|
||||
const char fmt_spph[] = "[spph] spindle pause on hold%7d [0=no,1=pause_on_hold]\n";
|
||||
const char fmt_spde[] = "[spde] spindle spinup delay%10.1f seconds\n";
|
||||
const char fmt_spdn[] = "[spdn] spindle spindown delay%8.1f seconds\n";
|
||||
const char fmt_spsn[] = "[spsn] spindle speed min%14.2f rpm\n";
|
||||
const char fmt_spsm[] = "[spsm] spindle speed max%14.2f rpm\n";
|
||||
const char fmt_spoe[] = "[spoe] spindle speed override ena%2d [0=disable,1=enable]\n";
|
||||
@@ -430,6 +436,7 @@ void sp_print_spep(nvObj_t *nv) { text_print(nv, fmt_spep);} // TYPE_INT
|
||||
void sp_print_spdp(nvObj_t *nv) { text_print(nv, fmt_spdp);} // TYPE_INT
|
||||
void sp_print_spph(nvObj_t *nv) { text_print(nv, fmt_spph);} // TYPE_INT
|
||||
void sp_print_spde(nvObj_t *nv) { text_print(nv, fmt_spde);} // TYPE_FLOAT
|
||||
void sp_print_spdn(nvObj_t *nv) { text_print(nv, fmt_spdn);} // TYPE_FLOAT
|
||||
void sp_print_spsn(nvObj_t *nv) { text_print(nv, fmt_spsn);} // TYPE_FLOAT
|
||||
void sp_print_spsm(nvObj_t *nv) { text_print(nv, fmt_spsm);} // TYPE_FLOAT
|
||||
void sp_print_spoe(nvObj_t *nv) { text_print(nv, fmt_spoe);} // TYPE INT
|
||||
|
||||
+6
-1
@@ -95,7 +95,7 @@ typedef struct spSpindle {
|
||||
|
||||
spPolarity enable_polarity; // {spep:} 0=active low, 1=active high
|
||||
spPolarity dir_polarity; // {spdp:} 0=clockwise low, 1=clockwise high
|
||||
bool pause_on_hold; // {spph:} pause on feedhold
|
||||
bool pause_enable; // {spph:} pause on feedhold
|
||||
float spinup_delay; // {spde:} optional delay on spindle start (set to 0 to disable)
|
||||
float spindown_delay; // {spds:} optional delay on spindle stop (set to 0 to disable)
|
||||
|
||||
@@ -141,6 +141,9 @@ stat_t sp_set_spph(nvObj_t *nv);
|
||||
|
||||
stat_t sp_get_spde(nvObj_t *nv);
|
||||
stat_t sp_set_spde(nvObj_t *nv);
|
||||
stat_t sp_get_spdn(nvObj_t *nv);
|
||||
stat_t sp_set_spdn(nvObj_t *nv);
|
||||
|
||||
stat_t sp_get_spsn(nvObj_t *nv);
|
||||
stat_t sp_set_spsn(nvObj_t *nv);
|
||||
stat_t sp_get_spsm(nvObj_t *nv);
|
||||
@@ -165,6 +168,7 @@ stat_t sp_set_sps(nvObj_t* nv);
|
||||
void sp_print_spdp(nvObj_t* nv);
|
||||
void sp_print_spph(nvObj_t* nv);
|
||||
void sp_print_spde(nvObj_t* nv);
|
||||
void sp_print_spdn(nvObj_t* nv);
|
||||
void sp_print_spsn(nvObj_t* nv);
|
||||
void sp_print_spsm(nvObj_t* nv);
|
||||
void sp_print_spoe(nvObj_t* nv);
|
||||
@@ -179,6 +183,7 @@ stat_t sp_set_sps(nvObj_t* nv);
|
||||
#define sp_print_spdp tx_print_stub
|
||||
#define sp_print_spph tx_print_stub
|
||||
#define sp_print_spde tx_print_stub
|
||||
#define sp_print_spdn tx_print_stub
|
||||
#define sp_print_spsn tx_print_stub
|
||||
#define sp_print_spsm tx_print_stub
|
||||
#define sp_print_spoe tx_print_stub
|
||||
|
||||
Reference in New Issue
Block a user