Merge branch 'MK3' into sort_files

This commit is contained in:
PavelSindler 2017-12-11 11:50:47 +01:00 committed by GitHub
commit 20de899d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14999 additions and 14889 deletions

View File

@ -63,27 +63,40 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define Z_PAUSE_LIFT 20
#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
#define HOMING_FEEDRATE {2500, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
//#define DEFAULT_MAX_FEEDRATE {400, 400, 12, 120} // (mm/sec)
#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
#define DEFAULT_MAX_FEEDRATE {500, 500, 12, 120} // (mm/sec) max feedrate (M203)
#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201)
#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts
#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S)
#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T)
#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min)
//#define MAX_SILENT_FEEDRATE 2700 //
//Silent mode limits
#define SILENT_MAX_ACCEL_X 800 // X-axis max acceleration in silent mode in mm/s^2
#define SILENT_MAX_ACCEL_Y 800 // Y-axis max axxeleration in silent mode in mm/s^2
#define SILENT_MAX_ACCEL_X_ST (100*SILENT_MAX_ACCEL_X) // X max accel in steps/s^2
#define SILENT_MAX_ACCEL_Y_ST (100*SILENT_MAX_ACCEL_Y) // Y max accel in steps/s^2
#define SILENT_MAX_FEEDRATE 80 //because mode switched to normal for homming in mm/s, this value limits also homing, it should be greater (80mm/s=4800mm/min>2700mm/min)
//cannot compile (ultralcd.cpp, line 6165), please FIX
#define END_FILE_SECTION 0
#define Z_AXIS_ALWAYS_ON 1
// Automatic recovery after crash is detected
#define AUTOMATIC_RECOVERY_AFTER_CRASH
// Disable some commands
#define _DISABLE_M42_M226
//DEBUG
//#define _NO_ASM
#define DEBUG_DCODES //D codes
#if 1
#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR
//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial
//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD
//#define DEBUG_RESUME_PRINT //Resume/save print debug enable
@ -512,8 +525,6 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define DEFAULT_RETRACTION 1 //used for PINDA temp calibration and pause print
#endif
#define END_FILE_SECTION 10000 //number of bytes from end of file used for checking if file is complete
// How much shall the print head be lifted on power panic?
// Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this,
// UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step.

File diff suppressed because it is too large Load Diff

View File

@ -441,7 +441,9 @@ static float feedrate = 1500.0, next_feedrate, saved_feedrate;
// Also there is bool axis_relative_modes[] per axis flag.
static bool relative_mode = false;
#ifndef _DISABLE_M42_M226
const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
#endif //_DISABLE_M42_M226
//static float tt = 0;
//static float bt = 0;
@ -3907,6 +3909,7 @@ void process_commands()
autotempShutdown();
}
break;
#ifndef _DISABLE_M42_M226
case 42: //M42 -Change pin status via gcode
if (code_seen('S'))
{
@ -3934,7 +3937,7 @@ void process_commands()
}
}
break;
#endif //_DISABLE_M42_M226
case 44: // M44: Prusa3D: Reset the bed skew and offset calibration.
// Reset the baby step value and the baby step applied flag.
@ -4950,6 +4953,7 @@ Sigma_Exit:
}
break;
#ifndef _DISABLE_M42_M226
case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
{
if(code_seen('P')){
@ -5001,6 +5005,7 @@ Sigma_Exit:
}
}
break;
#endif //_DISABLE_M42_M226
#if NUM_SERVOS > 0
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds

View File

@ -63,6 +63,10 @@
#include "mesh_bed_calibration.h"
#endif
#ifdef TMC2130
#include "tmc2130.h"
#endif //TMC2130
//===========================================================================
//=============================public variables ============================
//===========================================================================
@ -997,8 +1001,16 @@ Having the real displacement of the head, we can calculate the total movement le
for(int i=0; i < 4; i++)
{
current_speed[i] = delta_mm[i] * inverse_second;
#ifdef TMC2130
float max_fr = max_feedrate[i];
if ((tmc2130_mode == TMC2130_MODE_SILENT) && (i < 2))
max_fr = SILENT_MAX_FEEDRATE;
if(fabs(current_speed[i]) > max_fr)
speed_factor = min(speed_factor, max_fr / fabs(current_speed[i]));
#else //TMC2130
if(fabs(current_speed[i]) > max_feedrate[i])
speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
#endif //TMC2130
}
// Correct the speed
@ -1023,6 +1035,26 @@ Having the real displacement of the head, we can calculate the total movement le
else
{
block->acceleration_st = ceil(acceleration * steps_per_mm); // convert to: acceleration steps/sec^2
#ifdef TMC2130
if (tmc2130_mode == TMC2130_MODE_SILENT)
{
if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > SILENT_MAX_ACCEL_X_ST)
block->acceleration_st = SILENT_MAX_ACCEL_X_ST;
if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > SILENT_MAX_ACCEL_Y_ST)
block->acceleration_st = SILENT_MAX_ACCEL_Y_ST;
}
else
{
if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
}
if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
#else //TMC2130
// Limit acceleration per axis
//FIXME Vojtech: One shall rather limit a projection of the acceleration vector instead of using the limit.
if(((float)block->acceleration_st * (float)block->steps_x / (float)block->step_event_count) > axis_steps_per_sqr_second[X_AXIS])
@ -1033,6 +1065,7 @@ Having the real displacement of the head, we can calculate the total movement le
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
#endif //TMC2130
}
// Acceleration of the segment, in mm/sec^2
block->acceleration = block->acceleration_st / steps_per_mm;

View File

@ -41,6 +41,10 @@
int fsensor_counter = 0; //counter for e-steps
#endif //PAT9125
#ifdef DEBUG_STACK_MONITOR
uint16_t SP_min = 0x21FF;
#endif //DEBUG_STACK_MONITOR
//===========================================================================
//=============================public variables ============================
//===========================================================================
@ -371,6 +375,10 @@ FORCE_INLINE void trapezoid_generator_reset() {
// "The Stepper Driver Interrupt" - This timer interrupt is the workhorse.
// It pops blocks from the block_buffer and executes them by pulsing the stepper pins appropriately.
ISR(TIMER1_COMPA_vect) {
#ifdef DEBUG_STACK_MONITOR
uint16_t sp = SPL + 256 * SPH;
if (sp < SP_min) SP_min = sp;
#endif //DEBUG_STACK_MONITOR
#ifdef LIN_ADVANCE
advance_isr_scheduler();
#else

View File

@ -1538,10 +1538,8 @@ static void lcd_menu_fails_stats()
lcd.print(" Filament fails: ");
lcd.setCursor(17, 3);
lcd.print(itostr3((int)ferror_count));
if (lcd_clicked())
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
@ -1549,6 +1547,21 @@ static void lcd_menu_fails_stats()
}
extern uint16_t SP_min;
extern char* __malloc_heap_start;
extern char* __malloc_heap_end;
static void lcd_menu_debug()
{
fprintf_P(lcdout, PSTR(ESC_H(1,1)"RAM statistics"ESC_H(5,1)"SP_min: 0x%04x"ESC_H(1,2)"heap_start: 0x%04x"ESC_H(3,3)"heap_end: 0x%04x"), SP_min, __malloc_heap_start, __malloc_heap_end);
if (lcd_clicked())
{
lcd_quick_feedback();
lcd_return_to_status();
}
}
static void lcd_menu_temperatures()
{
fprintf_P(lcdout, PSTR(ESC_H(1,1) "Ambient: %d%c" ESC_H(1,2) "PINDA: %d%c"), (int)current_temperature_ambient, '\x01', (int)current_temperature_pinda, '\x01');
@ -4972,7 +4985,9 @@ static void lcd_main_menu()
MENU_ITEM(submenu, MSG_SUPPORT, lcd_support_menu);
MENU_ITEM(submenu, PSTR("Fail stats"), lcd_menu_fails_stats);
MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);
END_MENU();
}
@ -6207,7 +6222,7 @@ static void menu_action_function(menuFunc_t data) {
static bool check_file(const char* filename) {
bool result = false;
uint32_t filesize;
card.openFile(filename, true);
card.openFile((char*)filename, true);
filesize = card.getFileSize();
if (filesize > END_FILE_SECTION) {
card.setIndex(filesize - END_FILE_SECTION);
@ -6235,23 +6250,25 @@ static void menu_action_sdfile(const char* filename, char* longFilename)
sprintf_P(cmd, PSTR("M23 %s"), filename);
for (c = &cmd[4]; *c; c++)
*c = tolower(*c);
for (int i = 0; i < 8; i++) {
eeprom_write_byte((uint8_t*)EEPROM_FILENAME + i, filename[i]);
}
uint8_t depth = (uint8_t)card.getWorkDirDepth();
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
for (uint8_t i = 0; i < depth; i++) {
for (int j = 0; j < 8; j++) {
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
}
}
if (!check_file(filename)) {
result = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_FILE_INCOMPLETE, false, false);
lcd_update_enable(true);
}
if (result) {
uint8_t depth = (uint8_t)card.getWorkDirDepth();
for (uint8_t i = 0; i < depth; i++) {
for (int j = 0; j < 8; j++) {
eeprom_write_byte((uint8_t*)EEPROM_DIRS + j + 8 * i, dir_names[i][j]);
}
}
eeprom_write_byte((uint8_t*)EEPROM_DIR_DEPTH, depth);
enquecommand(cmd);
enquecommand_P(PSTR("M24"));
}