mirror of
https://github.com/synthetos/g2.git
synced 2026-02-06 02:51:54 +08:00
Rearrange init some to fix a crash, details:
mr was not being intialized before it was being used by the stepper intialization. Also added a check to prevent it from happening from other places.
This commit is contained in:
@@ -100,11 +100,11 @@ void application_init_machine(void)
|
||||
{
|
||||
cm = &cm1; // set global canonical machine pointer to primary machine
|
||||
cm->machine_state = MACHINE_INITIALIZING;
|
||||
canonical_machine_inits(); // combined inits for CMs and planner - do before anything might use cm or mr!
|
||||
|
||||
stepper_init(); // stepper subsystem
|
||||
encoder_init(); // virtual encoders
|
||||
gpio_init(); // inputs and outputs
|
||||
canonical_machine_inits(); // combined inits for CMs and planner
|
||||
}
|
||||
|
||||
void application_init_startup(void)
|
||||
|
||||
@@ -264,6 +264,12 @@ void mp_set_runtime_position(uint8_t axis, const float position) { mr->position[
|
||||
|
||||
void mp_set_steps_to_runtime_position()
|
||||
{
|
||||
if (mr == nullptr) {
|
||||
#if IN_DEBUGGER
|
||||
__asm__ volatile("BKPT 1"); // mp_set_steps_to_runtime_position called with null mr!
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
float step_position[MOTORS];
|
||||
// There use to be a call to kn_inverse_kinematics here, but we don't do that now, instead we call kn->sync_encoders()
|
||||
// after handling the steps, allowing the kinematics to intelligently handle the offset of step and position.
|
||||
|
||||
Reference in New Issue
Block a user