mirror of
https://github.com/synthetos/g2.git
synced 2026-02-06 02:51:54 +08:00
Minor commit
This commit is contained in:
@@ -91,8 +91,8 @@ static stat_t _finalize_p2_hold_exit(void);
|
||||
* (unlikely, but handled as 1b).
|
||||
* (2) - The block has decelerated to some velocity > zero, so needs continuation into next block
|
||||
* (3) - The block has decelerated to zero velocity
|
||||
* (3a) - The end of deceleration is detected (inline in mp_exec_aline())
|
||||
* (3b) - The end of deceleration is signeled and transitioned
|
||||
* (3a) - The end of deceleration is detected inline in mp_exec_aline()
|
||||
* (3b) - The end of deceleration is signaled and state is transitioned
|
||||
* (4) - We have finished all the runtime work now we have to wait for the motors to stop
|
||||
* (4a) - It's a homing or probing feedhold - ditch the remaining buffer & go directly to OFF
|
||||
* (4b) - It's a p2 feedhold - ditch the remaining buffer & signal we want a p2 queue flush
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
#include "util.h"
|
||||
#include "xio.h"
|
||||
|
||||
/**** Probe singleton structure ****/
|
||||
|
||||
/**** Local stuff ****/
|
||||
|
||||
#define MINIMUM_PROBE_TRAVEL 0.254 // mm of travel below which the probe will err out
|
||||
|
||||
@@ -71,14 +72,9 @@ static stat_t _probing_backoff();
|
||||
static stat_t _probing_finish();
|
||||
static stat_t _probing_exception_exit(stat_t status);
|
||||
static stat_t _probe_move(const float target[], const bool flags[]);
|
||||
static void _motion_end_callback(float* vect, bool* flag);
|
||||
static void _send_probe_report(void);
|
||||
|
||||
// helper
|
||||
static void _motion_end_callback(float* vect, bool* flag)
|
||||
{
|
||||
pb.wait_for_motion_end = false;
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
**** G38.x Probing Cycle **********************************************************
|
||||
***********************************************************************************/
|
||||
@@ -147,7 +143,7 @@ uint8_t cm_straight_probe(float target[], bool flags[], bool trip_sense, bool al
|
||||
|
||||
// initialize the probe input; error if no probe input specified
|
||||
if ((pb.probe_input = gpio_get_probing_input()) == -1) {
|
||||
return(cm_alarm(STAT_NO_PROBE_INPUT_CONFIGURED, "No probe input"));
|
||||
return(cm_alarm(STAT_NO_PROBE_INPUT_CONFIGURED, "Probe input not configured"));
|
||||
}
|
||||
|
||||
// setup
|
||||
@@ -273,18 +269,27 @@ static stat_t _probing_backoff()
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
* _probe_move() - function to execute probing moves
|
||||
* _probe_move() - function to execute probing moves
|
||||
* _motion_end_callback() - callback completes when motion has stopped
|
||||
*
|
||||
* target[] must be provided in machine canonical coordinates (absolute, mm)
|
||||
* cm_set_absolute_override() also zeros work offsets, which are restored on exit.
|
||||
*/
|
||||
|
||||
static void _motion_end_callback(float* vect, bool* flag)
|
||||
{
|
||||
while (!mp_runtime_is_idle()) {
|
||||
__NOP(); // block until current segment is done
|
||||
};
|
||||
pb.wait_for_motion_end = false;
|
||||
}
|
||||
|
||||
static stat_t _probe_move(const float target[], const bool flags[])
|
||||
{
|
||||
cm_set_absolute_override(MODEL, ABSOLUTE_OVERRIDE_ON);
|
||||
pb.wait_for_motion_end = true; // set this BEFORE the motion starts
|
||||
cm_straight_feed(target, flags);
|
||||
mp_queue_command(_motion_end_callback, nullptr, nullptr); // the last two arguments are ignored anyway
|
||||
cm_straight_feed(target, flags); // NB: feed rate was set earlier, so it's OK
|
||||
mp_queue_command(_motion_end_callback, nullptr, nullptr); // the last two arguments are ignored anyway
|
||||
return (STAT_EAGAIN);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<InterfaceName>SWD</InterfaceName>
|
||||
</ToolOptions>
|
||||
<ToolType>com.atmel.avrdbg.tool.atmelice</ToolType>
|
||||
<ToolNumber>J41800030015</ToolNumber>
|
||||
<ToolNumber>J41800036434</ToolNumber>
|
||||
<ToolName>Atmel-ICE</ToolName>
|
||||
</com_atmel_avrdbg_tool_atmelice>
|
||||
<UseGdb>True</UseGdb>
|
||||
@@ -100,7 +100,7 @@
|
||||
<HWProgramCounterSampling>True</HWProgramCounterSampling>
|
||||
</PercepioTrace>
|
||||
<preserveEEPROM>true</preserveEEPROM>
|
||||
<avrtoolserialnumber>J41800030015</avrtoolserialnumber>
|
||||
<avrtoolserialnumber>J41800036434</avrtoolserialnumber>
|
||||
<avrdeviceexpectedsignature>0x284E0A60</avrdeviceexpectedsignature>
|
||||
<avrtoolinterfaceclock>10000000</avrtoolinterfaceclock>
|
||||
<custom>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
* kinematics.cpp - inverse kinematics routines
|
||||
* This file is part of the g2core project
|
||||
*
|
||||
* Copyright (c) 2010 - 2016 Alden S. Hart, Jr.
|
||||
* Copyright (c) 2010 - 2017 Alden S. Hart, Jr.
|
||||
* Copyright (c) 2016 - 2017 Rob Giseburt
|
||||
*
|
||||
* This file ("the software") is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License, version 2 as published by the
|
||||
@@ -127,7 +128,6 @@ static void _inverse_kinematics(const float travel[], float joint[]) {
|
||||
*
|
||||
* This function is NOT to be used where high-speed is important. If that becomes the case,
|
||||
* there are many opportunities for caching and optimization for performance here.
|
||||
*
|
||||
*/
|
||||
|
||||
void kn_forward_kinematics(const float steps[], float travel[]) {
|
||||
@@ -139,7 +139,7 @@ void kn_forward_kinematics(const float steps[], float travel[]) {
|
||||
best_steps_per_unit[axis] = -1.0;
|
||||
}
|
||||
|
||||
// Scan through each axis, and then through each motor
|
||||
// Scan through each axis then through each motor
|
||||
for (uint8_t axis = 0; axis < AXES; axis++) {
|
||||
if (cm->a[axis].axis_mode == AXIS_INHIBITED) {
|
||||
travel[axis] = 0.0;
|
||||
@@ -147,13 +147,12 @@ void kn_forward_kinematics(const float steps[], float travel[]) {
|
||||
}
|
||||
for (uint8_t motor = 0; motor < MOTORS; motor++) {
|
||||
if (st_cfg.mot[motor].motor_map == axis) {
|
||||
// If this motor has a better (or the only) resolution, then we use this motor's value
|
||||
// If this motor has a better (or the only) resolution, then use this motor's value
|
||||
if (best_steps_per_unit[axis] < st_cfg.mot[motor].steps_per_unit) {
|
||||
best_steps_per_unit[axis] = st_cfg.mot[motor].steps_per_unit;
|
||||
travel[axis] = steps[motor] * st_cfg.mot[motor].units_per_step;
|
||||
|
||||
// If a econd motor has the same reolution for the same axis, we'll average their values
|
||||
} else if (fp_EQ(best_steps_per_unit[axis], st_cfg.mot[motor].steps_per_unit)) {
|
||||
} // If a second motor has the same resolution for the same axis average their values
|
||||
else if (fp_EQ(best_steps_per_unit[axis], st_cfg.mot[motor].steps_per_unit)) {
|
||||
travel[axis] = (travel[axis] + (steps[motor] * st_cfg.mot[motor].units_per_step)) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user