mirror of
https://github.com/synthetos/g2.git
synced 2026-09-26 09:03:37 +08:00
Experimental changes to trapezoid generator.
This commit is contained in:
@@ -435,17 +435,17 @@ void cm_set_model_target(float target[], float flag[])
|
||||
void cm_set_model_position(stat_t status)
|
||||
{
|
||||
// Even if we are coalescing the move need to keep the gcode model correct
|
||||
if (status == STAT_OK) {
|
||||
// if (status == STAT_OK) {
|
||||
copy_vector(cm.gmx.position, cm.gm.target);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
void cm_set_model_position_from_runtime(stat_t status)
|
||||
{
|
||||
// Even if we are coalescing the move need to keep the gcode model correct
|
||||
if (status == STAT_OK) {
|
||||
// if (status == STAT_OK) {
|
||||
copy_vector(cm.gmx.position, mr.gm.target);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ extern "C"{
|
||||
/**** Stepper DDA and dwell timer settings ****/
|
||||
|
||||
//#define FREQUENCY_DDA 50000UL
|
||||
#define FREQUENCY_DDA 100000UL
|
||||
#define FREQUENCY_DDA 200000UL
|
||||
#define FREQUENCY_DWELL 1000UL
|
||||
#define FREQUENCY_SGI 200000UL // 200,000 Hz means software interrupts will fire 5 uSec after being called
|
||||
|
||||
|
||||
Executable → Regular
+30
-12
@@ -470,11 +470,18 @@ static void _calculate_trapezoid(mpBuf_t *bf)
|
||||
bf->cruise_velocity = bf->entry_velocity;
|
||||
if (bf->length >= MIN_TAIL_LENGTH) { // run this as a 2+ segment tail
|
||||
bf->tail_length = bf->length;
|
||||
} else if (bf->length > MIN_BODY_LENGTH) { // run this as a 1 segment body
|
||||
bf->body_length = bf->length;
|
||||
} else {
|
||||
bf->move_state = MOVE_SKIP; // tell runtime to skip the block
|
||||
printf("######## Trapezoid skip[1] - line %lu\n", bf->gm.linenum);
|
||||
} else { // run this as a 1 segment body
|
||||
bf->body_length = bf->length;
|
||||
if (bf->length > MIN_BODY_LENGTH) {
|
||||
// Average the speed for this one segment:
|
||||
bf->cruise_velocity = (bf->entry_velocity + bf->exit_velocity)/2;
|
||||
} else {
|
||||
// we need to lower the speed to take at least MIN_SEGMENT_TIME as a body move
|
||||
bf->cruise_velocity = bf->length / MIN_SEGMENT_TIME;
|
||||
}
|
||||
|
||||
bf->entry_velocity = bf->cruise_velocity;
|
||||
bf->exit_velocity = bf->cruise_velocity;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -485,11 +492,18 @@ static void _calculate_trapezoid(mpBuf_t *bf)
|
||||
bf->cruise_velocity = bf->exit_velocity;
|
||||
if (bf->length >= MIN_HEAD_LENGTH) { // run this as a 2+ segment head
|
||||
bf->head_length = bf->length;
|
||||
} else if (bf->length > MIN_BODY_LENGTH) { // run this as a 1 segment body
|
||||
bf->body_length = bf->length;
|
||||
} else {
|
||||
bf->move_state = MOVE_SKIP; // tell runtime to skip the block
|
||||
printf("######## Trapezoid skip[2] - line %lu\n", bf->gm.linenum);
|
||||
} else { // run this as a 1 segment body
|
||||
bf->body_length = bf->length;
|
||||
if (bf->length > MIN_BODY_LENGTH) {
|
||||
// Average the speed for this one segment:
|
||||
bf->cruise_velocity = (bf->entry_velocity + bf->exit_velocity)/2;
|
||||
} else {
|
||||
// we need to lower the speed to take at least MIN_SEGMENT_TIME as a body move
|
||||
bf->cruise_velocity = bf->length / MIN_SEGMENT_TIME;
|
||||
}
|
||||
|
||||
bf->entry_velocity = bf->cruise_velocity;
|
||||
bf->exit_velocity = bf->cruise_velocity;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -497,8 +511,8 @@ static void _calculate_trapezoid(mpBuf_t *bf)
|
||||
// Set head and tail lengths
|
||||
bf->head_length = _get_target_length(bf->entry_velocity, bf->cruise_velocity, bf);
|
||||
bf->tail_length = _get_target_length(bf->exit_velocity, bf->cruise_velocity, bf);
|
||||
if (bf->head_length < MIN_HEAD_LENGTH) { bf->head_length = 0;}
|
||||
if (bf->tail_length < MIN_TAIL_LENGTH) { bf->tail_length = 0;}
|
||||
// if (bf->head_length < MIN_HEAD_LENGTH) { bf->head_length = 0;}
|
||||
// if (bf->tail_length < MIN_TAIL_LENGTH) { bf->tail_length = 0;}
|
||||
|
||||
// Rate-limited HT and HT' cases
|
||||
if (bf->length < (bf->head_length + bf->tail_length)) { // it's rate limited
|
||||
@@ -508,6 +522,10 @@ static void _calculate_trapezoid(mpBuf_t *bf)
|
||||
bf->head_length = bf->length/2;
|
||||
bf->tail_length = bf->head_length;
|
||||
bf->cruise_velocity = min(bf->cruise_vmax, _get_target_velocity(bf->entry_velocity, bf->head_length, bf));
|
||||
|
||||
if (bf->head_length < MIN_HEAD_LENGTH || bf->tail_length < MIN_TAIL_LENGTH) {
|
||||
bf->cruise_velocity = (bf->length / (2*MIN_SEGMENT_TIME)) - bf->entry_velocity;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace Motate {
|
||||
|
||||
pin_number kDebug1_PinNumber = 49;
|
||||
pin_number kDebug2_PinNumber = 47;
|
||||
pin_number kDebug3_PinNumber = 45;
|
||||
|
||||
pin_number kKinen_SyncPinNumber = 53;
|
||||
|
||||
@@ -130,7 +131,7 @@ namespace Motate {
|
||||
pin_number kSocket6_StepPinNumber = 42;
|
||||
pin_number kSocket6_DirPinNumber = 43;
|
||||
pin_number kSocket6_EnablePinNumber = 44;
|
||||
pin_number kSocket6_Microstep_0PinNumber = 45;
|
||||
pin_number kSocket6_Microstep_0PinNumber = -1;//45;
|
||||
pin_number kSocket6_Microstep_1PinNumber = 46;
|
||||
pin_number kSocket6_Microstep_2PinNumber = -1;
|
||||
pin_number kSocket6_VrefPinNumber = -1;//67; //PWMTimer<0>
|
||||
|
||||
@@ -163,6 +163,7 @@ namespace Motate {
|
||||
|
||||
pin_number kDebug1_PinNumber = -1;
|
||||
pin_number kDebug2_PinNumber = -1;
|
||||
pin_number kDebug3_PinNumber = -1;
|
||||
|
||||
// GRBL / gShield compatibility pins -- Due board ONLY
|
||||
|
||||
|
||||
+2
-2
@@ -93,12 +93,12 @@
|
||||
//#include "settings/settings_openpnp.h" // OpenPnP
|
||||
//#include "settings/settings_othercutter.h" // Otherfab OtherCutter
|
||||
//#include "settings/settings_othermill.h" // Otherfab OtherMill
|
||||
#include "settings/settings_pocketnc.h" // PocketNC 5 axis machining center
|
||||
//#include "settings/settings_pocketnc.h" // PocketNC 5 axis machining center
|
||||
//#include "settings/settings_probotixV90.h" // Probotix FireballV90
|
||||
//#include "settings/settings_shapeoko375.h" // Shapeoko (1) - 375mm rails
|
||||
//#include "settings/settings_ultimaker.h" // Ultimaker 3D printer
|
||||
//#include "settings/settings_zen7x12.h" // Zen Toolworks 7x12
|
||||
|
||||
#include "settings/settings_Ultimaker_Rob.h"
|
||||
/*** Handle optional modules that may not be in every machine ***/
|
||||
|
||||
// If PWM_1 is not defined fill it with default values
|
||||
|
||||
Executable → Regular
+1
-1
@@ -61,6 +61,7 @@ using namespace Motate;
|
||||
OutputPin<kGRBL_CommonEnablePinNumber> common_enable; // shorter form of the above
|
||||
OutputPin<kDebug1_PinNumber> dda_debug_pin1;
|
||||
OutputPin<kDebug2_PinNumber> dda_debug_pin2;
|
||||
OutputPin<kDebug3_PinNumber> dda_debug_pin3;
|
||||
|
||||
// Example with prefixed name::
|
||||
//Motate::Timer<dda_timer_num> dda_timer(kTimerUpToMatch, FREQUENCY_DDA);// stepper pulse generation
|
||||
@@ -621,7 +622,6 @@ namespace Motate { // Define timer inside Motate namespace
|
||||
|
||||
static void _load_move()
|
||||
{
|
||||
//dda_debug_pin1 = 1;
|
||||
// Be aware that dda_ticks_downcount must equal zero for the loader to run.
|
||||
// So the initial load must also have this set to zero as part of initialization
|
||||
if (st_run.dda_ticks_downcount != 0) return; // exit if it's still busy
|
||||
|
||||
Reference in New Issue
Block a user