Commit 59733b03 authored by MagoKimbra's avatar MagoKimbra

Update

parent 002b9fbd
......@@ -16,8 +16,6 @@
Bed Probe and Delta geometry Autocalibration G30 A
* G31 - Dock Z Probe sled (if enabled)
* G32 - Undock Z Probe sled (if enabled)
* G60 - Store in memory the actual position
* G61 - Move X Y Z to position in memory
* G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates
* G92 - Set current position to cordinates given
......@@ -91,6 +89,12 @@
* M302 - Allow cold extrudes
* M303 - PID relay autotune S[temperature] sets the target temperature. (default target temperature = 150C)
* M304 - Set bed PID parameters P I and D
* M331 - Save current position coordinates (all axes, for active extruder).
* S<SLOT> - specifies memory slot # (0-based) to save into (default 0).
* M332 - Apply/restore saved coordinates to the active extruder.
* X Y Z E - Value to add at stored coordinates.
* F<speed> - Set Feedrate.
* S<SLOT> - specifies memory slot # (0-based) to restore from (default 0).
* M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly.
* M400 - Finish all moves
......
......@@ -6,6 +6,16 @@
* Add Acceleration retraction for extruder.
* Add EJerk for extruder
* Remove limit for virtual extruder to 4. Now width MKR4 or NPr2 is possible have infinite extruder...
* Add M92 T* E (Set step per unit for any extruder)
* Add M203 T* E (Set max feedrate for any extruder)
* Add M204 T* R (Set acc retraction for any extruder)
* Add M205 T* E (Set E Jerk for any extruder)
* Add M331 Save current position coordinates (all axes, for active extruder).
S<SLOT> - specifies memory slot # (0-based) to save into (default 0).
* Add M332 Apply/restore saved coordinates to the active extruder.
X Y Z E - Value to add at stored coordinates.
F<speed> - Set Feedrate.
S<SLOT> - specifies memory slot # (0-based) to save into (default 0).
### Version 4.1.2
* Serial message function standardized for a better code style
......
......@@ -381,6 +381,10 @@
#define MM_PER_ARC_SEGMENT 1
#define N_ARC_CORRECTION 25
// Defines the number of memory slots for saving/restoring position (M331/M332)
// The values should not be less than 1
#define NUM_POSITON_SLOTS 2
const unsigned int dropsegments = 5; // everything with less than this number of steps will be ignored as move and joined with the next movement
// Control heater 0 and heater 1 in parallel.
......
......@@ -262,7 +262,6 @@ extern float home_offset[3];
extern float min_pos[3];
extern float max_pos[3];
extern bool axis_known_position[3];
extern float lastpos[4];
extern float zprobe_zoffset;
// Lifetime stats
......
......@@ -92,8 +92,6 @@
* G30 - Single Z Probe, probes bed at current XY location. - Bed Probe and Delta geometry Autocalibration
* G31 - Dock sled (Z_PROBE_SLED only)
* G32 - Undock sled (Z_PROBE_SLED only)
* G60 - Store in memory actual position
* G61 - Move X Y Z to position in memory
* G90 - Use Absolute Coordinates
* G91 - Use Relative Coordinates
* G92 - Set current position to coordinates given
......@@ -181,6 +179,12 @@
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
* M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
* M304 - Set bed PID parameters P I and D
* M331 - Save current position coordinates (all axes, for active extruder).
* S<SLOT> - specifies memory slot # (0-based) to save into (default 0).
* M332 - Apply/restore saved coordinates to the active extruder.
* X Y Z E - Value to add at stored coordinates.
* F<speed> - Set Feedrate.
* S<SLOT> - specifies memory slot # (0-based) to restore from (default 0).
* M350 - Set microstepping mode.
* M351 - Toggle MS1 MS2 pins directly.
* M380 - Activate solenoid on active extruder
......@@ -235,9 +239,11 @@ uint8_t debugLevel = DEBUG_INFO|DEBUG_ERRORS;
static float feedrate = 1500.0, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 };
float destination[NUM_AXIS] = { 0.0 };
float lastpos[NUM_AXIS] = { 0.0 };
bool axis_known_position[3] = { false };
bool pos_saved = false;
float stored_position[NUM_POSITON_SLOTS][NUM_AXIS];
static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
static char *current_command, *current_command_args;
......@@ -562,7 +568,7 @@ bool enqueuecommand(const char *cmd) {
SET_OUTPUT(EXP_VOLTAGE_LEVEL_PIN);
WRITE(EXP_VOLTAGE_LEVEL_PIN,UI_VOLTAGE_LEVEL);
ExternalDac::begin(); //initialize ExternalDac
lcd_buzz(10,10);
buzz(10,10);
}
#endif
......@@ -3639,38 +3645,6 @@ inline void gcode_G28() {
}
#endif // DELTA && Z_PROBE_ENDSTOP
// G60: Store in memory actual position
inline void gcode_G60() {
memcpy(lastpos, current_position, sizeof(lastpos));
//ECHO_SMV(DB, " Lastpos X: ", lastpos[X_AXIS]);
//ECHO_MV(" Lastpos Y: ", lastpos[Y_AXIS]);
//ECHO_MV(" Lastpos Z: ", lastpos[Z_AXIS]);
//ECHO_EMV(" Lastpos E: ", lastpos[E_AXIS]);
}
// G61: move to X Y Z in memory
inline void gcode_G61() {
for(int8_t i = 0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) {
destination[i] = (float)code_value() + lastpos[i];
}
else {
destination[i] = current_position[i];
}
}
//ECHO_SMV(DB, " Move to X: ", destination[X_AXIS]);
//ECHO_MV(" Move to Y: ", destination[Y_AXIS]);
//ECHO_MV(" Move to Z: ", destination[Z_AXIS]);
//ECHO_EMV(" Move to E: ", destination[E_AXIS]);
if(code_seen('F')) {
float next_feedrate = code_value();
if(next_feedrate > 0.0) feedrate = next_feedrate;
}
//finish moves
prepare_move();
}
/**
* G92: Set current position to given X Y Z E
*/
......@@ -5091,7 +5065,7 @@ inline void gcode_M226() {
}
#endif // NUM_SERVOS > 0
#if HAS_LCD_BUZZ
#if HAS_BUZZER
/**
* M300: Play beep sound S<frequency Hz> P<duration ms>
......@@ -5100,10 +5074,10 @@ inline void gcode_M226() {
uint16_t beepS = code_seen('S') ? code_value_short() : 100;
uint32_t beepP = code_seen('P') ? code_value_long() : 1000;
if (beepP > 5000) beepP = 5000; // limit to 5 seconds
lcd_buzz(beepP, beepS);
buzz(beepP, beepS);
}
#endif // HAS_LCD_BUZZ
#endif // HAS_BUZZER
#ifdef PIDTEMP
......@@ -5175,6 +5149,73 @@ inline void gcode_M226() {
}
#endif // PIDTEMPBED
/**
* M331: save current position
* S<slot> specifies memory slot # (0-based) to save into (default 0)
*/
inline void gcode_M331() {
int slot = 0;
if (code_seen('S')) slot = code_value();
if (slot < 0 || slot >= NUM_POSITON_SLOTS) {
ECHO_LMV(ER, MSG_INVALID_POS_SLOT, (int)NUM_POSITON_SLOTS);
return;
}
memcpy(stored_position[slot], current_position, sizeof(*stored_position));
pos_saved = true;
ECHO_SM(DB, MSG_SAVED_POS);
ECHO_MV(" S", slot);
ECHO_MV("<-X:", stored_position[slot][X_AXIS]);
ECHO_MV(" Y:", stored_position[slot][Y_AXIS]);
ECHO_MV(" Z:", stored_position[slot][Z_AXIS]);
ECHO_EMV(" E:", stored_position[slot][E_AXIS]);
}
/**
* M332: Apply/restore saved coordinates to the active extruder.
* X Y Z E - Value to add at stored coordinates.
* F<speed> - Set Feedrate.
* S<slot> specifies memory slot # (0-based) to save into (default 0).
*/
inline void gcode_M332() {
if (!pos_saved) return;
bool make_move = false;
int slot = 0;
if (code_seen('S')) slot = code_value();
if (slot < 0 || slot >= NUM_POSITON_SLOTS) {
ECHO_LMV(ER, MSG_INVALID_POS_SLOT, (int)NUM_POSITON_SLOTS);
return;
}
ECHO_SM(DB, MSG_RESTORING_POS);
ECHO_MV(" S", slot);
ECHO_M("->");
if (code_seen('F')) {
float next_feedrate = code_value();
if (next_feedrate > 0.0) feedrate = next_feedrate;
}
for(int8_t i = 0; i < NUM_AXIS; i++) {
if(code_seen(axis_codes[i])) {
destination[i] = (float)code_value() + stored_position[slot][i];
}
else {
destination[i] = current_position[i];
}
ECHO_MV(" ", axis_codes[i]);
ECHO_MV(":", destination[i]);
}
ECHO_E;
//finish moves
prepare_move();
st_synchronize();
}
#if HAS_MICROSTEPS
// M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
inline void gcode_M350() {
......@@ -5450,7 +5491,7 @@ inline void gcode_M428() {
else {
ECHO_LM(ER, MSG_ERR_M428_TOO_FAR);
LCD_ALERTMESSAGEPGM("Err: Too far!");
#if HAS_LCD_BUZZ
#if HAS_BUZZER
enqueuecommands_P(PSTR("M300 S40 P200"));
#endif
err = true;
......@@ -5469,7 +5510,7 @@ inline void gcode_M428() {
#endif
ECHO_LM(DB, "Offset applied.");
LCD_ALERTMESSAGEPGM("Offset applied.");
#if HAS_LCD_BUZZ
#if HAS_BUZZER
enqueuecommands_P(PSTR("M300 S659 P200\nM300 S698 P200"));
#endif
}
......@@ -5528,7 +5569,7 @@ inline void gcode_M503() {
*
*/
inline void gcode_M600() {
float target[NUM_AXIS], fr60 = feedrate / 60;
float lastpos[NUM_AXIS], target[NUM_AXIS], fr60 = feedrate / 60;
filament_changing = true;
for (int i = 0; i < NUM_AXIS; i++)
target[i] = lastpos[i] = current_position[i];
......@@ -5605,7 +5646,7 @@ inline void gcode_M503() {
LCD_ALERTMESSAGEPGM("Zzzz Zzzz Zzzz");
}
if (beep) {
for(int8_t i = 0; i < 3; i++) lcd_buzz(100, 1000);
for(int8_t i = 0; i < 3; i++) buzz(100, 1000);
last_set = millis();
beep = false;
++cnt;
......@@ -6215,9 +6256,9 @@ void process_next_command() {
#endif // DELTA && Z_PROBE_ENDSTOP
case 60: // G60 Store in memory actual position
gcode_G60(); break;
gcode_M331(); break;
case 61: // G61 move to X Y Z in memory
gcode_G61(); break;
gcode_M332(); break;
case 90: // G90
relative_mode = false; break;
case 91: // G91
......@@ -6436,10 +6477,10 @@ void process_next_command() {
gcode_M280(); break;
#endif // NUM_SERVOS > 0
#if HAS_LCD_BUZZ
#if HAS_BUZZER
case 300: // M300 - Play beep tone
gcode_M300(); break;
#endif // HAS_LCD_BUZZ
#endif // HAS_BUZZER
#ifdef PIDTEMP
case 301: // M301
......@@ -6461,13 +6502,16 @@ void process_next_command() {
gcode_M304(); break;
#endif // PIDTEMPBED
case 331: // M331 Saved Coordinated
gcode_M331(); break;
case 332: // M332 Restored Coordinates
gcode_M332(); break;
#if HAS_MICROSTEPS
case 350: // M350 Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
gcode_M350();
break;
gcode_M350(); break;
case 351: // M351 Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
gcode_M351();
break;
gcode_M351(); break;
#endif // HAS_MICROSTEPS
#ifdef SCARA
......
......@@ -4,7 +4,7 @@
*/
#ifndef CONDITIONALS_H
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#ifndef CONFIGURATION_LCD // Get the LCD defines which are needed first
#define CONFIGURATION_LCD
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
......@@ -210,11 +210,6 @@
#endif
#endif
/**
* LCD BUZZ
*/
#define HAS_LCD_BUZZ (defined(ULTRA_LCD) || (defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
/**
* SPLASH_SCREEN_DURATION for no DOGLCD display
*/
......@@ -223,7 +218,7 @@
#define SPLASH_SCREEN_DURATION 500
#endif
#else // CONFIGURATION_LCD
#else // CONFIGURATION_LCD
#define CONDITIONALS_H
/**
......@@ -249,12 +244,7 @@
#endif
#endif
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "pins.h"
/**
......@@ -425,7 +415,7 @@
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS + active_extruder] / EXTRUSION_AREA)
#endif
#ifdef ULTIPANEL
#if defined(ULTIPANEL) && !defined(ELB_FULL_GRAPHIC_CONTROLLER)
#undef SDCARDDETECTINVERTED
#endif
......@@ -493,8 +483,6 @@
#elif TEMP_SENSOR_BED == 0
#undef BED_MINTEMP
#undef BED_MAXTEMP
#undef THERMAL_PROTECTION_BED
#undef THERMAL_PROTECTION_BED_PERIOD
#elif TEMP_SENSOR_BED > 0
#define THERMISTORBED TEMP_SENSOR_BED
#define BED_USES_THERMISTOR
......@@ -647,5 +635,10 @@
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
#endif //CONFIGURATION_LCD
/**
* LCD BUZZ
*/
#define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
#endif //CONFIGURATION_LCD
#endif //CONDITIONALS_H
......@@ -77,9 +77,9 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_E2 " E2"
#define MSG_E3 " E3"
#define MSG_E4 " E4"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
#define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......@@ -176,13 +176,18 @@
#define MSG_YSCALE "Y Scale"
#endif
// Extra
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
#define MSG_RETRACT_XMM "Retract " STRINGIFY(LCD_RETRACT_LENGTH) "mm"
#define MSG_SAVED_POS "Saved position"
#define MSG_RESTORING_POS "Restoring position"
#define MSG_INVALID_POS_SLOT "Invalid slot, total slots: "
// Firmware Test
#ifdef FIRMWARE_TEST
#define MSG_FWTEST_YES "Put the Y command to go next"
#define MSG_FWTEST_NO "Put the N command to go next"
......
......@@ -77,9 +77,9 @@
#define MSG_PID_P "PID-P"
#define MSG_PID_I "PID-I"
#define MSG_PID_D "PID-D"
#define MSG_E2 " E2"
#define MSG_E3 " E3"
#define MSG_E4 " E4"
#define MSG_H1 " H1"
#define MSG_H2 " H2"
#define MSG_H3 " H3"
#define MSG_ACC "Accel"
#define MSG_VXY_JERK "Vxy-jerk"
#define MSG_VZ_JERK "Vz-jerk"
......@@ -176,13 +176,18 @@
#define MSG_YSCALE "Y Scale"
#endif
// Extra
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configurazione"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
#define MSG_RETRACT_XMM "Retract " STRINGIFY(LCD_RETRACT_LENGTH) "mm"
#define MSG_SAVED_POS "Posizione Salvata"
#define MSG_RESTORING_POS "Restoring position"
#define MSG_INVALID_POS_SLOT "Invalid slot, total slots: "
// Firmware Test
#ifdef FIRMWARE_TEST
#define MSG_FWTEST_YES "Dai il comando Y per andare avanti"
#define MSG_FWTEST_NO "Dai il comando N per andare avanti"
......
......@@ -36,7 +36,6 @@
#if defined(PIDTEMPBED) || defined(PIDTEMP)
#define PID_dT ((OVERSAMPLENR * 14.0)/(F_CPU / 64.0 / 256.0))
#define RECI_PID_dT ( 1 / PID_dT )
#endif
//===========================================================================
......@@ -375,17 +374,14 @@ int getHeaterPower(int heater) {
#if HAS_AUTO_FAN
void setExtruderAutoFanState(int pin, bool state)
{
void setExtruderAutoFanState(int pin, bool state) {
unsigned char newFanSpeed = (state != 0) ? EXTRUDER_AUTO_FAN_SPEED : 0;
// this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode(pin, OUTPUT);
digitalWrite(pin, newFanSpeed);
analogWrite(pin, newFanSpeed);
}
void checkExtruderAutoFans()
{
void checkExtruderAutoFans() {
uint8_t fanState = 0;
// which fan pins need to be turned on?
......@@ -448,7 +444,7 @@ void checkExtruderAutoFans()
#endif
}
#endif // any extruder auto fan pins set
#endif // HAS_AUTO_FAN
//
// Temperature Error Handlers
......@@ -944,6 +940,20 @@ void tp_init() {
#if HAS_FILAMENT_SENSOR
ANALOG_SELECT(FILWIDTH_PIN);
#endif
#if HAS_AUTO_FAN_0
pinMode(EXTRUDER_0_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_1 && (EXTRUDER_1_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN)
pinMode(EXTRUDER_1_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_2 && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_2_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN)
pinMode(EXTRUDER_2_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_AUTO_FAN_3 && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_0_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_1_AUTO_FAN_PIN) && (EXTRUDER_3_AUTO_FAN_PIN != EXTRUDER_2_AUTO_FAN_PIN)
pinMode(EXTRUDER_3_AUTO_FAN_PIN, OUTPUT);
#endif
#if HAS_POWER_CONSUMPTION_SENSOR
ANALOG_SELECT(POWER_CONSUMPTION_PIN);
#endif
......@@ -979,7 +989,6 @@ void tp_init() {
#ifdef HEATER_0_MAXTEMP
TEMP_MAX_ROUTINE(0);
#endif
#if HOTENDS > 1
#ifdef HEATER_1_MINTEMP
TEMP_MIN_ROUTINE(1);
......
......@@ -520,16 +520,16 @@ static void lcd_tune_menu() {
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_multiplier, 10, 999);
#if TEMP_SENSOR_0 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 0", &target_temperature[0], 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if TEMP_SENSOR_1 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 1", &target_temperature[1], 0, HEATER_1_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if TEMP_SENSOR_2 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[2], 0, HEATER_2_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if TEMP_SENSOR_3 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[3], 0, HEATER_3_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if TEMP_SENSOR_BED != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP + LCD_MAX_TEMP_OFFSET);
......@@ -641,15 +641,15 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem
static void lcd_preheat_pla_menu() {
START_MENU(lcd_prepare_menu);
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
MENU_ITEM(function, MSG_PREHEAT_PLA " 1", lcd_preheat_pla0);
MENU_ITEM(function, MSG_PREHEAT_PLA " 0", lcd_preheat_pla0);
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_PLA " 2", lcd_preheat_pla1);
MENU_ITEM(function, MSG_PREHEAT_PLA " 1", lcd_preheat_pla1);
#endif //2 extruder preheat
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_PLA " 3", lcd_preheat_pla2);
MENU_ITEM(function, MSG_PREHEAT_PLA " 2", lcd_preheat_pla2);
#endif //3 extruder preheat
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_PLA " 4", lcd_preheat_pla3);
MENU_ITEM(function, MSG_PREHEAT_PLA " 3", lcd_preheat_pla3);
#endif //4 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
#if TEMP_SENSOR_BED != 0
......@@ -661,15 +661,15 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem
static void lcd_preheat_abs_menu() {
START_MENU(lcd_prepare_menu);
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
MENU_ITEM(function, MSG_PREHEAT_ABS " 1", lcd_preheat_abs0);
MENU_ITEM(function, MSG_PREHEAT_ABS " 0", lcd_preheat_abs0);
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_ABS " 2", lcd_preheat_abs1);
MENU_ITEM(function, MSG_PREHEAT_ABS " 1", lcd_preheat_abs1);
#endif //2 extruder preheat
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_ABS " 3", lcd_preheat_abs2);
MENU_ITEM(function, MSG_PREHEAT_ABS " 2", lcd_preheat_abs2);
#endif //3 extruder preheat
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_ABS " 4", lcd_preheat_abs3);
MENU_ITEM(function, MSG_PREHEAT_ABS " 3", lcd_preheat_abs3);
#endif //4 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
#if TEMP_SENSOR_BED != 0
......@@ -681,15 +681,15 @@ void lcd_preheat_gum0() { _lcd_preheat(0, gumPreheatHotendTemp, gumPreheatHPBTem
static void lcd_preheat_gum_menu() {
START_MENU(lcd_prepare_menu);
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
MENU_ITEM(function, MSG_PREHEAT_GUM " 1", lcd_preheat_gum0);
MENU_ITEM(function, MSG_PREHEAT_GUM " 0", lcd_preheat_gum0);
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_GUM " 2", lcd_preheat_gum1);
MENU_ITEM(function, MSG_PREHEAT_GUM " 1", lcd_preheat_gum1);
#endif //2 extruder preheat
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_GUM " 3", lcd_preheat_gum2);
MENU_ITEM(function, MSG_PREHEAT_GUM " 2", lcd_preheat_gum2);
#endif //3 extruder preheat
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
MENU_ITEM(function, MSG_PREHEAT_GUM " 4", lcd_preheat_gum3);
MENU_ITEM(function, MSG_PREHEAT_GUM " 3", lcd_preheat_gum3);
#endif //all extruder preheat
MENU_ITEM(function, MSG_PREHEAT_GUM_ALL, lcd_preheat_gum0123);
#if TEMP_SENSOR_BED != 0
......@@ -967,17 +967,17 @@ static void lcd_control_menu() {
PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
updatePID();
}
void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
void copy_and_scalePID_i_H0() { copy_and_scalePID_i(0); }
void copy_and_scalePID_d_H0() { copy_and_scalePID_d(0); }
#if HOTENDS > 1
void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
void copy_and_scalePID_i_H1() { copy_and_scalePID_i(1); }
void copy_and_scalePID_d_H1() { copy_and_scalePID_d(1); }
#if HOTENDS > 2
void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); }
void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
void copy_and_scalePID_i_H2() { copy_and_scalePID_i(2); }
void copy_and_scalePID_d_H2() { copy_and_scalePID_d(2); }
#if HOTENDS > 3
void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
void copy_and_scalePID_d_E4() { copy_and_scalePID_d(3); }
void copy_and_scalePID_i_H3() { copy_and_scalePID_i(3); }
void copy_and_scalePID_d_H4() { copy_and_scalePID_d(3); }
#endif //HOTENDS > 3
#endif //HOTENDS > 2
#endif //HOTENDS > 1
......@@ -1001,19 +1001,19 @@ static void lcd_control_temperature_menu() {
// Nozzle, Nozzle 2, Nozzle 3, Nozzle 4
//
#if TEMP_SENSOR_0 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 0", &target_temperature[0], 0, HEATER_0_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if HOTENDS > 1
#if TEMP_SENSOR_1 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 1", &target_temperature[1], 0, HEATER_1_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if HOTENDS > 2
#if TEMP_SENSOR_2 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[2], 0, HEATER_2_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#if HOTENDS > 3
#if TEMP_SENSOR_3 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP + LCD_MAX_TEMP_OFFSET);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[3], 0, HEATER_3_MAXTEMP + LCD_MAX_TEMP_OFFSET);
#endif
#endif //HOTENDS > 3
#endif //HOTENDS > 2
......@@ -1053,32 +1053,32 @@ static void lcd_control_temperature_menu() {
raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_H0);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_H0);
#if HOTENDS > 1
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_E2, &PID_PARAM(Kp,1), 1, 9990);
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_H1, &PID_PARAM(Kp,1), 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E2, &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_H1, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_H1);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_H1, &raw_Kd, 1, 9990, copy_and_scalePID_d_H1);
#if HOTENDS > 2
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_E3, &PID_PARAM(Kp,2), 1, 9990);
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_H2, &PID_PARAM(Kp,2), 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E3, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E3, &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_H2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_H2);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_H2, &raw_Kd, 1, 9990, copy_and_scalePID_d_H2);
#if HOTENDS > 3
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,3));
raw_Kd = unscalePID_d(PID_PARAM(Kd,3));
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_E4, &PID_PARAM(Kp,3), 1, 9990);
MENU_ITEM_EDIT(float52, MSG_PID_P MSG_H3, &PID_PARAM(Kp,3), 1, 9990);
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E4, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E4, &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_H3, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_H3);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_H3, &raw_Kd, 1, 9990, copy_and_scalePID_d_H3);
#endif //HOTENDS > 3
#endif //HOTENDS > 2
#endif //HOTENDS > 1
......@@ -1223,8 +1223,8 @@ static void lcd_control_motion_menu() {
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
#endif
#ifdef SCARA
MENU_ITEM_EDIT(float52, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
MENU_ITEM_EDIT(float52, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
#endif
END_MENU();
}
......@@ -1241,13 +1241,13 @@ static void lcd_control_volumetric_menu() {
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
if (volumetric_enabled) {
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 1", &filament_size[0], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 0", &filament_size[0], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
#if EXTRUDERS > 1
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 2", &filament_size[1], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 1", &filament_size[1], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
#if EXTRUDERS > 2
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 3", &filament_size[2], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 2", &filament_size[2], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
#if EXTRUDERS > 3
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 4", &filament_size[3], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER " 3", &filament_size[3], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
......@@ -1474,7 +1474,7 @@ void lcd_quick_feedback() {
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS (1000/6)
#endif
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#elif defined(BEEPER) && BEEPER >= 0
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
......@@ -1482,7 +1482,7 @@ void lcd_quick_feedback() {
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
#endif
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#else
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
......@@ -1913,7 +1913,12 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#endif
}
void lcd_buzz(long duration, uint16_t freq) {
bool lcd_clicked() { return LCD_CLICKED; }
#endif // ULTIPANEL
#if HAS_BUZZER
void buzz(long duration, uint16_t freq) {
if (freq > 0) {
#ifdef LCD_USE_I2C_BUZZER
lcd.buzz(duration, freq);
......@@ -1929,10 +1934,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
delay(duration);
}
}
bool lcd_clicked() { return LCD_CLICKED; }
#endif // ULTIPANEL
#endif
/*********************************/
/** Number to string conversion **/
......
......@@ -59,8 +59,6 @@
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
extern millis_t previous_lcd_status_ms;
#endif
void lcd_buzz(long duration,uint16_t freq);
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
bool lcd_clicked();
......@@ -117,7 +115,6 @@
FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {}
FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_reset_alert_level() {}
FORCE_INLINE void lcd_buzz(long duration, uint16_t freq) {}
FORCE_INLINE bool lcd_detected(void) { return true; }
#define LCD_MESSAGEPGM(x) do{}while(0)
......@@ -125,6 +122,10 @@
#endif //ULTRA_LCD
#if HAS_BUZZER
void buzz(long duration,uint16_t freq);
#endif
char *itostr2(const uint8_t &x);
char *itostr31(const int &xx);
char *itostr3(const int &xx);
......
......@@ -546,31 +546,46 @@ static void lcd_implementation_status_screen() {
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0
// If we both have a 2nd extruder and a heated bed,
// If we both have a 2nd hotend and a heated bed,
// show the heated bed temp on the left,
// since the first line is filled with extruder temps
// since the first line is filled with hotend temps
LCD_TEMP(degBed(), degTargetBed(), LCD_STR_BEDTEMP[0]);
#else
#ifdef DELTA
lcd.print('X');
if (axis_known_position[X_AXIS])
#ifdef DELTA
lcd.print(ftostr30(current_position[X_AXIS]));
#else
lcd.print(ftostr3(current_position[X_AXIS]));
#endif
else
lcd_printPGM(PSTR("---"));
#ifdef DELTA
lcd_printPGM(PSTR(" Y"));
if (axis_known_position[Y_AXIS])
lcd.print(ftostr30(current_position[Y_AXIS]));
else
#else
lcd.print('X');
lcd.print(ftostr3(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
if (axis_known_position[Y_AXIS])
lcd.print(ftostr3(current_position[Y_AXIS]));
else
#endif // DELTA
lcd_printPGM(PSTR("---"));
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH >= 20
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z');
if (axis_known_position[Z_AXIS])
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
else
lcd_printPGM(PSTR("---.--"));
#endif // LCD_HEIGHT > 2
......
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