mirror of
https://github.com/synthetos/g2.git
synced 2026-09-21 10:35:38 +08:00
Testing and tweaking
This commit is contained in:
@@ -840,7 +840,6 @@ const cfgItem_t cfgArray[] = {
|
||||
{ "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","spdr", _fip, 2, sp_print_spdr, sp_get_spdr, sp_set_spdr, (float *)&cs.null, SPINDLE_DWELL_TIME }, // direction reversal 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 },
|
||||
|
||||
@@ -249,11 +249,10 @@ stat_t cm_switch_to_hold_context()
|
||||
cm_straight_traverse(target, flags);
|
||||
cm_set_distance_mode(stored_distance_mode);
|
||||
}
|
||||
|
||||
// optional spindle stop
|
||||
if (spindle.pause_on_hold) {
|
||||
|
||||
}
|
||||
|
||||
spindle_control_sync(SPINDLE_PAUSE); // optional spindle pause
|
||||
// coolant_control_sync(COOLANT_PAUSE); // optional coolant pause
|
||||
|
||||
return (STAT_OK);
|
||||
}
|
||||
|
||||
@@ -280,14 +279,9 @@ stat_t cm_return_from_hold_context() // LATER: if value == true return with
|
||||
}
|
||||
|
||||
// *** While still in secondary machine:
|
||||
/*
|
||||
if (cm->machine_state == MACHINE_ALARM) {
|
||||
cm_spindle_off_immediate();
|
||||
cm_coolant_off_immediate();
|
||||
*/
|
||||
// restart spindle (with optional dwell)
|
||||
|
||||
// restart coolant
|
||||
|
||||
spindle_control_sync(SPINDLE_RESUME); // resume spindle if paused
|
||||
// coolant_control_sync(COOLANT_RESUME); // resume coolant if paused
|
||||
|
||||
// perform the G30 move and queue a wait
|
||||
float target[] = { 0,0,0,0,0,0 }; // LATER: Make this move return through XY, then Z
|
||||
|
||||
+4
-33
@@ -114,6 +114,10 @@ static void _exec_spindle_control(float *value, bool *flag)
|
||||
if ((control == SPINDLE_RESUME) && (spindle.state != SPINDLE_PAUSE)) {
|
||||
return;
|
||||
}
|
||||
if ((control == SPINDLE_PAUSE) && (spindle.state != SPINDLE_OFF)) {
|
||||
return;
|
||||
}
|
||||
|
||||
spindle.state = control; // record new spindle state
|
||||
uint8_t on_bit = SPINDLE_OFF; // default to off
|
||||
int8_t dir_bit = -1; // -1 will skip setting the direction
|
||||
@@ -235,39 +239,6 @@ static float _get_spindle_pwm (spSpindle_t &_spindle, pwmControl_t &_pwm)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static float _get_spindle_pwm (spSpindle_t *sp, pwmControl_t *_pwm)
|
||||
{
|
||||
float speed_lo, speed_hi, phase_lo, phase_hi;
|
||||
if (sp->direction == SPINDLE_CW ) {
|
||||
speed_lo = _pwm->c[PWM_1].cw_speed_lo;
|
||||
speed_hi = _pwm->c[PWM_1].cw_speed_hi;
|
||||
phase_lo = _pwm->c[PWM_1].cw_phase_lo;
|
||||
phase_hi = _pwm->c[PWM_1].cw_phase_hi;
|
||||
} else { // if (direction == SPINDLE_CCW ) {
|
||||
speed_lo = _pwm->c[PWM_1].ccw_speed_lo;
|
||||
speed_hi = _pwm->c[PWM_1].ccw_speed_hi;
|
||||
phase_lo = _pwm->c[PWM_1].ccw_phase_lo;
|
||||
phase_hi = _pwm->c[PWM_1].ccw_phase_hi;
|
||||
}
|
||||
|
||||
if ((sp->state == SPINDLE_CW) || (sp->state == SPINDLE_CCW)) {
|
||||
// clamp spindle speed to lo/hi range
|
||||
if (sp->speed < speed_lo) {
|
||||
sp->speed = speed_lo;
|
||||
}
|
||||
if (sp->speed > speed_hi) {
|
||||
sp->speed = speed_hi;
|
||||
}
|
||||
// normalize speed to [0..1]
|
||||
float speed = (sp->speed - speed_lo) / (speed_hi - speed_lo);
|
||||
return ((speed * (phase_hi - phase_lo)) + phase_lo);
|
||||
} else {
|
||||
return (_pwm->c[PWM_1].phase_off);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/***********************************************************************************
|
||||
* spindle_override_control()
|
||||
* spindle_start_override()
|
||||
|
||||
+2
-1
@@ -51,7 +51,8 @@ typedef enum { // how spindle controls are presented by the Gco
|
||||
SPINDLE_CCW = 2, // M4 and store CCW to spsindle.direction
|
||||
SPINDLE_PAUSE, // request PAUSE and store PAUSED state to spindle.state
|
||||
SPINDLE_RESUME, // request RESUME and revert spindle.state to CW, CCW
|
||||
SPINDLE_WAIT // handle transient WAIT states (not an action state)
|
||||
SPINDLE_SPINUP, // spindle is coming up to speed
|
||||
SPINDLE_SPINDOWN // spindle is spinning down to stop
|
||||
} spControl;
|
||||
#define SPINDLE_ACTION_MAX SPINDLE_RESUME
|
||||
|
||||
|
||||
Reference in New Issue
Block a user