Commit 6c633f0e authored by MagoKimbra's avatar MagoKimbra

Merge remote-tracking branch 'refs/remotes/origin/master' into dev

parents 249efc81 8e9f3658
This diff is collapsed.
......@@ -48,7 +48,6 @@ void ok_to_send();
void calibration_report();
void bed_probe_all();
void set_delta_constants();
void save_carriage_positions(int position_num);
void calculate_delta(float cartesian[3]);
void adjust_delta(float cartesian[3]);
void adj_endstops();
......@@ -71,7 +70,13 @@ void ok_to_send();
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
#endif
void prepare_move();
void prepare_move(
#if MECH(DELTA)
const bool delta_probe = false
#endif
);
void kill(const char *);
void Stop();
......@@ -130,9 +135,9 @@ extern float home_offset[3];
extern float hotend_offset[3][HOTENDS];
extern float sw_endstop_min[3];
extern float sw_endstop_max[3];
extern bool axis_known_position[3];
extern bool axis_homed[3];
extern float zprobe_zoffset;
extern uint8_t axis_known_position;
extern uint8_t axis_was_homed;
#if HEATER_USES_AD595
extern float ad595_offset[HOTENDS];
......
......@@ -50,9 +50,6 @@
// 18 Japanese utf
// 19 Chinese
#define STRINGIFY_(n) #n
#define STRINGIFY(n) STRINGIFY_(n)
#define PROTOCOL_VERSION "2.0"
#if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
......
......@@ -349,6 +349,21 @@ FORCE_INLINE void _draw_heater_status(int x, int heater) {
#endif
}
FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
if (blink)
lcd_printPGM(pstr);
else {
if (!axis_homed[axis])
lcd_printPGM(PSTR("?"));
else {
if (!axis_known_position[axis])
lcd_printPGM(PSTR(" "));
else
lcd_printPGM(pstr);
}
}
}
static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white
......@@ -458,34 +473,20 @@ static void lcd_implementation_status_screen() {
u8g.setColorIndex(0); // white on black
u8g.setPrintPos(2, XYZ_BASELINE);
lcd_print(TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? 'X' : '?');
u8g.drawPixel(8, XYZ_BASELINE - 5);
u8g.drawPixel(8, XYZ_BASELINE - 3);
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
u8g.setPrintPos(10, XYZ_BASELINE);
if (TEST(axis_was_homed, X_AXIS))
lcd_print(ftostr31ns(current_position[X_AXIS]));
else
lcd_printPGM(PSTR("---"));
lcd_print(ftostr4sign(current_position[X_AXIS]));
u8g.setPrintPos(43, XYZ_BASELINE);
lcd_print(TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? 'Y' : '?');
u8g.drawPixel(49, XYZ_BASELINE - 5);
u8g.drawPixel(49, XYZ_BASELINE - 3);
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
u8g.setPrintPos(51, XYZ_BASELINE);
if (TEST(axis_was_homed, Y_AXIS))
lcd_print(ftostr31ns(current_position[Y_AXIS]));
else
lcd_printPGM(PSTR("---"));
lcd_print(ftostr4sign(current_position[Y_AXIS]));
u8g.setPrintPos(83, XYZ_BASELINE);
lcd_print(TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? 'Z' : '?');
u8g.drawPixel(89, XYZ_BASELINE - 5);
u8g.drawPixel(89, XYZ_BASELINE - 3);
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
u8g.setPrintPos(91, XYZ_BASELINE);
if (TEST(axis_was_homed, Z_AXIS))
lcd_print(ftostr32sp(current_position[Z_AXIS]));
else
lcd_printPGM(PSTR("---.--"));
lcd_print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
u8g.setColorIndex(1); // black on white
// Feedrate
......
......@@ -2034,6 +2034,17 @@ int lcd_strlen_P(const char* s) {
return j;
}
bool lcd_blink() {
static uint8_t blink = 0;
static millis_t next_blink_ms = 0;
millis_t ms = millis();
if (ELAPSED(ms, next_blink_ms)) {
blink ^= 0xFF;
next_blink_ms = ms + 1000 - LCD_UPDATE_INTERVAL / 2;
}
return blink != 0;
}
/**
* Update the LCD, read encoder buttons, etc.
* - Read button states
......@@ -2096,7 +2107,7 @@ void lcd_update() {
#if ENABLED(REPRAPWORLD_KEYPAD)
#if ENABLED(DELTA) || ENABLED(SCARA)
#if MECH(DELTA) || MECH(SCARA)
#define _KEYPAD_MOVE_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#else
#define _KEYPAD_MOVE_ALLOWED true
......
......@@ -575,6 +575,21 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
}
#endif // SHOW_BOOTSCREEN
FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
if (blink)
lcd_printPGM(pstr);
else {
if (!axis_homed[axis])
lcd_printPGM(PSTR("?"));
else {
if (!axis_known_position[axis])
lcd_printPGM(PSTR(" "));
else
lcd_printPGM(pstr);
}
}
}
/*
Possible status screens:
16x2 |000/000 B000/000|
......@@ -668,6 +683,8 @@ static void lcd_implementation_status_screen() {
#if LCD_HEIGHT > 2
bool blink = lcd_blink();
#if LCD_WIDTH < 20
#if ENABLED(SDSUPPORT)
......@@ -684,12 +701,6 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, 1);
//
// Print XYZ Coordinates
// If the axis was not homed, show "---"
// If the position is untrusted, show "?"
//
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0
// If we both have a 2nd hotend and a heated bed,
......@@ -698,29 +709,25 @@ static void lcd_implementation_status_screen() {
LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
#else
// Before homing the axis letters are blinking 'X' <-> '?'.
// When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '.
// When everything is ok you see a constant 'X'.
lcd.print(TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? 'X' : '?');
if (TEST(axis_was_homed, X_AXIS))
lcd.print(ftostr4sign(current_position[X_AXIS]));
else
lcd_printPGM(PSTR(" ---"));
_draw_axis_label(X_AXIS, PSTR(MSG_X), blink);
lcd.print(ftostr4sign(current_position[X_AXIS]));
lcd_printPGM(TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? PSTR(" Y") : PSTR(" ?"));
if (TEST(axis_was_homed, Y_AXIS))
lcd.print(ftostr4sign(current_position[Y_AXIS]));
else
lcd_printPGM(PSTR(" ---"));
lcd_printPGM(PSTR(" "));
_draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink);
lcd.print(ftostr4sign(current_position[Y_AXIS]));
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH >= 20
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd_printPGM(TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? PSTR("Z ") : PSTR("? "));
if (TEST(axis_was_homed, Z_AXIS))
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
else
lcd_printPGM(PSTR("---.--"));
_draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink);
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif // LCD_HEIGHT > 2
......@@ -807,12 +814,12 @@ static void lcd_implementation_status_screen() {
//Display both Status message line and Filament display on the last line
#if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
if (millis() >= previous_lcd_status_ms + 5000) {
if (millis() >= previous_lcd_status_ms + 5000UL) {
lcd_print(lcd_status_message);
}
#if HAS(LCD_POWER_SENSOR)
#if HAS(LCD_FILAMENT_SENSOR)
else if (millis() < message_millis + 10000)
else if (millis() < message_millis + 10000UL)
#else
else
#endif
......@@ -829,7 +836,7 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("Dia "));
lcd.print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR(" V"));
lcd.print(itostr3(100.0*volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd.print(itostr3(100.0 * volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd.print('%');
return;
}
......@@ -900,17 +907,20 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, char* value) {
void lcd_implementation_drawedit(const char* pstr, const char* value = NULL) {
lcd.setCursor(1, 1);
lcd_printPGM(pstr);
lcd.print(':');
lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
lcd_print(value);
if (value != NULL) {
lcd.print(':');
lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
lcd_print(value);
}
}
#if ENABLED(SDSUPPORT)
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* longFilename, uint8_t concat, char post_char) {
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - concat;
lcd.setCursor(0, row);
......
......@@ -48,14 +48,9 @@
#define ENABLED defined
#define DISABLED !defined
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define HAS(FE) (HAS_##FE)
#define HASNT(FE) (!(HAS_##FE))
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
// Macros to contrain values
#define NUMERIC(a) ((a) >= '0' && '9' >= (a))
#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-')
......@@ -73,4 +68,12 @@
#define STRINGIFY_(n) #n
#define STRINGIFY(n) STRINGIFY_(n)
// Macro for varie
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))
#define NOOP do{}while(0)
#endif //__MACROS_H
......@@ -532,12 +532,13 @@ float junction_deviation = 0.1;
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
//this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
int32_t target[NUM_AXIS];
target[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]);
target[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]);
target[Z_AXIS] = lround(z * axis_steps_per_unit[Z_AXIS]);
target[E_AXIS] = lround(e * axis_steps_per_unit[E_AXIS + extruder]);
// this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
int32_t target[NUM_AXIS] = {
lround(x * axis_steps_per_unit[X_AXIS]),
lround(y * axis_steps_per_unit[Y_AXIS]),
lround(z * axis_steps_per_unit[Z_AXIS]),
lround(e * axis_steps_per_unit[E_AXIS + extruder])
};
// If changing extruder have to recalculate current position based on
// the steps-per-mm value for the new extruder.
......
......@@ -305,7 +305,7 @@ void checkHitEndstops() {
card.sdprinting = false;
card.closeFile();
#endif
for (int i = 0; i < 3; i++) CBI(axis_known_position, i); // not homed anymore
for (int i = 0; i < 3; i++) axis_known_position[i] = true; // not homed anymore
quickStop(); // kill the planner buffer
Stop(); // restart by M999
}
......@@ -656,12 +656,11 @@ ISR(TIMER1_COMPA_vect) {
trapezoid_generator_reset();
// Initialize Bresenham counters to 1/2 the ceiling
long new_count = -(current_block->step_event_count >> 1);
counter_X = counter_Y = counter_Z = counter_E = new_count;
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
#if ENABLED(COLOR_MIXING_EXTRUDER)
for (uint8_t i = 0; i < DRIVER_EXTRUDERS; i++)
counter_m[i] = new_count;
counter_m[i] = -(current_block->step_event_count >> 1);
#endif
step_events_completed = 0;
......
......@@ -188,7 +188,7 @@
#define E5_ENABLE_READ READ(E5_ENABLE_PIN)
#if ENABLED(COLOR_MIXING_EXTRUDER)
#define E_STEP_WRITE(v) ; /* not used for mixing extruders! */
#define E_STEP_WRITE(v) NOOP /* not used for mixing extruders! */
#if DRIVER_EXTRUDERS > 5
#define En_STEP_WRITE(n,v) { switch (n) { case 0: E0_STEP_WRITE(v); break; case 1: E1_STEP_WRITE(v); break; case 2: E2_STEP_WRITE(v); break; case 3: E3_STEP_WRITE(v); break; case 4: E4_STEP_WRITE(v); break; case 5: E5_STEP_WRITE(v); } }
#define NORM_E_DIR() { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); E2_DIR_WRITE(!INVERT_E2_DIR); E3_DIR_WRITE(!INVERT_E3_DIR); E4_DIR_WRITE(!INVERT_E4_DIR); E5_DIR_WRITE(!INVERT_E5_DIR); }
......@@ -254,7 +254,7 @@
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); } while (0)
#elif HAS(X_ENABLE)
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
#else
#define enable_x() ;
#define disable_x() ;
......@@ -266,7 +266,7 @@
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }
#else
#define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }
#endif
#else
#define enable_y() ;
......@@ -276,10 +276,10 @@
#if HAS(Z_ENABLE)
#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#endif
#else
#define enable_z() ;
......@@ -305,16 +305,16 @@
#define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
#endif
#define enable_e1() ;
#define disable_e1() ;
#define enable_e2() ;
#define disable_e2() ;
#define enable_e3() ;
#define disable_e3() ;
#define enable_e4() ;
#define disable_e4() ;
#define enable_e5() ;
#define disable_e5() ;
#define enable_e1() NOOP
#define disable_e1() NOOP
#define enable_e2() NOOP
#define disable_e2() NOOP
#define enable_e3() NOOP
#define disable_e3() NOOP
#define enable_e4() NOOP
#define disable_e4() NOOP
#define enable_e5() NOOP
#define disable_e5() NOOP
#else // !COLOR_MIXING_EXTRUDER
......@@ -322,48 +322,48 @@
#define enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e0() /* nothing */
#define disable_e0() /* nothing */
#define enable_e0() NOOP
#define disable_e0() NOOP
#endif
#if (DRIVER_EXTRUDERS > 1) && HAS(E1_ENABLE)
#define enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e1() /* nothing */
#define disable_e1() /* nothing */
#define enable_e1() NOOP
#define disable_e1() NOOP
#endif
#if (DRIVER_EXTRUDERS > 2) && HAS(E2_ENABLE)
#define enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e2() /* nothing */
#define disable_e2() /* nothing */
#define enable_e2() NOOP
#define disable_e2() NOOP
#endif
#if (DRIVER_EXTRUDERS > 3) && HAS(E3_ENABLE)
#define enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e3() /* nothing */
#define disable_e3() /* nothing */
#define enable_e3() NOOP
#define disable_e3() NOOP
#endif
#if (DRIVER_EXTRUDERS > 4) && HAS(E4_ENABLE)
#define enable_e4() E4_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e4() E4_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e4() /* nothing */
#define disable_e4() /* nothing */
#define enable_e4() NOOP
#define disable_e4() NOOP
#endif
#if (DRIVER_EXTRUDERS > 5) && HAS(E5_ENABLE)
#define enable_e5() E5_ENABLE_WRITE( E_ENABLE_ON)
#define disable_e5() E5_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_e5() /* nothing */
#define disable_e5() /* nothing */
#define enable_e5() NOOP
#define disable_e5() NOOP
#endif
#endif
......
......@@ -612,30 +612,24 @@
char* valuetemp;
memset(buffer, 0, sizeof(buffer));
strcat(buffer, TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? "X" : "?");
if (TEST(axis_was_homed, X_AXIS)) {
strcat(buffer, (axis_known_position[X_AXIS] ? "X" : "?"));
if (axis_homed[X_AXIS]) {
valuetemp = ftostr4sign(current_position[X_AXIS]);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
strcat(buffer, TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? PSTR(" Y") : PSTR(" ?"));
if (TEST(axis_was_homed, Y_AXIS)) {
strcat(buffer, (axis_known_position[Y_AXIS] ? " Y" : " ?"));
if (axis_homed[Y_AXIS]) {
valuetemp = ftostr4sign(current_position[Y_AXIS]);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
strcat(buffer, TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? PSTR(" Z ") : PSTR("? "));
if (TEST(axis_was_homed, Z_AXIS)) {
strcat(buffer, (axis_known_position[Z_AXIS] ? " Z " : " ? "));
if (axis_homed[Z_AXIS]) {
valuetemp = ftostr32sp(current_position[Z_AXIS] + 0.00001);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
LedCoord1.setText(buffer);
LedCoord6.setText(buffer);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment