Commit 15c6606c authored by MagoKimbra's avatar MagoKimbra

Fix pause end filament

parent d8fb5208
......@@ -47,7 +47,7 @@
//#define FIRMWARE_TEST
#ifdef FIRMWARE_TEST
#undef BAUDRATE
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino fuction at max 115200 baudrate.
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#endif
/***********************************************************************\
......
......@@ -355,7 +355,7 @@ void Config_ResetDefault()
#ifdef PIDTEMP
#ifndef SINGLENOZZLE
for (short e=0;e<EXTRUDERS;e++)
for (int e=0;e<EXTRUDERS;e++)
#else
int e = 0; // only need to write once
#endif //SINGLENOZZLE
......
......@@ -456,7 +456,7 @@ const unsigned int dropsegments=5; //everything with less than this number of st
#ifdef FILAMENTCHANGEENABLE
#define FILAMENTCHANGE_XPOS 3
#define FILAMENTCHANGE_YPOS 3
#define FILAMENTCHANGE_ZADD 10
#define FILAMENTCHANGE_ZADD 5
#define FILAMENTCHANGE_FIRSTRETRACT -2
#define FILAMENTCHANGE_FINALRETRACT -100
#endif
......
......@@ -14,10 +14,14 @@
// it is a Russian alphabet translation
// except 0401 --> 0xa2 = ╗, 0451 --> 0xb5
const PROGMEM uint8_t utf_recode[] =
{ 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,
0xa8,0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,
0xbe,0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
{ 0x41,0xa0,0x42,0xa1,0xe0,0x45,0xa3,0xa4,
0xa5,0xa6,0x4b,0xa7,0x4d,0x48,0x4f,0xa8,
0x50,0x43,0x54,0xa9,0xaa,0x58,0xe1,0xab,
0xac,0xe2,0xad,0xae,0x62,0xaf,0xb0,0xb1,
0x61,0xb2,0xb3,0xb4,0xe3,0x65,0xb6,0xb7,
0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0x6f,0xbe,
0x70,0x63,0xbf,0x79,0xe4,0x78,0xe5,0xc0,
0xc1,0xe6,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7
};
// When the display powers up, it is configured as follows:
......
......@@ -86,6 +86,7 @@ M1 - Same as M0
M03 - Put S<value> in laser beam control
M04 - Turn on laser beam
M05 - Turn off laser beam
M11 - Start printer for pause mode
M17 - Enable/Power all stepper motors
M18 - Disable all stepper motors; same as M84
M20 - List SD card
......@@ -156,6 +157,8 @@ M301 - Set PID parameters P I and D
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
M350 - Set microstepping mode.
M351 - Toggle MS1 MS2 pins directly.
M400 - Finish all moves
M401 - Lower z-probe if present
M402 - Raise z-probe if present
......@@ -173,8 +176,6 @@ M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<du
M666 - Set z probe offset or Endstop and delta geometry adjustment
M907 - Set digital trimpot motor current using axis codes.
M908 - Control digital trimpot directly.
M350 - Set microstepping mode.
M351 - Toggle MS1 MS2 pins directly.
************ SCARA Specific - This can change to suit future G-code regulations
M360 - SCARA calibration: Move to calc-position ThetaA (0 deg calibration)
......@@ -441,7 +442,8 @@ static uint8_t tmp_extruder;
bool Stopped = false;
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
bool paused = true;
bool paused = false;
bool printing = false;
#endif
#if NUM_SERVOS > 0
......@@ -459,6 +461,40 @@ bool target_direction;
//===========================================================================
//=============================Routines======================================
//===========================================================================
class Timer
{
public:
Timer(void);
void set_max_delay(unsigned long v);
void set(void);
boolean check(void);
private:
unsigned long max_delay;
unsigned long last_set;
};
Timer::Timer(void)
{
max_delay = 3600000UL; // default 1 hour
}
void Timer::set_max_delay(unsigned long v)
{
max_delay = v;
set();
}
void Timer::set()
{
last_set = millis();
}
boolean Timer::check()
{
unsigned long now = millis();
if (now - last_set > max_delay) {
last_set = now;
return true;
}
return false;
}
Timer timer;
void get_arc_coordinates();
bool setTargetedHotend(int code);
......@@ -1966,7 +2002,95 @@ void refresh_cmd_timeout(void)
}
#endif //Z_PROBE_SLED
inline void wait_heater()
{
setWatch();
unsigned long codenum = millis();
/* See if we are heating up or cooling down */
target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
cancel_heatup = false;
#ifdef TEMP_RESIDENCY_TIME
long residencyStart;
residencyStart = -1;
/* continue to loop until we have reached the target temp
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
while ((!cancel_heatup)&&((residencyStart == -1) ||
(residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))))
#else
while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)))
#endif //TEMP_RESIDENCY_TIME
{
if ((millis() - codenum) > 1000UL)
{
//Print Temp Reading and remaining time every 1 second while heating up/cooling down
SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL((int)tmp_extruder);
#ifdef TEMP_RESIDENCY_TIME
SERIAL_PROTOCOLPGM(" W:");
if (residencyStart > -1)
{
codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL;
SERIAL_PROTOCOLLN( codenum );
}
else
{
SERIAL_PROTOCOLLN( "?" );
}
#else
SERIAL_PROTOCOLLN("");
#endif //TEMP_RESIDENCY_TIME
codenum = millis();
}
manage_heater();
manage_inactivity();
lcd_update();
#ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */
if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) ||
(residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) ||
(residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) )
{
residencyStart = millis();
}
#endif //TEMP_RESIDENCY_TIME
}
LCD_MESSAGEPGM(MSG_HEATING_COMPLETE);
starttime=millis();
refresh_cmd_timeout();
}
inline void wait_bed()
{
unsigned long codenum = millis();
cancel_heatup = false;
target_direction = isHeatingBed(); // true if heating, false if cooling
while ((target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)))
{
if ((millis() - codenum) > 1000) //Print Temp Reading every 1 second while heating up.
{
float tt=degHotend(active_extruder);
SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL(tt);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL((int)active_extruder);
SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLLN("");
codenum = millis();
}
manage_heater();
manage_inactivity();
lcd_update();
}
LCD_MESSAGEPGM(MSG_BED_DONE);
refresh_cmd_timeout();
}
/******************************************************************************
***************************** G-Code Functions ********************************
......@@ -2038,7 +2162,7 @@ inline void gcode_G4() {
#endif //FWRETRACT
// G28: Home all axes, one at a time
inline void gcode_G28() {
inline void gcode_G28(boolean home_x=false, boolean home_y=false) {
#ifdef ENABLE_AUTO_BED_LEVELING
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all levelling data)
#endif //ENABLE_AUTO_BED_LEVELING
......@@ -2054,7 +2178,7 @@ inline void gcode_G28() {
feedrate = 0.0;
home_all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])) || (code_seen(axis_codes[E_AXIS])));
home_all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])) || (code_seen(axis_codes[E_AXIS])) || home_x || home_y);
#ifdef NPR2
if((home_all_axis) || (code_seen(axis_codes[E_AXIS]))) {
......@@ -2101,7 +2225,7 @@ inline void gcode_G28() {
#endif
#ifdef QUICK_HOME
if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS]))) //first diagonal move
if((home_all_axis)||( code_seen(axis_codes[X_AXIS]) && code_seen(axis_codes[Y_AXIS])) || home_x || home_y) //first diagonal move
{
current_position[X_AXIS] = current_position[Y_AXIS] = 0;
......@@ -2146,7 +2270,7 @@ inline void gcode_G28() {
}
#endif // QUICK_HOME
if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
if((home_all_axis) || (code_seen(axis_codes[X_AXIS])) || home_x)
{
#ifdef DUAL_X_CARRIAGE
int tmp_extruder = active_extruder;
......@@ -2165,7 +2289,7 @@ inline void gcode_G28() {
#endif //DUAL_X_CARRIAGE
}
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) HOMEAXIS(Y);
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS])) || home_y) HOMEAXIS(Y);
if(code_seen(axis_codes[X_AXIS]) && code_value_long() != 0) {
#ifdef SCARA
......@@ -2185,7 +2309,7 @@ inline void gcode_G28() {
#if Z_HOME_DIR < 0 // If homing towards BED do Z last
#ifndef Z_SAFE_HOMING
if (code_seen('M')) { // Manual G28
if (code_seen('M') && !(home_x || home_y)) { // Manual G28
#ifdef ULTIPANEL
if(home_all_axis) {
boolean zig = true;
......@@ -3434,29 +3558,88 @@ inline void gcode_G92() {
disable_e();
delay(100);
LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
uint8_t cnt = 0;
boolean beep = true;
int cnt = 4;
#ifndef SINGLENOZZLE
int old_target_temperature[EXTRUDERS] = { 0 };
for(int8_t e=0;e<EXTRUDERS;e++)
#else
int old_target_temperature[1] = { 0 };
int8_t e=0;
#endif
{
old_target_temperature[e]=target_temperature[e];
}
int old_target_temperature_bed = target_temperature_bed;
timer.set_max_delay(60000); // 1 minute
while (!lcd_clicked()) {
cnt++;
manage_heater();
manage_inactivity(true);
lcd_update();
if (cnt == 0) {
#if BEEPER > 0
if (timer.check() && cnt <= 5) beep = true;
if (cnt >= 5) {
disable_heater();
disable_x();
disable_y();
disable_z();
disable_e();
}
if (beep) {
timer.set();
#ifdef LCD_USE_I2C_BUZZER
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
for(int8_t i=0;i<3;i++) {
lcd_buzz(1000/6,100);
}
#else
for(int8_t i=0;i<3;i++) {
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
}
#endif
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
for(int8_t i=0;i<3;i++)
{
WRITE(BEEPER,HIGH);
delay(3);
delay(100);
WRITE(BEEPER,LOW);
delay(3);
#else
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
lcd_buzz(1000/6, 100);
delay(100);
}
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
for(int8_t i=0;i<3;i++)
{
WRITE(BEEPER,HIGH);
delay(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
WRITE(BEEPER,LOW);
delay(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2);
}
#endif
#endif
beep = false;
cnt += 1;
}
}
//reset LCD alert message
lcd_reset_alert_level();
if (cnt >= 5) {
#ifndef SINGLENOZZLE
for(int8_t e=0;e<EXTRUDERS;e++)
#else
int8_t e=0;
#endif
{
setTargetHotend(old_target_temperature[e], e);
CooldownNoWait = true;
wait_heater();
}
setTargetBed(old_target_temperature_bed);
CooldownNoWait = true;
wait_bed();
}
//return to normal
if (code_seen('L')) target[E_AXIS] -= code_value();
#ifdef FILAMENTCHANGE_FINALRETRACT
......@@ -3466,11 +3649,12 @@ inline void gcode_G92() {
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
paused = false;
#endif
current_position[E_AXIS] = target[E_AXIS]; //the long retract of L is compensated by manual filament feeding
plan_set_e_position(current_position[E_AXIS]);
//reset LCD alert message
lcd_reset_alert_level();
for(int8_t i=0; i < NUM_AXIS; i++) current_position[i]=target[i];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
// HOME X & Y & Z(only Delta)
gcode_G28(true,true);
#ifdef DELTA
calculate_delta(lastpos);
......@@ -3481,6 +3665,8 @@ inline void gcode_G92() {
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], target[E_AXIS], feedrate/60, active_extruder, active_driver); //move z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], lastpos[E_AXIS], feedrate/60, active_extruder, active_driver); //final unretract
#endif
for(int8_t i=0; i < NUM_AXIS; i++) current_position[i]=lastpos[i];
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
}
#endif //FILAMENTCHANGEENABLE
......@@ -3736,6 +3922,15 @@ void process_commands()
break;
#endif //LASERBEAM
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
case 11: //M11 - Start printing
{
printing = true;
paused = false;
}
break;
#endif
case 17: //M17 - Enable/Power all stepper motors
{
LCD_MESSAGEPGM(MSG_NO_MOVE);
......@@ -4176,65 +4371,7 @@ void process_commands()
autotemp_enabled=true;
}
#endif //AUTOTEMP
setWatch();
codenum = millis();
/* See if we are heating up or cooling down */
target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
cancel_heatup = false;
#ifdef TEMP_RESIDENCY_TIME
long residencyStart;
residencyStart = -1;
/* continue to loop until we have reached the target temp
_and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
while ((!cancel_heatup)&&((residencyStart == -1) ||
(residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))))
#else
while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)))
#endif //TEMP_RESIDENCY_TIME
{
if ((millis() - codenum) > 1000UL)
{
//Print Temp Reading and remaining time every 1 second while heating up/cooling down
SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL_F(degHotend(tmp_extruder),1);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL((int)tmp_extruder);
#ifdef TEMP_RESIDENCY_TIME
SERIAL_PROTOCOLPGM(" W:");
if (residencyStart > -1)
{
codenum = ((TEMP_RESIDENCY_TIME * 1000UL) - (millis() - residencyStart)) / 1000UL;
SERIAL_PROTOCOLLN( codenum );
}
else
{
SERIAL_PROTOCOLLN( "?" );
}
#else
SERIAL_PROTOCOLLN("");
#endif //TEMP_RESIDENCY_TIME
codenum = millis();
}
manage_heater();
manage_inactivity();
lcd_update();
#ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */
if ((residencyStart == -1 && target_direction && (degHotend(tmp_extruder) >= (degTargetHotend(tmp_extruder)-TEMP_WINDOW))) ||
(residencyStart == -1 && !target_direction && (degHotend(tmp_extruder) <= (degTargetHotend(tmp_extruder)+TEMP_WINDOW))) ||
(residencyStart > -1 && labs(degHotend(tmp_extruder) - degTargetHotend(tmp_extruder)) > TEMP_HYSTERESIS) )
{
residencyStart = millis();
}
#endif //TEMP_RESIDENCY_TIME
}
LCD_MESSAGEPGM(MSG_HEATING_COMPLETE);
starttime=millis();
refresh_cmd_timeout();
wait_heater();
}
break;
case 111: //M111 - Debug mode
......@@ -4435,31 +4572,7 @@ void process_commands()
setTargetBed(code_value());
CooldownNoWait = false;
}
codenum = millis();
cancel_heatup = false;
target_direction = isHeatingBed(); // true if heating, false if cooling
while ((target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)))
{
if ((millis() - codenum) > 1000) //Print Temp Reading every 1 second while heating up.
{
float tt=degHotend(active_extruder);
SERIAL_PROTOCOLPGM("T:");
SERIAL_PROTOCOL(tt);
SERIAL_PROTOCOLPGM(" E:");
SERIAL_PROTOCOL((int)active_extruder);
SERIAL_PROTOCOLPGM(" B:");
SERIAL_PROTOCOL_F(degBed(),1);
SERIAL_PROTOCOLLN("");
codenum = millis();
}
manage_heater();
manage_inactivity();
lcd_update();
}
LCD_MESSAGEPGM(MSG_BED_DONE);
refresh_cmd_timeout();
wait_bed();
#endif
}
break;
......@@ -6120,7 +6233,7 @@ void kill()
void pause()
{
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
if (READ(PAUSE_PIN) == 0 && !paused)
if (READ(PAUSE_PIN) == 0 && printing && !paused)
{
paused = true;
enquecommand("M600");
......@@ -6128,10 +6241,6 @@ void pause()
enquecommand("G4 P0");
enquecommand("G4 P0");
}
else if (READ(PAUSE_PIN) == 1 && paused)
{
paused = false;
}
#endif // defined(PAUSE_PIN) && PAUSE_PIN > -1
}
......
......@@ -65,7 +65,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
createFilename(lfilename,p);
path[0]=0;
if(strlen(prepend)==0) //avoid leading / if already in prepend
if(prepend[0]==0) //avoid leading / if already in prepend
{
strcat(path,"/");
}
......
......@@ -315,7 +315,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) {
char c;
uint8_t n = LCD_WIDTH - 2 - (pgm ? strlen_P(data) : (strlen(data)));
uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
lcd_implementation_mark_as_selected(row, pre_char);
......@@ -377,18 +377,18 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
uint8_t char_width = DOG_CHAR_WIDTH;
#ifdef USE_BIG_EDIT_FONT
if (strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
u8g.setFont(FONT_MENU_EDIT);
lcd_width = LCD_WIDTH_EDIT + 1;
char_width = DOG_CHAR_WIDTH_EDIT;
if (strlen_P(pstr) >= LCD_WIDTH_EDIT - strlen(value)) rows = 2;
if (lcd_strlen_P(pstr) >= LCD_WIDTH_EDIT - lcd_strlen(value)) rows = 2;
}
else {
u8g.setFont(FONT_MENU);
}
#endif
if (strlen_P(pstr) > LCD_WIDTH - 2 - strlen(value)) rows = 2;
if (lcd_strlen_P(pstr) > LCD_WIDTH - 2 - lcd_strlen(value)) rows = 2;
const float kHalfChar = DOG_CHAR_HEIGHT_EDIT / 2;
float rowHeight = u8g.getHeight() / (rows + 1); // 1/(rows+1) = 1/2 or 1/3
......@@ -396,7 +396,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
u8g.setPrintPos(0, rowHeight + kHalfChar);
lcd_printPGM(pstr);
u8g.print(':');
u8g.setPrintPos((lcd_width-1-strlen(value)) * char_width, rows * rowHeight + kHalfChar);
u8g.setPrintPos((lcd_width-1-lcd_strlen(value)) * char_width, rows * rowHeight + kHalfChar);
u8g.print(value);
}
......
......@@ -65,9 +65,11 @@ float current_temperature_bed = 0.0;
float redundant_temperature = 0.0;
#endif
#ifdef PIDTEMP
float Kp[4];
float Ki[4];
float Kd[4];
#ifndef SINGLENOZZLE
float Kp[EXTRUDERS],Ki[EXTRUDERS],Kd[EXTRUDERS];
#else
float Kp[1],Ki[1],Kd[1];
#endif
#endif //PIDTEMP
#ifdef PIDTEMPBED
......@@ -400,9 +402,7 @@ void updatePID()
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki[e];
}
#else
for(int e = 0; e < 1; e++) {
temp_iState_max[e] = PID_INTEGRAL_DRIVE_MAX / Ki[0];
}
temp_iState_max[0] = PID_INTEGRAL_DRIVE_MAX / Ki[0];
#endif
#endif
#ifdef PIDTEMPBED
......@@ -538,7 +538,7 @@ void manage_heater()
#ifndef SINGLENOZZLE
for(int e = 0; e < EXTRUDERS; e++)
#else
for(int e = 0; e < 1; e++)
int e = 0;
#endif // !SINLGENOZZE
{
......@@ -1145,19 +1145,18 @@ void setWatch()
{
#ifdef WATCH_TEMP_PERIOD
#ifndef SINGLENOZZLE
for (uint8_t e = 0; e < EXTRUDERS; e++)
{
for (int e = 0; e < EXTRUDERS; e++)
#else
uint8_t e = 0;
{
int e = 0;
#endif // !SINGLENOZZLE
{
if(degHotend(e) < degTargetHotend(e) - (WATCH_TEMP_INCREASE * 2))
{
watch_start_temp[e] = degHotend(e);
watchmillis[e] = millis();
}
}
#endif
#endif //WATCH_TEMP_PERIOD
}
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
......@@ -1225,9 +1224,9 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
void disable_heater()
{
#ifndef SINGLENOZZLE
for(uint8_t i=0;i<EXTRUDERS;i++)
for(int i=0;i<EXTRUDERS;i++)
#else
uint8_t i=0;
int i=0;
#endif // !SINGLENOZZLE
setTargetHotend(0,i);
setTargetBed(0);
......
......@@ -41,19 +41,19 @@ void manage_heater(); //it is critical that this is called periodically.
// low level conversion routines
// do not use these routines and variables outside of temperature.cpp
#ifndef SINGLENOZZLE
extern int target_temperature[EXTRUDERS];
extern float current_temperature[EXTRUDERS];
#ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[EXTRUDERS];
extern int current_temperature_bed_raw;
#endif
extern int target_temperature[EXTRUDERS];
extern float current_temperature[EXTRUDERS];
#ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[EXTRUDERS];
extern int current_temperature_bed_raw;
#endif
#else
extern int target_temperature[1];
extern float current_temperature[1];
#ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[1];
extern int current_temperature_bed_raw;
#endif
extern int target_temperature[1];
extern float current_temperature[1];
#ifdef SHOW_TEMP_ADC_VALUES
extern int current_temperature_raw[1];
extern int current_temperature_bed_raw;
#endif
#endif //SINGLENOZZLE
extern int target_temperature_bed;
......@@ -67,19 +67,21 @@ extern float current_temperature_bed;
#endif
#ifdef PIDTEMP
extern float Kp[4],Ki[4],Kd[4];
#ifndef SINGLENOZZLE
extern float Kp[EXTRUDERS],Ki[EXTRUDERS],Kd[EXTRUDERS];
#else
extern float Kp[1],Ki[1],Kd[1];
#endif
float scalePID_i(float i);
float scalePID_d(float d);
float unscalePID_i(float i);
float unscalePID_d(float d);
#endif
#ifdef PIDTEMPBED
extern float bedKp,bedKi,bedKd;
#endif
#ifdef BABYSTEPPING
extern volatile int babystepsTodo[3];
#endif
......
......@@ -1095,6 +1095,16 @@ const short temptable_1047[][2] PROGMEM = {
};
#endif
#if (THERMISTORHEATER_0 == 999) || (THERMISTORHEATER_1 == 999) || (THERMISTORHEATER_2 == 999) || (THERMISTORHEATER_3 == 999) || (THERMISTORBED == 999) //User defined table
// Dummy Thermistor table.. It will ALWAYS read 25C.
const short temptable_999[][2] PROGMEM = {
{1*OVERSAMPLENR, 25},
{1023*OVERSAMPLENR, 25}
};
#endif
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)
......
......@@ -156,7 +156,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
_menuItemNr++;\
} while(0)
#ifdef ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
#define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
if (_menuItemNr == _lineNr) { \
if (lcdDrawUpdate) { \
const char* _label_pstr = PSTR(label); \
......@@ -176,18 +176,18 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
} \
} \
_menuItemNr++; \
} while(0)
#endif
} while(0)
#endif //ENCODER_RATE_MULTIPLIER
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#ifdef ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#else
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#endif
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#else //!ENCODER_RATE_MULTIPLIER
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
#endif //!ENCODER_RATE_MULTIPLIER
#define END_MENU() \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
......@@ -461,23 +461,23 @@ static void lcd_tune_menu()
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
#endif
#ifndef SINGLENOZZLE
#if TEMP_SENSOR_1 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_2 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_3 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
#endif
#endif // !SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
MENU_ITEM_EDIT(int3, MSG_FLOW " 0", &extruder_multiplier[0], 10, 999);
......@@ -1020,33 +1020,35 @@ static void lcd_control_temperature_menu()
{
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
#endif
#ifndef SINGLENOZZLE
#if TEMP_SENSOR_1 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_2 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_3 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
#endif
#endif // !SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0)
#if TEMP_SENSOR_0 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
#endif
#if EXTRUDERS > 1
#if TEMP_SENSOR_1 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
#endif
#if EXTRUDERS > 2
#if TEMP_SENSOR_2 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
#endif
#if EXTRUDERS > 3
#if TEMP_SENSOR_3 != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
#endif
#endif
#endif
#endif
#if TEMP_SENSOR_BED != 0
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
#endif
MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
#if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
#endif
#ifdef PIDTEMP
#endif
#ifdef PIDTEMP
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[0]);
raw_Kd = unscalePID_d(Kd[0]);
......@@ -1054,8 +1056,8 @@ static void lcd_control_temperature_menu()
// 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);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
#ifndef SINGLENOZZLE
#if EXTRUDERS > 1
#ifndef SINGLENOZZLE
#if EXTRUDERS > 1
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[1]);
raw_Kd = unscalePID_d(Kd[1]);
......@@ -1063,8 +1065,8 @@ static void lcd_control_temperature_menu()
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //EXTRUDERS > 1
#if EXTRUDERS > 2
#endif //EXTRUDERS > 1
#if EXTRUDERS > 2
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[2]);
raw_Kd = unscalePID_d(Kd[2]);
......@@ -1072,8 +1074,8 @@ static void lcd_control_temperature_menu()
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //EXTRUDERS > 2
#if EXTRUDERS > 3
#endif //EXTRUDERS > 2
#if EXTRUDERS > 3
// set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(Ki[3]);
raw_Kd = unscalePID_d(Kd[3]);
......@@ -1081,9 +1083,9 @@ static void lcd_control_temperature_menu()
// i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d);
#endif //EXTRUDERS > 2
#endif //SINGLENOZZLE
#endif //PIDTEMP
#endif //EXTRUDERS > 2
#endif //SINGLENOZZLE
#endif //PIDTEMP
MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_GUM_SETTINGS, lcd_control_temperature_preheat_gum_settings_menu);
......@@ -1129,13 +1131,15 @@ static void lcd_control_temperature_preheat_gum_settings_menu()
START_MENU();
MENU_ITEM(back, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &gumPreheatFanSpeed, 0, 255);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &gumPreheatHotendTemp, 0, HEATER_0_MAXTEMP - 15);
#if TEMP_SENSOR_BED != 0
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &gumPreheatHPBTemp, 0, BED_MAXTEMP - 15);
#endif
#ifdef EEPROM_SETTINGS
#endif
#ifdef EEPROM_SETTINGS
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif
#endif
END_MENU();
}
......@@ -1192,20 +1196,20 @@ static void lcd_control_volumetric_menu()
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
if (volumetric_enabled) {
MENU_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);
#if EXTRUDERS > 1
MENU_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);
#if EXTRUDERS > 2
MENU_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);
#if EXTRUDERS > 3
MENU_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);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
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);
#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);
#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);
#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);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
}
END_MENU();
}
#ifdef DOGLCD
static void lcd_set_contrast()
{
......@@ -1485,6 +1489,26 @@ void lcd_init()
#endif
}
int lcd_strlen(char *s) {
int i = 0, j = 0;
while (s[i]) {
if ((s[i] & 0xc0) != 0x80) j++;
i++;
}
return j;
}
int lcd_strlen_P(const char *s) {
int j = 0;
while (pgm_read_byte(s)) {
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
s++;
}
return j;
}
void lcd_update()
{
static unsigned long timeoutToStatus = 0;
......@@ -1549,28 +1573,21 @@ void lcd_update()
{
int32_t encoderMultiplier = 1;
#ifdef ENCODER_RATE_MULTIPLIER
if (encoderRateMultiplierEnabled)
{
#ifdef ENCODER_RATE_MULTIPLIER
if (encoderRateMultiplierEnabled) {
int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
if (lastEncoderMovementMillis != 0)
{
if (lastEncoderMovementMillis != 0) {
// Note that the rate is always calculated between to passes through the
// loop and that the abs of the encoderDiff value is tracked.
float encoderStepRate =
(float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0;
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)
{
encoderMultiplier = 100;
}
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC)
{
encoderMultiplier = 10;
}
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
#ifdef ENCODER_RATE_MULTIPLIER_DEBUG
#ifdef ENCODER_RATE_MULTIPLIER_DEBUG
SERIAL_ECHO_START;
SERIAL_ECHO("Enc Step Rate: ");
SERIAL_ECHO(encoderStepRate);
......@@ -1580,12 +1597,13 @@ void lcd_update()
SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
SERIAL_ECHO(" ENCODER_100X_STEPS_PER_SEC: ");
SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
#endif
#endif //ENCODER_RATE_MULTIPLIER_DEBUG
}
lastEncoderMovementMillis = millis();
}
#endif
#endif //ENCODER_RATE_MULTIPLIER
lcdDrawUpdate = 1;
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
encoderDiff = 0;
......@@ -1636,7 +1654,7 @@ void lcd_ignore_click(bool b)
}
void lcd_finishstatus() {
int len = strlen(lcd_status_message);
int len = lcd_strlen(lcd_status_message);
if (len > 0) {
while (len < LCD_WIDTH) {
lcd_status_message[len++] = ' ';
......
......@@ -4,7 +4,8 @@
#include "Marlin.h"
#ifdef ULTRA_LCD
int lcd_strlen(char *s);
int lcd_strlen_P(const char *s);
void lcd_update();
void lcd_init();
void lcd_setstatus(const char* message);
......
......@@ -660,7 +660,7 @@ static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, c
{
lcd.print(c);
pstr++;
n--;
if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
}
while(n--)
lcd.print(' ');
......@@ -672,9 +672,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
......@@ -682,7 +682,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const
{
lcd.print(c);
pstr++;
n--;
if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
}
lcd.print(':');
while(n--)
......@@ -694,9 +694,9 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
char c;
//Use all characters in narrow LCDs
#if LCD_WIDTH < 20
uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
uint8_t n = LCD_WIDTH - 1 - 1 - lcd_strlen_P(data);
#else
uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
uint8_t n = LCD_WIDTH - 1 - 2 - lcd_strlen_P(data);
#endif
lcd.setCursor(0, row);
lcd.print(pre_char);
......@@ -704,7 +704,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons
{
lcd.print(c);
pstr++;
n--;
if ((pgm_read_byte(pstr) & 0xc0) != 0x80) n--;
}
lcd.print(':');
while(n--)
......@@ -757,9 +757,9 @@ void lcd_implementation_drawedit(const char* pstr, char* value)
lcd_printPGM(pstr);
lcd.print(':');
#if LCD_WIDTH < 20
lcd.setCursor(LCD_WIDTH - strlen(value), 1);
lcd.setCursor(LCD_WIDTH - lcd_strlen(value), 1);
#else
lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
lcd.setCursor(LCD_WIDTH -1 - lcd_strlen(value), 1);
#endif
lcd.print(value);
}
......
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