Commit ecadaf77 authored by MagoKimbra's avatar MagoKimbra

Update ultralcd.cpp

parent b194f5e1
...@@ -816,26 +816,26 @@ static void lcd_prepare_menu() { ...@@ -816,26 +816,26 @@ static void lcd_prepare_menu() {
} }
#endif // DELTA #endif // DELTA
inline void line_to_current() { inline void line_to_current(AxisEnum axis) {
#ifdef DELTA #ifdef DELTA
calculate_delta(current_position); calculate_delta(current_position);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder, active_driver); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder, active_driver);
#else #else
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder, active_driver); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder, active_driver);
#endif #endif
} }
float move_menu_scale; float move_menu_scale;
static void lcd_move_menu_axis(); static void lcd_move_menu_axis();
static void _lcd_move(const char *name, int axis, int min, int max) { static void _lcd_move(const char *name, AxisEnum axis, int min, int max) {
if (encoderPosition != 0) { if (encoderPosition != 0) {
refresh_cmd_timeout(); refresh_cmd_timeout();
current_position[axis] += float((int)encoderPosition) * move_menu_scale; current_position[axis] += float((int)encoderPosition) * move_menu_scale;
if (min_software_endstops && current_position[axis] < min) current_position[axis] = min; if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
if (max_software_endstops && current_position[axis] > max) current_position[axis] = max; if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
encoderPosition = 0; encoderPosition = 0;
line_to_current(); line_to_current(axis);
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis])); if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
...@@ -848,7 +848,7 @@ static void lcd_move_e() { ...@@ -848,7 +848,7 @@ static void lcd_move_e() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
encoderPosition = 0; encoderPosition = 0;
line_to_current(); line_to_current(E_AXIS);
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS])); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
...@@ -1310,23 +1310,18 @@ void lcd_quick_feedback() { ...@@ -1310,23 +1310,18 @@ void lcd_quick_feedback() {
#endif #endif
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#elif defined(BEEPER) && BEEPER > -1 #elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#ifndef LCD_FEEDBACK_FREQUENCY_HZ #ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 5000 #define LCD_FEEDBACK_FREQUENCY_HZ 5000
#endif #endif
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2 #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
#endif #endif
const uint16_t delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2; lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
uint16_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000; #else
while (i--) { #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
WRITE(BEEPER,HIGH); #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
delayMicroseconds(delay); #endif
WRITE(BEEPER,LOW); delay(LCD_FEEDBACK_FREQUENCY_DURATION_MS);
delayMicroseconds(delay);
}
const uint16_t j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0);
if (j) delayMicroseconds(j);
#endif #endif
} }
...@@ -1713,9 +1708,19 @@ bool lcd_detected(void) { ...@@ -1713,9 +1708,19 @@ bool lcd_detected(void) {
} }
void lcd_buzz(long duration, uint16_t freq) { void lcd_buzz(long duration, uint16_t freq) {
#ifdef LCD_USE_I2C_BUZZER if (freq > 0) {
#if BEEPER > 0
SET_OUTPUT(BEEPER);
tone(BEEPER, freq, duration);
#elif defined(LCD_USE_I2C_BUZZER)
lcd.buzz(duration,freq); lcd.buzz(duration,freq);
#else
delay(duration);
#endif #endif
}
else {
delay(duration);
}
} }
bool lcd_clicked() { return LCD_CLICKED; } bool lcd_clicked() { return LCD_CLICKED; }
......
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