Commit 93f4bbb8 authored by MagoKimbra's avatar MagoKimbra

Same Fix

parent fcf48a89
......@@ -797,7 +797,7 @@ void Config_PrintSettings(bool forReplay) {
ECHO_LM(DB, "Filament settings: Disabled");
}
}
ConfigSD_PrintSettings(forReplay);
if (printer_usage_seconds > 0) ConfigSD_PrintSettings(forReplay);
}
void ConfigSD_PrintSettings(bool forReplay) {
......@@ -872,6 +872,7 @@ void ConfigSD_PrintSettings(bool forReplay) {
}
card.closeFile(false);
config_readed = true;
ConfigSD_PrintSettings(true);
}
int ConfigSD_KeyIndex(char *key) { //At the moment a binary search algorithm is used for simplicity, if it will be necessary (Eg. tons of key), an hash search algorithm will be implemented.
......
......@@ -459,6 +459,7 @@ unsigned long printer_usage_seconds;
//===========================================================================
//================================ Functions ================================
//===========================================================================
void get_arc_coordinates();
bool setTargetedHotend(int code);
......@@ -579,7 +580,6 @@ void setup_homepin(void) {
#endif
}
void setup_photpin() {
#if HAS_PHOTOGRAPH
OUT_WRITE(PHOTOGRAPH_PIN, LOW);
......@@ -735,6 +735,7 @@ void setup() {
pinMode(STAT_LED_RED, OUTPUT);
digitalWrite(STAT_LED_RED, LOW); // turn it off
#endif
#ifdef STAT_LED_BLUE
pinMode(STAT_LED_BLUE, OUTPUT);
digitalWrite(STAT_LED_BLUE, LOW); // turn it off
......@@ -1257,8 +1258,8 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
st_synchronize();
endstops_hit_on_purpose(); // clear endstop hit flags
// Get the current stepper position after bumping an endstop
current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
// make sure the planner knows where we are as it may be a bit different than we last said to move to
sync_plan_position();
}
......@@ -2613,12 +2614,6 @@ inline void gcode_G4() {
* Y Home to the Y endstop
* Z Home to the Z endstop
*
* If numbers are included with XYZ set the position as with G92
* Currently adds the home_offset, which may be wrong and removed soon.
*
* Xn Home X, setting X to n + home_offset[X_AXIS]
* Yn Home Y, setting Y to n + home_offset[Y_AXIS]
* Zn Home Z, setting Z to n + home_offset[Z_AXIS]
*/
inline void gcode_G28(boolean home_x = false, boolean home_y = false) {
......@@ -3800,7 +3795,7 @@ inline void gcode_M42() {
* L = Number of legs of movement before probe
*
* This function assumes the bed has been homed. Specifically, that a G28 command
* as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
* as been issued prior to invoking the M49 Z-Probe repeatability measurement function.
* Any information generated by a prior G29 Bed leveling command will be lost and need to be
* regenerated.
*/
......@@ -3817,6 +3812,9 @@ inline void gcode_M42() {
}
}
if (verbose_level > 0)
ECHO_LM(DB, "M49 Z-Probe Repeatability test");
if (code_seen('P') || code_seen('p')) {
n_samples = code_value_short();
if (n_samples < 4 || n_samples > 50) {
......@@ -3825,8 +3823,6 @@ inline void gcode_M42() {
}
}
if (verbose_level > 0) ECHO_LM(DB, "M49 Z-Probe Repeatability test");
double X_probe_location, Y_probe_location,
X_current = X_probe_location = st_get_position_mm(X_AXIS),
Y_current = Y_probe_location = st_get_position_mm(Y_AXIS),
......@@ -3926,8 +3922,8 @@ inline void gcode_M42() {
if (radius < 0.0) radius = -radius;
X_current = X_probe_location + cos(theta) * radius;
Y_current = Y_probe_location + sin(theta) * radius;
X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
Y_current = Y_probe_location + sin(theta) * radius;
Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
if (verbose_level > 3) {
......@@ -3983,6 +3979,8 @@ inline void gcode_M42() {
ECHO_E;
}
if (verbose_level > 0) ECHO_E;
plan_buffer_line(X_probe_location, Y_probe_location, Z_start_location, current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder, active_driver);
st_synchronize();
......@@ -4154,7 +4152,7 @@ inline void gcode_M104() {
inline void gcode_M105() {
if (setTargetedHotend(105)) return;
#if HAS_TEMP_0 || HAS_TEMP_BED
#if HAS_TEMP_0 || HAS_TEMP_BED || defined(HEATER_0_USES_MAX6675)
ECHO_S(OK);
#if HAS_TEMP_0
ECHO_MV(" T:", degHotend(target_extruder), 1);
......
......@@ -620,6 +620,8 @@ ISR(TIMER1_COMPA_vect) {
{
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_probe_hit = true;
// if (z_probe_endstop && old_z_probe_endstop) ECHO_EV("z_probe_endstop = true");
}
old_z_probe_endstop = z_probe_endstop;
#endif
......@@ -653,6 +655,9 @@ ISR(TIMER1_COMPA_vect) {
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_z_hit = true;
// if (z_max_both) ECHO_EV("z_max_endstop = true");
// if (z2_max_both) ECHO_EV("z2_max_endstop = true");
if (!performing_homing || (performing_homing && z_max_both && z2_max_both)) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count;
}
......@@ -790,6 +795,7 @@ ISR(TIMER1_COMPA_vect) {
#endif
}
else if (step_events_completed > (unsigned long)current_block->decelerate_after) {
MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
if (step_rate > acc_step_rate) { // Check step_rate stays positive
......
......@@ -276,28 +276,28 @@ static void lcd_status_screen() {
#ifdef LCD_PROGRESS_BAR
millis_t ms = millis();
#ifndef PROGRESS_MSG_ONCE
if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progressBarTick = ms;
if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
progress_bar_ms = ms;
}
#endif
#if PROGRESS_MSG_EXPIRE > 0
// Handle message expire
if (expireStatusMillis > 0) {
if (expire_status_ms > 0) {
if (card.isFileOpen()) {
// Expire the message when printing is active
if (IS_SD_PRINTING) {
// Expire the message when printing is active
if (ms >= expireStatusMillis) {
if (ms >= expire_status_ms) {
lcd_status_message[0] = '\0';
expireStatusMillis = 0;
expire_status_ms = 0;
}
}
else {
expireStatusMillis += LCD_UPDATE_INTERVAL;
expire_status_ms += LCD_UPDATE_INTERVAL;
}
}
else {
expireStatusMillis = 0;
expire_status_ms = 0;
}
}
#endif
......@@ -1557,9 +1557,9 @@ void lcd_ignore_click(bool b) {
void lcd_finishstatus(bool persist=false) {
#ifdef LCD_PROGRESS_BAR
progressBarTick = millis();
progress_bar_ms = millis();
#if PROGRESS_MSG_EXPIRE > 0
expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
#endif
#endif
lcdDrawUpdate = 2;
......@@ -1570,7 +1570,7 @@ void lcd_finishstatus(bool persist=false) {
}
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus() { expireStatusMillis = 0; }
void dontExpireStatus() { expire_status_ms = 0; }
#endif
void set_utf_strlen(char *s, uint8_t n) {
......@@ -1583,6 +1583,8 @@ void set_utf_strlen(char *s, uint8_t n) {
s[i] = 0;
}
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, 3*LCD_WIDTH);
......@@ -1712,8 +1714,9 @@ void lcd_buzz(long duration, uint16_t freq) {
#if BEEPER > 0
SET_OUTPUT(BEEPER);
tone(BEEPER, freq, duration);
delay(duration);
#elif defined(LCD_USE_I2C_BUZZER)
lcd.buzz(duration,freq);
lcd.buzz(duration, freq);
#else
delay(duration);
#endif
......
......@@ -8,6 +8,7 @@
int lcd_strlen_P(const char *s);
void lcd_update();
void lcd_init();
bool lcd_hasstatus();
void lcd_setstatus(const char* message, const bool persist=false);
void lcd_setstatuspgm(const char* message, const uint8_t level=0);
void lcd_setalertstatuspgm(const char* message);
......@@ -108,6 +109,7 @@
#else //no LCD
FORCE_INLINE void lcd_update() {}
FORCE_INLINE void lcd_init() {}
FORCE_INLINE bool lcd_hasstatus() { return false; }
FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {}
FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {}
FORCE_INLINE void lcd_buttons_update() {}
......@@ -115,8 +117,8 @@
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
FORCE_INLINE bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)
#define LCD_MESSAGEPGM(x) do{}while(0)
#define LCD_ALERTMESSAGEPGM(x) do{}while(0)
#endif //ULTRA_LCD
......
......@@ -202,9 +202,9 @@
#include "utf_mapper.h"
#ifdef LCD_PROGRESS_BAR
static uint16_t progressBarTick = 0;
static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0
static uint16_t expireStatusMillis = 0;
static millis_t expire_status_ms = 0;
#endif
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
......@@ -634,8 +634,9 @@ static void lcd_implementation_status_screen() {
#ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) {
if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
// draw the progress bar
// Draw the progress bar if the message has shown long enough
// or if there is no message set.
if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH+1], b = ' ';
......
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