Commit 3a7dea0b authored by MagoKimbra's avatar MagoKimbra

Update LCD

parent 9f3e404f
...@@ -50,7 +50,8 @@ uint8_t debugLevel = DEBUG_ERRORS; ...@@ -50,7 +50,8 @@ uint8_t debugLevel = DEBUG_ERRORS;
static float feedrate = 1500.0, saved_feedrate; static float feedrate = 1500.0, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 }; float current_position[NUM_AXIS] = { 0.0 };
float destination[NUM_AXIS] = { 0.0 }; float destination[NUM_AXIS] = { 0.0 };
bool axis_known_position[3] = { false }; uint8_t axis_known_position = 0;
uint8_t axis_was_homed = 0;
bool pos_saved = false; bool pos_saved = false;
float stored_position[NUM_POSITON_SLOTS][NUM_AXIS]; float stored_position[NUM_POSITON_SLOTS][NUM_AXIS];
...@@ -913,6 +914,7 @@ void get_command() { ...@@ -913,6 +914,7 @@ void get_command() {
bool code_has_value() { bool code_has_value() {
int i = 1; int i = 1;
char c = seen_pointer[i]; char c = seen_pointer[i];
while (c == ' ') c = seen_pointer[++i];
if (c == '-' || c == '+') c = seen_pointer[++i]; if (c == '-' || c == '+') c = seen_pointer[++i];
if (c == '.') c = seen_pointer[++i]; if (c == '.') c = seen_pointer[++i];
return (c >= '0' && c <= '9'); return (c >= '0' && c <= '9');
...@@ -1358,7 +1360,7 @@ static void clean_up_after_endstop_move() { ...@@ -1358,7 +1360,7 @@ static void clean_up_after_endstop_move() {
#if HAS(SERVO_ENDSTOPS) && HASNT(Z_PROBE_SLED) #if HAS(SERVO_ENDSTOPS) && HASNT(Z_PROBE_SLED)
void raise_z_for_servo() { void raise_z_for_servo() {
float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING; float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_PROBING;
z_dest += axis_known_position[Z_AXIS] ? zprobe_zoffset : zpos; z_dest += TEST(axis_was_homed, Z_AXIS) ? zprobe_zoffset : zpos;
if (zpos < z_dest) do_blocking_move_to_z(z_dest); // also updates current_position if (zpos < z_dest) do_blocking_move_to_z(z_dest); // also updates current_position
} }
#endif #endif
...@@ -1480,7 +1482,8 @@ static void clean_up_after_endstop_move() { ...@@ -1480,7 +1482,8 @@ static void clean_up_after_endstop_move() {
destination[axis] = current_position[axis]; destination[axis] = current_position[axis];
feedrate = 0.0; feedrate = 0.0;
endstops_hit_on_purpose(); // clear endstop hit flags endstops_hit_on_purpose(); // clear endstop hit flags
axis_known_position[axis] = true; BITSET(axis_was_homed, axis);
BITSET(axis_known_position, axis);
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
// bring probe back // bring probe back
...@@ -1589,7 +1592,8 @@ static void clean_up_after_endstop_move() { ...@@ -1589,7 +1592,8 @@ static void clean_up_after_endstop_move() {
destination[axis] = current_position[axis]; destination[axis] = current_position[axis];
feedrate = 0.0; feedrate = 0.0;
endstops_hit_on_purpose(); // clear endstop hit flags endstops_hit_on_purpose(); // clear endstop hit flags
axis_known_position[axis] = true; BITSET(axis_was_homed, axis);
BITSET(axis_known_position, axis);
} }
} }
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
...@@ -2534,9 +2538,9 @@ static void clean_up_after_endstop_move() { ...@@ -2534,9 +2538,9 @@ static void clean_up_after_endstop_move() {
void gcode_get_mix() { void gcode_get_mix() {
const char* mixing_codes = "ABCDHI"; const char* mixing_codes = "ABCDHI";
float mix_total = 0.0; float mix_total = 0.0;
for (int8_t e = 0; e < DRIVER_EXTRUDERS; e++) { for (int8_t i = 0; i < DRIVER_EXTRUDERS; i++) {
float v = code_seen(mixing_codes[e]) ? code_value() : mixing_factor[e]; float v = code_seen(mixing_codes[i]) ? code_value() : mixing_factor[i];
mixing_factor[e] = v; mixing_factor[i] = v;
mix_total += v; mix_total += v;
} }
...@@ -2544,8 +2548,8 @@ static void clean_up_after_endstop_move() { ...@@ -2544,8 +2548,8 @@ static void clean_up_after_endstop_move() {
if (mix_total < 0.9999 || mix_total > 1.0001) { if (mix_total < 0.9999 || mix_total > 1.0001) {
ECHO_EM("Warning: Mix factors must add up to 1.0. Scaling."); ECHO_EM("Warning: Mix factors must add up to 1.0. Scaling.");
float mix_scale = 1.0 / mix_total; float mix_scale = 1.0 / mix_total;
for (int8_t e = 0; e < DRIVER_EXTRUDERS; e++) for (int8_t i = 0; i < DRIVER_EXTRUDERS; i++)
mixing_factor[e] *= mix_scale; mixing_factor[i] *= mix_scale;
} }
} }
#endif #endif
...@@ -2587,7 +2591,6 @@ static void clean_up_after_endstop_move() { ...@@ -2587,7 +2591,6 @@ static void clean_up_after_endstop_move() {
set_destination_to_current(); set_destination_to_current();
if (retracting) { if (retracting) {
feedrate = retract_feedrate * 60; feedrate = retract_feedrate * 60;
current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder]; current_position[E_AXIS] += (swapping ? retract_length_swap : retract_length) / volumetric_multiplier[active_extruder];
plan_set_e_position(current_position[E_AXIS]); plan_set_e_position(current_position[E_AXIS]);
...@@ -2604,7 +2607,6 @@ static void clean_up_after_endstop_move() { ...@@ -2604,7 +2607,6 @@ static void clean_up_after_endstop_move() {
} }
} }
else { else {
if (retract_zlift > 0.01) { if (retract_zlift > 0.01) {
current_position[Z_AXIS] += retract_zlift; current_position[Z_AXIS] += retract_zlift;
#if MECH(DELTA) || MECH(SCARA) #if MECH(DELTA) || MECH(SCARA)
...@@ -2644,7 +2646,7 @@ static void clean_up_after_endstop_move() { ...@@ -2644,7 +2646,7 @@ static void clean_up_after_endstop_move() {
if (debugLevel & DEBUG_INFO) if (debugLevel & DEBUG_INFO)
ECHO_LMV(INFO, "dock_sled", dock); ECHO_LMV(INFO, "dock_sled", dock);
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) { if (axis_known_position & (BIT(X_AXIS)|BIT(Y_AXIS)) != BIT(X_AXIS)|BIT(Y_AXIS)) {
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
ECHO_LM(DB, MSG_POSITION_UNKNOWN); ECHO_LM(DB, MSG_POSITION_UNKNOWN);
return; return;
...@@ -3303,7 +3305,7 @@ inline void gcode_G28() { ...@@ -3303,7 +3305,7 @@ inline void gcode_G28() {
else if (homeZ) { // Don't need to Home Z twice else if (homeZ) { // Don't need to Home Z twice
// Let's see if X and Y are homed // Let's see if X and Y are homed
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { if (axis_was_homed & (BIT(X_AXIS)|BIT(Y_AXIS)) == BIT(X_AXIS)|BIT(Y_AXIS)) {
// Make sure the probe is within the physical limits // Make sure the probe is within the physical limits
// NOTE: This doesn't necessarily ensure the probe is also within the bed! // NOTE: This doesn't necessarily ensure the probe is also within the bed!
...@@ -3348,7 +3350,7 @@ inline void gcode_G28() { ...@@ -3348,7 +3350,7 @@ inline void gcode_G28() {
if (home_all_axis || homeZ) { if (home_all_axis || homeZ) {
// Let's see if X and Y are homed // Let's see if X and Y are homed
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) { if (axis_was_homed & (BIT(X_AXIS)|BIT(Y_AXIS)) == BIT(X_AXIS)|BIT(Y_AXIS)) {
current_position[Z_AXIS] = 0; current_position[Z_AXIS] = 0;
sync_plan_position(); sync_plan_position();
...@@ -3477,7 +3479,7 @@ inline void gcode_G28() { ...@@ -3477,7 +3479,7 @@ inline void gcode_G28() {
ECHO_LM(INFO, "gcode_G29 >>>"); ECHO_LM(INFO, "gcode_G29 >>>");
// Don't allow auto-leveling without homing first // Don't allow auto-leveling without homing first
if (!axis_known_position[X_AXIS] || !axis_known_position[Y_AXIS]) { if (axis_known_position & (BIT(X_AXIS)|BIT(Y_AXIS)) != BIT(X_AXIS)|BIT(Y_AXIS)) {
LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN); LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
ECHO_LM(ER, MSG_POSITION_UNKNOWN); ECHO_LM(ER, MSG_POSITION_UNKNOWN);
return; return;
...@@ -6151,7 +6153,7 @@ inline void gcode_M428() { ...@@ -6151,7 +6153,7 @@ inline void gcode_M428() {
memcpy(new_pos, current_position, sizeof(new_pos)); memcpy(new_pos, current_position, sizeof(new_pos));
memcpy(new_offs, home_offset, sizeof(new_offs)); memcpy(new_offs, home_offset, sizeof(new_offs));
for (int8_t i = X_AXIS; i <= Z_AXIS; i++) { for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
if (axis_known_position[i]) { if (TEST(axis_known_position, i)) {
#if MECH(DELTA) #if MECH(DELTA)
float base = (new_pos[i] > (min_pos[i] + max_pos[i]) / 2) ? base_home_pos[i] : 0, float base = (new_pos[i] > (min_pos[i] + max_pos[i]) / 2) ? base_home_pos[i] : 0,
#else #else
......
...@@ -103,6 +103,11 @@ extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional ...@@ -103,6 +103,11 @@ extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional
extern float current_position[NUM_AXIS]; extern float current_position[NUM_AXIS];
extern float destination[NUM_AXIS]; extern float destination[NUM_AXIS];
extern float home_offset[3]; extern float home_offset[3];
extern float min_pos[3];
extern float max_pos[3];
extern float zprobe_zoffset;
extern uint8_t axis_known_position;
extern uint8_t axis_was_homed;
// Hotend offset // Hotend offset
#if HOTENDS > 1 #if HOTENDS > 1
...@@ -132,11 +137,6 @@ extern float home_offset[3]; ...@@ -132,11 +137,6 @@ extern float home_offset[3];
extern float axis_scaling[3]; // Build size scaling extern float axis_scaling[3]; // Build size scaling
#endif #endif
extern float min_pos[3];
extern float max_pos[3];
extern bool axis_known_position[3];
extern float zprobe_zoffset;
// Lifetime stats // Lifetime stats
extern unsigned long printer_usage_seconds; // this can old about 136 year before go overflow. If you belive that you can live more than this please contact me. extern unsigned long printer_usage_seconds; // this can old about 136 year before go overflow. If you belive that you can live more than this please contact me.
// Filament stats // Filament stats
......
...@@ -354,7 +354,9 @@ static void lcd_implementation_status_screen() { ...@@ -354,7 +354,9 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
} }
// X, Y, Z-Coordinates // Print XYZ Coordinates
// If the axis was not homed, show "---"
// If the position is untrusted, show "?"
#define XYZ_BASELINE 38 #define XYZ_BASELINE 38
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
...@@ -364,30 +366,33 @@ static void lcd_implementation_status_screen() { ...@@ -364,30 +366,33 @@ static void lcd_implementation_status_screen() {
u8g.drawBox(0, 30, LCD_PIXEL_WIDTH, 9); u8g.drawBox(0, 30, LCD_PIXEL_WIDTH, 9);
#endif #endif
u8g.setColorIndex(0); // white on black u8g.setColorIndex(0); // white on black
u8g.setPrintPos(2, XYZ_BASELINE); u8g.setPrintPos(2, XYZ_BASELINE);
lcd_print('X'); 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 - 5);
u8g.drawPixel(8, XYZ_BASELINE - 3); u8g.drawPixel(8, XYZ_BASELINE - 3);
u8g.setPrintPos(10, XYZ_BASELINE); u8g.setPrintPos(10, XYZ_BASELINE);
if (axis_known_position[X_AXIS]) if (TEST(axis_was_homed, X_AXIS))
lcd_print(ftostr31ns(current_position[X_AXIS])); lcd_print(ftostr31ns(current_position[X_AXIS]));
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
u8g.setPrintPos(43, XYZ_BASELINE); u8g.setPrintPos(43, XYZ_BASELINE);
lcd_print('Y'); 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 - 5);
u8g.drawPixel(49, XYZ_BASELINE - 3); u8g.drawPixel(49, XYZ_BASELINE - 3);
u8g.setPrintPos(51, XYZ_BASELINE); u8g.setPrintPos(51, XYZ_BASELINE);
if (axis_known_position[Y_AXIS]) if (TEST(axis_was_homed, Y_AXIS))
lcd_print(ftostr31ns(current_position[Y_AXIS])); lcd_print(ftostr31ns(current_position[Y_AXIS]));
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
u8g.setPrintPos(83, XYZ_BASELINE); u8g.setPrintPos(83, XYZ_BASELINE);
lcd_print('Z'); 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 - 5);
u8g.drawPixel(89, XYZ_BASELINE - 3); u8g.drawPixel(89, XYZ_BASELINE - 3);
u8g.setPrintPos(91, XYZ_BASELINE); u8g.setPrintPos(91, XYZ_BASELINE);
if (axis_known_position[Z_AXIS]) if (TEST(axis_was_homed, Z_AXIS))
lcd_print(ftostr32sp(current_position[Z_AXIS])); lcd_print(ftostr32sp(current_position[Z_AXIS]));
else else
lcd_printPGM(PSTR("---.--")); lcd_printPGM(PSTR("---.--"));
......
...@@ -839,7 +839,7 @@ static void lcd_prepare_menu() { ...@@ -839,7 +839,7 @@ static void lcd_prepare_menu() {
// Level Bed // Level Bed
// //
#if ENABLED(AUTO_BED_LEVELING_FEATURE) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) if (axis_known_position & (BIT(X_AXIS)|BIT(Y_AXIS)) == BIT(X_AXIS)|BIT(Y_AXIS)) {
MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29")); MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29"));
#elif !MECH(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0 #elif !MECH(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0
MENU_ITEM(submenu, MSG_MBL_SETTING, config_lcd_level_bed); MENU_ITEM(submenu, MSG_MBL_SETTING, config_lcd_level_bed);
......
...@@ -236,6 +236,11 @@ ...@@ -236,6 +236,11 @@
#include "utf_mapper.h" #include "utf_mapper.h"
#if ENABLED(SHOW_BOOTSCREEN)
static void bootscreen();
static bool show_bootscreen = true;
#endif
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
static millis_t progress_bar_ms = 0; static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
...@@ -425,6 +430,10 @@ static void lcd_implementation_init( ...@@ -425,6 +430,10 @@ static void lcd_implementation_init(
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#endif #endif
#if ENABLED(SHOW_BOOTSCREEN)
if (show_bootscreen) bootscreen();
#endif
lcd_set_custom_characters( lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
progress_bar_set progress_bar_set
...@@ -452,6 +461,98 @@ char lcd_print(char* str) { ...@@ -452,6 +461,98 @@ char lcd_print(char* str) {
unsigned lcd_print(char c) { return charset_mapper(c); } unsigned lcd_print(char c) { return charset_mapper(c); }
#if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(int line) {
lcd.setCursor(0, 3);
for (int i = 0; i < LCD_WIDTH; i++)
lcd_print(' ');
}
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
void lcd_scroll(int col, int line, const char* text, int len, int time) {
char tmp[LCD_WIDTH + 1] = {0};
int n = max(lcd_strlen_P(text) - len, 0);
for (int i = 0; i <= n; i++) {
strncpy_P(tmp, text + i, min(len, LCD_WIDTH));
lcd.setCursor(col, line);
lcd_print(tmp);
delay(time / max(n, 1));
}
}
static void bootscreen() {
show_bootscreen = false;
byte top_left[8] = {
B00000,
B00000,
B00000,
B00000,
B00001,
B00010,
B00100,
B00100
};
byte top_right[8] = {
B00000,
B00000,
B00000,
B11100,
B11100,
B01100,
B00100,
B00100
};
byte botom_left[8] = {
B00100,
B00010,
B00001,
B00000,
B00000,
B00000,
B00000,
B00000
};
byte botom_right[8] = {
B00100,
B01000,
B10000,
B00000,
B00000,
B00000,
B00000,
B00000
};
lcd.createChar(0, top_left);
lcd.createChar(1, top_right);
lcd.createChar(2, botom_left);
lcd.createChar(3, botom_right);
lcd.clear();
#define TEXT_SCREEN_LOGO_SHIFT ((LCD_WIDTH/2) - 7)
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x01');
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 1); lcd_printPGM(PSTR("|MarlinKimbra|"));
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x03');
delay(1000);
#ifdef STRING_SPLASH_LINE1
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 3000);
#endif
#ifdef STRING_SPLASH_LINE2
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 3000);
#endif
#ifdef FIRMWARE_URL
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(FIRMWARE_URL), LCD_WIDTH, 5000);
#endif
}
#endif // SHOW_BOOTSCREEN
/* /*
Possible status screens: Possible status screens:
16x2 |000/000 B000/000| 16x2 |000/000 B000/000|
...@@ -561,6 +662,12 @@ static void lcd_implementation_status_screen() { ...@@ -561,6 +662,12 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, 1); 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 HOTENDS > 1 && TEMP_SENSOR_BED != 0
// If we both have a 2nd hotend and a heated bed, // If we both have a 2nd hotend and a heated bed,
...@@ -570,14 +677,14 @@ static void lcd_implementation_status_screen() { ...@@ -570,14 +677,14 @@ static void lcd_implementation_status_screen() {
#else #else
lcd.print('X'); lcd.print(TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? 'X' : '?');
if (axis_known_position[X_AXIS]) if (TEST(axis_was_homed, X_AXIS))
lcd.print(ftostr4sign(current_position[X_AXIS])); lcd.print(ftostr4sign(current_position[X_AXIS]));
else else
lcd_printPGM(PSTR(" ---")); lcd_printPGM(PSTR(" ---"));
lcd_printPGM(PSTR(" Y")); lcd_printPGM(TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? PSTR(" Y") : PSTR(" ?"));
if (axis_known_position[Y_AXIS]) if (TEST(axis_was_homed, Y_AXIS))
lcd.print(ftostr4sign(current_position[Y_AXIS])); lcd.print(ftostr4sign(current_position[Y_AXIS]));
else else
lcd_printPGM(PSTR(" ---")); lcd_printPGM(PSTR(" ---"));
...@@ -587,8 +694,8 @@ static void lcd_implementation_status_screen() { ...@@ -587,8 +694,8 @@ static void lcd_implementation_status_screen() {
#endif // LCD_WIDTH >= 20 #endif // LCD_WIDTH >= 20
lcd.setCursor(LCD_WIDTH - 8, 1); lcd.setCursor(LCD_WIDTH - 8, 1);
lcd_printPGM(PSTR("Z ")); lcd_printPGM(TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? PSTR("Z ") : PSTR("? "));
if (axis_known_position[Z_AXIS]) if (TEST(axis_was_homed, Z_AXIS))
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
else else
lcd_printPGM(PSTR("---.--")); lcd_printPGM(PSTR("---.--"));
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
// Macros for bit masks // Macros for bit masks
#define BIT(b) (1<<(b)) #define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0) #define TEST(n,b) (((n)&BIT(b))!=0)
#define BITSET(n,b) n |= BIT(b)
#define BITCLR(n,b) n &= ~BIT(b)
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b)) #define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (BIT(b))
// Macros for maths shortcuts // Macros for maths shortcuts
......
...@@ -696,7 +696,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -696,7 +696,7 @@ ISR(TIMER1_COMPA_vect) {
#if ENABLED(COLOR_MIXING_EXTRUDER) #if ENABLED(COLOR_MIXING_EXTRUDER)
long dir = TEST(out_bits, E_AXIS) ? -1 : 1; long dir = TEST(out_bits, E_AXIS) ? -1 : 1;
for (uint8_t j = 0; j < DRIVER_EXTRUDERS; j++) { for (int8_t j = 0; j < DRIVER_EXTRUDERS; j++) {
counter_m[j] += current_block->mix_steps[j]; counter_m[j] += current_block->mix_steps[j];
if (counter_m[j] > 0) { if (counter_m[j] > 0) {
counter_m[j] -= current_block->step_event_count; counter_m[j] -= current_block->step_event_count;
......
...@@ -180,10 +180,10 @@ ...@@ -180,10 +180,10 @@
#if ENABLED(DUAL_X_CARRIAGE) && HAS(X_ENABLE) && HAS(X2_ENABLE) #if ENABLED(DUAL_X_CARRIAGE) && HAS(X_ENABLE) && HAS(X2_ENABLE)
#define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0) #define enable_x() do { X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); } while (0)
#define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } while (0) #define disable_x() do { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); BITCLR(axis_known_position, X_AXIS); } while (0)
#elif HAS(X_ENABLE) #elif HAS(X_ENABLE)
#define enable_x() X_ENABLE_WRITE( X_ENABLE_ON) #define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; } #define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); BITCLR(axis_known_position, X_AXIS); }
#else #else
#define enable_x() ; #define enable_x() ;
#define disable_x() ; #define disable_x() ;
...@@ -192,10 +192,10 @@ ...@@ -192,10 +192,10 @@
#if HAS(Y_ENABLE) #if HAS(Y_ENABLE)
#if ENABLED(Y_DUAL_STEPPER_DRIVERS) #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
#define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); } #define enable_y() { Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); BITCLR(axis_known_position, Y_AXIS); }
#else #else
#define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON) #define enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; } #define disable_y() { Y_ENABLE_WRITE(!Y_ENABLE_ON); BITCLR(axis_known_position, Y_AXIS); }
#endif #endif
#else #else
#define enable_y() ; #define enable_y() ;
...@@ -205,10 +205,10 @@ ...@@ -205,10 +205,10 @@
#if HAS(Z_ENABLE) #if HAS(Z_ENABLE)
#if ENABLED(Z_DUAL_STEPPER_DRIVERS) #if ENABLED(Z_DUAL_STEPPER_DRIVERS)
#define enable_z() { Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); } #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); axis_known_position[Z_AXIS] = false; } #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); BITCLR(axis_known_position, Z_AXIS); }
#else #else
#define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON) #define enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; } #define disable_z() { Z_ENABLE_WRITE(!Z_ENABLE_ON); BITCLR(axis_known_position, Z_AXIS); }
#endif #endif
#else #else
#define enable_z() ; #define enable_z() ;
......
...@@ -528,24 +528,24 @@ ...@@ -528,24 +528,24 @@
char* valuetemp; char* valuetemp;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
strcat(buffer, "X"); strcat(buffer, TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? "X" : "?");
if (axis_known_position[X_AXIS]) { if (TEST(axis_was_homed, X_AXIS)) {
valuetemp = ftostr4sign(current_position[X_AXIS]); valuetemp = ftostr4sign(current_position[X_AXIS]);
strcat(buffer, valuetemp); strcat(buffer, valuetemp);
} }
else else
strcat(buffer, "---"); strcat(buffer, "---");
strcat(buffer, " Y"); strcat(buffer, TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? PSTR(" Y") : PSTR(" ?"));
if (axis_known_position[Y_AXIS]) { if (TEST(axis_was_homed, Y_AXIS)) {
valuetemp = ftostr4sign(current_position[Y_AXIS]); valuetemp = ftostr4sign(current_position[Y_AXIS]);
strcat(buffer, valuetemp); strcat(buffer, valuetemp);
} }
else else
strcat(buffer, "---"); strcat(buffer, "---");
strcat(buffer, " Z"); strcat(buffer, TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? PSTR("Z ") : PSTR("? "));
if (axis_known_position[Z_AXIS]) { if (TEST(axis_was_homed, Z_AXIS)) {
valuetemp = ftostr32sp(current_position[Z_AXIS] + 0.00001); valuetemp = ftostr32sp(current_position[Z_AXIS] + 0.00001);
strcat(buffer, valuetemp); strcat(buffer, valuetemp);
} }
......
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