commit
a0eab56e9c
|
|
@ -7,8 +7,8 @@
|
||||||
#define STR(x) STR_HELPER(x)
|
#define STR(x) STR_HELPER(x)
|
||||||
|
|
||||||
// Firmware version
|
// Firmware version
|
||||||
#define FW_VERSION "5.0.2-TZB"
|
#define FW_VERSION "5.0.3-TZB"
|
||||||
#define FW_COMMIT_NR 2234
|
#define FW_COMMIT_NR 2235
|
||||||
// FW_VERSION_UNKNOWN means this is an unofficial build.
|
// FW_VERSION_UNKNOWN means this is an unofficial build.
|
||||||
// The firmware should only be checked into github with this symbol.
|
// The firmware should only be checked into github with this symbol.
|
||||||
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
|
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,20 @@ void Config_StoreSettings();
|
||||||
bool Config_RetrieveSettings();
|
bool Config_RetrieveSettings();
|
||||||
#else
|
#else
|
||||||
FORCE_INLINE void Config_StoreSettings() {}
|
FORCE_INLINE void Config_StoreSettings() {}
|
||||||
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
|
FORCE_INLINE void Config_RetrieveSettings() {
|
||||||
|
Config_ResetDefault();
|
||||||
|
Config_PrintSettings();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
|
inline uint8_t calibration_status() {
|
||||||
inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
|
return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS);
|
||||||
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
|
}
|
||||||
|
inline void calibration_status_store(uint8_t status) {
|
||||||
|
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status);
|
||||||
|
}
|
||||||
|
inline bool calibration_status_pinda() {
|
||||||
|
return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA);
|
||||||
|
}
|
||||||
|
|
||||||
#endif//CONFIG_STORE_H
|
#endif//CONFIG_STORE_H
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,15 @@ void print_mem(uint32_t address, uint16_t count, uint8_t type, uint8_t countperl
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: data = *((uint8_t*)address++); break;
|
case 0:
|
||||||
case 1: data = eeprom_read_byte((uint8_t*)address++); break;
|
data = *((uint8_t*)address++);
|
||||||
case 2: data = pgm_read_byte_far((uint8_t*)address++); break;
|
break;
|
||||||
|
case 1:
|
||||||
|
data = eeprom_read_byte((uint8_t*)address++);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
data = pgm_read_byte_far((uint8_t*)address++);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
print_hex_byte(data);
|
print_hex_byte(data);
|
||||||
|
|
@ -412,13 +418,20 @@ const char* dcode_9_ADC_name(uint8_t i)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0: return PSTR("TEMP_HEATER0");
|
case 0:
|
||||||
case 1: return PSTR("TEMP_HEATER1");
|
return PSTR("TEMP_HEATER0");
|
||||||
case 2: return PSTR("TEMP_BED");
|
case 1:
|
||||||
case 3: return PSTR("TEMP_PINDA");
|
return PSTR("TEMP_HEATER1");
|
||||||
case 4: return PSTR("VOLT_PWR");
|
case 2:
|
||||||
case 5: return PSTR("TEMP_AMBIENT");
|
return PSTR("TEMP_BED");
|
||||||
case 6: return PSTR("VOLT_BED");
|
case 3:
|
||||||
|
return PSTR("TEMP_PINDA");
|
||||||
|
case 4:
|
||||||
|
return PSTR("VOLT_PWR");
|
||||||
|
case 5:
|
||||||
|
return PSTR("TEMP_AMBIENT");
|
||||||
|
case 6:
|
||||||
|
return PSTR("VOLT_BED");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -443,18 +456,25 @@ uint16_t dcode_9_ADC_val(uint8_t i)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0: return current_temperature_raw[0];
|
case 0:
|
||||||
case 1: return 0;
|
return current_temperature_raw[0];
|
||||||
case 2: return current_temperature_bed_raw;
|
case 1:
|
||||||
case 3: return current_temperature_raw_pinda;
|
return 0;
|
||||||
|
case 2:
|
||||||
|
return current_temperature_bed_raw;
|
||||||
|
case 3:
|
||||||
|
return current_temperature_raw_pinda;
|
||||||
#ifdef VOLT_PWR_PIN
|
#ifdef VOLT_PWR_PIN
|
||||||
case 4: return current_voltage_raw_pwr;
|
case 4:
|
||||||
|
return current_voltage_raw_pwr;
|
||||||
#endif //VOLT_PWR_PIN
|
#endif //VOLT_PWR_PIN
|
||||||
#ifdef AMBIENT_THERMISTOR
|
#ifdef AMBIENT_THERMISTOR
|
||||||
case 5: return current_temperature_raw_ambient;
|
case 5:
|
||||||
|
return current_temperature_raw_ambient;
|
||||||
#endif //AMBIENT_THERMISTOR
|
#endif //AMBIENT_THERMISTOR
|
||||||
#ifdef VOLT_BED_PIN
|
#ifdef VOLT_BED_PIN
|
||||||
case 6: return current_voltage_raw_bed;
|
case 6:
|
||||||
|
return current_voltage_raw_bed;
|
||||||
#endif //VOLT_BED_PIN
|
#endif //VOLT_BED_PIN
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -540,16 +560,28 @@ void dcode_2130()
|
||||||
uint8_t axis = 0xff;
|
uint8_t axis = 0xff;
|
||||||
switch (strchr_pointer[1+4])
|
switch (strchr_pointer[1+4])
|
||||||
{
|
{
|
||||||
case 'X': axis = X_AXIS; break;
|
case 'X':
|
||||||
case 'Y': axis = Y_AXIS; break;
|
axis = X_AXIS;
|
||||||
case 'Z': axis = Z_AXIS; break;
|
break;
|
||||||
case 'E': axis = E_AXIS; break;
|
case 'Y':
|
||||||
|
axis = Y_AXIS;
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
axis = Z_AXIS;
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
axis = E_AXIS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (axis != 0xff)
|
if (axis != 0xff)
|
||||||
{
|
{
|
||||||
char ch_axis = strchr_pointer[1+4];
|
char ch_axis = strchr_pointer[1+4];
|
||||||
if (strchr_pointer[1+5] == '0') { tmc2130_set_pwr(axis, 0); }
|
if (strchr_pointer[1+5] == '0') {
|
||||||
else if (strchr_pointer[1+5] == '1') { tmc2130_set_pwr(axis, 1); }
|
tmc2130_set_pwr(axis, 0);
|
||||||
|
}
|
||||||
|
else if (strchr_pointer[1+5] == '1') {
|
||||||
|
tmc2130_set_pwr(axis, 1);
|
||||||
|
}
|
||||||
else if (strchr_pointer[1+5] == '+')
|
else if (strchr_pointer[1+5] == '+')
|
||||||
{
|
{
|
||||||
if (strchr_pointer[1+6] == 0)
|
if (strchr_pointer[1+6] == 0)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -262,7 +262,9 @@ void refresh_cmd_timeout(void);
|
||||||
extern volatile unsigned long timer0_millis;
|
extern volatile unsigned long timer0_millis;
|
||||||
// An unsynchronized equivalent to a standard Arduino millis() function.
|
// An unsynchronized equivalent to a standard Arduino millis() function.
|
||||||
// To be used inside an interrupt routine.
|
// To be used inside an interrupt routine.
|
||||||
FORCE_INLINE unsigned long millis_nc() { return timer0_millis; }
|
FORCE_INLINE unsigned long millis_nc() {
|
||||||
|
return timer0_millis;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FAST_PWM_FAN
|
#ifdef FAST_PWM_FAN
|
||||||
void setPwmFrequency(uint8_t pin, int val);
|
void setPwmFrequency(uint8_t pin, int val);
|
||||||
|
|
|
||||||
|
|
@ -407,15 +407,26 @@ uint16_t gcode_in_progress = 0;
|
||||||
uint16_t mcode_in_progress = 0;
|
uint16_t mcode_in_progress = 0;
|
||||||
|
|
||||||
void serial_echopair_P(const char *s_P, float v)
|
void serial_echopair_P(const char *s_P, float v)
|
||||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
{
|
||||||
|
serialprintPGM(s_P);
|
||||||
|
SERIAL_ECHO(v);
|
||||||
|
}
|
||||||
void serial_echopair_P(const char *s_P, double v)
|
void serial_echopair_P(const char *s_P, double v)
|
||||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
{
|
||||||
|
serialprintPGM(s_P);
|
||||||
|
SERIAL_ECHO(v);
|
||||||
|
}
|
||||||
void serial_echopair_P(const char *s_P, unsigned long v)
|
void serial_echopair_P(const char *s_P, unsigned long v)
|
||||||
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
|
{
|
||||||
|
serialprintPGM(s_P);
|
||||||
|
SERIAL_ECHO(v);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
#include "SdFatUtil.h"
|
#include "SdFatUtil.h"
|
||||||
int freeMemory() { return SdFatUtil::FreeRam(); }
|
int freeMemory() {
|
||||||
|
return SdFatUtil::FreeRam();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern unsigned int __bss_end;
|
extern unsigned int __bss_end;
|
||||||
|
|
@ -818,10 +829,18 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
factory_reset(level);
|
factory_reset(level);
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 0: _delay_ms(0); break;
|
case 0:
|
||||||
case 1: _delay_ms(0); break;
|
_delay_ms(0);
|
||||||
case 2: _delay_ms(0); break;
|
break;
|
||||||
case 3: _delay_ms(0); break;
|
case 1:
|
||||||
|
_delay_ms(0);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_delay_ms(0);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_delay_ms(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -832,8 +851,12 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
void show_fw_version_warnings() {
|
void show_fw_version_warnings() {
|
||||||
if (FW_DEV_VERSION == FW_VERSION_GOLD || FW_DEV_VERSION == FW_VERSION_RC) return;
|
if (FW_DEV_VERSION == FW_VERSION_GOLD || FW_DEV_VERSION == FW_VERSION_RC) return;
|
||||||
switch (FW_DEV_VERSION) {
|
switch (FW_DEV_VERSION) {
|
||||||
case(FW_VERSION_ALPHA): lcd_show_fullscreen_message_and_wait_P(_i("You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage.")); break;////MSG_FW_VERSION_ALPHA c=20 r=8
|
case(FW_VERSION_ALPHA):
|
||||||
case(FW_VERSION_BETA): lcd_show_fullscreen_message_and_wait_P(_i("You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage.")); break;////MSG_FW_VERSION_BETA c=20 r=8
|
lcd_show_fullscreen_message_and_wait_P(_i("You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage."));
|
||||||
|
break;////MSG_FW_VERSION_ALPHA c=20 r=8
|
||||||
|
case(FW_VERSION_BETA):
|
||||||
|
lcd_show_fullscreen_message_and_wait_P(_i("You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage."));
|
||||||
|
break;////MSG_FW_VERSION_BETA c=20 r=8
|
||||||
case(FW_VERSION_DEVEL):
|
case(FW_VERSION_DEVEL):
|
||||||
case(FW_VERSION_DEBUG):
|
case(FW_VERSION_DEBUG):
|
||||||
lcd_update_enable(false);
|
lcd_update_enable(false);
|
||||||
|
|
@ -844,7 +867,8 @@ void show_fw_version_warnings() {
|
||||||
lcd_puts_at_P(0, 0, PSTR("Debbugging build !!!"));
|
lcd_puts_at_P(0, 0, PSTR("Debbugging build !!!"));
|
||||||
#endif
|
#endif
|
||||||
lcd_puts_at_P(0, 1, PSTR("May destroy printer!"));
|
lcd_puts_at_P(0, 1, PSTR("May destroy printer!"));
|
||||||
lcd_puts_at_P(0, 2, PSTR("ver ")); lcd_puts_P(PSTR(FW_VERSION_FULL));
|
lcd_puts_at_P(0, 2, PSTR("ver "));
|
||||||
|
lcd_puts_P(PSTR(FW_VERSION_FULL));
|
||||||
lcd_puts_at_P(0, 3, PSTR(FW_REPOSITORY));
|
lcd_puts_at_P(0, 3, PSTR(FW_REPOSITORY));
|
||||||
lcd_wait_for_click();
|
lcd_wait_for_click();
|
||||||
break;
|
break;
|
||||||
|
|
@ -1481,7 +1505,8 @@ void setup()
|
||||||
eeprom_write_word((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
|
eeprom_write_word((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
|
||||||
eeprom_write_word((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
|
eeprom_write_word((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
|
||||||
break;
|
break;
|
||||||
default: break; //no change, show no message
|
default:
|
||||||
|
break; //no change, show no message
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!previous_settings_retrieved) {
|
if (!previous_settings_retrieved) {
|
||||||
|
|
@ -1818,9 +1843,15 @@ void loop()
|
||||||
// crashdet_stop_and_save_print();
|
// crashdet_stop_and_save_print();
|
||||||
switch (crash)
|
switch (crash)
|
||||||
{
|
{
|
||||||
case 1: enquecommand_P((PSTR("CRASH_DETECTEDX"))); break;
|
case 1:
|
||||||
case 2: enquecommand_P((PSTR("CRASH_DETECTEDY"))); break;
|
enquecommand_P((PSTR("CRASH_DETECTEDX")));
|
||||||
case 3: enquecommand_P((PSTR("CRASH_DETECTEDXY"))); break;
|
break;
|
||||||
|
case 2:
|
||||||
|
enquecommand_P((PSTR("CRASH_DETECTEDY")));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
enquecommand_P((PSTR("CRASH_DETECTEDXY")));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
@ -1856,8 +1887,12 @@ static void axis_is_at_home(int axis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
|
inline void set_current_to_destination() {
|
||||||
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
|
memcpy(current_position, destination, sizeof(current_position));
|
||||||
|
}
|
||||||
|
inline void set_destination_to_current() {
|
||||||
|
memcpy(destination, current_position, sizeof(destination));
|
||||||
|
}
|
||||||
|
|
||||||
//! @return original feedmultiply
|
//! @return original feedmultiply
|
||||||
static int setup_for_endstop_move(bool enable_endstops_now = true) {
|
static int setup_for_endstop_move(bool enable_endstops_now = true) {
|
||||||
|
|
@ -2043,7 +2078,8 @@ inline void gcode_M900() {
|
||||||
SERIAL_ECHOLN(extruder_advance_k);
|
SERIAL_ECHOLN(extruder_advance_k);
|
||||||
SERIAL_ECHOPGM(" E/D=");
|
SERIAL_ECHOPGM(" E/D=");
|
||||||
const float ratio = advance_ed_ratio;
|
const float ratio = advance_ed_ratio;
|
||||||
if (ratio) SERIAL_ECHOLN(ratio); else SERIAL_ECHOLNPGM("Auto");
|
if (ratio) SERIAL_ECHOLN(ratio);
|
||||||
|
else SERIAL_ECHOLNPGM("Auto");
|
||||||
}
|
}
|
||||||
#endif // LIN_ADVANCE
|
#endif // LIN_ADVANCE
|
||||||
|
|
||||||
|
|
@ -2412,8 +2448,10 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
SERIAL_ECHOPGM("G28, initial "); print_world_coordinates();
|
SERIAL_ECHOPGM("G28, initial ");
|
||||||
SERIAL_ECHOPGM("G28, initial "); print_physical_coordinates();
|
print_world_coordinates();
|
||||||
|
SERIAL_ECHOPGM("G28, initial ");
|
||||||
|
print_physical_coordinates();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flag for the display update routine and to disable the print cancelation during homing.
|
// Flag for the display update routine and to disable the print cancelation during homing.
|
||||||
|
|
@ -2480,12 +2518,14 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
||||||
// In the quick mode, if both x and y are to be homed, a diagonal move will be performed initially.
|
// In the quick mode, if both x and y are to be homed, a diagonal move will be performed initially.
|
||||||
if(home_x && home_y) //first diagonal move
|
if(home_x && home_y) //first diagonal move
|
||||||
{
|
{
|
||||||
current_position[X_AXIS] = 0;current_position[Y_AXIS] = 0;
|
current_position[X_AXIS] = 0;
|
||||||
|
current_position[Y_AXIS] = 0;
|
||||||
|
|
||||||
int x_axis_home_dir = home_dir(X_AXIS);
|
int x_axis_home_dir = home_dir(X_AXIS);
|
||||||
|
|
||||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
|
destination[X_AXIS] = 1.5 * max_length(X_AXIS) * x_axis_home_dir;
|
||||||
|
destination[Y_AXIS] = 1.5 * max_length(Y_AXIS) * home_dir(Y_AXIS);
|
||||||
feedrate = homing_feedrate[X_AXIS];
|
feedrate = homing_feedrate[X_AXIS];
|
||||||
if(homing_feedrate[Y_AXIS]<feedrate)
|
if(homing_feedrate[Y_AXIS]<feedrate)
|
||||||
feedrate = homing_feedrate[Y_AXIS];
|
feedrate = homing_feedrate[Y_AXIS];
|
||||||
|
|
@ -2568,15 +2608,20 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
||||||
enable_endstops(false);
|
enable_endstops(false);
|
||||||
#ifdef DEBUG_BUILD
|
#ifdef DEBUG_BUILD
|
||||||
SERIAL_ECHOLNPGM("plan_set_position()");
|
SERIAL_ECHOLNPGM("plan_set_position()");
|
||||||
MYSERIAL.println(current_position[X_AXIS]);MYSERIAL.println(current_position[Y_AXIS]);
|
MYSERIAL.println(current_position[X_AXIS]);
|
||||||
MYSERIAL.println(current_position[Z_AXIS]);MYSERIAL.println(current_position[E_AXIS]);
|
MYSERIAL.println(current_position[Y_AXIS]);
|
||||||
|
MYSERIAL.println(current_position[Z_AXIS]);
|
||||||
|
MYSERIAL.println(current_position[E_AXIS]);
|
||||||
#endif
|
#endif
|
||||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||||
#ifdef DEBUG_BUILD
|
#ifdef DEBUG_BUILD
|
||||||
SERIAL_ECHOLNPGM("plan_buffer_line()");
|
SERIAL_ECHOLNPGM("plan_buffer_line()");
|
||||||
MYSERIAL.println(destination[X_AXIS]);MYSERIAL.println(destination[Y_AXIS]);
|
MYSERIAL.println(destination[X_AXIS]);
|
||||||
MYSERIAL.println(destination[Z_AXIS]);MYSERIAL.println(destination[E_AXIS]);
|
MYSERIAL.println(destination[Y_AXIS]);
|
||||||
MYSERIAL.println(feedrate);MYSERIAL.println(active_extruder);
|
MYSERIAL.println(destination[Z_AXIS]);
|
||||||
|
MYSERIAL.println(destination[E_AXIS]);
|
||||||
|
MYSERIAL.println(feedrate);
|
||||||
|
MYSERIAL.println(active_extruder);
|
||||||
#endif
|
#endif
|
||||||
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
|
|
@ -2683,13 +2728,18 @@ void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, long home_
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (farm_mode) { prusa_statistics(20); };
|
if (farm_mode) {
|
||||||
|
prusa_statistics(20);
|
||||||
|
};
|
||||||
|
|
||||||
homing_flag = false;
|
homing_flag = false;
|
||||||
#if 0
|
#if 0
|
||||||
SERIAL_ECHOPGM("G28, final "); print_world_coordinates();
|
SERIAL_ECHOPGM("G28, final ");
|
||||||
SERIAL_ECHOPGM("G28, final "); print_physical_coordinates();
|
print_world_coordinates();
|
||||||
SERIAL_ECHOPGM("G28, final "); print_mesh_bed_leveling_table();
|
SERIAL_ECHOPGM("G28, final ");
|
||||||
|
print_physical_coordinates();
|
||||||
|
SERIAL_ECHOPGM("G28, final ");
|
||||||
|
print_mesh_bed_leveling_table();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4100,7 +4150,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
|
|
||||||
printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]);
|
printf_P(_N("\nZERO: %.3f\n"), current_position[Z_AXIS]);
|
||||||
|
|
||||||
int i = -1; for (; i < 5; i++)
|
int i = -1;
|
||||||
|
for (; i < 5; i++)
|
||||||
{
|
{
|
||||||
float temp = (40 + i * 5);
|
float temp = (40 + i * 5);
|
||||||
printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5));
|
printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5));
|
||||||
|
|
@ -4272,14 +4323,27 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
|
|
||||||
if (code_seen('X')) dimension_x = code_value();
|
if (code_seen('X')) dimension_x = code_value();
|
||||||
if (code_seen('Y')) dimension_y = code_value();
|
if (code_seen('Y')) dimension_y = code_value();
|
||||||
if (code_seen("XP")) { strchr_pointer+=1; points_x = code_value(); }
|
if (code_seen("XP")) {
|
||||||
if (code_seen("YP")) { strchr_pointer+=1; points_y = code_value(); }
|
strchr_pointer+=1;
|
||||||
if (code_seen("XO")) { strchr_pointer+=1; offset_x = code_value(); }
|
points_x = code_value();
|
||||||
if (code_seen("YO")) { strchr_pointer+=1; offset_y = code_value(); }
|
}
|
||||||
|
if (code_seen("YP")) {
|
||||||
|
strchr_pointer+=1;
|
||||||
|
points_y = code_value();
|
||||||
|
}
|
||||||
|
if (code_seen("XO")) {
|
||||||
|
strchr_pointer+=1;
|
||||||
|
offset_x = code_value();
|
||||||
|
}
|
||||||
|
if (code_seen("YO")) {
|
||||||
|
strchr_pointer+=1;
|
||||||
|
offset_y = code_value();
|
||||||
|
}
|
||||||
|
|
||||||
bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
bed_analysis(dimension_x,dimension_y,points_x,points_y,offset_x,offset_y);
|
||||||
|
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -4293,7 +4357,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
}
|
}
|
||||||
printf_P(_N("%d: %d\n"), i, fan_speed[1]);
|
printf_P(_N("%d: %d\n"), i, fan_speed[1]);
|
||||||
}
|
}
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* G80: Mesh-based Z probe, probes a grid and produces a
|
* G80: Mesh-based Z probe, probes a grid and produces a
|
||||||
|
|
@ -4960,7 +5025,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
if(!call_procedure)
|
if(!call_procedure)
|
||||||
starttime=millis(); //procedure calls count as normal print time.
|
starttime=millis(); //procedure calls count as normal print time.
|
||||||
}
|
}
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
case 928: //M928 - Start SD write
|
case 928: //M928 - Start SD write
|
||||||
starpos = (strchr(strchr_pointer + 5,'*'));
|
starpos = (strchr(strchr_pointer + 5,'*'));
|
||||||
if(starpos != NULL) {
|
if(starpos != NULL) {
|
||||||
|
|
@ -5483,7 +5549,8 @@ Sigma_Exit:
|
||||||
SERIAL_PROTOCOL(cur_extruder);
|
SERIAL_PROTOCOL(cur_extruder);
|
||||||
SERIAL_PROTOCOLPGM("->");
|
SERIAL_PROTOCOLPGM("->");
|
||||||
SERIAL_PROTOCOL_F(raw, 5);
|
SERIAL_PROTOCOL_F(raw, 5);
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
SERIAL_PROTOCOLLN("");
|
SERIAL_PROTOCOLLN("");
|
||||||
KEEPALIVE_STATE(NOT_BUSY);
|
KEEPALIVE_STATE(NOT_BUSY);
|
||||||
|
|
@ -5498,7 +5565,9 @@ Sigma_Exit:
|
||||||
}
|
}
|
||||||
LCD_MESSAGERPGM(_T(MSG_HEATING));
|
LCD_MESSAGERPGM(_T(MSG_HEATING));
|
||||||
heating_status = 1;
|
heating_status = 1;
|
||||||
if (farm_mode) { prusa_statistics(1); };
|
if (farm_mode) {
|
||||||
|
prusa_statistics(1);
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef AUTOTEMP
|
#ifdef AUTOTEMP
|
||||||
autotemp_enabled=false;
|
autotemp_enabled=false;
|
||||||
|
|
@ -5535,7 +5604,9 @@ Sigma_Exit:
|
||||||
LCD_MESSAGERPGM(_T(MSG_HEATING_COMPLETE));
|
LCD_MESSAGERPGM(_T(MSG_HEATING_COMPLETE));
|
||||||
KEEPALIVE_STATE(IN_HANDLER);
|
KEEPALIVE_STATE(IN_HANDLER);
|
||||||
heating_status = 2;
|
heating_status = 2;
|
||||||
if (farm_mode) { prusa_statistics(2); };
|
if (farm_mode) {
|
||||||
|
prusa_statistics(2);
|
||||||
|
};
|
||||||
|
|
||||||
//starttime=millis();
|
//starttime=millis();
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
|
|
@ -5545,7 +5616,9 @@ Sigma_Exit:
|
||||||
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
|
||||||
LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
|
LCD_MESSAGERPGM(_T(MSG_BED_HEATING));
|
||||||
heating_status = 3;
|
heating_status = 3;
|
||||||
if (farm_mode) { prusa_statistics(1); };
|
if (farm_mode) {
|
||||||
|
prusa_statistics(1);
|
||||||
|
};
|
||||||
if (code_seen('S'))
|
if (code_seen('S'))
|
||||||
{
|
{
|
||||||
setTargetBed(code_value());
|
setTargetBed(code_value());
|
||||||
|
|
@ -6002,7 +6075,8 @@ Sigma_Exit:
|
||||||
{
|
{
|
||||||
cs.retract_zlift = code_value() ;
|
cs.retract_zlift = code_value() ;
|
||||||
}
|
}
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min]
|
case 208: // M208 - set retract recover length S[positive mm surplus to the M207 S*] F[feedrate mm/min]
|
||||||
{
|
{
|
||||||
if(code_seen('S'))
|
if(code_seen('S'))
|
||||||
|
|
@ -6013,7 +6087,8 @@ Sigma_Exit:
|
||||||
{
|
{
|
||||||
cs.retract_recover_feedrate = code_value()/60 ;
|
cs.retract_recover_feedrate = code_value()/60 ;
|
||||||
}
|
}
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
|
case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
|
||||||
{
|
{
|
||||||
if(code_seen('S'))
|
if(code_seen('S'))
|
||||||
|
|
@ -6031,7 +6106,8 @@ Sigma_Exit:
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
retracted[2]=false;
|
retracted[2]=false;
|
||||||
#endif
|
#endif
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
cs.autoretract_enabled=true;
|
cs.autoretract_enabled=true;
|
||||||
|
|
@ -6042,7 +6118,8 @@ Sigma_Exit:
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
retracted[2]=false;
|
retracted[2]=false;
|
||||||
#endif
|
#endif
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
SERIAL_ECHO_START;
|
SERIAL_ECHO_START;
|
||||||
SERIAL_ECHORPGM(MSG_UNKNOWN_COMMAND);
|
SERIAL_ECHORPGM(MSG_UNKNOWN_COMMAND);
|
||||||
|
|
@ -6051,7 +6128,8 @@ Sigma_Exit:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
#endif // FWRETRACT
|
#endif // FWRETRACT
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
||||||
|
|
@ -6078,7 +6156,8 @@ Sigma_Exit:
|
||||||
SERIAL_ECHO(extruder_offset[Y_AXIS][extruder]);
|
SERIAL_ECHO(extruder_offset[Y_AXIS][extruder]);
|
||||||
}
|
}
|
||||||
SERIAL_ECHOLN("");
|
SERIAL_ECHOLN("");
|
||||||
}break;
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
||||||
{
|
{
|
||||||
|
|
@ -6875,7 +6954,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
if (mmu_enabled)
|
if (mmu_enabled)
|
||||||
{
|
{
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
delay(1500);
|
|
||||||
mmu_command(MMU_CMD_C0);
|
mmu_command(MMU_CMD_C0);
|
||||||
mmu_extruder = tmp_extruder; //filament change is finished
|
mmu_extruder = tmp_extruder; //filament change is finished
|
||||||
mmu_load_to_nozzle();
|
mmu_load_to_nozzle();
|
||||||
|
|
@ -6904,7 +6982,6 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||||
|
|
||||||
manage_response(true, true);
|
manage_response(true, true);
|
||||||
delay(1500);
|
|
||||||
mmu_command(MMU_CMD_C0);
|
mmu_command(MMU_CMD_C0);
|
||||||
mmu_extruder = tmp_extruder; //filament change is finished
|
mmu_extruder = tmp_extruder; //filament change is finished
|
||||||
|
|
||||||
|
|
@ -7018,49 +7095,63 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DCODES
|
#ifdef DEBUG_DCODES
|
||||||
case -1: //! D-1 - Endless loop
|
case -1: //! D-1 - Endless loop
|
||||||
dcode__1(); break;
|
dcode__1();
|
||||||
|
break;
|
||||||
case 0: //! D0 - Reset
|
case 0: //! D0 - Reset
|
||||||
dcode_0(); break;
|
dcode_0();
|
||||||
|
break;
|
||||||
case 1: //! D1 - Clear EEPROM
|
case 1: //! D1 - Clear EEPROM
|
||||||
dcode_1(); break;
|
dcode_1();
|
||||||
|
break;
|
||||||
case 2: //! D2 - Read/Write RAM
|
case 2: //! D2 - Read/Write RAM
|
||||||
dcode_2(); break;
|
dcode_2();
|
||||||
|
break;
|
||||||
#endif //DEBUG_DCODES
|
#endif //DEBUG_DCODES
|
||||||
#ifdef DEBUG_DCODE3
|
#ifdef DEBUG_DCODE3
|
||||||
case 3: //! D3 - Read/Write EEPROM
|
case 3: //! D3 - Read/Write EEPROM
|
||||||
dcode_3(); break;
|
dcode_3();
|
||||||
|
break;
|
||||||
#endif //DEBUG_DCODE3
|
#endif //DEBUG_DCODE3
|
||||||
#ifdef DEBUG_DCODES
|
#ifdef DEBUG_DCODES
|
||||||
case 4: //! D4 - Read/Write PIN
|
case 4: //! D4 - Read/Write PIN
|
||||||
dcode_4(); break;
|
dcode_4();
|
||||||
|
break;
|
||||||
#endif //DEBUG_DCODES
|
#endif //DEBUG_DCODES
|
||||||
#ifdef DEBUG_DCODE5
|
#ifdef DEBUG_DCODE5
|
||||||
case 5: // D5 - Read/Write FLASH
|
case 5: // D5 - Read/Write FLASH
|
||||||
dcode_5(); break;
|
dcode_5();
|
||||||
|
break;
|
||||||
break;
|
break;
|
||||||
#endif //DEBUG_DCODE5
|
#endif //DEBUG_DCODE5
|
||||||
#ifdef DEBUG_DCODES
|
#ifdef DEBUG_DCODES
|
||||||
case 6: // D6 - Read/Write external FLASH
|
case 6: // D6 - Read/Write external FLASH
|
||||||
dcode_6(); break;
|
dcode_6();
|
||||||
|
break;
|
||||||
case 7: //! D7 - Read/Write Bootloader
|
case 7: //! D7 - Read/Write Bootloader
|
||||||
dcode_7(); break;
|
dcode_7();
|
||||||
|
break;
|
||||||
case 8: //! D8 - Read/Write PINDA
|
case 8: //! D8 - Read/Write PINDA
|
||||||
dcode_8(); break;
|
dcode_8();
|
||||||
|
break;
|
||||||
case 9: //! D9 - Read/Write ADC
|
case 9: //! D9 - Read/Write ADC
|
||||||
dcode_9(); break;
|
dcode_9();
|
||||||
|
break;
|
||||||
|
|
||||||
case 10: //! D10 - XYZ calibration = OK
|
case 10: //! D10 - XYZ calibration = OK
|
||||||
dcode_10(); break;
|
dcode_10();
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
case 2130: //! D2130 - TMC2130
|
case 2130: //! D2130 - TMC2130
|
||||||
dcode_2130(); break;
|
dcode_2130();
|
||||||
|
break;
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
#ifdef FILAMENT_SENSOR
|
#ifdef FILAMENT_SENSOR
|
||||||
case 9125: //! D9125 - FILAMENT_SENSOR
|
case 9125: //! D9125 - FILAMENT_SENSOR
|
||||||
dcode_9125(); break;
|
dcode_9125();
|
||||||
|
break;
|
||||||
#endif //FILAMENT_SENSOR
|
#endif //FILAMENT_SENSOR
|
||||||
|
|
||||||
#endif //DEBUG_DCODES
|
#endif //DEBUG_DCODES
|
||||||
|
|
@ -7442,7 +7533,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active && mmuFSensorLoading) {
|
if (mmuFSensorLoading) {
|
||||||
fsensor_check_autoload();
|
fsensor_check_autoload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7594,7 +7685,9 @@ void Stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsStopped() { return Stopped; };
|
bool IsStopped() {
|
||||||
|
return Stopped;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef FAST_PWM_FAN
|
#ifdef FAST_PWM_FAN
|
||||||
void setPwmFrequency(uint8_t pin, int val)
|
void setPwmFrequency(uint8_t pin, int val)
|
||||||
|
|
@ -8573,9 +8666,12 @@ void recover_machine_state_after_power_panic(bool bTiny)
|
||||||
|
|
||||||
// 6) Power up the motors, mark their positions as known.
|
// 6) Power up the motors, mark their positions as known.
|
||||||
//FIXME Verfiy, whether the X and Y axes should be powered up here, as they will later be re-homed anyway.
|
//FIXME Verfiy, whether the X and Y axes should be powered up here, as they will later be re-homed anyway.
|
||||||
axis_known_position[X_AXIS] = true; enable_x();
|
axis_known_position[X_AXIS] = true;
|
||||||
axis_known_position[Y_AXIS] = true; enable_y();
|
enable_x();
|
||||||
axis_known_position[Z_AXIS] = true; enable_z();
|
axis_known_position[Y_AXIS] = true;
|
||||||
|
enable_y();
|
||||||
|
axis_known_position[Z_AXIS] = true;
|
||||||
|
enable_z();
|
||||||
|
|
||||||
SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial ");
|
SERIAL_ECHOPGM("recover_machine_state_after_power_panic, initial ");
|
||||||
print_physical_coordinates();
|
print_physical_coordinates();
|
||||||
|
|
@ -8637,12 +8733,15 @@ void restore_print_from_eeprom() {
|
||||||
// E axis relative mode.
|
// E axis relative mode.
|
||||||
enquecommand_P(PSTR("M83"));
|
enquecommand_P(PSTR("M83"));
|
||||||
// Move to the XY print position in logical coordinates, where the print has been killed.
|
// Move to the XY print position in logical coordinates, where the print has been killed.
|
||||||
strcpy_P(cmd, PSTR("G1 X")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0))));
|
strcpy_P(cmd, PSTR("G1 X"));
|
||||||
strcat_P(cmd, PSTR(" Y")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4))));
|
strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 0))));
|
||||||
|
strcat_P(cmd, PSTR(" Y"));
|
||||||
|
strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4))));
|
||||||
strcat_P(cmd, PSTR(" F2000"));
|
strcat_P(cmd, PSTR(" F2000"));
|
||||||
enquecommand(cmd);
|
enquecommand(cmd);
|
||||||
// Move the Z axis down to the print, in logical coordinates.
|
// Move the Z axis down to the print, in logical coordinates.
|
||||||
strcpy_P(cmd, PSTR("G1 Z")); strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z))));
|
strcpy_P(cmd, PSTR("G1 Z"));
|
||||||
|
strcat(cmd, ftostr32(eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z))));
|
||||||
enquecommand(cmd);
|
enquecommand(cmd);
|
||||||
// Unretract.
|
// Unretract.
|
||||||
enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480"));
|
enquecommand_P(PSTR("G1 E" STRINGIFY(2*default_retraction)" F480"));
|
||||||
|
|
@ -8712,12 +8811,18 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
SERIAL_ECHOPGM("SDPOS_ATOMIC="); MYSERIAL.println(sdpos_atomic, DEC);
|
SERIAL_ECHOPGM("SDPOS_ATOMIC=");
|
||||||
SERIAL_ECHOPGM("SDPOS="); MYSERIAL.println(card.get_sdpos(), DEC);
|
MYSERIAL.println(sdpos_atomic, DEC);
|
||||||
SERIAL_ECHOPGM("SDLEN_PLAN="); MYSERIAL.println(sdlen_planner, DEC);
|
SERIAL_ECHOPGM("SDPOS=");
|
||||||
SERIAL_ECHOPGM("SDLEN_CMDQ="); MYSERIAL.println(sdlen_cmdqueue, DEC);
|
MYSERIAL.println(card.get_sdpos(), DEC);
|
||||||
SERIAL_ECHOPGM("PLANNERBLOCKS="); MYSERIAL.println(int(nplanner_blocks), DEC);
|
SERIAL_ECHOPGM("SDLEN_PLAN=");
|
||||||
SERIAL_ECHOPGM("SDSAVED="); MYSERIAL.println(saved_sdpos, DEC);
|
MYSERIAL.println(sdlen_planner, DEC);
|
||||||
|
SERIAL_ECHOPGM("SDLEN_CMDQ=");
|
||||||
|
MYSERIAL.println(sdlen_cmdqueue, DEC);
|
||||||
|
SERIAL_ECHOPGM("PLANNERBLOCKS=");
|
||||||
|
MYSERIAL.println(int(nplanner_blocks), DEC);
|
||||||
|
SERIAL_ECHOPGM("SDSAVED=");
|
||||||
|
MYSERIAL.println(saved_sdpos, DEC);
|
||||||
//SERIAL_ECHOPGM("SDFILELEN="); MYSERIAL.println(card.fileSize(), DEC);
|
//SERIAL_ECHOPGM("SDFILELEN="); MYSERIAL.println(card.fileSize(), DEC);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,13 +170,19 @@ class Sd2Card {
|
||||||
* Set SD error code.
|
* Set SD error code.
|
||||||
* \param[in] code value for error code.
|
* \param[in] code value for error code.
|
||||||
*/
|
*/
|
||||||
void error(uint8_t code) {errorCode_ = code;}
|
void error(uint8_t code) {
|
||||||
|
errorCode_ = code;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* \return error code for last error. See Sd2Card.h for a list of error codes.
|
* \return error code for last error. See Sd2Card.h for a list of error codes.
|
||||||
*/
|
*/
|
||||||
int errorCode() const {return errorCode_;}
|
int errorCode() const {
|
||||||
|
return errorCode_;
|
||||||
|
}
|
||||||
/** \return error data for last error. */
|
/** \return error data for last error. */
|
||||||
int errorData() const {return status_;}
|
int errorData() const {
|
||||||
|
return status_;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Initialize an SD flash memory card with default clock rate and chip
|
* Initialize an SD flash memory card with default clock rate and chip
|
||||||
* select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin).
|
* select pin. See sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin).
|
||||||
|
|
@ -216,7 +222,9 @@ class Sd2Card {
|
||||||
/** Return the card type: SD V1, SD V2 or SDHC
|
/** Return the card type: SD V1, SD V2 or SDHC
|
||||||
* \return 0 - SD V1, 1 - SD V2, or 3 - SDHC.
|
* \return 0 - SD V1, 1 - SD V2, or 3 - SDHC.
|
||||||
*/
|
*/
|
||||||
int type() const {return type_;}
|
int type() const {
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
bool writeBlock(uint32_t blockNumber, const uint8_t* src);
|
bool writeBlock(uint32_t blockNumber, const uint8_t* src);
|
||||||
bool writeData(const uint8_t* src);
|
bool writeData(const uint8_t* src);
|
||||||
bool writeStart(uint32_t blockNumber, uint32_t eraseCount);
|
bool writeStart(uint32_t blockNumber, uint32_t eraseCount);
|
||||||
|
|
@ -225,8 +233,12 @@ class Sd2Card {
|
||||||
// Toshiba FlashAir support
|
// Toshiba FlashAir support
|
||||||
uint8_t readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst);
|
uint8_t readExtMemory(uint8_t mio, uint8_t func, uint32_t addr, uint16_t count, uint8_t* dst);
|
||||||
|
|
||||||
void setFlashAirCompatible(bool flashAirCompatible) { flash_air_compatible_ = flashAirCompatible; }
|
void setFlashAirCompatible(bool flashAirCompatible) {
|
||||||
bool getFlashAirCompatible() const { return flash_air_compatible_; }
|
flash_air_compatible_ = flashAirCompatible;
|
||||||
|
}
|
||||||
|
bool getFlashAirCompatible() const {
|
||||||
|
return flash_air_compatible_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
@ -247,7 +259,9 @@ class Sd2Card {
|
||||||
bool readRegister(uint8_t cmd, void* buf);
|
bool readRegister(uint8_t cmd, void* buf);
|
||||||
void chipSelectHigh();
|
void chipSelectHigh();
|
||||||
void chipSelectLow();
|
void chipSelectLow();
|
||||||
void type(uint8_t value) {type_ = value;}
|
void type(uint8_t value) {
|
||||||
|
type_ = value;
|
||||||
|
}
|
||||||
bool waitNotBusy(uint16_t timeoutMillis);
|
bool waitNotBusy(uint16_t timeoutMillis);
|
||||||
bool writeData(uint8_t token, const uint8_t* src);
|
bool writeData(uint8_t token, const uint8_t* src);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,9 @@ class SdBaseFile {
|
||||||
/** Create an instance. */
|
/** Create an instance. */
|
||||||
SdBaseFile() : writeError(false), type_(FAT_FILE_TYPE_CLOSED) {}
|
SdBaseFile() : writeError(false), type_(FAT_FILE_TYPE_CLOSED) {}
|
||||||
SdBaseFile(const char* path, uint8_t oflag);
|
SdBaseFile(const char* path, uint8_t oflag);
|
||||||
~SdBaseFile() {if(isOpen()) close();}
|
~SdBaseFile() {
|
||||||
|
if(isOpen()) close();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* writeError is set to true if an error occurs during a write().
|
* writeError is set to true if an error occurs during a write().
|
||||||
* Set writeError to false before calling print() and/or write() and check
|
* Set writeError to false before calling print() and/or write() and check
|
||||||
|
|
@ -207,11 +209,17 @@ class SdBaseFile {
|
||||||
bool createContiguous(SdBaseFile* dirFile,
|
bool createContiguous(SdBaseFile* dirFile,
|
||||||
const char* path, uint32_t size);
|
const char* path, uint32_t size);
|
||||||
/** \return The current cluster number for a file or directory. */
|
/** \return The current cluster number for a file or directory. */
|
||||||
uint32_t curCluster() const {return curCluster_;}
|
uint32_t curCluster() const {
|
||||||
|
return curCluster_;
|
||||||
|
}
|
||||||
/** \return The current position for a file or directory. */
|
/** \return The current position for a file or directory. */
|
||||||
uint32_t curPosition() const {return curPosition_;}
|
uint32_t curPosition() const {
|
||||||
|
return curPosition_;
|
||||||
|
}
|
||||||
/** \return Current working directory */
|
/** \return Current working directory */
|
||||||
static SdBaseFile* cwd() {return cwd_;}
|
static SdBaseFile* cwd() {
|
||||||
|
return cwd_;
|
||||||
|
}
|
||||||
/** Set the date/time callback function
|
/** Set the date/time callback function
|
||||||
*
|
*
|
||||||
* \param[in] dateTime The user's call back function. The callback
|
* \param[in] dateTime The user's call back function. The callback
|
||||||
|
|
@ -244,24 +252,38 @@ class SdBaseFile {
|
||||||
dateTime_ = dateTime;
|
dateTime_ = dateTime;
|
||||||
}
|
}
|
||||||
/** Cancel the date/time callback function. */
|
/** Cancel the date/time callback function. */
|
||||||
static void dateTimeCallbackCancel() {dateTime_ = 0;}
|
static void dateTimeCallbackCancel() {
|
||||||
|
dateTime_ = 0;
|
||||||
|
}
|
||||||
bool dirEntry(dir_t* dir);
|
bool dirEntry(dir_t* dir);
|
||||||
static void dirName(const dir_t& dir, char* name);
|
static void dirName(const dir_t& dir, char* name);
|
||||||
bool exists(const char* name);
|
bool exists(const char* name);
|
||||||
int16_t fgets(char* str, int16_t num, char* delim = 0);
|
int16_t fgets(char* str, int16_t num, char* delim = 0);
|
||||||
/** \return The total number of bytes in a file or directory. */
|
/** \return The total number of bytes in a file or directory. */
|
||||||
uint32_t fileSize() const {return fileSize_;}
|
uint32_t fileSize() const {
|
||||||
|
return fileSize_;
|
||||||
|
}
|
||||||
/** \return The first cluster number for a file or directory. */
|
/** \return The first cluster number for a file or directory. */
|
||||||
uint32_t firstCluster() const {return firstCluster_;}
|
uint32_t firstCluster() const {
|
||||||
|
return firstCluster_;
|
||||||
|
}
|
||||||
bool getFilename(char* name);
|
bool getFilename(char* name);
|
||||||
/** \return True if this is a directory else false. */
|
/** \return True if this is a directory else false. */
|
||||||
bool isDir() const {return type_ >= FAT_FILE_TYPE_MIN_DIR;}
|
bool isDir() const {
|
||||||
|
return type_ >= FAT_FILE_TYPE_MIN_DIR;
|
||||||
|
}
|
||||||
/** \return True if this is a normal file else false. */
|
/** \return True if this is a normal file else false. */
|
||||||
bool isFile() const {return type_ == FAT_FILE_TYPE_NORMAL;}
|
bool isFile() const {
|
||||||
|
return type_ == FAT_FILE_TYPE_NORMAL;
|
||||||
|
}
|
||||||
/** \return True if this is an open file/directory else false. */
|
/** \return True if this is an open file/directory else false. */
|
||||||
bool isOpen() const {return type_ != FAT_FILE_TYPE_CLOSED;}
|
bool isOpen() const {
|
||||||
|
return type_ != FAT_FILE_TYPE_CLOSED;
|
||||||
|
}
|
||||||
/** \return True if this is a subdirectory else false. */
|
/** \return True if this is a subdirectory else false. */
|
||||||
bool isSubDir() const {return type_ == FAT_FILE_TYPE_SUBDIR;}
|
bool isSubDir() const {
|
||||||
|
return type_ == FAT_FILE_TYPE_SUBDIR;
|
||||||
|
}
|
||||||
/** \return True if this is the root directory. */
|
/** \return True if this is the root directory. */
|
||||||
bool isRoot() const {
|
bool isRoot() const {
|
||||||
return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32;
|
return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32;
|
||||||
|
|
@ -287,11 +309,15 @@ class SdBaseFile {
|
||||||
static bool remove(SdBaseFile* dirFile, const char* path);
|
static bool remove(SdBaseFile* dirFile, const char* path);
|
||||||
bool remove();
|
bool remove();
|
||||||
/** Set the file's current position to zero. */
|
/** Set the file's current position to zero. */
|
||||||
void rewind() {seekSet(0);}
|
void rewind() {
|
||||||
|
seekSet(0);
|
||||||
|
}
|
||||||
bool rename(SdBaseFile* dirFile, const char* newPath);
|
bool rename(SdBaseFile* dirFile, const char* newPath);
|
||||||
bool rmdir();
|
bool rmdir();
|
||||||
// for backward compatibility
|
// for backward compatibility
|
||||||
bool rmDir() {return rmdir();}
|
bool rmDir() {
|
||||||
|
return rmdir();
|
||||||
|
}
|
||||||
bool rmRfStar();
|
bool rmRfStar();
|
||||||
/** Set the files position to current position + \a pos. See seekSet().
|
/** Set the files position to current position + \a pos. See seekSet().
|
||||||
* \param[in] offset The new position in bytes from the current position.
|
* \param[in] offset The new position in bytes from the current position.
|
||||||
|
|
@ -304,7 +330,9 @@ class SdBaseFile {
|
||||||
* \param[in] offset The new position in bytes from end-of-file.
|
* \param[in] offset The new position in bytes from end-of-file.
|
||||||
* \return true for success or false for failure.
|
* \return true for success or false for failure.
|
||||||
*/
|
*/
|
||||||
bool seekEnd(int32_t offset = 0) {return seekSet(fileSize_ + offset);}
|
bool seekEnd(int32_t offset = 0) {
|
||||||
|
return seekSet(fileSize_ + offset);
|
||||||
|
}
|
||||||
bool seekSet(uint32_t pos);
|
bool seekSet(uint32_t pos);
|
||||||
bool sync();
|
bool sync();
|
||||||
bool timestamp(SdBaseFile* file);
|
bool timestamp(SdBaseFile* file);
|
||||||
|
|
@ -315,10 +343,14 @@ class SdBaseFile {
|
||||||
*
|
*
|
||||||
* \return The file or directory type.
|
* \return The file or directory type.
|
||||||
*/
|
*/
|
||||||
uint8_t type() const {return type_;}
|
uint8_t type() const {
|
||||||
|
return type_;
|
||||||
|
}
|
||||||
bool truncate(uint32_t size);
|
bool truncate(uint32_t size);
|
||||||
/** \return SdVolume that contains this file. */
|
/** \return SdVolume that contains this file. */
|
||||||
SdVolume* volume() const {return vol_;}
|
SdVolume* volume() const {
|
||||||
|
return vol_;
|
||||||
|
}
|
||||||
int16_t write(const void* buf, uint16_t nbyte);
|
int16_t write(const void* buf, uint16_t nbyte);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
private:
|
private:
|
||||||
|
|
@ -401,7 +433,9 @@ class SdBaseFile {
|
||||||
* \param[out] dir Location for return of the file's directory entry.
|
* \param[out] dir Location for return of the file's directory entry.
|
||||||
* \return true for success or false for failure.
|
* \return true for success or false for failure.
|
||||||
*/
|
*/
|
||||||
bool dirEntry(dir_t& dir) {return dirEntry(&dir);} // NOLINT
|
bool dirEntry(dir_t& dir) {
|
||||||
|
return dirEntry(&dir); // NOLINT
|
||||||
|
}
|
||||||
/** \deprecated Use:
|
/** \deprecated Use:
|
||||||
* bool mkdir(SdBaseFile* dir, const char* path);
|
* bool mkdir(SdBaseFile* dir, const char* path);
|
||||||
* \param[in] dir An open SdFat instance for the directory that will contain
|
* \param[in] dir An open SdFat instance for the directory that will contain
|
||||||
|
|
@ -450,12 +484,16 @@ class SdBaseFile {
|
||||||
* \param[in] vol The FAT volume containing the root directory to be opened.
|
* \param[in] vol The FAT volume containing the root directory to be opened.
|
||||||
* \return true for success or false for failure.
|
* \return true for success or false for failure.
|
||||||
*/
|
*/
|
||||||
bool openRoot(SdVolume& vol) {return openRoot(&vol);} // NOLINT
|
bool openRoot(SdVolume& vol) {
|
||||||
|
return openRoot(&vol); // NOLINT
|
||||||
|
}
|
||||||
/** \deprecated Use: int8_t readDir(dir_t* dir);
|
/** \deprecated Use: int8_t readDir(dir_t* dir);
|
||||||
* \param[out] dir The dir_t struct that will receive the data.
|
* \param[out] dir The dir_t struct that will receive the data.
|
||||||
* \return bytes read for success zero for eof or -1 for failure.
|
* \return bytes read for success zero for eof or -1 for failure.
|
||||||
*/
|
*/
|
||||||
int8_t readDir(dir_t& dir, char* longFilename) {return readDir(&dir, longFilename);} // NOLINT
|
int8_t readDir(dir_t& dir, char* longFilename) {
|
||||||
|
return readDir(&dir, longFilename); // NOLINT
|
||||||
|
}
|
||||||
/** \deprecated Use:
|
/** \deprecated Use:
|
||||||
* static uint8_t remove(SdBaseFile* dirFile, const char* path);
|
* static uint8_t remove(SdBaseFile* dirFile, const char* path);
|
||||||
* \param[in] dirFile The directory that contains the file.
|
* \param[in] dirFile The directory that contains the file.
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
* \class SdFile
|
* \class SdFile
|
||||||
* \brief SdBaseFile with Print.
|
* \brief SdBaseFile with Print.
|
||||||
*/
|
*/
|
||||||
class SdFile : public SdBaseFile/*, public Print*/ {
|
class SdFile : public SdBaseFile { /*, public Print*/
|
||||||
public:
|
public:
|
||||||
SdFile() {}
|
SdFile() {}
|
||||||
SdFile(const char* name, uint8_t oflag);
|
SdFile(const char* name, uint8_t oflag);
|
||||||
|
|
|
||||||
|
|
@ -80,43 +80,69 @@ class SdVolume {
|
||||||
* failure include not finding a valid partition, not finding a valid
|
* failure include not finding a valid partition, not finding a valid
|
||||||
* FAT file system or an I/O error.
|
* FAT file system or an I/O error.
|
||||||
*/
|
*/
|
||||||
bool init(Sd2Card* dev) { return init(dev, 1) ? true : init(dev, 0);}
|
bool init(Sd2Card* dev) {
|
||||||
|
return init(dev, 1) ? true : init(dev, 0);
|
||||||
|
}
|
||||||
bool init(Sd2Card* dev, uint8_t part);
|
bool init(Sd2Card* dev, uint8_t part);
|
||||||
|
|
||||||
// inline functions that return volume info
|
// inline functions that return volume info
|
||||||
/** \return The volume's cluster size in blocks. */
|
/** \return The volume's cluster size in blocks. */
|
||||||
uint8_t blocksPerCluster() const {return blocksPerCluster_;}
|
uint8_t blocksPerCluster() const {
|
||||||
|
return blocksPerCluster_;
|
||||||
|
}
|
||||||
/** \return The number of blocks in one FAT. */
|
/** \return The number of blocks in one FAT. */
|
||||||
uint32_t blocksPerFat() const {return blocksPerFat_;}
|
uint32_t blocksPerFat() const {
|
||||||
|
return blocksPerFat_;
|
||||||
|
}
|
||||||
/** \return The total number of clusters in the volume. */
|
/** \return The total number of clusters in the volume. */
|
||||||
uint32_t clusterCount() const {return clusterCount_;}
|
uint32_t clusterCount() const {
|
||||||
|
return clusterCount_;
|
||||||
|
}
|
||||||
/** \return The shift count required to multiply by blocksPerCluster. */
|
/** \return The shift count required to multiply by blocksPerCluster. */
|
||||||
uint8_t clusterSizeShift() const {return clusterSizeShift_;}
|
uint8_t clusterSizeShift() const {
|
||||||
|
return clusterSizeShift_;
|
||||||
|
}
|
||||||
/** \return The logical block number for the start of file data. */
|
/** \return The logical block number for the start of file data. */
|
||||||
uint32_t dataStartBlock() const {return dataStartBlock_;}
|
uint32_t dataStartBlock() const {
|
||||||
|
return dataStartBlock_;
|
||||||
|
}
|
||||||
/** \return The number of FAT structures on the volume. */
|
/** \return The number of FAT structures on the volume. */
|
||||||
uint8_t fatCount() const {return fatCount_;}
|
uint8_t fatCount() const {
|
||||||
|
return fatCount_;
|
||||||
|
}
|
||||||
/** \return The logical block number for the start of the first FAT. */
|
/** \return The logical block number for the start of the first FAT. */
|
||||||
uint32_t fatStartBlock() const {return fatStartBlock_;}
|
uint32_t fatStartBlock() const {
|
||||||
|
return fatStartBlock_;
|
||||||
|
}
|
||||||
/** \return The FAT type of the volume. Values are 12, 16 or 32. */
|
/** \return The FAT type of the volume. Values are 12, 16 or 32. */
|
||||||
uint8_t fatType() const {return fatType_;}
|
uint8_t fatType() const {
|
||||||
|
return fatType_;
|
||||||
|
}
|
||||||
int32_t freeClusterCount();
|
int32_t freeClusterCount();
|
||||||
/** \return The number of entries in the root directory for FAT16 volumes. */
|
/** \return The number of entries in the root directory for FAT16 volumes. */
|
||||||
uint32_t rootDirEntryCount() const {return rootDirEntryCount_;}
|
uint32_t rootDirEntryCount() const {
|
||||||
|
return rootDirEntryCount_;
|
||||||
|
}
|
||||||
/** \return The logical block number for the start of the root directory
|
/** \return The logical block number for the start of the root directory
|
||||||
on FAT16 volumes or the first cluster number on FAT32 volumes. */
|
on FAT16 volumes or the first cluster number on FAT32 volumes. */
|
||||||
uint32_t rootDirStart() const {return rootDirStart_;}
|
uint32_t rootDirStart() const {
|
||||||
|
return rootDirStart_;
|
||||||
|
}
|
||||||
/** Sd2Card object for this volume
|
/** Sd2Card object for this volume
|
||||||
* \return pointer to Sd2Card object.
|
* \return pointer to Sd2Card object.
|
||||||
*/
|
*/
|
||||||
Sd2Card* sdCard() {return sdCard_;}
|
Sd2Card* sdCard() {
|
||||||
|
return sdCard_;
|
||||||
|
}
|
||||||
/** Debug access to FAT table
|
/** Debug access to FAT table
|
||||||
*
|
*
|
||||||
* \param[in] n cluster number.
|
* \param[in] n cluster number.
|
||||||
* \param[out] v value of entry
|
* \param[out] v value of entry
|
||||||
* \return true for success or false for failure
|
* \return true for success or false for failure
|
||||||
*/
|
*/
|
||||||
bool dbgFat(uint32_t n, uint32_t* v) {return fatGet(n, v);}
|
bool dbgFat(uint32_t n, uint32_t* v) {
|
||||||
|
return fatGet(n, v);
|
||||||
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
private:
|
private:
|
||||||
// Allow SdBaseFile access to SdVolume private data.
|
// Allow SdBaseFile access to SdVolume private data.
|
||||||
|
|
@ -154,13 +180,20 @@ class SdVolume {
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool allocContiguous(uint32_t count, uint32_t* curCluster);
|
bool allocContiguous(uint32_t count, uint32_t* curCluster);
|
||||||
uint8_t blockOfCluster(uint32_t position) const {
|
uint8_t blockOfCluster(uint32_t position) const {
|
||||||
return (position >> 9) & (blocksPerCluster_ - 1);}
|
return (position >> 9) & (blocksPerCluster_ - 1);
|
||||||
|
}
|
||||||
uint32_t clusterStartBlock(uint32_t cluster) const {
|
uint32_t clusterStartBlock(uint32_t cluster) const {
|
||||||
return dataStartBlock_ + ((cluster - 2) << clusterSizeShift_);}
|
return dataStartBlock_ + ((cluster - 2) << clusterSizeShift_);
|
||||||
|
}
|
||||||
uint32_t blockNumber(uint32_t cluster, uint32_t position) const {
|
uint32_t blockNumber(uint32_t cluster, uint32_t position) const {
|
||||||
return clusterStartBlock(cluster) + blockOfCluster(position);}
|
return clusterStartBlock(cluster) + blockOfCluster(position);
|
||||||
cache_t *cache() {return &cacheBuffer_;}
|
}
|
||||||
uint32_t cacheBlockNumber() {return cacheBlockNumber_;}
|
cache_t *cache() {
|
||||||
|
return &cacheBuffer_;
|
||||||
|
}
|
||||||
|
uint32_t cacheBlockNumber() {
|
||||||
|
return cacheBlockNumber_;
|
||||||
|
}
|
||||||
#if USE_MULTIPLE_CARDS
|
#if USE_MULTIPLE_CARDS
|
||||||
bool cacheFlush();
|
bool cacheFlush();
|
||||||
bool cacheRawBlock(uint32_t blockNumber, bool dirty);
|
bool cacheRawBlock(uint32_t blockNumber, bool dirty);
|
||||||
|
|
@ -173,7 +206,9 @@ class SdVolume {
|
||||||
cacheDirty_ = dirty;
|
cacheDirty_ = dirty;
|
||||||
cacheBlockNumber_ = blockNumber;
|
cacheBlockNumber_ = blockNumber;
|
||||||
}
|
}
|
||||||
void cacheSetDirty() {cacheDirty_ |= CACHE_FOR_WRITE;}
|
void cacheSetDirty() {
|
||||||
|
cacheDirty_ |= CACHE_FOR_WRITE;
|
||||||
|
}
|
||||||
bool chainSize(uint32_t beginCluster, uint32_t* size);
|
bool chainSize(uint32_t beginCluster, uint32_t* size);
|
||||||
bool fatGet(uint32_t cluster, uint32_t* value);
|
bool fatGet(uint32_t cluster, uint32_t* value);
|
||||||
bool fatPut(uint32_t cluster, uint32_t value);
|
bool fatPut(uint32_t cluster, uint32_t value);
|
||||||
|
|
@ -187,7 +222,8 @@ class SdVolume {
|
||||||
return cluster >= FAT32EOC_MIN;
|
return cluster >= FAT32EOC_MIN;
|
||||||
}
|
}
|
||||||
bool readBlock(uint32_t block, uint8_t* dst) {
|
bool readBlock(uint32_t block, uint8_t* dst) {
|
||||||
return sdCard_->readBlock(block, dst);}
|
return sdCard_->readBlock(block, dst);
|
||||||
|
}
|
||||||
bool writeBlock(uint32_t block, const uint8_t* dst) {
|
bool writeBlock(uint32_t block, const uint8_t* dst) {
|
||||||
return sdCard_->writeBlock(block, dst);
|
return sdCard_->writeBlock(block, dst);
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +235,9 @@ class SdVolume {
|
||||||
* \param[in] dev The SD card where the volume is located.
|
* \param[in] dev The SD card where the volume is located.
|
||||||
* \return true for success or false for failure.
|
* \return true for success or false for failure.
|
||||||
*/
|
*/
|
||||||
bool init(Sd2Card& dev) {return init(&dev);} // NOLINT
|
bool init(Sd2Card& dev) {
|
||||||
|
return init(&dev); // NOLINT
|
||||||
|
}
|
||||||
/** \deprecated Use: bool SdVolume::init(Sd2Card* dev, uint8_t vol);
|
/** \deprecated Use: bool SdVolume::init(Sd2Card* dev, uint8_t vol);
|
||||||
* \param[in] dev The SD card where the volume is located.
|
* \param[in] dev The SD card where the volume is located.
|
||||||
* \param[in] part The partition to be used.
|
* \param[in] part The partition to be used.
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,8 @@ uint8_t Servo::attach(int pin, int min, int max)
|
||||||
{
|
{
|
||||||
if(this->servoIndex < MAX_SERVOS ) {
|
if(this->servoIndex < MAX_SERVOS ) {
|
||||||
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
||||||
if (pin > 0) this->pin = pin; else pin = this->pin;
|
if (pin > 0) this->pin = pin;
|
||||||
|
else pin = this->pin;
|
||||||
#endif
|
#endif
|
||||||
pinMode( pin, OUTPUT) ; // set servo pin to output
|
pinMode( pin, OUTPUT) ; // set servo pin to output
|
||||||
servos[this->servoIndex].Pin.nbr = pin;
|
servos[this->servoIndex].Pin.nbr = pin;
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,17 @@ class Timer
|
||||||
public:
|
public:
|
||||||
Timer();
|
Timer();
|
||||||
void start();
|
void start();
|
||||||
void stop(){m_isRunning = false;}
|
void stop() {
|
||||||
bool running(){return m_isRunning;}
|
m_isRunning = false;
|
||||||
|
}
|
||||||
|
bool running() {
|
||||||
|
return m_isRunning;
|
||||||
|
}
|
||||||
bool expired(T msPeriod);
|
bool expired(T msPeriod);
|
||||||
protected:
|
protected:
|
||||||
T started(){return m_started;}
|
T started() {
|
||||||
|
return m_started;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
bool m_isRunning;
|
bool m_isRunning;
|
||||||
T m_started;
|
T m_started;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ void adc_reset(void)
|
||||||
{
|
{
|
||||||
adc_state = 0;
|
adc_state = 0;
|
||||||
adc_count = 0;
|
adc_count = 0;
|
||||||
uint8_t i; for (i = 0; i < ADC_CHAN_CNT; i++)
|
uint8_t i;
|
||||||
|
for (i = 0; i < ADC_CHAN_CNT; i++)
|
||||||
if ((adc_sim_mask & (1 << i)) == 0)
|
if ((adc_sim_mask & (1 << i)) == 0)
|
||||||
adc_values[i] = 0;
|
adc_values[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -276,12 +276,17 @@ uint16_t CardReader::getWorkDirDepth() {
|
||||||
void CardReader::getAbsFilename(char *t)
|
void CardReader::getAbsFilename(char *t)
|
||||||
{
|
{
|
||||||
uint8_t cnt=0;
|
uint8_t cnt=0;
|
||||||
*t='/';t++;cnt++;
|
*t='/';
|
||||||
|
t++;
|
||||||
|
cnt++;
|
||||||
for(uint8_t i=0; i<workDirDepth; i++)
|
for(uint8_t i=0; i<workDirDepth; i++)
|
||||||
{
|
{
|
||||||
workDirParents[i].getFilename(t); //SDBaseFile.getfilename!
|
workDirParents[i].getFilename(t); //SDBaseFile.getfilename!
|
||||||
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
||||||
{t++;cnt++;} //crawl counter forward.
|
{
|
||||||
|
t++; //crawl counter forward.
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(cnt<MAXPATHNAMELENGTH-13)
|
if(cnt<MAXPATHNAMELENGTH-13)
|
||||||
file.getFilename(t);
|
file.getFilename(t);
|
||||||
|
|
|
||||||
|
|
@ -52,22 +52,52 @@ public:
|
||||||
#endif //SDSORT_QUICKSORT
|
#endif //SDSORT_QUICKSORT
|
||||||
void getfilename_sorted(const uint16_t nr);
|
void getfilename_sorted(const uint16_t nr);
|
||||||
#if SDSORT_GCODE
|
#if SDSORT_GCODE
|
||||||
FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); }
|
FORCE_INLINE void setSortOn(bool b) {
|
||||||
FORCE_INLINE void setSortFolders(int i) { sort_folders = i; presort(); }
|
sort_alpha = b;
|
||||||
|
presort();
|
||||||
|
}
|
||||||
|
FORCE_INLINE void setSortFolders(int i) {
|
||||||
|
sort_folders = i;
|
||||||
|
presort();
|
||||||
|
}
|
||||||
//FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; }
|
//FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
|
FORCE_INLINE bool isFileOpen() {
|
||||||
FORCE_INLINE bool eof() { return sdpos>=filesize ;};
|
return file.isOpen();
|
||||||
FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
|
}
|
||||||
FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
|
FORCE_INLINE bool eof() {
|
||||||
FORCE_INLINE uint8_t percentDone(){if(!isFileOpen()) return 0; if(filesize) return sdpos/((filesize+99)/100); else return 0;};
|
return sdpos>=filesize ;
|
||||||
FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
|
};
|
||||||
FORCE_INLINE uint32_t get_sdpos() { if (!isFileOpen()) return 0; else return(sdpos); };
|
FORCE_INLINE int16_t get() {
|
||||||
|
sdpos = file.curPosition();
|
||||||
|
return (int16_t)file.read();
|
||||||
|
};
|
||||||
|
FORCE_INLINE void setIndex(long index) {
|
||||||
|
sdpos = index;
|
||||||
|
file.seekSet(index);
|
||||||
|
};
|
||||||
|
FORCE_INLINE uint8_t percentDone() {
|
||||||
|
if(!isFileOpen()) return 0;
|
||||||
|
if(filesize) return sdpos/((filesize+99)/100);
|
||||||
|
else return 0;
|
||||||
|
};
|
||||||
|
FORCE_INLINE char* getWorkDirName() {
|
||||||
|
workDir.getFilename(filename);
|
||||||
|
return filename;
|
||||||
|
};
|
||||||
|
FORCE_INLINE uint32_t get_sdpos() {
|
||||||
|
if (!isFileOpen()) return 0;
|
||||||
|
else return(sdpos);
|
||||||
|
};
|
||||||
|
|
||||||
bool ToshibaFlashAir_isEnabled() const { return card.getFlashAirCompatible(); }
|
bool ToshibaFlashAir_isEnabled() const {
|
||||||
void ToshibaFlashAir_enable(bool enable) { card.setFlashAirCompatible(enable); }
|
return card.getFlashAirCompatible();
|
||||||
|
}
|
||||||
|
void ToshibaFlashAir_enable(bool enable) {
|
||||||
|
card.setFlashAirCompatible(enable);
|
||||||
|
}
|
||||||
bool ToshibaFlashAir_GetIP(uint8_t *ip);
|
bool ToshibaFlashAir_GetIP(uint8_t *ip);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,24 @@ extern void get_command();
|
||||||
extern uint16_t cmdqueue_calc_sd_length();
|
extern uint16_t cmdqueue_calc_sd_length();
|
||||||
|
|
||||||
// Return True if a character was found
|
// Return True if a character was found
|
||||||
static inline bool code_seen(char code) { return (strchr_pointer = strchr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
|
static inline bool code_seen(char code) {
|
||||||
static inline bool code_seen(const char *code) { return (strchr_pointer = strstr(CMDBUFFER_CURRENT_STRING, code)) != NULL; }
|
return (strchr_pointer = strchr(CMDBUFFER_CURRENT_STRING, code)) != NULL;
|
||||||
static inline float code_value() { return strtod(strchr_pointer+1, NULL);}
|
}
|
||||||
static inline long code_value_long() { return strtol(strchr_pointer+1, NULL, 10); }
|
static inline bool code_seen(const char *code) {
|
||||||
static inline int16_t code_value_short() { return int16_t(strtol(strchr_pointer+1, NULL, 10)); };
|
return (strchr_pointer = strstr(CMDBUFFER_CURRENT_STRING, code)) != NULL;
|
||||||
static inline uint8_t code_value_uint8() { return uint8_t(strtol(strchr_pointer+1, NULL, 10)); };
|
}
|
||||||
|
static inline float code_value() {
|
||||||
|
return strtod(strchr_pointer+1, NULL);
|
||||||
|
}
|
||||||
|
static inline long code_value_long() {
|
||||||
|
return strtol(strchr_pointer+1, NULL, 10);
|
||||||
|
}
|
||||||
|
static inline int16_t code_value_short() {
|
||||||
|
return int16_t(strtol(strchr_pointer+1, NULL, 10));
|
||||||
|
};
|
||||||
|
static inline uint8_t code_value_uint8() {
|
||||||
|
return uint8_t(strtol(strchr_pointer+1, NULL, 10));
|
||||||
|
};
|
||||||
|
|
||||||
static inline float code_value_float()
|
static inline float code_value_float()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,618 +0,0 @@
|
||||||
#ifndef CONFIGURATION_PRUSA_H
|
|
||||||
#define CONFIGURATION_PRUSA_H
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
GENERAL SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Printer revision
|
|
||||||
#define PRINTER_TYPE PRINTER_MK3
|
|
||||||
#define FILAMENT_SIZE "1_75mm_MK3"
|
|
||||||
#define NOZZLE_TYPE "E3Dv6full"
|
|
||||||
|
|
||||||
// Developer flag
|
|
||||||
#define DEVELOPER
|
|
||||||
|
|
||||||
// Printer name
|
|
||||||
#define CUSTOM_MENDEL_NAME "Prusa i3 MK3"
|
|
||||||
|
|
||||||
// Electronics
|
|
||||||
#define MOTHERBOARD BOARD_EINSY_1_0a
|
|
||||||
#define STEEL_SHEET
|
|
||||||
#define HAS_SECOND_SERIAL_PORT
|
|
||||||
|
|
||||||
|
|
||||||
// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier)
|
|
||||||
//#define E3D_PT100_EXTRUDER_WITH_AMP
|
|
||||||
//#define E3D_PT100_EXTRUDER_NO_AMP
|
|
||||||
//#define E3D_PT100_BED_WITH_AMP
|
|
||||||
//#define E3D_PT100_BED_NO_AMP
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
AXIS SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Steps per unit {X,Y,Z,E}
|
|
||||||
//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140}
|
|
||||||
#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280}
|
|
||||||
//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,560}
|
|
||||||
|
|
||||||
// Endstop inverting
|
|
||||||
#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop.
|
|
||||||
#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop.
|
|
||||||
#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop.
|
|
||||||
|
|
||||||
// Direction inverting
|
|
||||||
#define INVERT_X_DIR 1 // for Mendel set to 0, for Orca set to 1
|
|
||||||
#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0
|
|
||||||
#define INVERT_Z_DIR 1 // for Mendel set to 0, for Orca set to 1
|
|
||||||
#define INVERT_E0_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0
|
|
||||||
#define INVERT_E1_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0
|
|
||||||
#define INVERT_E2_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0
|
|
||||||
|
|
||||||
// Home position
|
|
||||||
#define MANUAL_X_HOME_POS 0
|
|
||||||
#define MANUAL_Y_HOME_POS -2.2
|
|
||||||
#define MANUAL_Z_HOME_POS 0.2
|
|
||||||
|
|
||||||
// Travel limits after homing
|
|
||||||
#define X_MAX_POS 255
|
|
||||||
#define X_MIN_POS 0
|
|
||||||
#define Y_MAX_POS 212.5
|
|
||||||
#define Y_MIN_POS -4 //orig -4
|
|
||||||
#define Z_MAX_POS 210
|
|
||||||
#define Z_MIN_POS 0.15
|
|
||||||
|
|
||||||
// Canceled home position
|
|
||||||
#define X_CANCEL_POS 50
|
|
||||||
#define Y_CANCEL_POS 190
|
|
||||||
|
|
||||||
//Pause print position
|
|
||||||
#define X_PAUSE_POS 50
|
|
||||||
#define Y_PAUSE_POS 190
|
|
||||||
#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 {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000
|
|
||||||
|
|
||||||
//#define DEFAULT_Y_OFFSET 4.f // Default distance of Y_MIN_POS point from endstop, when the printer is not calibrated.
|
|
||||||
/**
|
|
||||||
* [0,0] steel sheet print area point X coordinate in bed print area coordinates
|
|
||||||
*/
|
|
||||||
#define SHEET_PRINT_ZERO_REF_X 0.f
|
|
||||||
/**
|
|
||||||
* [0,0] steel sheet print area point Y coordinate in bed print area coordinates
|
|
||||||
*/
|
|
||||||
#define SHEET_PRINT_ZERO_REF_Y -2.f
|
|
||||||
|
|
||||||
#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203)
|
|
||||||
#define DEFAULT_MAX_FEEDRATE_SILENT {100, 100, 12, 120} // (mm/sec) max feedrate (M203), silent mode
|
|
||||||
|
|
||||||
#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201)
|
|
||||||
#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode
|
|
||||||
|
|
||||||
|
|
||||||
#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)
|
|
||||||
|
|
||||||
//Silent mode limits
|
|
||||||
#define SILENT_MAX_ACCEL_XY 960ul // max acceleration in silent mode in mm/s^2
|
|
||||||
#define SILENT_MAX_FEEDRATE_XY 100 // max feedrate in mm/s
|
|
||||||
|
|
||||||
//Normal mode limits
|
|
||||||
#define NORMAL_MAX_ACCEL_XY 2500ul // max acceleration in normal mode in mm/s^2
|
|
||||||
#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s
|
|
||||||
|
|
||||||
//number of bytes from end of the file to start check
|
|
||||||
#define END_FILE_SECTION 20000
|
|
||||||
|
|
||||||
#define Z_AXIS_ALWAYS_ON 1
|
|
||||||
|
|
||||||
//Crash detection
|
|
||||||
#define CRASHDET_TIMER 45 //seconds
|
|
||||||
#define CRASHDET_COUNTER_MAX 3
|
|
||||||
|
|
||||||
// New XYZ calibration
|
|
||||||
#define NEW_XYZCAL
|
|
||||||
|
|
||||||
// Watchdog support
|
|
||||||
#define WATCHDOG
|
|
||||||
|
|
||||||
// Power panic
|
|
||||||
#define UVLO_SUPPORT
|
|
||||||
|
|
||||||
// Fan check
|
|
||||||
#define FANCHECK
|
|
||||||
|
|
||||||
// Safety timer
|
|
||||||
#define SAFETYTIMER
|
|
||||||
#define DEFAULT_SAFETYTIMER_TIME_MINS 30
|
|
||||||
|
|
||||||
// Filament sensor
|
|
||||||
#define PAT9125
|
|
||||||
#define FILAMENT_SENSOR
|
|
||||||
|
|
||||||
// Backlash -
|
|
||||||
//#define BACKLASH_X
|
|
||||||
//#define BACKLASH_Y
|
|
||||||
|
|
||||||
|
|
||||||
// Minimum ambient temperature limit to start triggering MINTEMP errors [C]
|
|
||||||
// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it,
|
|
||||||
// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle
|
|
||||||
// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater)
|
|
||||||
#define MINTEMP_MINAMBIENT 25
|
|
||||||
#define MINTEMP_MINAMBIENT_RAW 978
|
|
||||||
|
|
||||||
#define DEBUG_DCODE3
|
|
||||||
|
|
||||||
//#define DEBUG_BUILD
|
|
||||||
//#define DEBUG_SEC_LANG //secondary language debug output at startup
|
|
||||||
//#define DEBUG_W25X20CL //debug external spi flash
|
|
||||||
#ifdef DEBUG_BUILD
|
|
||||||
//#define _NO_ASM
|
|
||||||
#define DEBUG_DCODES //D codes
|
|
||||||
#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
|
|
||||||
//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output
|
|
||||||
//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored
|
|
||||||
//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored
|
|
||||||
//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored
|
|
||||||
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
|
|
||||||
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
|
|
||||||
//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored
|
|
||||||
#define DEBUG_DISABLE_STARTMSGS //no startup messages
|
|
||||||
//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored
|
|
||||||
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
|
|
||||||
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
|
|
||||||
//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed
|
|
||||||
//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages
|
|
||||||
//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest
|
|
||||||
//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3)
|
|
||||||
//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3)
|
|
||||||
//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled)
|
|
||||||
//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled)
|
|
||||||
#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line
|
|
||||||
#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message.
|
|
||||||
#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display.
|
|
||||||
#define CMD_DIAGNOSTICS //Show cmd queue length on printer display
|
|
||||||
#endif /* DEBUG_BUILD */
|
|
||||||
|
|
||||||
//#define FSENSOR_QUALITY
|
|
||||||
|
|
||||||
|
|
||||||
#define LINEARITY_CORRECTION
|
|
||||||
#define TMC2130_LINEARITY_CORRECTION
|
|
||||||
#define TMC2130_LINEARITY_CORRECTION_XYZ
|
|
||||||
//#define TMC2130_VARIABLE_RESOLUTION
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
TMC2130 default settings
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
#define TMC2130_FCLK 12000000 // fclk = 12MHz
|
|
||||||
|
|
||||||
#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes
|
|
||||||
#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis
|
|
||||||
#define TMC2130_USTEPS_E 32 // microstep resolution for E axis
|
|
||||||
#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes
|
|
||||||
#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis
|
|
||||||
#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis
|
|
||||||
|
|
||||||
#define TMC2130_PWM_GRAD_X 2 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AMPL_X 230 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AUTO_X 1 // PWMCONF
|
|
||||||
#define TMC2130_PWM_FREQ_X 2 // PWMCONF
|
|
||||||
|
|
||||||
#define TMC2130_PWM_GRAD_Y 2 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AMPL_Y 235 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AUTO_Y 1 // PWMCONF
|
|
||||||
#define TMC2130_PWM_FREQ_Y 2 // PWMCONF
|
|
||||||
|
|
||||||
#define TMC2130_PWM_GRAD_Z 4 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AMPL_Z 200 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AUTO_Z 1 // PWMCONF
|
|
||||||
#define TMC2130_PWM_FREQ_Z 2 // PWMCONF
|
|
||||||
|
|
||||||
#define TMC2130_PWM_GRAD_E 4 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AMPL_E 240 // PWMCONF
|
|
||||||
#define TMC2130_PWM_AUTO_E 1 // PWMCONF
|
|
||||||
#define TMC2130_PWM_FREQ_E 2 // PWMCONF
|
|
||||||
|
|
||||||
#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz
|
|
||||||
#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz
|
|
||||||
//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz
|
|
||||||
//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz
|
|
||||||
|
|
||||||
//#define TMC2130_STEALTH_E // Extruder stealthChop mode
|
|
||||||
//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2)
|
|
||||||
|
|
||||||
//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410)
|
|
||||||
#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410)
|
|
||||||
#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk)
|
|
||||||
|
|
||||||
#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode
|
|
||||||
#define TMC2130_THIGH 0 // THIGH - unused
|
|
||||||
|
|
||||||
//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold
|
|
||||||
//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold
|
|
||||||
#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold
|
|
||||||
#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold
|
|
||||||
#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold
|
|
||||||
#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold
|
|
||||||
|
|
||||||
#define TMC2130_SG_HOMING 1 // stallguard homing
|
|
||||||
#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis
|
|
||||||
#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis
|
|
||||||
#define TMC2130_SG_THRS_Z 4 // stallguard sensitivity for Z axis
|
|
||||||
#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis
|
|
||||||
|
|
||||||
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
|
|
||||||
#define TMC2130_CURRENTS_H {16, 20, 35, 30} // default holding currents for all axes
|
|
||||||
#define TMC2130_CURRENTS_R {16, 20, 35, 30} // default running currents for all axes
|
|
||||||
#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor
|
|
||||||
|
|
||||||
#define TMC2130_STEALTH_Z
|
|
||||||
|
|
||||||
//#define TMC2130_SERVICE_CODES_M910_M918
|
|
||||||
|
|
||||||
//#define TMC2130_DEBUG
|
|
||||||
//#define TMC2130_DEBUG_WR
|
|
||||||
//#define TMC2130_DEBUG_RD
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
EXTRUDER SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Mintemps
|
|
||||||
#define HEATER_0_MINTEMP 15
|
|
||||||
#define HEATER_1_MINTEMP 5
|
|
||||||
#define HEATER_2_MINTEMP 5
|
|
||||||
#define BED_MINTEMP 15
|
|
||||||
|
|
||||||
// Maxtemps
|
|
||||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
|
||||||
#define HEATER_0_MAXTEMP 410
|
|
||||||
#else
|
|
||||||
#define HEATER_0_MAXTEMP 305
|
|
||||||
#endif
|
|
||||||
#define HEATER_1_MAXTEMP 305
|
|
||||||
#define HEATER_2_MAXTEMP 305
|
|
||||||
#define BED_MAXTEMP 125
|
|
||||||
|
|
||||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP)
|
|
||||||
// Define PID constants for extruder with PT100
|
|
||||||
#define DEFAULT_Kp 21.70
|
|
||||||
#define DEFAULT_Ki 1.60
|
|
||||||
#define DEFAULT_Kd 73.76
|
|
||||||
#else
|
|
||||||
// Define PID constants for extruder
|
|
||||||
//#define DEFAULT_Kp 40.925
|
|
||||||
//#define DEFAULT_Ki 4.875
|
|
||||||
//#define DEFAULT_Kd 86.085
|
|
||||||
#define DEFAULT_Kp 16.13
|
|
||||||
#define DEFAULT_Ki 1.1625
|
|
||||||
#define DEFAULT_Kd 56.23
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Extrude mintemp
|
|
||||||
#define EXTRUDE_MINTEMP 175
|
|
||||||
|
|
||||||
// Extruder cooling fans
|
|
||||||
#define EXTRUDER_0_AUTO_FAN_PIN 8
|
|
||||||
#define EXTRUDER_1_AUTO_FAN_PIN -1
|
|
||||||
#define EXTRUDER_2_AUTO_FAN_PIN -1
|
|
||||||
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
|
|
||||||
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
LOAD/UNLOAD FILAMENT SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Load filament commands
|
|
||||||
#define LOAD_FILAMENT_0 "M83"
|
|
||||||
#define LOAD_FILAMENT_1 "G1 E70 F400"
|
|
||||||
#define LOAD_FILAMENT_2 "G1 E40 F100"
|
|
||||||
|
|
||||||
// Unload filament commands
|
|
||||||
#define UNLOAD_FILAMENT_0 "M83"
|
|
||||||
#define UNLOAD_FILAMENT_1 "G1 E-80 F7000"
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
CHANGE FILAMENT SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Filament change configuration
|
|
||||||
#define FILAMENTCHANGEENABLE
|
|
||||||
#ifdef FILAMENTCHANGEENABLE
|
|
||||||
#define FILAMENTCHANGE_XPOS 211
|
|
||||||
#define FILAMENTCHANGE_YPOS 0
|
|
||||||
#define FILAMENTCHANGE_ZADD 2
|
|
||||||
#define FILAMENTCHANGE_FIRSTRETRACT -2
|
|
||||||
#define FILAMENTCHANGE_FINALRETRACT -80
|
|
||||||
|
|
||||||
#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600)
|
|
||||||
#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701)
|
|
||||||
#define FILAMENTCHANGE_RECFEED 5
|
|
||||||
|
|
||||||
#define FILAMENTCHANGE_XYFEED 50
|
|
||||||
#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600)
|
|
||||||
#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701)
|
|
||||||
//#define FILAMENTCHANGE_RFEED 400
|
|
||||||
#define FILAMENTCHANGE_RFEED 7000 / 60
|
|
||||||
#define FILAMENTCHANGE_EXFEED 2
|
|
||||||
#define FILAMENTCHANGE_ZFEED 15
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
ADDITIONAL FEATURES SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Define Prusa filament runout sensor
|
|
||||||
//#define FILAMENT_RUNOUT_SUPPORT
|
|
||||||
|
|
||||||
#ifdef FILAMENT_RUNOUT_SUPPORT
|
|
||||||
#define FILAMENT_RUNOUT_SENSOR 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// temperature runaway
|
|
||||||
#define TEMP_RUNAWAY_BED_HYSTERESIS 5
|
|
||||||
#define TEMP_RUNAWAY_BED_TIMEOUT 360
|
|
||||||
|
|
||||||
#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15
|
|
||||||
#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
MOTOR CURRENT SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Motor Current settings for Einsy/tmc = 0..63
|
|
||||||
#define MOTOR_CURRENT_PWM_RANGE 63
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
BED SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
// Define Mesh Bed Leveling system to enable it
|
|
||||||
#define MESH_BED_LEVELING
|
|
||||||
#ifdef MESH_BED_LEVELING
|
|
||||||
|
|
||||||
#define MBL_Z_STEP 0.01
|
|
||||||
|
|
||||||
// Mesh definitions
|
|
||||||
#define MESH_MIN_X 35
|
|
||||||
#define MESH_MAX_X 238
|
|
||||||
#define MESH_MIN_Y 6
|
|
||||||
#define MESH_MAX_Y 202
|
|
||||||
|
|
||||||
// Mesh upsample definition
|
|
||||||
#define MESH_NUM_X_POINTS 7
|
|
||||||
#define MESH_NUM_Y_POINTS 7
|
|
||||||
// Mesh measure definition
|
|
||||||
#define MESH_MEAS_NUM_X_POINTS 3
|
|
||||||
#define MESH_MEAS_NUM_Y_POINTS 3
|
|
||||||
|
|
||||||
#define MESH_HOME_Z_CALIB 0.2
|
|
||||||
#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc.
|
|
||||||
|
|
||||||
#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right
|
|
||||||
#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind
|
|
||||||
#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Bed Temperature Control
|
|
||||||
// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis
|
|
||||||
//
|
|
||||||
// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
|
|
||||||
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
|
|
||||||
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
|
|
||||||
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
|
|
||||||
// If your configuration is significantly different than this and you don't understand the issues involved, you probably
|
|
||||||
// shouldn't use bed PID until someone else verifies your hardware works.
|
|
||||||
// If this is enabled, find your own PID constants below.
|
|
||||||
#define PIDTEMPBED
|
|
||||||
//
|
|
||||||
//#define BED_LIMIT_SWITCHING
|
|
||||||
|
|
||||||
// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option.
|
|
||||||
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
|
|
||||||
// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did,
|
|
||||||
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED)
|
|
||||||
#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current
|
|
||||||
|
|
||||||
// Bed temperature compensation settings
|
|
||||||
#define BED_OFFSET 10
|
|
||||||
#define BED_OFFSET_START 40
|
|
||||||
#define BED_OFFSET_CENTER 50
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PIDTEMPBED
|
|
||||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
|
||||||
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
|
|
||||||
#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP)
|
|
||||||
// Define PID constants for extruder with PT100
|
|
||||||
#define DEFAULT_bedKp 21.70
|
|
||||||
#define DEFAULT_bedKi 1.60
|
|
||||||
#define DEFAULT_bedKd 73.76
|
|
||||||
#else
|
|
||||||
#define DEFAULT_bedKp 126.13
|
|
||||||
#define DEFAULT_bedKi 4.30
|
|
||||||
#define DEFAULT_bedKd 924.76
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
|
|
||||||
//from pidautotune
|
|
||||||
// #define DEFAULT_bedKp 97.1
|
|
||||||
// #define DEFAULT_bedKi 1.41
|
|
||||||
// #define DEFAULT_bedKd 1675.16
|
|
||||||
|
|
||||||
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
|
|
||||||
#endif // PIDTEMPBED
|
|
||||||
|
|
||||||
//connect message when communication with monitoring broken
|
|
||||||
//#define FARM_CONNECT_MESSAGE
|
|
||||||
|
|
||||||
/*-----------------------------------
|
|
||||||
PREHEAT SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
#define FARM_PREHEAT_HOTEND_TEMP 250
|
|
||||||
#define FARM_PREHEAT_HPB_TEMP 60
|
|
||||||
#define FARM_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define PLA_PREHEAT_HOTEND_TEMP 215
|
|
||||||
#define PLA_PREHEAT_HPB_TEMP 60
|
|
||||||
#define PLA_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define ABS_PREHEAT_HOTEND_TEMP 255
|
|
||||||
#define ABS_PREHEAT_HPB_TEMP 100
|
|
||||||
#define ABS_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define HIPS_PREHEAT_HOTEND_TEMP 220
|
|
||||||
#define HIPS_PREHEAT_HPB_TEMP 100
|
|
||||||
#define HIPS_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define PP_PREHEAT_HOTEND_TEMP 254
|
|
||||||
#define PP_PREHEAT_HPB_TEMP 100
|
|
||||||
#define PP_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define PET_PREHEAT_HOTEND_TEMP 230
|
|
||||||
#define PET_PREHEAT_HPB_TEMP 85
|
|
||||||
#define PET_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
#define FLEX_PREHEAT_HOTEND_TEMP 240
|
|
||||||
#define FLEX_PREHEAT_HPB_TEMP 50
|
|
||||||
#define FLEX_PREHEAT_FAN_SPEED 0
|
|
||||||
|
|
||||||
/*------------------------------------
|
|
||||||
THERMISTORS SETTINGS
|
|
||||||
*------------------------------------*/
|
|
||||||
|
|
||||||
//
|
|
||||||
//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table
|
|
||||||
//
|
|
||||||
//// Temperature sensor settings:
|
|
||||||
// -2 is thermocouple with MAX6675 (only for sensor 0)
|
|
||||||
// -1 is thermocouple with AD595
|
|
||||||
// 0 is not used
|
|
||||||
// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup)
|
|
||||||
// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup)
|
|
||||||
// 3 is Mendel-parts thermistor (4.7k pullup)
|
|
||||||
// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !!
|
|
||||||
// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
|
|
||||||
// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup)
|
|
||||||
// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup)
|
|
||||||
// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup)
|
|
||||||
// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup)
|
|
||||||
// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup)
|
|
||||||
// 10 is 100k RS thermistor 198-961 (4.7k pullup)
|
|
||||||
// 11 is 100k beta 3950 1% thermistor (4.7k pullup)
|
|
||||||
// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed)
|
|
||||||
// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE"
|
|
||||||
// 20 is the PT100 circuit found in the Ultimainboard V2.x
|
|
||||||
// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950
|
|
||||||
//
|
|
||||||
// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k
|
|
||||||
// (but gives greater accuracy and more stable PID)
|
|
||||||
// 51 is 100k thermistor - EPCOS (1k pullup)
|
|
||||||
// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup)
|
|
||||||
// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup)
|
|
||||||
//
|
|
||||||
// 1047 is Pt1000 with 4k7 pullup
|
|
||||||
// 1010 is Pt1000 with 1k pullup (non standard)
|
|
||||||
// 147 is Pt100 with 4k7 pullup
|
|
||||||
// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a
|
|
||||||
// 247 is Pt100 with 4k7 pullup and PT100 Amplifier
|
|
||||||
// 110 is Pt100 with 1k pullup (non standard)
|
|
||||||
|
|
||||||
#if defined(E3D_PT100_EXTRUDER_WITH_AMP)
|
|
||||||
#define TEMP_SENSOR_0 247
|
|
||||||
#elif defined(E3D_PT100_EXTRUDER_NO_AMP)
|
|
||||||
#define TEMP_SENSOR_0 148
|
|
||||||
#else
|
|
||||||
#define TEMP_SENSOR_0 5
|
|
||||||
#endif
|
|
||||||
#define TEMP_SENSOR_1 0
|
|
||||||
#define TEMP_SENSOR_2 0
|
|
||||||
#if defined(E3D_PT100_BED_WITH_AMP)
|
|
||||||
#define TEMP_SENSOR_BED 247
|
|
||||||
#elif defined(E3D_PT100_BED_NO_AMP)
|
|
||||||
#define TEMP_SENSOR_BED 148
|
|
||||||
#else
|
|
||||||
#define TEMP_SENSOR_BED 1
|
|
||||||
#endif
|
|
||||||
#define TEMP_SENSOR_PINDA 1
|
|
||||||
#define TEMP_SENSOR_AMBIENT 2000
|
|
||||||
|
|
||||||
#define STACK_GUARD_TEST_VALUE 0xA2A2
|
|
||||||
|
|
||||||
#define MAX_BED_TEMP_CALIBRATION 50
|
|
||||||
#define MAX_HOTEND_TEMP_CALIBRATION 50
|
|
||||||
|
|
||||||
#define MAX_E_STEPS_PER_UNIT 250
|
|
||||||
#define MIN_E_STEPS_PER_UNIT 100
|
|
||||||
|
|
||||||
#define Z_BABYSTEP_MIN -3999
|
|
||||||
#define Z_BABYSTEP_MAX 0
|
|
||||||
|
|
||||||
#define PINDA_PREHEAT_X 20
|
|
||||||
#define PINDA_PREHEAT_Y 60
|
|
||||||
#define PINDA_PREHEAT_Z 0.15
|
|
||||||
/*
|
|
||||||
#define PINDA_PREHEAT_X 70
|
|
||||||
#define PINDA_PREHEAT_Y -3
|
|
||||||
#define PINDA_PREHEAT_Z 1*/
|
|
||||||
#define PINDA_HEAT_T 120 //time in s
|
|
||||||
|
|
||||||
#define PINDA_MIN_T 50
|
|
||||||
#define PINDA_STEP_T 10
|
|
||||||
#define PINDA_MAX_T 100
|
|
||||||
|
|
||||||
#define PING_TIME 60 //time in s
|
|
||||||
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes
|
|
||||||
#define PING_ALLERT_PERIOD 60 //time in s
|
|
||||||
|
|
||||||
#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring
|
|
||||||
#define NC_BUTTON_LONG_PRESS 15 //time in s
|
|
||||||
|
|
||||||
#define LONG_PRESS_TIME 1000 //time in ms for button long press
|
|
||||||
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
|
|
||||||
|
|
||||||
#define DEFAULT_PID_TEMP 210
|
|
||||||
|
|
||||||
#define MIN_PRINT_FAN_SPEED 75
|
|
||||||
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
// For example, the Prusa i3 MK2 with 16 microsteps per full step has Z stepping of 400 microsteps per mm.
|
|
||||||
// At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm.
|
|
||||||
// The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm.
|
|
||||||
//#define UVLO_Z_AXIS_SHIFT 1.92
|
|
||||||
#define UVLO_Z_AXIS_SHIFT 0.64
|
|
||||||
// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically.
|
|
||||||
#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5
|
|
||||||
|
|
||||||
#define HEATBED_V2
|
|
||||||
|
|
||||||
#define M600_TIMEOUT 600 //seconds
|
|
||||||
|
|
||||||
//#define SUPPORT_VERBOSITY
|
|
||||||
|
|
||||||
#define MMU_REQUIRED_FW_BUILDNR 83
|
|
||||||
#define MMU_HWRESET
|
|
||||||
//#define MMU_DEBUG //print communication between MMU2 and printer on serial
|
|
||||||
|
|
||||||
#endif //__CONFIGURATION_PRUSA_H
|
|
||||||
|
|
@ -177,7 +177,7 @@ bool fsensor_enable(void)
|
||||||
fsensor_not_responding = false;
|
fsensor_not_responding = false;
|
||||||
else
|
else
|
||||||
fsensor_not_responding = true;
|
fsensor_not_responding = true;
|
||||||
fsensor_enabled = true;
|
fsensor_enabled = pat9125 ? true : false;
|
||||||
fsensor_autoload_set(true);
|
fsensor_autoload_set(true);
|
||||||
fsensor_autoload_enabled = false;
|
fsensor_autoload_enabled = false;
|
||||||
fsensor_oq_meassure = false;
|
fsensor_oq_meassure = false;
|
||||||
|
|
@ -291,12 +291,13 @@ bool fsensor_check_autoload(void)
|
||||||
if (fsensor_autoload_c != fsensor_autoload_c_old)
|
if (fsensor_autoload_c != fsensor_autoload_c_old)
|
||||||
printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum);
|
printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum);
|
||||||
#endif
|
#endif
|
||||||
// if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30))
|
|
||||||
if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20))
|
if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20))
|
||||||
{
|
{
|
||||||
if (mmu_enabled) mmu_command(MMU_CMD_FS);
|
if (mmu_enabled) {
|
||||||
|
mmu_command(MMU_CMD_FS);
|
||||||
fsensor_autoload_check_stop();
|
fsensor_autoload_check_stop();
|
||||||
fsensor_autoload_enabled = false;
|
fsensor_autoload_enabled = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -468,8 +469,12 @@ void fsensor_st_block_begin(block_t* bl)
|
||||||
((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8)))
|
((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8)))
|
||||||
{
|
{
|
||||||
// !!! bit toggling (PINxn <- 1) (for PinChangeInterrupt) does not work for some MCU pins
|
// !!! bit toggling (PINxn <- 1) (for PinChangeInterrupt) does not work for some MCU pins
|
||||||
if (PIN_GET(FSENSOR_INT_PIN)) {PIN_VAL(FSENSOR_INT_PIN, LOW);}
|
if (PIN_GET(FSENSOR_INT_PIN)) {
|
||||||
else {PIN_VAL(FSENSOR_INT_PIN, HIGH);}
|
PIN_VAL(FSENSOR_INT_PIN, LOW);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PIN_VAL(FSENSOR_INT_PIN, HIGH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,8 +485,12 @@ void fsensor_st_block_chunk(block_t* bl, int cnt)
|
||||||
if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len))
|
if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len))
|
||||||
{
|
{
|
||||||
// !!! bit toggling (PINxn <- 1) (for PinChangeInterrupt) does not work for some MCU pins
|
// !!! bit toggling (PINxn <- 1) (for PinChangeInterrupt) does not work for some MCU pins
|
||||||
if (PIN_GET(FSENSOR_INT_PIN)) {PIN_VAL(FSENSOR_INT_PIN, LOW);}
|
if (PIN_GET(FSENSOR_INT_PIN)) {
|
||||||
else {PIN_VAL(FSENSOR_INT_PIN, HIGH);}
|
PIN_VAL(FSENSOR_INT_PIN, LOW);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
PIN_VAL(FSENSOR_INT_PIN, HIGH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,22 @@ uint8_t lang_selected = 0;
|
||||||
|
|
||||||
#if (LANG_MODE == 0) //primary language only
|
#if (LANG_MODE == 0) //primary language only
|
||||||
|
|
||||||
uint8_t lang_select(uint8_t lang) { return 0; }
|
uint8_t lang_select(uint8_t lang) {
|
||||||
uint8_t lang_get_count() { return 1; }
|
return 0;
|
||||||
uint16_t lang_get_code(uint8_t lang) { return LANG_CODE_EN; }
|
}
|
||||||
const char* lang_get_name_by_code(uint16_t code) { return _n("English"); }
|
uint8_t lang_get_count() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
uint16_t lang_get_code(uint8_t lang) {
|
||||||
|
return LANG_CODE_EN;
|
||||||
|
}
|
||||||
|
const char* lang_get_name_by_code(uint16_t code) {
|
||||||
|
return _n("English");
|
||||||
|
}
|
||||||
void lang_reset(void) { }
|
void lang_reset(void) { }
|
||||||
uint8_t lang_is_selected(void) { return 1; }
|
uint8_t lang_is_selected(void) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#else //(LANG_MODE == 0) //secondary languages in progmem or xflash
|
#else //(LANG_MODE == 0) //secondary languages in progmem or xflash
|
||||||
|
|
||||||
|
|
@ -96,7 +106,8 @@ uint8_t lang_check(uint16_t addr)
|
||||||
uint16_t sum = 0;
|
uint16_t sum = 0;
|
||||||
uint16_t size = pgm_read_word((uint16_t*)(addr + 4));
|
uint16_t size = pgm_read_word((uint16_t*)(addr + 4));
|
||||||
uint16_t lt_sum = pgm_read_word((uint16_t*)(addr + 8));
|
uint16_t lt_sum = pgm_read_word((uint16_t*)(addr + 8));
|
||||||
uint16_t i; for (i = 0; i < size; i++)
|
uint16_t i;
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
sum += (uint16_t)pgm_read_byte((uint8_t*)(addr + i)) << ((i & 1)?0:8);
|
sum += (uint16_t)pgm_read_byte((uint8_t*)(addr + i)) << ((i & 1)?0:8);
|
||||||
sum -= lt_sum; //subtract checksum
|
sum -= lt_sum; //subtract checksum
|
||||||
sum = (sum >> 8) | ((sum & 0xff) << 8); //swap bytes
|
sum = (sum >> 8) | ((sum & 0xff) << 8); //swap bytes
|
||||||
|
|
@ -203,13 +214,20 @@ const char* lang_get_name_by_code(uint16_t code)
|
||||||
{
|
{
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case LANG_CODE_EN: return _n("English");
|
case LANG_CODE_EN:
|
||||||
case LANG_CODE_CZ: return _n("Cestina");
|
return _n("English");
|
||||||
case LANG_CODE_DE: return _n("Deutsch");
|
case LANG_CODE_CZ:
|
||||||
case LANG_CODE_ES: return _n("Espanol");
|
return _n("Cestina");
|
||||||
case LANG_CODE_FR: return _n("Francais");
|
case LANG_CODE_DE:
|
||||||
case LANG_CODE_IT: return _n("Italiano");
|
return _n("Deutsch");
|
||||||
case LANG_CODE_PL: return _n("Polski");
|
case LANG_CODE_ES:
|
||||||
|
return _n("Espanol");
|
||||||
|
case LANG_CODE_FR:
|
||||||
|
return _n("Francais");
|
||||||
|
case LANG_CODE_IT:
|
||||||
|
return _n("Italiano");
|
||||||
|
case LANG_CODE_PL:
|
||||||
|
return _n("Polski");
|
||||||
}
|
}
|
||||||
return _n("??");
|
return _n("??");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -419,8 +419,10 @@ uint8_t lcd_escape_write(uint8_t chr)
|
||||||
case 2:
|
case 2:
|
||||||
switch (chr)
|
switch (chr)
|
||||||
{
|
{
|
||||||
case '2': return 1; // escape = "\x1b[2"
|
case '2':
|
||||||
case '?': return 1; // escape = "\x1b[?"
|
return 1; // escape = "\x1b[2"
|
||||||
|
case '?':
|
||||||
|
return 1; // escape = "\x1b[?"
|
||||||
default:
|
default:
|
||||||
if (chr_is_num) return 1; // escape = "\x1b[%1d"
|
if (chr_is_num) return 1; // escape = "\x1b[%1d"
|
||||||
}
|
}
|
||||||
|
|
@ -433,7 +435,11 @@ uint8_t lcd_escape_write(uint8_t chr)
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
if (chr == 'J') // escape = "\x1b[2J"
|
if (chr == 'J') // escape = "\x1b[2J"
|
||||||
{ lcd_clear(); lcd_currline = 0; break; } // EraseScreen
|
{
|
||||||
|
lcd_clear(); // EraseScreen
|
||||||
|
lcd_currline = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if (e_2_is_num && // escape = "\x1b[%1d"
|
if (e_2_is_num && // escape = "\x1b[%1d"
|
||||||
((chr == ';') || // escape = "\x1b[%1d;"
|
((chr == ';') || // escape = "\x1b[%1d;"
|
||||||
|
|
@ -861,7 +867,8 @@ const uint8_t lcd_chardata_bedTemp[8] PROGMEM = {
|
||||||
B10101,
|
B10101,
|
||||||
B11111,
|
B11111,
|
||||||
B00000,
|
B00000,
|
||||||
B00000}; //thanks Sonny Mounicou
|
B00000
|
||||||
|
}; //thanks Sonny Mounicou
|
||||||
|
|
||||||
const uint8_t lcd_chardata_degree[8] PROGMEM = {
|
const uint8_t lcd_chardata_degree[8] PROGMEM = {
|
||||||
B01100,
|
B01100,
|
||||||
|
|
@ -871,7 +878,8 @@ const uint8_t lcd_chardata_degree[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000};
|
B00000
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t lcd_chardata_thermometer[8] PROGMEM = {
|
const uint8_t lcd_chardata_thermometer[8] PROGMEM = {
|
||||||
B00100,
|
B00100,
|
||||||
|
|
@ -881,7 +889,8 @@ const uint8_t lcd_chardata_thermometer[8] PROGMEM = {
|
||||||
B01010,
|
B01010,
|
||||||
B10001,
|
B10001,
|
||||||
B10001,
|
B10001,
|
||||||
B01110};
|
B01110
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t lcd_chardata_uplevel[8] PROGMEM = {
|
const uint8_t lcd_chardata_uplevel[8] PROGMEM = {
|
||||||
B00100,
|
B00100,
|
||||||
|
|
@ -891,7 +900,8 @@ const uint8_t lcd_chardata_uplevel[8] PROGMEM = {
|
||||||
B11100,
|
B11100,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000}; //thanks joris
|
B00000
|
||||||
|
}; //thanks joris
|
||||||
|
|
||||||
const uint8_t lcd_chardata_refresh[8] PROGMEM = {
|
const uint8_t lcd_chardata_refresh[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
|
|
@ -901,7 +911,8 @@ const uint8_t lcd_chardata_refresh[8] PROGMEM = {
|
||||||
B00011,
|
B00011,
|
||||||
B10011,
|
B10011,
|
||||||
B01100,
|
B01100,
|
||||||
B00000}; //thanks joris
|
B00000
|
||||||
|
}; //thanks joris
|
||||||
|
|
||||||
const uint8_t lcd_chardata_folder[8] PROGMEM = {
|
const uint8_t lcd_chardata_folder[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
|
|
@ -911,7 +922,8 @@ const uint8_t lcd_chardata_folder[8] PROGMEM = {
|
||||||
B10001,
|
B10001,
|
||||||
B11111,
|
B11111,
|
||||||
B00000,
|
B00000,
|
||||||
B00000}; //thanks joris
|
B00000
|
||||||
|
}; //thanks joris
|
||||||
|
|
||||||
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
|
/*const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
|
||||||
B11100,
|
B11100,
|
||||||
|
|
@ -951,7 +963,8 @@ const uint8_t lcd_chardata_feedrate[8] PROGMEM = {
|
||||||
B10010,
|
B10010,
|
||||||
B00100,
|
B00100,
|
||||||
B00000,
|
B00000,
|
||||||
B00000};
|
B00000
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t lcd_chardata_clock[8] PROGMEM = {
|
const uint8_t lcd_chardata_clock[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
|
|
@ -961,7 +974,8 @@ const uint8_t lcd_chardata_clock[8] PROGMEM = {
|
||||||
B10001,
|
B10001,
|
||||||
B01110,
|
B01110,
|
||||||
B00000,
|
B00000,
|
||||||
B00000}; //thanks Sonny Mounicou
|
B00000
|
||||||
|
}; //thanks Sonny Mounicou
|
||||||
|
|
||||||
const uint8_t lcd_chardata_arrup[8] PROGMEM = {
|
const uint8_t lcd_chardata_arrup[8] PROGMEM = {
|
||||||
B00100,
|
B00100,
|
||||||
|
|
@ -971,7 +985,8 @@ const uint8_t lcd_chardata_arrup[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000,
|
B00000,
|
||||||
B00000};
|
B00000
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t lcd_chardata_arrdown[8] PROGMEM = {
|
const uint8_t lcd_chardata_arrdown[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
|
|
@ -981,7 +996,8 @@ const uint8_t lcd_chardata_arrdown[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
B10001,
|
B10001,
|
||||||
B01010,
|
B01010,
|
||||||
B00100};
|
B00100
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1012,7 +1028,8 @@ const uint8_t lcd_chardata_progress[8] PROGMEM = {
|
||||||
B11111,
|
B11111,
|
||||||
B11111,
|
B11111,
|
||||||
B11111,
|
B11111,
|
||||||
B11111};
|
B11111
|
||||||
|
};
|
||||||
|
|
||||||
void lcd_set_custom_characters_progress(void)
|
void lcd_set_custom_characters_progress(void)
|
||||||
{
|
{
|
||||||
|
|
@ -1027,7 +1044,8 @@ const uint8_t lcd_chardata_arr2down[8] PROGMEM = {
|
||||||
B00100,
|
B00100,
|
||||||
B10001,
|
B10001,
|
||||||
B01010,
|
B01010,
|
||||||
B00100};
|
B00100
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t lcd_chardata_confirm[8] PROGMEM = {
|
const uint8_t lcd_chardata_confirm[8] PROGMEM = {
|
||||||
B00000,
|
B00000,
|
||||||
|
|
@ -1036,7 +1054,8 @@ const uint8_t lcd_chardata_confirm[8] PROGMEM = {
|
||||||
B10110,
|
B10110,
|
||||||
B11100,
|
B11100,
|
||||||
B01000,
|
B01000,
|
||||||
B00000};
|
B00000
|
||||||
|
};
|
||||||
|
|
||||||
void lcd_set_custom_characters_nextpage(void)
|
void lcd_set_custom_characters_nextpage(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,9 @@ const float bed_ref_points[] PROGMEM = {
|
||||||
|
|
||||||
#endif //not HEATBED_V2
|
#endif //not HEATBED_V2
|
||||||
|
|
||||||
static inline float sqr(float x) { return x * x; }
|
static inline float sqr(float x) {
|
||||||
|
return x * x;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HEATBED_V2
|
#ifdef HEATBED_V2
|
||||||
static inline bool point_on_1st_row(const uint8_t /*i*/)
|
static inline bool point_on_1st_row(const uint8_t /*i*/)
|
||||||
|
|
@ -1158,7 +1160,8 @@ inline bool find_bed_induction_sensor_point_xy(int
|
||||||
goto endloop;
|
goto endloop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endloop:;
|
endloop:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
#ifdef SUPPORT_VERBOSITY
|
#ifdef SUPPORT_VERBOSITY
|
||||||
if (verbosity_level >= 20) {
|
if (verbosity_level >= 20) {
|
||||||
|
|
@ -2565,9 +2568,14 @@ BedSkewOffsetDetectionResultType improve_bed_offset_and_skew(int8_t method, int8
|
||||||
found = improve_bed_induction_sensor_point3(verbosity_level);
|
found = improve_bed_induction_sensor_point3(verbosity_level);
|
||||||
} else {
|
} else {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case 0: found = improve_bed_induction_sensor_point(); break;
|
case 0:
|
||||||
case 1: found = improve_bed_induction_sensor_point2(mesh_point < 2, verbosity_level); break;
|
found = improve_bed_induction_sensor_point();
|
||||||
default: break;
|
break;
|
||||||
|
case 1:
|
||||||
|
found = improve_bed_induction_sensor_point2(mesh_point < 2, verbosity_level);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
|
|
||||||
mesh_bed_leveling mbl;
|
mesh_bed_leveling mbl;
|
||||||
|
|
||||||
mesh_bed_leveling::mesh_bed_leveling() { reset(); }
|
mesh_bed_leveling::mesh_bed_leveling() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
void mesh_bed_leveling::reset() {
|
void mesh_bed_leveling::reset() {
|
||||||
active = 0;
|
active = 0;
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,21 @@ public:
|
||||||
void upsample_3x3();
|
void upsample_3x3();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static float get_x(int i) { return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i); }
|
static float get_x(int i) {
|
||||||
static float get_y(int i) { return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i); }
|
return float(MESH_MIN_X) + float(MESH_X_DIST) * float(i);
|
||||||
|
}
|
||||||
|
static float get_y(int i) {
|
||||||
|
return float(MESH_MIN_Y) + float(MESH_Y_DIST) * float(i);
|
||||||
|
}
|
||||||
|
|
||||||
// Measurement point for the Z probe.
|
// Measurement point for the Z probe.
|
||||||
// If use_default=true, then the default positions for a correctly built printer are used.
|
// If use_default=true, then the default positions for a correctly built printer are used.
|
||||||
// Otherwise a correction matrix is pulled from the EEPROM if available.
|
// Otherwise a correction matrix is pulled from the EEPROM if available.
|
||||||
static void get_meas_xy(int ix, int iy, float &x, float &y, bool use_default);
|
static void get_meas_xy(int ix, int iy, float &x, float &y, bool use_default);
|
||||||
|
|
||||||
void set_z(int ix, int iy, float z) { z_values[iy][ix] = z; }
|
void set_z(int ix, int iy, float z) {
|
||||||
|
z_values[iy][ix] = z;
|
||||||
|
}
|
||||||
|
|
||||||
int select_x_index(float x) {
|
int select_x_index(float x) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#define MMU_TODELAY 100
|
#define MMU_TODELAY 100
|
||||||
#define MMU_TIMEOUT 10
|
#define MMU_TIMEOUT 10
|
||||||
#define MMU_CMD_TIMEOUT 300000ul //5min timeout for mmu commands (except P0)
|
#define MMU_CMD_TIMEOUT 60000ul //300000ul //1min timeout for mmu commands (except P0)
|
||||||
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
#define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds
|
||||||
|
|
||||||
#ifdef MMU_HWRESET
|
#ifdef MMU_HWRESET
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
bool mmu_enabled = false;
|
bool mmu_enabled = false;
|
||||||
|
|
||||||
bool mmu_ready = false;
|
bool mmu_ready = false;
|
||||||
|
bool isMMUPrintPaused = false;
|
||||||
|
|
||||||
bool mmuFSensorLoading = false;
|
bool mmuFSensorLoading = false;
|
||||||
int lastLoadedFilament = -10;
|
int lastLoadedFilament = -10;
|
||||||
|
|
@ -160,14 +161,6 @@ int8_t mmu_rx_ok(void)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check 'nk' response
|
|
||||||
int8_t mmu_rx_not_ok(void)
|
|
||||||
{
|
|
||||||
int8_t res = uart2_rx_str_P(PSTR("nk\n"));
|
|
||||||
if (res == 1) mmu_last_response = millis();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
//check 'MK3 FSensor requested to look for load' response
|
//check 'MK3 FSensor requested to look for load' response
|
||||||
int8_t mmu_rx_fsensorLook(void)
|
int8_t mmu_rx_fsensorLook(void)
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +203,6 @@ void mmu_init(void)
|
||||||
* 2 >> 1 MMURX ok, Finda State
|
* 2 >> 1 MMURX ok, Finda State
|
||||||
* 3 >> 1 MMURX ok, mmu commands response
|
* 3 >> 1 MMURX ok, mmu commands response
|
||||||
* 10 >> 3 MMUECHO, confirm receipt of cmd (timeout 500ms to resend)
|
* 10 >> 3 MMUECHO, confirm receipt of cmd (timeout 500ms to resend)
|
||||||
* 20 >> 1 not_ok
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void mmu_loop(void)
|
void mmu_loop(void)
|
||||||
|
|
@ -219,6 +211,8 @@ void mmu_loop(void)
|
||||||
#ifdef MMU_DEBUG
|
#ifdef MMU_DEBUG
|
||||||
if (last_state != mmu_state) printf_P(PSTR("MMU loop, state=%d\n"), mmu_state);
|
if (last_state != mmu_state) printf_P(PSTR("MMU loop, state=%d\n"), mmu_state);
|
||||||
#endif //MMU_DEBUG
|
#endif //MMU_DEBUG
|
||||||
|
//if (mmu_print_saved && !isMMUPrintPaused) { printf_P(PSTR("// action:pause\n")); isMMUPrintPaused = true; }
|
||||||
|
//if (!mmu_print_saved && isMMUPrintPaused) { printf_P(PSTR("// action:resume\n")); isMMUPrintPaused = false; }
|
||||||
last_state = mmu_state;
|
last_state = mmu_state;
|
||||||
switch (mmu_state)
|
switch (mmu_state)
|
||||||
{
|
{
|
||||||
|
|
@ -421,7 +415,6 @@ void mmu_loop(void)
|
||||||
{
|
{
|
||||||
printf_P(PSTR("MMU <= 'Filament seen at extruder'\n"));
|
printf_P(PSTR("MMU <= 'Filament seen at extruder'\n"));
|
||||||
mmu_puts_P(PSTR("EE\n"));
|
mmu_puts_P(PSTR("EE\n"));
|
||||||
//mmuFSensorLoading = false;
|
|
||||||
mmu_state = 3; // wait for response
|
mmu_state = 3; // wait for response
|
||||||
}
|
}
|
||||||
mmu_cmd = 0;
|
mmu_cmd = 0;
|
||||||
|
|
@ -430,13 +423,14 @@ void mmu_loop(void)
|
||||||
{
|
{
|
||||||
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
|
mmu_puts_P(PSTR("P0\n")); //send 'read finda' request
|
||||||
mmu_state = 2;
|
mmu_state = 2;
|
||||||
|
} else if (((mmu_last_response + 500) < millis()) && mmuFSensorLoading) {
|
||||||
|
if (!fsensor_enabled) fsensor_enable();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 2: //response to command P0
|
case 2: //response to command P0
|
||||||
if (mmu_rx_ok() > 0)
|
if (mmu_rx_ok() > 0)
|
||||||
{
|
{
|
||||||
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer
|
||||||
//printf_P(PSTR("MMU => '%dok'\n"), mmu_finda);
|
|
||||||
if (!mmu_finda && CHECK_FINDA && fsensor_enabled) {
|
if (!mmu_finda && CHECK_FINDA && fsensor_enabled) {
|
||||||
fsensor_stop_and_save_print();
|
fsensor_stop_and_save_print();
|
||||||
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
|
enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover
|
||||||
|
|
@ -444,8 +438,6 @@ void mmu_loop(void)
|
||||||
else enquecommand_front_P(PSTR("M600")); //save print and run M600 command
|
else enquecommand_front_P(PSTR("M600")); //save print and run M600 command
|
||||||
}
|
}
|
||||||
mmu_state = 1;
|
mmu_state = 1;
|
||||||
//if (mmu_cmd == 0)
|
|
||||||
//mmu_ready = true;
|
|
||||||
}
|
}
|
||||||
else if ((mmu_last_request + MMU_P0_TIMEOUT) < millis())
|
else if ((mmu_last_request + MMU_P0_TIMEOUT) < millis())
|
||||||
{ //resend request after timeout (30s)
|
{ //resend request after timeout (30s)
|
||||||
|
|
@ -470,39 +462,19 @@ void mmu_loop(void)
|
||||||
printf_P(PSTR("MMU => 'ok'\n"));
|
printf_P(PSTR("MMU => 'ok'\n"));
|
||||||
mmu_ready = true;
|
mmu_ready = true;
|
||||||
mmu_state = 1;
|
mmu_state = 1;
|
||||||
} else if(mmu_rx_not_ok() > 0)
|
|
||||||
{
|
|
||||||
printf_P(PSTR("MMU => 'fixTheProblem!!'\n"));
|
|
||||||
mmu_ready = false;
|
|
||||||
mmu_state = 20;
|
|
||||||
}
|
|
||||||
else if ((mmu_last_request + MMU_CMD_TIMEOUT) < millis())
|
|
||||||
{ //resend request after timeout (5 min)
|
|
||||||
printf_P(PSTR("MMU => 'Erro 5m Timeout'\n"));
|
|
||||||
mmu_ready = false;
|
|
||||||
mmu_state = 20;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 10: //echo response, comms confirmation
|
case 10: //echo response, comms confirmation
|
||||||
if (mmu_rx_echo() > 0)
|
if (mmu_rx_echo() > 0)
|
||||||
{
|
{
|
||||||
printf_P(PSTR("MMU => 'CMD ACK 0x%2X'\n"), mmu_cmd);
|
printf_P(PSTR("MMU => 'CMD ACK 0x%2X'\n"), mmu_cmd);
|
||||||
//mmu_puts_P(PSTR("EE\n")); // Advise MMU CMD is correct, execute
|
|
||||||
ack_received = true;
|
ack_received = true;
|
||||||
mmu_state = 1; // Do normal Await command completion confirmation
|
mmu_state = 1; // Do normal Await command completion confirmation
|
||||||
} else if ((mmu_last_request + 1000) < millis()) { // Timeout if echo doesn't match request, resend cmd
|
} else if ((mmu_last_request + 1000) < millis()) { // Timeout if echo doesn't match request, resend cmd
|
||||||
//printf_P(PSTR("MMU => 'CMD RETRY'\n"));
|
|
||||||
printf_P(PSTR("MMU => 'CMD RETRY 0x%2X'\n"), mmu_cmd);
|
printf_P(PSTR("MMU => 'CMD RETRY 0x%2X'\n"), mmu_cmd);
|
||||||
mmu_state = 1;
|
mmu_state = 1;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 20: // MMU in fixTheProblem mode, we're waiting for an all good from it to continue.
|
|
||||||
if (mmu_rx_ok() > 0)
|
|
||||||
{
|
|
||||||
//if ok received then go back to ready
|
|
||||||
mmu_state = 1;
|
|
||||||
mmu_ready = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +517,6 @@ void mmu_command(uint8_t cmd)
|
||||||
|
|
||||||
bool mmu_get_response(void)
|
bool mmu_get_response(void)
|
||||||
{
|
{
|
||||||
// printf_P(PSTR("mmu_get_response - begin\n"));
|
|
||||||
KEEPALIVE_STATE(IN_PROCESS);
|
KEEPALIVE_STATE(IN_PROCESS);
|
||||||
while (mmu_cmd != 0)
|
while (mmu_cmd != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -553,7 +524,7 @@ bool mmu_get_response(void)
|
||||||
}
|
}
|
||||||
while (!mmu_ready)
|
while (!mmu_ready)
|
||||||
{
|
{
|
||||||
if ((mmu_state == 3) || (mmu_state == 10) || ((mmuFSensorLoading) && ((mmu_last_request + MMU_CMD_TIMEOUT) > millis()))) {
|
if (((mmu_state == 3) || (mmu_state == 10) || (mmuFSensorLoading)) && ((mmu_last_request + MMU_CMD_TIMEOUT) > millis())) {
|
||||||
delay_keep_alive(100);
|
delay_keep_alive(100);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|
@ -561,7 +532,6 @@ bool mmu_get_response(void)
|
||||||
}
|
}
|
||||||
bool ret = mmu_ready;
|
bool ret = mmu_ready;
|
||||||
mmu_ready = false;
|
mmu_ready = false;
|
||||||
// printf_P(PSTR("mmu_get_response - end %d\n"), ret?1:0);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -616,7 +586,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
|
||||||
lcd_display_message_fullscreen_P(_i("MMU needs user attention."));
|
lcd_display_message_fullscreen_P(_i("MMU needs user attention."));
|
||||||
screen++;
|
screen++;
|
||||||
}
|
}
|
||||||
else { //screen 1
|
else if (screen == 1) { //screen 1
|
||||||
if((degTargetHotend(active_extruder) == 0) && turn_off_nozzle) lcd_display_message_fullscreen_P(_i("Press the knob to resume nozzle temperature."));
|
if((degTargetHotend(active_extruder) == 0) && turn_off_nozzle) lcd_display_message_fullscreen_P(_i("Press the knob to resume nozzle temperature."));
|
||||||
else lcd_display_message_fullscreen_P(_i("Fix the issue and then press button on MMU unit."));
|
else lcd_display_message_fullscreen_P(_i("Fix the issue and then press button on MMU unit."));
|
||||||
screen = 0;
|
screen = 0;
|
||||||
|
|
@ -633,6 +603,11 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
|
||||||
for (uint8_t i = 0; i < 50; i++) {
|
for (uint8_t i = 0; i < 50; i++) {
|
||||||
if (lcd_clicked()) {
|
if (lcd_clicked()) {
|
||||||
setTargetHotend(hotend_temp_bckp, active_extruder);
|
setTargetHotend(hotend_temp_bckp, active_extruder);
|
||||||
|
if (mmuFSensorLoading) {
|
||||||
|
if (!fsensor_enabled) fsensor_enable();
|
||||||
|
if (!fsensor_autoload_enabled) fsensor_autoload_enabled = true;
|
||||||
|
fsensor_autoload_check_stop();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delay_keep_alive(100);
|
delay_keep_alive(100);
|
||||||
|
|
@ -664,8 +639,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle)
|
||||||
current_position[Z_AXIS] = z_position_bckp;
|
current_position[Z_AXIS] = z_position_bckp;
|
||||||
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder);
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_display_message_fullscreen_P(_i("MMU OK. Resuming..."));
|
lcd_display_message_fullscreen_P(_i("MMU OK. Resuming..."));
|
||||||
delay_keep_alive(1000); //delay just for showing MMU OK message for a while in case that there are no xyz movements
|
delay_keep_alive(1000); //delay just for showing MMU OK message for a while in case that there are no xyz movements
|
||||||
|
|
@ -775,7 +749,6 @@ void mmu_M600_load_filament(bool automatic)
|
||||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||||
|
|
||||||
manage_response(false, true);
|
manage_response(false, true);
|
||||||
delay(1500);
|
|
||||||
mmu_command(MMU_CMD_C0);
|
mmu_command(MMU_CMD_C0);
|
||||||
mmu_extruder = tmp_extruder; //filament change is finished
|
mmu_extruder = tmp_extruder; //filament change is finished
|
||||||
mmu_load_to_nozzle();
|
mmu_load_to_nozzle();
|
||||||
|
|
@ -1295,12 +1268,12 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr)
|
||||||
tmp_extruder = filament_nr;
|
tmp_extruder = filament_nr;
|
||||||
lcd_update_enable(false);
|
lcd_update_enable(false);
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT));
|
lcd_set_cursor(0, 1);
|
||||||
|
lcd_puts_P(_T(MSG_LOADING_FILAMENT));
|
||||||
lcd_print(" ");
|
lcd_print(" ");
|
||||||
lcd_print(tmp_extruder + 1);
|
lcd_print(tmp_extruder + 1);
|
||||||
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
mmu_command(MMU_CMD_T0 + tmp_extruder);
|
||||||
manage_response(true, true);
|
manage_response(true, true);
|
||||||
delay(1500);
|
|
||||||
mmu_command(MMU_CMD_C0);
|
mmu_command(MMU_CMD_C0);
|
||||||
mmu_extruder = tmp_extruder; //filament change is finished
|
mmu_extruder = tmp_extruder; //filament change is finished
|
||||||
mmu_load_to_nozzle();
|
mmu_load_to_nozzle();
|
||||||
|
|
|
||||||
|
|
@ -47,15 +47,12 @@ extern int8_t mmu_rx_echo(void);
|
||||||
|
|
||||||
extern int8_t mmu_rx_ok(void);
|
extern int8_t mmu_rx_ok(void);
|
||||||
|
|
||||||
extern int8_t mmu_rx_not_ok(void);
|
|
||||||
|
|
||||||
extern int8_t mmu_rx_sensFilatBoot(void);
|
extern int8_t mmu_rx_sensFilatBoot(void);
|
||||||
|
|
||||||
extern void mmu_init(void);
|
extern void mmu_init(void);
|
||||||
|
|
||||||
extern void mmu_loop(void);
|
extern void mmu_loop(void);
|
||||||
|
|
||||||
|
|
||||||
extern void mmu_reset(void);
|
extern void mmu_reset(void);
|
||||||
|
|
||||||
extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
|
extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament);
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,12 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
|
||||||
|
|
||||||
// CCW angle between position and target from circle center. Only one atan2() trig computation required.
|
// CCW angle between position and target from circle center. Only one atan2() trig computation required.
|
||||||
float angular_travel = atan2(r_axis0*rt_axis1-r_axis1*rt_axis0, r_axis0*rt_axis0+r_axis1*rt_axis1);
|
float angular_travel = atan2(r_axis0*rt_axis1-r_axis1*rt_axis0, r_axis0*rt_axis0+r_axis1*rt_axis1);
|
||||||
if (angular_travel < 0) { angular_travel += 2*M_PI; }
|
if (angular_travel < 0) {
|
||||||
if (isclockwise) { angular_travel -= 2*M_PI; }
|
angular_travel += 2*M_PI;
|
||||||
|
}
|
||||||
|
if (isclockwise) {
|
||||||
|
angular_travel -= 2*M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
//20141002:full circle for G03 did not work, e.g. G03 X80 Y80 I20 J0 F2000 is giving an Angle of zero so head is not moving
|
//20141002:full circle for G03 did not work, e.g. G03 X80 Y80 I20 J0 F2000 is giving an Angle of zero so head is not moving
|
||||||
//to compensate when start pos = target pos && angle is zero -> angle = 2Pi
|
//to compensate when start pos = target pos && angle is zero -> angle = 2Pi
|
||||||
|
|
@ -53,7 +57,9 @@ void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8
|
||||||
//end fix G03
|
//end fix G03
|
||||||
|
|
||||||
float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
|
float millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
|
||||||
if (millimeters_of_travel < 0.001) { return; }
|
if (millimeters_of_travel < 0.001) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT);
|
uint16_t segments = floor(millimeters_of_travel/MM_PER_ARC_SEGMENT);
|
||||||
if(segments == 0) segments = 1;
|
if(segments == 0) segments = 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,8 @@ static void verifySpace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getNch(uint8_t count) {
|
static void getNch(uint8_t count) {
|
||||||
do getch(); while (--count);
|
do getch();
|
||||||
|
while (--count);
|
||||||
verifySpace();
|
verifySpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include "swi2c.h"
|
#include "swi2c.h"
|
||||||
#endif //PAT9125_SWI2C
|
#endif //PAT9125_SWI2C
|
||||||
|
|
||||||
|
#define PAT9125_NEW_INIT
|
||||||
|
|
||||||
uint8_t pat9125_PID1 = 0;
|
uint8_t pat9125_PID1 = 0;
|
||||||
uint8_t pat9125_PID2 = 0;
|
uint8_t pat9125_PID2 = 0;
|
||||||
|
|
|
||||||
|
|
@ -872,22 +872,34 @@ block->steps_y.wide = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-p
|
||||||
enable_e0();
|
enable_e0();
|
||||||
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE*2;
|
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE*2;
|
||||||
|
|
||||||
if(g_uc_extruder_last_move[1] == 0) {disable_e1();}
|
if(g_uc_extruder_last_move[1] == 0) {
|
||||||
if(g_uc_extruder_last_move[2] == 0) {disable_e2();}
|
disable_e1();
|
||||||
|
}
|
||||||
|
if(g_uc_extruder_last_move[2] == 0) {
|
||||||
|
disable_e2();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
enable_e1();
|
enable_e1();
|
||||||
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
|
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
|
||||||
|
|
||||||
if(g_uc_extruder_last_move[0] == 0) {disable_e0();}
|
if(g_uc_extruder_last_move[0] == 0) {
|
||||||
if(g_uc_extruder_last_move[2] == 0) {disable_e2();}
|
disable_e0();
|
||||||
|
}
|
||||||
|
if(g_uc_extruder_last_move[2] == 0) {
|
||||||
|
disable_e2();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
enable_e2();
|
enable_e2();
|
||||||
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
|
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
|
||||||
|
|
||||||
if(g_uc_extruder_last_move[0] == 0) {disable_e0();}
|
if(g_uc_extruder_last_move[0] == 0) {
|
||||||
if(g_uc_extruder_last_move[1] == 0) {disable_e1();}
|
disable_e0();
|
||||||
|
}
|
||||||
|
if(g_uc_extruder_last_move[1] == 0) {
|
||||||
|
disable_e1();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1002,13 +1014,25 @@ Having the real displacement of the head, we can calculate the total movement le
|
||||||
// Limit acceleration per axis
|
// Limit acceleration per axis
|
||||||
//FIXME Vojtech: One shall rather limit a projection of the acceleration vector instead of using the limit.
|
//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.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[X_AXIS])
|
if(((float)block->acceleration_st * (float)block->steps_x.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[X_AXIS])
|
||||||
{ block->acceleration_st = axis_steps_per_sqr_second[X_AXIS]; maxlimit_status |= (X_AXIS_MASK << 4); }
|
{
|
||||||
|
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
|
||||||
|
maxlimit_status |= (X_AXIS_MASK << 4);
|
||||||
|
}
|
||||||
if(((float)block->acceleration_st * (float)block->steps_y.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[Y_AXIS])
|
if(((float)block->acceleration_st * (float)block->steps_y.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[Y_AXIS])
|
||||||
{ block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS]; maxlimit_status |= (Y_AXIS_MASK << 4); }
|
{
|
||||||
|
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
|
||||||
|
maxlimit_status |= (Y_AXIS_MASK << 4);
|
||||||
|
}
|
||||||
if(((float)block->acceleration_st * (float)block->steps_e.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[E_AXIS])
|
if(((float)block->acceleration_st * (float)block->steps_e.wide / (float)block->step_event_count.wide) > axis_steps_per_sqr_second[E_AXIS])
|
||||||
{ block->acceleration_st = axis_steps_per_sqr_second[E_AXIS]; maxlimit_status |= (Z_AXIS_MASK << 4); }
|
{
|
||||||
|
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
|
||||||
|
maxlimit_status |= (Z_AXIS_MASK << 4);
|
||||||
|
}
|
||||||
if(((float)block->acceleration_st * (float)block->steps_z.wide / (float)block->step_event_count.wide ) > axis_steps_per_sqr_second[Z_AXIS])
|
if(((float)block->acceleration_st * (float)block->steps_z.wide / (float)block->step_event_count.wide ) > axis_steps_per_sqr_second[Z_AXIS])
|
||||||
{ block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS]; maxlimit_status |= (E_AXIS_MASK << 4); }
|
{
|
||||||
|
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
|
||||||
|
maxlimit_status |= (E_AXIS_MASK << 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Acceleration of the segment, in mm/sec^2
|
// Acceleration of the segment, in mm/sec^2
|
||||||
block->acceleration = block->acceleration_st / steps_per_mm;
|
block->acceleration = block->acceleration_st / steps_per_mm;
|
||||||
|
|
|
||||||
|
|
@ -50,15 +50,23 @@ uint8_t sm4_get_dir(uint8_t axis)
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
|
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
|
||||||
case 0: return (PORTL & 2)?0:1;
|
case 0:
|
||||||
case 1: return (PORTL & 1)?0:1;
|
return (PORTL & 2)?0:1;
|
||||||
case 2: return (PORTL & 4)?0:1;
|
case 1:
|
||||||
case 3: return (PORTL & 64)?1:0;
|
return (PORTL & 1)?0:1;
|
||||||
|
case 2:
|
||||||
|
return (PORTL & 4)?0:1;
|
||||||
|
case 3:
|
||||||
|
return (PORTL & 64)?1:0;
|
||||||
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
|
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
|
||||||
case 0: return (PORTL & 1)?1:0;
|
case 0:
|
||||||
case 1: return (PORTL & 2)?0:1;
|
return (PORTL & 1)?1:0;
|
||||||
case 2: return (PORTL & 4)?1:0;
|
case 1:
|
||||||
case 3: return (PORTL & 64)?0:1;
|
return (PORTL & 2)?0:1;
|
||||||
|
case 2:
|
||||||
|
return (PORTL & 4)?1:0;
|
||||||
|
case 3:
|
||||||
|
return (PORTL & 64)?0:1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -69,15 +77,39 @@ void sm4_set_dir(uint8_t axis, uint8_t dir)
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
|
#if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3))
|
||||||
case 0: if (!dir) PORTL |= 2; else PORTL &= ~2; break;
|
case 0:
|
||||||
case 1: if (!dir) PORTL |= 1; else PORTL &= ~1; break;
|
if (!dir) PORTL |= 2;
|
||||||
case 2: if (!dir) PORTL |= 4; else PORTL &= ~4; break;
|
else PORTL &= ~2;
|
||||||
case 3: if (dir) PORTL |= 64; else PORTL &= ~64; break;
|
break;
|
||||||
|
case 1:
|
||||||
|
if (!dir) PORTL |= 1;
|
||||||
|
else PORTL &= ~1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (!dir) PORTL |= 4;
|
||||||
|
else PORTL &= ~4;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (dir) PORTL |= 64;
|
||||||
|
else PORTL &= ~64;
|
||||||
|
break;
|
||||||
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
|
#elif ((MOTHERBOARD == BOARD_EINSY_1_0a))
|
||||||
case 0: if (dir) PORTL |= 1; else PORTL &= ~1; break;
|
case 0:
|
||||||
case 1: if (!dir) PORTL |= 2; else PORTL &= ~2; break;
|
if (dir) PORTL |= 1;
|
||||||
case 2: if (dir) PORTL |= 4; else PORTL &= ~4; break;
|
else PORTL &= ~1;
|
||||||
case 3: if (!dir) PORTL |= 64; else PORTL &= ~64; break;
|
break;
|
||||||
|
case 1:
|
||||||
|
if (!dir) PORTL |= 2;
|
||||||
|
else PORTL &= ~2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (dir) PORTL |= 4;
|
||||||
|
else PORTL &= ~4;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!dir) PORTL |= 64;
|
||||||
|
else PORTL &= ~64;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
asm("nop");
|
asm("nop");
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,11 @@ FORCE_INLINE unsigned short calc_timer(uint16_t step_rate) {
|
||||||
timer = (unsigned short)pgm_read_word_near(table_address);
|
timer = (unsigned short)pgm_read_word_near(table_address);
|
||||||
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
|
timer -= (((unsigned short)pgm_read_word_near(table_address+2) * (unsigned char)(step_rate & 0x0007))>>3);
|
||||||
}
|
}
|
||||||
if(timer < 100) { timer = 100; MYSERIAL.print(_N("Steprate too high: ")); MYSERIAL.println(step_rate); }//(20kHz this should never happen)////MSG_STEPPER_TOO_HIGH c=0 r=0
|
if(timer < 100) {
|
||||||
|
timer = 100; //(20kHz this should never happen)////MSG_STEPPER_TOO_HIGH c=0 r=0
|
||||||
|
MYSERIAL.print(_N("Steprate too high: "));
|
||||||
|
MYSERIAL.println(step_rate);
|
||||||
|
}
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1525,7 +1529,8 @@ void babystep(const uint8_t axis,const bool direction)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //BABYSTEPPING
|
#endif //BABYSTEPPING
|
||||||
|
|
@ -1623,22 +1628,42 @@ void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2)
|
||||||
{
|
{
|
||||||
if(ms1 > -1) switch(driver)
|
if(ms1 > -1) switch(driver)
|
||||||
{
|
{
|
||||||
case 0: digitalWrite( X_MS1_PIN,ms1); break;
|
case 0:
|
||||||
case 1: digitalWrite( Y_MS1_PIN,ms1); break;
|
digitalWrite( X_MS1_PIN,ms1);
|
||||||
case 2: digitalWrite( Z_MS1_PIN,ms1); break;
|
break;
|
||||||
case 3: digitalWrite(E0_MS1_PIN,ms1); break;
|
case 1:
|
||||||
|
digitalWrite( Y_MS1_PIN,ms1);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
digitalWrite( Z_MS1_PIN,ms1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
digitalWrite(E0_MS1_PIN,ms1);
|
||||||
|
break;
|
||||||
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
||||||
case 4: digitalWrite(E1_MS1_PIN,ms1); break;
|
case 4:
|
||||||
|
digitalWrite(E1_MS1_PIN,ms1);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(ms2 > -1) switch(driver)
|
if(ms2 > -1) switch(driver)
|
||||||
{
|
{
|
||||||
case 0: digitalWrite( X_MS2_PIN,ms2); break;
|
case 0:
|
||||||
case 1: digitalWrite( Y_MS2_PIN,ms2); break;
|
digitalWrite( X_MS2_PIN,ms2);
|
||||||
case 2: digitalWrite( Z_MS2_PIN,ms2); break;
|
break;
|
||||||
case 3: digitalWrite(E0_MS2_PIN,ms2); break;
|
case 1:
|
||||||
|
digitalWrite( Y_MS2_PIN,ms2);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
digitalWrite( Z_MS2_PIN,ms2);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
digitalWrite(E0_MS2_PIN,ms2);
|
||||||
|
break;
|
||||||
#if defined(E1_MS2_PIN) && E1_MS2_PIN > -1
|
#if defined(E1_MS2_PIN) && E1_MS2_PIN > -1
|
||||||
case 4: digitalWrite(E1_MS2_PIN,ms2); break;
|
case 4:
|
||||||
|
digitalWrite(E1_MS2_PIN,ms2);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1647,11 +1672,21 @@ void microstep_mode(uint8_t driver, uint8_t stepping_mode)
|
||||||
{
|
{
|
||||||
switch(stepping_mode)
|
switch(stepping_mode)
|
||||||
{
|
{
|
||||||
case 1: microstep_ms(driver,MICROSTEP1); break;
|
case 1:
|
||||||
case 2: microstep_ms(driver,MICROSTEP2); break;
|
microstep_ms(driver,MICROSTEP1);
|
||||||
case 4: microstep_ms(driver,MICROSTEP4); break;
|
break;
|
||||||
case 8: microstep_ms(driver,MICROSTEP8); break;
|
case 2:
|
||||||
case 16: microstep_ms(driver,MICROSTEP16); break;
|
microstep_ms(driver,MICROSTEP2);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
microstep_ms(driver,MICROSTEP4);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
microstep_ms(driver,MICROSTEP8);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
microstep_ms(driver,MICROSTEP16);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ void swi2c_init(void)
|
||||||
PIN_OUT(SWI2C_SCL);
|
PIN_OUT(SWI2C_SCL);
|
||||||
PIN_SET(SWI2C_SDA);
|
PIN_SET(SWI2C_SDA);
|
||||||
PIN_SET(SWI2C_SCL);
|
PIN_SET(SWI2C_SCL);
|
||||||
uint8_t i; for (i = 0; i < 100; i++)
|
uint8_t i;
|
||||||
|
for (i = 0; i < 100; i++)
|
||||||
__delay();
|
__delay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,7 +82,8 @@ uint8_t swi2c_read(void)
|
||||||
__delay();
|
__delay();
|
||||||
PIN_INP(SWI2C_SDA);
|
PIN_INP(SWI2C_SDA);
|
||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
int8_t bit; for (bit = 7; bit >= 0; bit--)
|
int8_t bit;
|
||||||
|
for (bit = 7; bit >= 0; bit--)
|
||||||
{
|
{
|
||||||
PIN_SET(SWI2C_SCL);
|
PIN_SET(SWI2C_SCL);
|
||||||
__delay();
|
__delay();
|
||||||
|
|
@ -95,7 +97,8 @@ uint8_t swi2c_read(void)
|
||||||
|
|
||||||
void swi2c_write(uint8_t data)
|
void swi2c_write(uint8_t data)
|
||||||
{
|
{
|
||||||
int8_t bit; for (bit = 7; bit >= 0; bit--)
|
int8_t bit;
|
||||||
|
for (bit = 7; bit >= 0; bit--)
|
||||||
{
|
{
|
||||||
if (data & (1 << bit)) PIN_SET(SWI2C_SDA);
|
if (data & (1 << bit)) PIN_SET(SWI2C_SDA);
|
||||||
else PIN_CLR(SWI2C_SDA);
|
else PIN_CLR(SWI2C_SDA);
|
||||||
|
|
@ -111,7 +114,10 @@ uint8_t swi2c_check(uint8_t dev_addr)
|
||||||
{
|
{
|
||||||
swi2c_start();
|
swi2c_start();
|
||||||
swi2c_write((dev_addr & SWI2C_DMSK) << SWI2C_ASHF);
|
swi2c_write((dev_addr & SWI2C_DMSK) << SWI2C_ASHF);
|
||||||
if (!swi2c_wait_ack()) { swi2c_stop(); return 0; }
|
if (!swi2c_wait_ack()) {
|
||||||
|
swi2c_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
swi2c_stop();
|
swi2c_stop();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +128,10 @@ uint8_t swi2c_readByte_A8(uint8_t dev_addr, uint8_t addr, uint8_t* pbyte)
|
||||||
{
|
{
|
||||||
swi2c_start();
|
swi2c_start();
|
||||||
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
||||||
if (!swi2c_wait_ack()) { swi2c_stop(); return 0; }
|
if (!swi2c_wait_ack()) {
|
||||||
|
swi2c_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
swi2c_write(addr & 0xff);
|
swi2c_write(addr & 0xff);
|
||||||
if (!swi2c_wait_ack()) return 0;
|
if (!swi2c_wait_ack()) return 0;
|
||||||
swi2c_stop();
|
swi2c_stop();
|
||||||
|
|
@ -139,7 +148,10 @@ uint8_t swi2c_writeByte_A8(uint8_t dev_addr, uint8_t addr, uint8_t* pbyte)
|
||||||
{
|
{
|
||||||
swi2c_start();
|
swi2c_start();
|
||||||
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
||||||
if (!swi2c_wait_ack()) { swi2c_stop(); return 0; }
|
if (!swi2c_wait_ack()) {
|
||||||
|
swi2c_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
swi2c_write(addr & 0xff);
|
swi2c_write(addr & 0xff);
|
||||||
if (!swi2c_wait_ack()) return 0;
|
if (!swi2c_wait_ack()) return 0;
|
||||||
swi2c_write(*pbyte);
|
swi2c_write(*pbyte);
|
||||||
|
|
@ -156,7 +168,10 @@ uint8_t swi2c_readByte_A16(uint8_t dev_addr, unsigned short addr, uint8_t* pbyte
|
||||||
{
|
{
|
||||||
swi2c_start();
|
swi2c_start();
|
||||||
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
||||||
if (!swi2c_wait_ack()) { swi2c_stop(); return 0; }
|
if (!swi2c_wait_ack()) {
|
||||||
|
swi2c_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
swi2c_write(addr >> 8);
|
swi2c_write(addr >> 8);
|
||||||
if (!swi2c_wait_ack()) return 0;
|
if (!swi2c_wait_ack()) return 0;
|
||||||
swi2c_write(addr & 0xff);
|
swi2c_write(addr & 0xff);
|
||||||
|
|
@ -175,7 +190,10 @@ uint8_t swi2c_writeByte_A16(uint8_t dev_addr, unsigned short addr, uint8_t* pbyt
|
||||||
{
|
{
|
||||||
swi2c_start();
|
swi2c_start();
|
||||||
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
swi2c_write(SWI2C_WMSK | ((dev_addr & SWI2C_DMSK) << SWI2C_ASHF));
|
||||||
if (!swi2c_wait_ack()) { swi2c_stop(); return 0; }
|
if (!swi2c_wait_ack()) {
|
||||||
|
swi2c_stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
swi2c_write(addr >> 8);
|
swi2c_write(addr >> 8);
|
||||||
if (!swi2c_wait_ack()) return 0;
|
if (!swi2c_wait_ack()) return 0;
|
||||||
swi2c_write(addr & 0xff);
|
swi2c_write(addr & 0xff);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ void swspi_tx(unsigned char tx)
|
||||||
{
|
{
|
||||||
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
||||||
if (swspi_miso == swspi_mosi) GPIO_OUT(swspi_mosi);
|
if (swspi_miso == swspi_mosi) GPIO_OUT(swspi_mosi);
|
||||||
unsigned char i = 0; for (; i < 8; i++)
|
unsigned char i = 0;
|
||||||
|
for (; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (tx & 0x80) GPIO_SET(swspi_mosi);
|
if (tx & 0x80) GPIO_SET(swspi_mosi);
|
||||||
else GPIO_CLR(swspi_mosi);
|
else GPIO_CLR(swspi_mosi);
|
||||||
|
|
@ -59,7 +60,8 @@ unsigned char swspi_rx()
|
||||||
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
||||||
if (swspi_miso == swspi_mosi) GPIO_OUT(swspi_mosi);
|
if (swspi_miso == swspi_mosi) GPIO_OUT(swspi_mosi);
|
||||||
unsigned char rx = 0;
|
unsigned char rx = 0;
|
||||||
unsigned char i = 0; for (; i < 8; i++)
|
unsigned char i = 0;
|
||||||
|
for (; i < 8; i++)
|
||||||
{
|
{
|
||||||
rx <<= 1;
|
rx <<= 1;
|
||||||
DELAY(delay);
|
DELAY(delay);
|
||||||
|
|
@ -75,7 +77,8 @@ unsigned char swspi_txrx(unsigned char tx)
|
||||||
{
|
{
|
||||||
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
int delay = 1 << (swspi_cfg & SWSPI_DEL));
|
||||||
unsigned char rx = 0;
|
unsigned char rx = 0;
|
||||||
unsigned char i = 0; for (; i < 8; i++)
|
unsigned char i = 0;
|
||||||
|
for (; i < 8; i++)
|
||||||
{
|
{
|
||||||
rx <<= 1;
|
rx <<= 1;
|
||||||
if (tx & 0x80) GPIO_SET(swspi_mosi);
|
if (tx & 0x80) GPIO_SET(swspi_mosi);
|
||||||
|
|
|
||||||
|
|
@ -307,22 +307,31 @@ static void temp_runaway_stop(bool isPreheat, bool isBed);
|
||||||
if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias;
|
if(bias > (extruder<0?(MAX_BED_POWER):(PID_MAX))/2) d = (extruder<0?(MAX_BED_POWER):(PID_MAX)) - 1 - bias;
|
||||||
else d = bias;
|
else d = bias;
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM(" bias: "); SERIAL_PROTOCOL(bias);
|
SERIAL_PROTOCOLPGM(" bias: ");
|
||||||
SERIAL_PROTOCOLPGM(" d: "); SERIAL_PROTOCOL(d);
|
SERIAL_PROTOCOL(bias);
|
||||||
SERIAL_PROTOCOLPGM(" min: "); SERIAL_PROTOCOL(min);
|
SERIAL_PROTOCOLPGM(" d: ");
|
||||||
SERIAL_PROTOCOLPGM(" max: "); SERIAL_PROTOCOLLN(max);
|
SERIAL_PROTOCOL(d);
|
||||||
|
SERIAL_PROTOCOLPGM(" min: ");
|
||||||
|
SERIAL_PROTOCOL(min);
|
||||||
|
SERIAL_PROTOCOLPGM(" max: ");
|
||||||
|
SERIAL_PROTOCOLLN(max);
|
||||||
if(pid_cycle > 2) {
|
if(pid_cycle > 2) {
|
||||||
Ku = (4.0*d)/(3.14159*(max-min)/2.0);
|
Ku = (4.0*d)/(3.14159*(max-min)/2.0);
|
||||||
Tu = ((float)(t_low + t_high)/1000.0);
|
Tu = ((float)(t_low + t_high)/1000.0);
|
||||||
SERIAL_PROTOCOLPGM(" Ku: "); SERIAL_PROTOCOL(Ku);
|
SERIAL_PROTOCOLPGM(" Ku: ");
|
||||||
SERIAL_PROTOCOLPGM(" Tu: "); SERIAL_PROTOCOLLN(Tu);
|
SERIAL_PROTOCOL(Ku);
|
||||||
|
SERIAL_PROTOCOLPGM(" Tu: ");
|
||||||
|
SERIAL_PROTOCOLLN(Tu);
|
||||||
_Kp = 0.6*Ku;
|
_Kp = 0.6*Ku;
|
||||||
_Ki = 2*_Kp/Tu;
|
_Ki = 2*_Kp/Tu;
|
||||||
_Kd = _Kp*Tu/8;
|
_Kd = _Kp*Tu/8;
|
||||||
SERIAL_PROTOCOLLNPGM(" Classic PID ");
|
SERIAL_PROTOCOLLNPGM(" Classic PID ");
|
||||||
SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(_Kp);
|
SERIAL_PROTOCOLPGM(" Kp: ");
|
||||||
SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(_Ki);
|
SERIAL_PROTOCOLLN(_Kp);
|
||||||
SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(_Kd);
|
SERIAL_PROTOCOLPGM(" Ki: ");
|
||||||
|
SERIAL_PROTOCOLLN(_Ki);
|
||||||
|
SERIAL_PROTOCOLPGM(" Kd: ");
|
||||||
|
SERIAL_PROTOCOLLN(_Kd);
|
||||||
/*
|
/*
|
||||||
_Kp = 0.33*Ku;
|
_Kp = 0.33*Ku;
|
||||||
_Ki = _Kp/Tu;
|
_Ki = _Kp/Tu;
|
||||||
|
|
@ -1233,9 +1242,13 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
|
||||||
|
|
||||||
if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5))
|
if (__preheat_errors[_heater_id] > ((_isbed) ? 2 : 5))
|
||||||
{
|
{
|
||||||
if (farm_mode) { prusa_statistics(0); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(0);
|
||||||
|
}
|
||||||
temp_runaway_stop(true, _isbed);
|
temp_runaway_stop(true, _isbed);
|
||||||
if (farm_mode) { prusa_statistics(91); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(91);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__preheat_start[_heater_id] = _current_temperature;
|
__preheat_start[_heater_id] = _current_temperature;
|
||||||
__preheat_counter[_heater_id] = 0;
|
__preheat_counter[_heater_id] = 0;
|
||||||
|
|
@ -1269,9 +1282,13 @@ void temp_runaway_check(int _heater_id, float _target_temperature, float _curren
|
||||||
temp_runaway_error_counter[_heater_id]++;
|
temp_runaway_error_counter[_heater_id]++;
|
||||||
if (temp_runaway_error_counter[_heater_id] * 2 > __timeout)
|
if (temp_runaway_error_counter[_heater_id] * 2 > __timeout)
|
||||||
{
|
{
|
||||||
if (farm_mode) { prusa_statistics(0); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(0);
|
||||||
|
}
|
||||||
temp_runaway_stop(false, _isbed);
|
temp_runaway_stop(false, _isbed);
|
||||||
if (farm_mode) { prusa_statistics(90); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(90);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1390,7 +1407,9 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode
|
||||||
WRITE(BEEPER, 1);
|
WRITE(BEEPER, 1);
|
||||||
// fanSpeed will consumed by the check_axes_activity() routine.
|
// fanSpeed will consumed by the check_axes_activity() routine.
|
||||||
fanSpeed=255;
|
fanSpeed=255;
|
||||||
if (farm_mode) { prusa_statistics(93); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(93);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void min_temp_error(uint8_t e) {
|
void min_temp_error(uint8_t e) {
|
||||||
|
|
@ -1408,7 +1427,9 @@ void min_temp_error(uint8_t e) {
|
||||||
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
|
||||||
Stop();
|
Stop();
|
||||||
#endif
|
#endif
|
||||||
if (farm_mode) { prusa_statistics(92); }
|
if (farm_mode) {
|
||||||
|
prusa_statistics(92);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1590,19 +1611,23 @@ ISR(TIMER0_COMPB_vect)
|
||||||
} else WRITE(HEATER_0_PIN,0);
|
} else WRITE(HEATER_0_PIN,0);
|
||||||
#if EXTRUDERS > 1
|
#if EXTRUDERS > 1
|
||||||
soft_pwm_1 = soft_pwm[1];
|
soft_pwm_1 = soft_pwm[1];
|
||||||
if(soft_pwm_1 > 0) WRITE(HEATER_1_PIN,1); else WRITE(HEATER_1_PIN,0);
|
if(soft_pwm_1 > 0) WRITE(HEATER_1_PIN,1);
|
||||||
|
else WRITE(HEATER_1_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
#if EXTRUDERS > 2
|
#if EXTRUDERS > 2
|
||||||
soft_pwm_2 = soft_pwm[2];
|
soft_pwm_2 = soft_pwm[2];
|
||||||
if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1); else WRITE(HEATER_2_PIN,0);
|
if(soft_pwm_2 > 0) WRITE(HEATER_2_PIN,1);
|
||||||
|
else WRITE(HEATER_2_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
|
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
|
||||||
soft_pwm_b = soft_pwm_bed;
|
soft_pwm_b = soft_pwm_bed;
|
||||||
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1); else WRITE(HEATER_BED_PIN,0);
|
if(soft_pwm_b > 0) WRITE(HEATER_BED_PIN,1);
|
||||||
|
else WRITE(HEATER_BED_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FAN_SOFT_PWM
|
#ifdef FAN_SOFT_PWM
|
||||||
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
||||||
if(soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
|
if(soft_pwm_fan > 0) WRITE(FAN_PIN,1);
|
||||||
|
else WRITE(FAN_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(soft_pwm_0 < pwm_count)
|
if(soft_pwm_0 < pwm_count)
|
||||||
|
|
@ -1812,7 +1837,8 @@ ISR(TIMER0_COMPB_vect)
|
||||||
#ifdef FAN_SOFT_PWM
|
#ifdef FAN_SOFT_PWM
|
||||||
if (pwm_count == 0) {
|
if (pwm_count == 0) {
|
||||||
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
soft_pwm_fan = fanSpeedSoftPwm / 2;
|
||||||
if (soft_pwm_fan > 0) WRITE(FAN_PIN,1); else WRITE(FAN_PIN,0);
|
if (soft_pwm_fan > 0) WRITE(FAN_PIN,1);
|
||||||
|
else WRITE(FAN_PIN,0);
|
||||||
}
|
}
|
||||||
if (soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
|
if (soft_pwm_fan < pwm_count) WRITE(FAN_PIN,0);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1864,8 +1890,7 @@ ISR(TIMER0_COMPB_vect)
|
||||||
babystepsTodo[axis]--; //less to do next time
|
babystepsTodo[axis]--; //less to do next time
|
||||||
asm("sei");
|
asm("sei");
|
||||||
}
|
}
|
||||||
else
|
else if(curTodo<0)
|
||||||
if(curTodo<0)
|
|
||||||
{
|
{
|
||||||
asm("cli");
|
asm("cli");
|
||||||
babystep(axis,/*fwd*/false);
|
babystep(axis,/*fwd*/false);
|
||||||
|
|
|
||||||
|
|
@ -136,9 +136,12 @@ uint16_t __tcoolthrs(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: return TMC2130_TCOOLTHRS_X;
|
case X_AXIS:
|
||||||
case Y_AXIS: return TMC2130_TCOOLTHRS_Y;
|
return TMC2130_TCOOLTHRS_X;
|
||||||
case Z_AXIS: return TMC2130_TCOOLTHRS_Z;
|
case Y_AXIS:
|
||||||
|
return TMC2130_TCOOLTHRS_Y;
|
||||||
|
case Z_AXIS:
|
||||||
|
return TMC2130_TCOOLTHRS_Z;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -240,8 +243,7 @@ void tmc2130_st_isr()
|
||||||
{
|
{
|
||||||
uint8_t mask = (X_AXIS_MASK << axis);
|
uint8_t mask = (X_AXIS_MASK << axis);
|
||||||
if (diag_mask & mask) tmc2130_sg_err[axis]++;
|
if (diag_mask & mask) tmc2130_sg_err[axis]++;
|
||||||
else
|
else if (tmc2130_sg_err[axis] > 0) tmc2130_sg_err[axis]--;
|
||||||
if (tmc2130_sg_err[axis] > 0) tmc2130_sg_err[axis]--;
|
|
||||||
if (tmc2130_sg_cnt[axis] < tmc2130_sg_err[axis])
|
if (tmc2130_sg_cnt[axis] < tmc2130_sg_err[axis])
|
||||||
{
|
{
|
||||||
tmc2130_sg_cnt[axis] = tmc2130_sg_err[axis];
|
tmc2130_sg_cnt[axis] = tmc2130_sg_err[axis];
|
||||||
|
|
@ -590,7 +592,8 @@ void tmc2130_wr_THIGH(uint8_t axis, uint32_t val32)
|
||||||
|
|
||||||
uint8_t tmc2130_usteps2mres(uint16_t usteps)
|
uint8_t tmc2130_usteps2mres(uint16_t usteps)
|
||||||
{
|
{
|
||||||
uint8_t mres = 8; while (mres && (usteps >>= 1)) mres--;
|
uint8_t mres = 8;
|
||||||
|
while (mres && (usteps >>= 1)) mres--;
|
||||||
return mres;
|
return mres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -599,10 +602,18 @@ inline void tmc2130_cs_low(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: WRITE(X_TMC2130_CS, LOW); break;
|
case X_AXIS:
|
||||||
case Y_AXIS: WRITE(Y_TMC2130_CS, LOW); break;
|
WRITE(X_TMC2130_CS, LOW);
|
||||||
case Z_AXIS: WRITE(Z_TMC2130_CS, LOW); break;
|
break;
|
||||||
case E_AXIS: WRITE(E0_TMC2130_CS, LOW); break;
|
case Y_AXIS:
|
||||||
|
WRITE(Y_TMC2130_CS, LOW);
|
||||||
|
break;
|
||||||
|
case Z_AXIS:
|
||||||
|
WRITE(Z_TMC2130_CS, LOW);
|
||||||
|
break;
|
||||||
|
case E_AXIS:
|
||||||
|
WRITE(E0_TMC2130_CS, LOW);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -610,10 +621,18 @@ inline void tmc2130_cs_high(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: WRITE(X_TMC2130_CS, HIGH); break;
|
case X_AXIS:
|
||||||
case Y_AXIS: WRITE(Y_TMC2130_CS, HIGH); break;
|
WRITE(X_TMC2130_CS, HIGH);
|
||||||
case Z_AXIS: WRITE(Z_TMC2130_CS, HIGH); break;
|
break;
|
||||||
case E_AXIS: WRITE(E0_TMC2130_CS, HIGH); break;
|
case Y_AXIS:
|
||||||
|
WRITE(Y_TMC2130_CS, HIGH);
|
||||||
|
break;
|
||||||
|
case Z_AXIS:
|
||||||
|
WRITE(Z_TMC2130_CS, HIGH);
|
||||||
|
break;
|
||||||
|
case E_AXIS:
|
||||||
|
WRITE(E0_TMC2130_CS, HIGH);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -707,10 +726,14 @@ uint8_t tmc2130_get_pwr(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: return _GET_PWR_X;
|
case X_AXIS:
|
||||||
case Y_AXIS: return _GET_PWR_Y;
|
return _GET_PWR_X;
|
||||||
case Z_AXIS: return _GET_PWR_Z;
|
case Y_AXIS:
|
||||||
case E_AXIS: return _GET_PWR_E;
|
return _GET_PWR_Y;
|
||||||
|
case Z_AXIS:
|
||||||
|
return _GET_PWR_Z;
|
||||||
|
case E_AXIS:
|
||||||
|
return _GET_PWR_E;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -719,10 +742,18 @@ void tmc2130_set_pwr(uint8_t axis, uint8_t pwr)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: _SET_PWR_X(pwr); break;
|
case X_AXIS:
|
||||||
case Y_AXIS: _SET_PWR_Y(pwr); break;
|
_SET_PWR_X(pwr);
|
||||||
case Z_AXIS: _SET_PWR_Z(pwr); break;
|
break;
|
||||||
case E_AXIS: _SET_PWR_E(pwr); break;
|
case Y_AXIS:
|
||||||
|
_SET_PWR_Y(pwr);
|
||||||
|
break;
|
||||||
|
case Z_AXIS:
|
||||||
|
_SET_PWR_Z(pwr);
|
||||||
|
break;
|
||||||
|
case E_AXIS:
|
||||||
|
_SET_PWR_E(pwr);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -730,10 +761,14 @@ uint8_t tmc2130_get_inv(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: return INVERT_X_DIR;
|
case X_AXIS:
|
||||||
case Y_AXIS: return INVERT_Y_DIR;
|
return INVERT_X_DIR;
|
||||||
case Z_AXIS: return INVERT_Z_DIR;
|
case Y_AXIS:
|
||||||
case E_AXIS: return INVERT_E0_DIR;
|
return INVERT_Y_DIR;
|
||||||
|
case Z_AXIS:
|
||||||
|
return INVERT_Z_DIR;
|
||||||
|
case E_AXIS:
|
||||||
|
return INVERT_E0_DIR;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -742,10 +777,14 @@ uint8_t tmc2130_get_dir(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: return _GET_DIR_X;
|
case X_AXIS:
|
||||||
case Y_AXIS: return _GET_DIR_Y;
|
return _GET_DIR_X;
|
||||||
case Z_AXIS: return _GET_DIR_Z;
|
case Y_AXIS:
|
||||||
case E_AXIS: return _GET_DIR_E;
|
return _GET_DIR_Y;
|
||||||
|
case Z_AXIS:
|
||||||
|
return _GET_DIR_Z;
|
||||||
|
case E_AXIS:
|
||||||
|
return _GET_DIR_E;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -755,10 +794,18 @@ void tmc2130_set_dir(uint8_t axis, uint8_t dir)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: _SET_DIR_X(dir); break;
|
case X_AXIS:
|
||||||
case Y_AXIS: _SET_DIR_Y(dir); break;
|
_SET_DIR_X(dir);
|
||||||
case Z_AXIS: _SET_DIR_Z(dir); break;
|
break;
|
||||||
case E_AXIS: _SET_DIR_E(dir); break;
|
case Y_AXIS:
|
||||||
|
_SET_DIR_Y(dir);
|
||||||
|
break;
|
||||||
|
case Z_AXIS:
|
||||||
|
_SET_DIR_Z(dir);
|
||||||
|
break;
|
||||||
|
case E_AXIS:
|
||||||
|
_SET_DIR_E(dir);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -766,10 +813,18 @@ void tmc2130_do_step(uint8_t axis)
|
||||||
{
|
{
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case X_AXIS: _DO_STEP_X; break;
|
case X_AXIS:
|
||||||
case Y_AXIS: _DO_STEP_Y; break;
|
_DO_STEP_X;
|
||||||
case Z_AXIS: _DO_STEP_Z; break;
|
break;
|
||||||
case E_AXIS: _DO_STEP_E; break;
|
case Y_AXIS:
|
||||||
|
_DO_STEP_Y;
|
||||||
|
break;
|
||||||
|
case Z_AXIS:
|
||||||
|
_DO_STEP_Z;
|
||||||
|
break;
|
||||||
|
case E_AXIS:
|
||||||
|
_DO_STEP_E;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -787,7 +842,8 @@ void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_
|
||||||
void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution)
|
void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution)
|
||||||
{
|
{
|
||||||
printf_P(PSTR("tmc2130_goto_step %d %d %d %d \n"), axis, step, dir, delay_us, microstep_resolution);
|
printf_P(PSTR("tmc2130_goto_step %d %d %d %d \n"), axis, step, dir, delay_us, microstep_resolution);
|
||||||
uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256u >> shift)) break;
|
uint8_t shift;
|
||||||
|
for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256u >> shift)) break;
|
||||||
uint16_t cnt = 4 * (1 << (8 - shift));
|
uint16_t cnt = 4 * (1 << (8 - shift));
|
||||||
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
|
uint16_t mscnt = tmc2130_rd_MSCNT(axis);
|
||||||
if (dir == 2)
|
if (dir == 2)
|
||||||
|
|
@ -888,12 +944,29 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000)
|
||||||
b = 0;
|
b = 0;
|
||||||
switch (dA)
|
switch (dA)
|
||||||
{
|
{
|
||||||
case -1: d0 = -1; d1 = 0; w[s+1] = 0; break;
|
case -1:
|
||||||
case 0: d0 = 0; d1 = 1; w[s+1] = 1; break;
|
d0 = -1;
|
||||||
case 1: d0 = 1; d1 = 2; w[s+1] = 2; break;
|
d1 = 0;
|
||||||
default: b = -1; break;
|
w[s+1] = 0;
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
d0 = 0;
|
||||||
|
d1 = 1;
|
||||||
|
w[s+1] = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
d0 = 1;
|
||||||
|
d1 = 2;
|
||||||
|
w[s+1] = 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
b = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (b >= 0) {
|
||||||
|
x[s] = i;
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
if (b >= 0) { x[s] = i; s++; }
|
|
||||||
}
|
}
|
||||||
else if (dA > d1) // delta > delta0 => switch wbit up
|
else if (dA > d1) // delta > delta0 => switch wbit up
|
||||||
{
|
{
|
||||||
|
|
@ -901,12 +974,29 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000)
|
||||||
b = 1;
|
b = 1;
|
||||||
switch (dA)
|
switch (dA)
|
||||||
{
|
{
|
||||||
case 1: d0 = 0; d1 = 1; w[s+1] = 1; break;
|
case 1:
|
||||||
case 2: d0 = 1; d1 = 2; w[s+1] = 2; break;
|
d0 = 0;
|
||||||
case 3: d0 = 2; d1 = 3; w[s+1] = 3; break;
|
d1 = 1;
|
||||||
default: b = -1; break;
|
w[s+1] = 1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
d0 = 1;
|
||||||
|
d1 = 2;
|
||||||
|
w[s+1] = 2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
d0 = 2;
|
||||||
|
d1 = 3;
|
||||||
|
w[s+1] = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
b = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (b >= 0) {
|
||||||
|
x[s] = i;
|
||||||
|
s++;
|
||||||
}
|
}
|
||||||
if (b >= 0) { x[s] = i; s++; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b < 0) break; // delta out of range (<-1 or >3)
|
if (b < 0) break; // delta out of range (<-1 or >3)
|
||||||
|
|
|
||||||
|
|
@ -1628,10 +1628,18 @@ void lcd_commands()
|
||||||
else
|
else
|
||||||
switch(snmm_stop_print_menu())
|
switch(snmm_stop_print_menu())
|
||||||
{
|
{
|
||||||
case 0: enquecommand_P(PSTR("M702")); break;//all
|
case 0:
|
||||||
case 1: enquecommand_P(PSTR("M702 U")); break; //used
|
enquecommand_P(PSTR("M702"));
|
||||||
case 2: enquecommand_P(PSTR("M702 C")); break; //current
|
break;//all
|
||||||
default: enquecommand_P(PSTR("M702")); break;
|
case 1:
|
||||||
|
enquecommand_P(PSTR("M702 U"));
|
||||||
|
break; //used
|
||||||
|
case 2:
|
||||||
|
enquecommand_P(PSTR("M702 C"));
|
||||||
|
break; //current
|
||||||
|
default:
|
||||||
|
enquecommand_P(PSTR("M702"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
lcd_commands_step = 3;
|
lcd_commands_step = 3;
|
||||||
}
|
}
|
||||||
|
|
@ -1648,7 +1656,9 @@ void lcd_commands()
|
||||||
if (lcd_commands_type == LCD_COMMAND_FARM_MODE_CONFIRM) /// farm mode confirm
|
if (lcd_commands_type == LCD_COMMAND_FARM_MODE_CONFIRM) /// farm mode confirm
|
||||||
{
|
{
|
||||||
|
|
||||||
if (lcd_commands_step == 0) { lcd_commands_step = 6; }
|
if (lcd_commands_step == 0) {
|
||||||
|
lcd_commands_step = 6;
|
||||||
|
}
|
||||||
|
|
||||||
if (lcd_commands_step == 1 && !blocks_queued())
|
if (lcd_commands_step == 1 && !blocks_queued())
|
||||||
{
|
{
|
||||||
|
|
@ -3945,9 +3955,14 @@ static void lcd_sort_type_set() {
|
||||||
uint8_t sdSort;
|
uint8_t sdSort;
|
||||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||||
switch (sdSort) {
|
switch (sdSort) {
|
||||||
case SD_SORT_TIME: sdSort = SD_SORT_ALPHA; break;
|
case SD_SORT_TIME:
|
||||||
case SD_SORT_ALPHA: sdSort = SD_SORT_NONE; break;
|
sdSort = SD_SORT_ALPHA;
|
||||||
default: sdSort = SD_SORT_TIME;
|
break;
|
||||||
|
case SD_SORT_ALPHA:
|
||||||
|
sdSort = SD_SORT_NONE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sdSort = SD_SORT_TIME;
|
||||||
}
|
}
|
||||||
eeprom_update_byte((unsigned char *)EEPROM_SD_SORT, sdSort);
|
eeprom_update_byte((unsigned char *)EEPROM_SD_SORT, sdSort);
|
||||||
presort_flag = true;
|
presort_flag = true;
|
||||||
|
|
@ -4017,14 +4032,28 @@ Sound_CycleState();
|
||||||
static void lcd_silent_mode_set() {
|
static void lcd_silent_mode_set() {
|
||||||
switch (SilentModeMenu) {
|
switch (SilentModeMenu) {
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
case SILENT_MODE_NORMAL: SilentModeMenu = SILENT_MODE_STEALTH; break;
|
case SILENT_MODE_NORMAL:
|
||||||
case SILENT_MODE_STEALTH: SilentModeMenu = SILENT_MODE_NORMAL; break;
|
SilentModeMenu = SILENT_MODE_STEALTH;
|
||||||
default: SilentModeMenu = SILENT_MODE_NORMAL; break; // (probably) not needed
|
break;
|
||||||
|
case SILENT_MODE_STEALTH:
|
||||||
|
SilentModeMenu = SILENT_MODE_NORMAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SilentModeMenu = SILENT_MODE_NORMAL;
|
||||||
|
break; // (probably) not needed
|
||||||
#else
|
#else
|
||||||
case SILENT_MODE_POWER: SilentModeMenu = SILENT_MODE_SILENT; break;
|
case SILENT_MODE_POWER:
|
||||||
case SILENT_MODE_SILENT: SilentModeMenu = SILENT_MODE_AUTO; break;
|
SilentModeMenu = SILENT_MODE_SILENT;
|
||||||
case SILENT_MODE_AUTO: SilentModeMenu = SILENT_MODE_POWER; break;
|
break;
|
||||||
default: SilentModeMenu = SILENT_MODE_POWER; break; // (probably) not needed
|
case SILENT_MODE_SILENT:
|
||||||
|
SilentModeMenu = SILENT_MODE_AUTO;
|
||||||
|
break;
|
||||||
|
case SILENT_MODE_AUTO:
|
||||||
|
SilentModeMenu = SILENT_MODE_POWER;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SilentModeMenu = SILENT_MODE_POWER;
|
||||||
|
break; // (probably) not needed
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
}
|
}
|
||||||
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
|
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
|
||||||
|
|
@ -4472,12 +4501,25 @@ void lcd_wizard(WizState state)
|
||||||
break;
|
break;
|
||||||
case S::Restore: // restore calibration status
|
case S::Restore: // restore calibration status
|
||||||
switch (calibration_status()) {
|
switch (calibration_status()) {
|
||||||
case CALIBRATION_STATUS_ASSEMBLED: state = S::Selftest; break; //run selftest
|
case CALIBRATION_STATUS_ASSEMBLED:
|
||||||
case CALIBRATION_STATUS_XYZ_CALIBRATION: state = S::Xyz; break; //run xyz cal.
|
state = S::Selftest;
|
||||||
case CALIBRATION_STATUS_Z_CALIBRATION: state = S::Z; break; //run z cal.
|
break; //run selftest
|
||||||
case CALIBRATION_STATUS_LIVE_ADJUST: state = S::IsFil; break; //run live adjust
|
case CALIBRATION_STATUS_XYZ_CALIBRATION:
|
||||||
case CALIBRATION_STATUS_CALIBRATED: end = true; eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); break;
|
state = S::Xyz;
|
||||||
default: state = S::Selftest; break; //if calibration status is unknown, run wizard from the beginning
|
break; //run xyz cal.
|
||||||
|
case CALIBRATION_STATUS_Z_CALIBRATION:
|
||||||
|
state = S::Z;
|
||||||
|
break; //run z cal.
|
||||||
|
case CALIBRATION_STATUS_LIVE_ADJUST:
|
||||||
|
state = S::IsFil;
|
||||||
|
break; //run live adjust
|
||||||
|
case CALIBRATION_STATUS_CALIBRATED:
|
||||||
|
end = true;
|
||||||
|
eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
state = S::Selftest;
|
||||||
|
break; //if calibration status is unknown, run wizard from the beginning
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case S::Selftest:
|
case S::Selftest:
|
||||||
|
|
@ -4583,7 +4625,8 @@ void lcd_wizard(WizState state)
|
||||||
end = true;
|
end = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5075,8 +5118,10 @@ void bowden_menu() {
|
||||||
|
|
||||||
static char snmm_stop_print_menu() { //menu for choosing which filaments will be unloaded in stop print
|
static char snmm_stop_print_menu() { //menu for choosing which filaments will be unloaded in stop print
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_puts_at_P(0,0,_T(MSG_UNLOAD_FILAMENT)); lcd_print(":");
|
lcd_puts_at_P(0,0,_T(MSG_UNLOAD_FILAMENT));
|
||||||
lcd_set_cursor(0, 1); lcd_print(">");
|
lcd_print(":");
|
||||||
|
lcd_set_cursor(0, 1);
|
||||||
|
lcd_print(">");
|
||||||
lcd_puts_at_P(1,2,_i("Used during print"));////MSG_USED c=19 r=1
|
lcd_puts_at_P(1,2,_i("Used during print"));////MSG_USED c=19 r=1
|
||||||
lcd_puts_at_P(1,3,_i("Current"));////MSG_CURRENT c=19 r=1
|
lcd_puts_at_P(1,3,_i("Current"));////MSG_CURRENT c=19 r=1
|
||||||
char cursor_pos = 1;
|
char cursor_pos = 1;
|
||||||
|
|
@ -5443,19 +5488,33 @@ static void lcd_farm_no()
|
||||||
if (abs((enc_dif - lcd_encoder_diff)) > 2) {
|
if (abs((enc_dif - lcd_encoder_diff)) > 2) {
|
||||||
if (enc_dif > lcd_encoder_diff) {
|
if (enc_dif > lcd_encoder_diff) {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case(0): if (_farmno >= 100) _farmno -= 100; break;
|
case(0):
|
||||||
case(1): if (_farmno % 100 >= 10) _farmno -= 10; break;
|
if (_farmno >= 100) _farmno -= 100;
|
||||||
case(2): if (_farmno % 10 >= 1) _farmno--; break;
|
break;
|
||||||
default: break;
|
case(1):
|
||||||
|
if (_farmno % 100 >= 10) _farmno -= 10;
|
||||||
|
break;
|
||||||
|
case(2):
|
||||||
|
if (_farmno % 10 >= 1) _farmno--;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc_dif < lcd_encoder_diff) {
|
if (enc_dif < lcd_encoder_diff) {
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case(0): if (_farmno < 900) _farmno += 100; break;
|
case(0):
|
||||||
case(1): if (_farmno % 100 < 90) _farmno += 10; break;
|
if (_farmno < 900) _farmno += 100;
|
||||||
case(2): if (_farmno % 10 <= 8)_farmno++; break;
|
break;
|
||||||
default: break;
|
case(1):
|
||||||
|
if (_farmno % 100 < 90) _farmno += 10;
|
||||||
|
break;
|
||||||
|
case(2):
|
||||||
|
if (_farmno % 10 <= 8)_farmno++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enc_dif = 0;
|
enc_dif = 0;
|
||||||
|
|
@ -5564,9 +5623,15 @@ unsigned char lcd_choose_color() {
|
||||||
|
|
||||||
if (lcd_clicked()) {
|
if (lcd_clicked()) {
|
||||||
switch(cursor_pos + first - 1) {
|
switch(cursor_pos + first - 1) {
|
||||||
case 0: return 1; break;
|
case 0:
|
||||||
case 1: return 0; break;
|
return 1;
|
||||||
default: return 99; break;
|
break;
|
||||||
|
case 1:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 99;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5601,11 +5666,17 @@ void lcd_confirm_print()
|
||||||
enc_dif = lcd_encoder_diff;
|
enc_dif = lcd_encoder_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor_pos > 2) { cursor_pos = 2; }
|
if (cursor_pos > 2) {
|
||||||
if (cursor_pos < 1) { cursor_pos = 1; }
|
cursor_pos = 2;
|
||||||
|
}
|
||||||
|
if (cursor_pos < 1) {
|
||||||
|
cursor_pos = 1;
|
||||||
|
}
|
||||||
|
|
||||||
lcd_set_cursor(0, 2); lcd_print(" ");
|
lcd_set_cursor(0, 2);
|
||||||
lcd_set_cursor(0, 3); lcd_print(" ");
|
lcd_print(" ");
|
||||||
|
lcd_set_cursor(0, 3);
|
||||||
|
lcd_print(" ");
|
||||||
lcd_set_cursor(2, 2);
|
lcd_set_cursor(2, 2);
|
||||||
lcd_puts_P(_T(MSG_YES));
|
lcd_puts_P(_T(MSG_YES));
|
||||||
lcd_set_cursor(2, 3);
|
lcd_set_cursor(2, 3);
|
||||||
|
|
@ -5969,10 +6040,18 @@ static void lcd_tune_menu()
|
||||||
#else //TMC2130
|
#else //TMC2130
|
||||||
if (!farm_mode) { //dont show in menu if we are in farm mode
|
if (!farm_mode) { //dont show in menu if we are in farm mode
|
||||||
switch (SilentModeMenu) {
|
switch (SilentModeMenu) {
|
||||||
case SILENT_MODE_POWER: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break;
|
case SILENT_MODE_POWER:
|
||||||
case SILENT_MODE_SILENT: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set); break;
|
MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set);
|
||||||
case SILENT_MODE_AUTO: MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set); break;
|
break;
|
||||||
default: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break; // (probably) not needed
|
case SILENT_MODE_SILENT:
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set);
|
||||||
|
break;
|
||||||
|
case SILENT_MODE_AUTO:
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set);
|
||||||
|
break; // (probably) not needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
@ -6088,11 +6167,17 @@ void lcd_sdcard_stop()
|
||||||
lcd_puts_P(_T(MSG_NO));
|
lcd_puts_P(_T(MSG_NO));
|
||||||
lcd_set_cursor(2, 3);
|
lcd_set_cursor(2, 3);
|
||||||
lcd_puts_P(_T(MSG_YES));
|
lcd_puts_P(_T(MSG_YES));
|
||||||
lcd_set_cursor(0, 2); lcd_print(" ");
|
lcd_set_cursor(0, 2);
|
||||||
lcd_set_cursor(0, 3); lcd_print(" ");
|
lcd_print(" ");
|
||||||
|
lcd_set_cursor(0, 3);
|
||||||
|
lcd_print(" ");
|
||||||
|
|
||||||
if ((int32_t)lcd_encoder > 2) { lcd_encoder = 2; }
|
if ((int32_t)lcd_encoder > 2) {
|
||||||
if ((int32_t)lcd_encoder < 1) { lcd_encoder = 1; }
|
lcd_encoder = 2;
|
||||||
|
}
|
||||||
|
if ((int32_t)lcd_encoder < 1) {
|
||||||
|
lcd_encoder = 1;
|
||||||
|
}
|
||||||
|
|
||||||
lcd_set_cursor(0, 1 + lcd_encoder);
|
lcd_set_cursor(0, 1 + lcd_encoder);
|
||||||
lcd_print(">");
|
lcd_print(">");
|
||||||
|
|
@ -6177,7 +6262,8 @@ bool lcd_selftest()
|
||||||
bool _result = true;
|
bool _result = true;
|
||||||
lcd_wait_for_cool_down();
|
lcd_wait_for_cool_down();
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
lcd_set_cursor(0, 0); lcd_puts_P(_i("Self test start "));////MSG_SELFTEST_START c=20 r=0
|
lcd_set_cursor(0, 0);
|
||||||
|
lcd_puts_P(_i("Self test start "));////MSG_SELFTEST_START c=20 r=0
|
||||||
#ifdef TMC2130
|
#ifdef TMC2130
|
||||||
FORCE_HIGH_POWER_START;
|
FORCE_HIGH_POWER_START;
|
||||||
#endif // TMC2130
|
#endif // TMC2130
|
||||||
|
|
@ -6373,9 +6459,15 @@ static bool lcd_selfcheck_axis_sg(unsigned char axis) {
|
||||||
float margin = 60;
|
float margin = 60;
|
||||||
float max_error_mm = 5;
|
float max_error_mm = 5;
|
||||||
switch (axis) {
|
switch (axis) {
|
||||||
case 0: axis_length = X_MAX_POS; break;
|
case 0:
|
||||||
case 1: axis_length = Y_MAX_POS + 8; break;
|
axis_length = X_MAX_POS;
|
||||||
default: axis_length = 210; break;
|
break;
|
||||||
|
case 1:
|
||||||
|
axis_length = Y_MAX_POS + 8;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
axis_length = 210;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmc2130_sg_stop_on_crash = false;
|
tmc2130_sg_stop_on_crash = false;
|
||||||
|
|
@ -6894,7 +6986,8 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
|
||||||
bool _result = check_opposite;
|
bool _result = check_opposite;
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
|
|
||||||
lcd_set_cursor(0, 0); lcd_puts_P(_T(MSG_SELFTEST_FAN));
|
lcd_set_cursor(0, 0);
|
||||||
|
lcd_puts_P(_T(MSG_SELFTEST_FAN));
|
||||||
|
|
||||||
switch (_fan)
|
switch (_fan)
|
||||||
{
|
{
|
||||||
|
|
@ -6917,9 +7010,12 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
|
||||||
}
|
}
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
lcd_set_cursor(1, 2); lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
lcd_set_cursor(1, 2);
|
||||||
lcd_set_cursor(0, 3); lcd_print(">");
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
||||||
lcd_set_cursor(1, 3); lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
lcd_set_cursor(0, 3);
|
||||||
|
lcd_print(">");
|
||||||
|
lcd_set_cursor(1, 3);
|
||||||
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
||||||
|
|
||||||
int8_t enc_dif = 0;
|
int8_t enc_dif = 0;
|
||||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||||
|
|
@ -6944,18 +7040,26 @@ static bool lcd_selftest_manual_fan_check(int _fan, bool check_opposite)
|
||||||
if (abs((enc_dif - lcd_encoder_diff)) > 2) {
|
if (abs((enc_dif - lcd_encoder_diff)) > 2) {
|
||||||
if (enc_dif > lcd_encoder_diff) {
|
if (enc_dif > lcd_encoder_diff) {
|
||||||
_result = !check_opposite;
|
_result = !check_opposite;
|
||||||
lcd_set_cursor(0, 2); lcd_print(">");
|
lcd_set_cursor(0, 2);
|
||||||
lcd_set_cursor(1, 2); lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
lcd_print(">");
|
||||||
lcd_set_cursor(0, 3); lcd_print(" ");
|
lcd_set_cursor(1, 2);
|
||||||
lcd_set_cursor(1, 3); lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
||||||
|
lcd_set_cursor(0, 3);
|
||||||
|
lcd_print(" ");
|
||||||
|
lcd_set_cursor(1, 3);
|
||||||
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc_dif < lcd_encoder_diff) {
|
if (enc_dif < lcd_encoder_diff) {
|
||||||
_result = check_opposite;
|
_result = check_opposite;
|
||||||
lcd_set_cursor(0, 2); lcd_print(" ");
|
lcd_set_cursor(0, 2);
|
||||||
lcd_set_cursor(1, 2); lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
lcd_print(" ");
|
||||||
lcd_set_cursor(0, 3); lcd_print(">");
|
lcd_set_cursor(1, 2);
|
||||||
lcd_set_cursor(1, 3); lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_YES));
|
||||||
|
lcd_set_cursor(0, 3);
|
||||||
|
lcd_print(">");
|
||||||
|
lcd_set_cursor(1, 3);
|
||||||
|
lcd_puts_P(_T(MSG_SELFTEST_FAN_NO));
|
||||||
}
|
}
|
||||||
enc_dif = 0;
|
enc_dif = 0;
|
||||||
lcd_encoder_diff = 0;
|
lcd_encoder_diff = 0;
|
||||||
|
|
@ -7014,7 +7118,8 @@ static bool lcd_selftest_fan_dialog(int _fan)
|
||||||
manage_heater(); //turn off fan
|
manage_heater(); //turn off fan
|
||||||
manage_inactivity(true); //to turn off print fan
|
manage_inactivity(true); //to turn off print fan
|
||||||
if (!fan_speed[1]) {
|
if (!fan_speed[1]) {
|
||||||
_result = false; _errno = 6; //print fan not spinning
|
_result = false;
|
||||||
|
_errno = 6; //print fan not spinning
|
||||||
}
|
}
|
||||||
else if (fan_speed[1] < 34) { //fan is spinning, but measured RPM are too low for print fan, it must be left extruder fan
|
else if (fan_speed[1] < 34) { //fan is spinning, but measured RPM are too low for print fan, it must be left extruder fan
|
||||||
//check fans manually
|
//check fans manually
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,14 @@
|
||||||
#define PRINT(p) print(p)
|
#define PRINT(p) print(p)
|
||||||
#define DEC 10
|
#define DEC 10
|
||||||
#define HEX 16
|
#define HEX 16
|
||||||
void print(const char* pc) { printf("%s", pc); }
|
void print(const char* pc) {
|
||||||
void print(int v) { printf("%d", v); }
|
printf("%s", pc);
|
||||||
void print(float v) { printf("%f", v); }
|
}
|
||||||
|
void print(int v) {
|
||||||
|
printf("%d", v);
|
||||||
|
}
|
||||||
|
void print(float v) {
|
||||||
|
printf("%f", v);
|
||||||
|
}
|
||||||
#endif //RC522_RPI
|
#endif //RC522_RPI
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ inline bool parse_version_P(const char *str, uint16_t version[4])
|
||||||
uint8_t n = minor - major - 1;
|
uint8_t n = minor - major - 1;
|
||||||
if (n > 4)
|
if (n > 4)
|
||||||
return false;
|
return false;
|
||||||
memcpy_P(buf, major, n); buf[n] = 0;
|
memcpy_P(buf, major, n);
|
||||||
|
buf[n] = 0;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
version[0] = strtol(buf, &endptr, 10);
|
version[0] = strtol(buf, &endptr, 10);
|
||||||
if (*endptr != 0)
|
if (*endptr != 0)
|
||||||
|
|
@ -173,7 +174,8 @@ inline bool parse_version_P(const char *str, uint16_t version[4])
|
||||||
n = rev - minor - 1;
|
n = rev - minor - 1;
|
||||||
if (n > 4)
|
if (n > 4)
|
||||||
return false;
|
return false;
|
||||||
memcpy_P(buf, minor, n); buf[n] = 0;
|
memcpy_P(buf, minor, n);
|
||||||
|
buf[n] = 0;
|
||||||
version[1] = strtol(buf, &endptr, 10);
|
version[1] = strtol(buf, &endptr, 10);
|
||||||
if (*endptr != 0)
|
if (*endptr != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,15 @@ matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3
|
||||||
//row_1.debug("row_1");
|
//row_1.debug("row_1");
|
||||||
//row_2.debug("row_2");
|
//row_2.debug("row_2");
|
||||||
matrix_3x3 new_matrix;
|
matrix_3x3 new_matrix;
|
||||||
new_matrix.matrix[0] = row_0.x; new_matrix.matrix[1] = row_0.y; new_matrix.matrix[2] = row_0.z;
|
new_matrix.matrix[0] = row_0.x;
|
||||||
new_matrix.matrix[3] = row_1.x; new_matrix.matrix[4] = row_1.y; new_matrix.matrix[5] = row_1.z;
|
new_matrix.matrix[1] = row_0.y;
|
||||||
new_matrix.matrix[6] = row_2.x; new_matrix.matrix[7] = row_2.y; new_matrix.matrix[8] = row_2.z;
|
new_matrix.matrix[2] = row_0.z;
|
||||||
|
new_matrix.matrix[3] = row_1.x;
|
||||||
|
new_matrix.matrix[4] = row_1.y;
|
||||||
|
new_matrix.matrix[5] = row_1.z;
|
||||||
|
new_matrix.matrix[6] = row_2.x;
|
||||||
|
new_matrix.matrix[7] = row_2.y;
|
||||||
|
new_matrix.matrix[8] = row_2.z;
|
||||||
//new_matrix.debug("new_matrix");
|
//new_matrix.debug("new_matrix");
|
||||||
|
|
||||||
return new_matrix;
|
return new_matrix;
|
||||||
|
|
@ -112,9 +118,15 @@ matrix_3x3 matrix_3x3::create_from_rows(vector_3 row_0, vector_3 row_1, vector_3
|
||||||
|
|
||||||
void matrix_3x3::set_to_identity()
|
void matrix_3x3::set_to_identity()
|
||||||
{
|
{
|
||||||
matrix[0] = 1; matrix[1] = 0; matrix[2] = 0;
|
matrix[0] = 1;
|
||||||
matrix[3] = 0; matrix[4] = 1; matrix[5] = 0;
|
matrix[1] = 0;
|
||||||
matrix[6] = 0; matrix[7] = 0; matrix[8] = 1;
|
matrix[2] = 0;
|
||||||
|
matrix[3] = 0;
|
||||||
|
matrix[4] = 1;
|
||||||
|
matrix[5] = 0;
|
||||||
|
matrix[6] = 0;
|
||||||
|
matrix[7] = 0;
|
||||||
|
matrix[8] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_3x3 matrix_3x3::create_look_at(vector_3 target)
|
matrix_3x3 matrix_3x3::create_look_at(vector_3 target)
|
||||||
|
|
@ -139,9 +151,15 @@ matrix_3x3 matrix_3x3::create_look_at(vector_3 target)
|
||||||
matrix_3x3 matrix_3x3::transpose(matrix_3x3 original)
|
matrix_3x3 matrix_3x3::transpose(matrix_3x3 original)
|
||||||
{
|
{
|
||||||
matrix_3x3 new_matrix;
|
matrix_3x3 new_matrix;
|
||||||
new_matrix.matrix[0] = original.matrix[0]; new_matrix.matrix[1] = original.matrix[3]; new_matrix.matrix[2] = original.matrix[6];
|
new_matrix.matrix[0] = original.matrix[0];
|
||||||
new_matrix.matrix[3] = original.matrix[1]; new_matrix.matrix[4] = original.matrix[4]; new_matrix.matrix[5] = original.matrix[7];
|
new_matrix.matrix[1] = original.matrix[3];
|
||||||
new_matrix.matrix[6] = original.matrix[2]; new_matrix.matrix[7] = original.matrix[5]; new_matrix.matrix[8] = original.matrix[8];
|
new_matrix.matrix[2] = original.matrix[6];
|
||||||
|
new_matrix.matrix[3] = original.matrix[1];
|
||||||
|
new_matrix.matrix[4] = original.matrix[4];
|
||||||
|
new_matrix.matrix[5] = original.matrix[7];
|
||||||
|
new_matrix.matrix[6] = original.matrix[2];
|
||||||
|
new_matrix.matrix[7] = original.matrix[5];
|
||||||
|
new_matrix.matrix[8] = original.matrix[8];
|
||||||
return new_matrix;
|
return new_matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,12 @@ uint8_t xyzcal_dm = 0;
|
||||||
void xyzcal_update_pos(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t)
|
void xyzcal_update_pos(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t)
|
||||||
{
|
{
|
||||||
// DBG(_n("xyzcal_update_pos dx=%d dy=%d dz=%d dir=%02x\n"), dx, dy, dz, xyzcal_dm);
|
// DBG(_n("xyzcal_update_pos dx=%d dy=%d dz=%d dir=%02x\n"), dx, dy, dz, xyzcal_dm);
|
||||||
if (xyzcal_dm&1) count_position[0] -= dx; else count_position[0] += dx;
|
if (xyzcal_dm&1) count_position[0] -= dx;
|
||||||
if (xyzcal_dm&2) count_position[1] -= dy; else count_position[1] += dy;
|
else count_position[0] += dx;
|
||||||
if (xyzcal_dm&4) count_position[2] -= dz; else count_position[2] += dz;
|
if (xyzcal_dm&2) count_position[1] -= dy;
|
||||||
|
else count_position[1] += dy;
|
||||||
|
if (xyzcal_dm&4) count_position[2] -= dz;
|
||||||
|
else count_position[2] += dz;
|
||||||
// DBG(_n(" after xyzcal_update_pos x=%ld y=%ld z=%ld\n"), count_position[0], count_position[1], count_position[2]);
|
// DBG(_n(" after xyzcal_update_pos x=%ld y=%ld z=%ld\n"), count_position[0], count_position[1], count_position[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -792,7 +795,8 @@ bool xyzcal_find_bed_induction_sensor_point_xy(void)
|
||||||
{
|
{
|
||||||
uint32_t x_avg = 0;
|
uint32_t x_avg = 0;
|
||||||
uint32_t y_avg = 0;
|
uint32_t y_avg = 0;
|
||||||
uint8_t n; for (n = 0; n < 4; n++)
|
uint8_t n;
|
||||||
|
for (n = 0; n < 4; n++)
|
||||||
{
|
{
|
||||||
if (!xyzcal_find_point_center2(1000)) break;
|
if (!xyzcal_find_point_center2(1000)) break;
|
||||||
x_avg += _X;
|
x_avg += _X;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# This FW is for use with MMU2, in combination with MMU2-FW https://github.com/TheZeroBeast/MM-control-01
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Table of contents
|
# Table of contents
|
||||||
|
|
||||||
<!--ts-->
|
<!--ts-->
|
||||||
|
|
@ -7,9 +11,6 @@
|
||||||
* [Documentation](#4-documentation)
|
* [Documentation](#4-documentation)
|
||||||
<!--te-->
|
<!--te-->
|
||||||
|
|
||||||
This FW is for use with MMU2, in combination with MMU2-FW https://github.com/TheZeroBeast/MM-control-01
|
|
||||||
|
|
||||||
|
|
||||||
# 1. Development environment preparation
|
# 1. Development environment preparation
|
||||||
|
|
||||||
1. install `"Arduino Software IDE"` for your preferred operating system
|
1. install `"Arduino Software IDE"` for your preferred operating system
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue