Added hard reset; Backlash bug fixes

pull/25/head
Patrick Felixberger 2019-02-04 20:43:16 +01:00
rodzic 242137a130
commit f22724e2e0
6 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -297,6 +297,7 @@ void USART2_IRQHandler(void)
switch(c) switch(c)
{ {
case CMD_RESET: MC_Reset(); break; // Call motion control reset routine. case CMD_RESET: MC_Reset(); break; // Call motion control reset routine.
case CMD_RESET_HARD: NVIC_SystemReset(); // Perform hard reset
case CMD_STATUS_REPORT: System_SetExecStateFlag(EXEC_STATUS_REPORT);break; case CMD_STATUS_REPORT: System_SetExecStateFlag(EXEC_STATUS_REPORT);break;
case CMD_CYCLE_START: System_SetExecStateFlag(EXEC_CYCLE_START); break; // Set as true case CMD_CYCLE_START: System_SetExecStateFlag(EXEC_CYCLE_START); break; // Set as true
case CMD_FEED_HOLD: System_SetExecStateFlag(EXEC_FEED_HOLD); break; // Set as true case CMD_FEED_HOLD: System_SetExecStateFlag(EXEC_FEED_HOLD); break; // Set as true

Wyświetl plik

@ -11,6 +11,7 @@ Grbl-Advanced includes full acceleration management with look ahead. That means
*** ***
### Extras:
#### Backlash Compensation: #### Backlash Compensation:
Backlash compensation enabled by default. You can switch it off in Config.h. Backlash compensation enabled by default. You can switch it off in Config.h.
Edit defaults.h to your needs. Edit defaults.h to your needs.
@ -22,6 +23,10 @@ Edit defaults.h to your needs.
#### Canned Drill Cycles (G81-G83): #### Canned Drill Cycles (G81-G83):
Added Canned Drill Cycles G81-G83 as experimental features. They are roughly tested and seem to work, but may contain still errors. Use at own risk! Added Canned Drill Cycles G81-G83 as experimental features. They are roughly tested and seem to work, but may contain still errors. Use at own risk!
#### Hard Reset
0x19 (CTRL-Y): Perform a hard reset.
***
### Build Environment: ### Build Environment:

Wyświetl plik

@ -51,6 +51,7 @@
// g-code programs, maybe selected for interface programs. // g-code programs, maybe selected for interface programs.
// NOTE: If changed, manually update help message in report.c. // NOTE: If changed, manually update help message in report.c.
#define CMD_RESET 0x18 // ctrl-x. #define CMD_RESET 0x18 // ctrl-x.
#define CMD_RESET_HARD 0x19 // ctrl-y.
#define CMD_STATUS_REPORT '?' #define CMD_STATUS_REPORT '?'
#define CMD_CYCLE_START '~' #define CMD_CYCLE_START '~'
#define CMD_FEED_HOLD '!' #define CMD_FEED_HOLD '!'

Wyświetl plik

@ -45,13 +45,19 @@ static uint8_t dir_negative[N_AXIS] = {DIR_NEGATIV};
void MC_Init(void) void MC_Init(void)
{ {
int32_t current_position[N_AXIS] = {0};
for(uint8_t i = 0; i < N_AXIS; i++) for(uint8_t i = 0; i < N_AXIS; i++)
{ {
dir_negative[i] = DIR_NEGATIV ^ (settings.homing_dir_mask & (1<<i)); dir_negative[i] = DIR_NEGATIV ^ (settings.homing_dir_mask & (1<<i));
} }
MC_SyncBacklashPosition();
}
void MC_SyncBacklashPosition(void)
{
int32_t current_position[N_AXIS] = {0};
// Copy current state of the system position variable // Copy current state of the system position variable
memcpy(current_position, sys_position, sizeof(sys_position)); memcpy(current_position, sys_position, sizeof(sys_position));
@ -465,6 +471,7 @@ uint8_t MC_ProbeCycle(float *target, Planner_LineData_t *pl_data, uint8_t parser
Stepper_Reset(); // Reset step segment buffer. Stepper_Reset(); // Reset step segment buffer.
Planner_Reset(); // Reset planner buffer. Zero planner positions. Ensure probing motion is cleared. Planner_Reset(); // Reset planner buffer. Zero planner positions. Ensure probing motion is cleared.
Planner_SyncPosition(); // Sync planner position to current machine position. Planner_SyncPosition(); // Sync planner position to current machine position.
MC_SyncBacklashPosition();
#ifdef MESSAGE_PROBE_COORDINATES #ifdef MESSAGE_PROBE_COORDINATES
// All done! Output the probe position as message. // All done! Output the probe position as message.

Wyświetl plik

@ -37,6 +37,8 @@
void MC_Init(void); void MC_Init(void);
void MC_SyncBacklashPosition(void);
// Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second
// unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in

Wyświetl plik

@ -237,6 +237,9 @@ void Stepper_WakeUp(void)
GPIO_ResetBits(GPIO_ENABLE_PORT, GPIO_ENABLE_PIN); GPIO_ResetBits(GPIO_ENABLE_PORT, GPIO_ENABLE_PIN);
} }
// Give steppers some time to wake up
Delay_ms(10);
// Initialize stepper output bits to ensure first ISR call does not step. // Initialize stepper output bits to ensure first ISR call does not step.
//st.step_outbits = step_port_invert_mask; //st.step_outbits = step_port_invert_mask;
st.step_outbits = 0; st.step_outbits = 0;