Commit c4586e04 authored by MagoKimbra's avatar MagoKimbra

Same fix LCD

parent 50d309d1
...@@ -138,7 +138,6 @@ ...@@ -138,7 +138,6 @@
#define NEWPANEL #define NEWPANEL
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
#define NEWPANEL //enable this if you have a click-encoder panel #define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT #define SDSUPPORT
...@@ -162,6 +161,35 @@ ...@@ -162,6 +161,35 @@
#endif #endif
#endif #endif
#ifdef DOGLCD
/* Custom characters defined in font font_6x10_marlin_symbols */
// \x00 intentionally skipped to avoid problems in strings
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
#define LCD_STR_ARROW_RIGHT "\x03"
#define LCD_STR_UPLEVEL "\x04"
#define LCD_STR_CLOCK "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_BEDTEMP "\x07"
#define LCD_STR_THERMOMETER "\x08"
#define LCD_STR_DEGREE "\x09"
#define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
#else
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string!
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
#endif
/** /**
* Default LCD contrast for dogm-like LCD displays * Default LCD contrast for dogm-like LCD displays
*/ */
...@@ -169,11 +197,18 @@ ...@@ -169,11 +197,18 @@
#define DEFAULT_LCD_CONTRAST 32 #define DEFAULT_LCD_CONTRAST 32
#endif #endif
#ifdef DOGLCD
#define HAS_LCD_CONTRAST
#ifdef U8GLIB_ST7920
#undef HAS_LCD_CONTRAST
#endif
#endif
#else // CONFIGURATION_LCD #else // CONFIGURATION_LCD
#define CONDITIONALS_H #define CONDITIONALS_H
#if !defined (__SAM3X8E__) #ifndef __SAM3X8E__
#ifndef AT90USB #ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#endif #endif
......
...@@ -14,13 +14,12 @@ ...@@ -14,13 +14,12 @@
* *
*/ */
#define EEPROM_VERSION "V19" #define EEPROM_VERSION "V20"
/** /**
* V19 EEPROM Layout: * V19 EEPROM Layout:
* *
* ver * ver
* baudrate
* axis_steps_per_unit (x7) * axis_steps_per_unit (x7)
* max_feedrate (x7) * max_feedrate (x7)
* retraction_feedrate (x4) * retraction_feedrate (x4)
...@@ -140,7 +139,6 @@ void Config_StoreSettings() { ...@@ -140,7 +139,6 @@ void Config_StoreSettings() {
char ver[4] = "000"; char ver[4] = "000";
int i = EEPROM_OFFSET; int i = EEPROM_OFFSET;
EEPROM_WRITE_VAR(i, ver); // invalidate data first EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, baudrate);
EEPROM_WRITE_VAR(i, axis_steps_per_unit); EEPROM_WRITE_VAR(i, axis_steps_per_unit);
EEPROM_WRITE_VAR(i, max_feedrate); EEPROM_WRITE_VAR(i, max_feedrate);
EEPROM_WRITE_VAR(i, max_retraction_feedrate); EEPROM_WRITE_VAR(i, max_retraction_feedrate);
...@@ -291,8 +289,6 @@ void Config_RetrieveSettings() { ...@@ -291,8 +289,6 @@ void Config_RetrieveSettings() {
float dummy = 0; float dummy = 0;
// version number match // version number match
EEPROM_READ_VAR(i, baudrate);
if(baudrate != 9600 && baudrate != 14400 && baudrate != 19200 && baudrate != 28800 && baudrate != 38400 && baudrate != 56000 && baudrate != 115200 && baudrate != 250000) baudrate = BAUDRATE;
EEPROM_READ_VAR(i, axis_steps_per_unit); EEPROM_READ_VAR(i, axis_steps_per_unit);
EEPROM_READ_VAR(i, max_feedrate); EEPROM_READ_VAR(i, max_feedrate);
EEPROM_READ_VAR(i, max_retraction_feedrate); EEPROM_READ_VAR(i, max_retraction_feedrate);
...@@ -446,9 +442,6 @@ void Config_RetrieveSettings() { ...@@ -446,9 +442,6 @@ void Config_RetrieveSettings() {
void Config_ResetDefault() { void Config_ResetDefault() {
//Setting default baudrate for serial
baudrate = BAUDRATE;
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE; float tmp2[] = DEFAULT_MAX_FEEDRATE;
float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE; float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
...@@ -587,10 +580,6 @@ void Config_ResetDefault() { ...@@ -587,10 +580,6 @@ void Config_ResetDefault() {
void Config_PrintSettings(bool forReplay) { void Config_PrintSettings(bool forReplay) {
// Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown // Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Baudrate: ", baudrate);
SERIAL_EOL;
if (!forReplay) { if (!forReplay) {
SERIAL_ECHOLNPGM("Steps per unit:"); SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// #define ENDSTOPPULLUP_XMIN // #define ENDSTOPPULLUP_XMIN
// #define ENDSTOPPULLUP_YMIN // #define ENDSTOPPULLUP_YMIN
// #define ENDSTOPPULLUP_ZMIN // #define ENDSTOPPULLUP_ZMIN
// #define ENDSTOPPULLUP_ZPROBE
// #define ENDSTOPPULLUP_EMIN // #define ENDSTOPPULLUP_EMIN
#endif #endif
...@@ -27,6 +28,12 @@ const bool E_MIN_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -27,6 +28,12 @@ const bool E_MIN_ENDSTOP_INVERTING = false; // set to true to invert the log
const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool X_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Y_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop. const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
// If you want to enable the Z Probe pin, but disable its use, uncomment the line below.
// This only affects a Z Probe Endstop if you have separate Z min endstop as well and have
// activated Z_PROBE_ENDSTOP below. If you are using the Z Min endstop on your Z Probe,
// this has no effect.
//#define DISABLE_Z_PROBE_ENDSTOP
// ENDSTOP SETTINGS: // ENDSTOP SETTINGS:
// Sets direction of endstop when homing; 1=MAX, -1=MIN // Sets direction of endstop when homing; 1=MAX, -1=MIN
...@@ -153,6 +160,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -153,6 +160,16 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the log
#define PROBE_SERVO_DEACTIVATION_DELAY 300 #define PROBE_SERVO_DEACTIVATION_DELAY 300
// Support for a dedicated Z PROBE endstop separate from the Z MIN endstop.
// If you would like to use both a Z PROBE and a Z MIN endstop together or just a Z PROBE with a custom pin, uncomment #define Z_PROBE_ENDSTOP and read the instructions below.
// If you want to still use the Z min endstop for homing, disable Z_SAFE_HOMING above. Eg; to park the head outside the bed area when homing with G28.
// WARNING: The Z MIN endstop will need to set properly as it would without a Z PROBE to prevent head crashes and premature stopping during a print.
// To use a separte Z PROBE endstop, you must have a Z_PROBE_PIN defined in the pins.h file for your control board.
// If you are using a servo based Z PROBE, you will need to enable NUM_SERVOS, SERVO_ENDSTOPS and SERVO_ENDSTOPS_ANGLES in the R/C Servo below.
// WARNING: Setting the wrong pin may have unexpected and potentially disastrous outcomes. Use with caution and do your homework.
//#define Z_PROBE_ENDSTOP
#endif // ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
......
...@@ -130,7 +130,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the log ...@@ -130,7 +130,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the log
// MOVEMENT SETTINGS // MOVEMENT SETTINGS
#define HOMING_FEEDRATE {100*60,100*60,100*60,0} // set the homing speeds (mm/min) #define HOMING_FEEDRATE {100*60, 100*60, 100*60, 0} // set the homing speeds (mm/min)
// default settings // default settings
// delta speeds must be the same on xyz // delta speeds must be the same on xyz
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
#include "HAL.h" #include "HAL.h"
#else #else
#include <util/delay.h> #include <util/delay.h>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include "HardwareSerial.h" #include "HardwareSerial.h"
#endif #endif
#if !defined (__SAM3X8E__) #ifndef __SAM3X8E__
#include "MarlinSerial.h" #include "MarlinSerial.h"
#endif #endif
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
#define MYSERIAL Serial #define MYSERIAL Serial
#endif // BTENABLED #endif // BTENABLED
#else #else
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
#define MYSERIAL Serial #define MYSERIAL Serial
#else #else
#define MYSERIAL MSerial #define MYSERIAL MSerial
...@@ -259,7 +259,6 @@ inline void refresh_cmd_timeout() { previous_millis_cmd = millis(); } ...@@ -259,7 +259,6 @@ inline void refresh_cmd_timeout() { previous_millis_cmd = millis(); }
#define CRITICAL_SECTION_END SREG = _sreg; #define CRITICAL_SECTION_END SREG = _sreg;
#endif #endif
extern unsigned long baudrate;
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
......
...@@ -200,7 +200,6 @@ M999 - Restart after being stopped by error ...@@ -200,7 +200,6 @@ M999 - Restart after being stopped by error
CardReader card; CardReader card;
#endif #endif
unsigned long baudrate;
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
int homing_bump_divisor[] = HOMING_BUMP_DIVISOR; int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
...@@ -478,7 +477,7 @@ void serial_echopair_P(const char *s_P, double v) ...@@ -478,7 +477,7 @@ void serial_echopair_P(const char *s_P, double v)
void serial_echopair_P(const char *s_P, unsigned long v) void serial_echopair_P(const char *s_P, unsigned long v)
{ serialprintPGM(s_P); SERIAL_ECHO(v); } { serialprintPGM(s_P); SERIAL_ECHO(v); }
#if !defined (__SAM3X8E__) #ifndef __SAM3X8E__
#ifdef SDSUPPORT #ifdef SDSUPPORT
#include "SdFatUtil.h" #include "SdFatUtil.h"
int freeMemory() { return SdFatUtil::FreeRam(); } int freeMemory() { return SdFatUtil::FreeRam(); }
...@@ -665,12 +664,8 @@ void setup() ...@@ -665,12 +664,8 @@ void setup()
#endif #endif
setup_killpin(); setup_killpin();
setup_filrunoutpin(); setup_filrunoutpin();
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
setup_powerhold(); setup_powerhold();
MYSERIAL.begin(baudrate); MYSERIAL.begin(BAUDRATE);
SERIAL_PROTOCOLLNPGM("start"); SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START; SERIAL_ECHO_START;
...@@ -708,6 +703,9 @@ void setup() ...@@ -708,6 +703,9 @@ void setup()
} }
#endif //!SDSUPPORT #endif //!SDSUPPORT
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
tp_init(); // Initialize temperature loop tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner; plan_init(); // Initialize planner;
watchdog_init(); watchdog_init();
...@@ -2052,7 +2050,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position, ...@@ -2052,7 +2050,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
} }
feedrate = oldFeedrate; feedrate = oldFeedrate;
retracted[active_extruder] = retract; retracted[active_extruder] = retracting;
} // retract() } // retract()
#endif //FWRETRACT #endif //FWRETRACT
...@@ -4229,7 +4227,7 @@ inline void gcode_M104() { ...@@ -4229,7 +4227,7 @@ inline void gcode_M104() {
*/ */
inline void gcode_M105() { inline void gcode_M105() {
if (setTargetedHotend(105)) return; if (setTargetedHotend(105)) return;
if (debugDryrun()) return;
#if HAS_TEMP_0 || HAS_TEMP_BED #if HAS_TEMP_0 || HAS_TEMP_BED
SERIAL_PROTOCOLPGM("ok"); SERIAL_PROTOCOLPGM("ok");
#if HAS_TEMP_0 #if HAS_TEMP_0
...@@ -6846,7 +6844,7 @@ void kill() ...@@ -6846,7 +6844,7 @@ void kill()
disable_all_steppers(); disable_all_steppers();
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
pinMode(PS_ON_PIN, INPUT); SET_INPUT(PS_ON_PIN);
#endif #endif
SERIAL_ERROR_START; SERIAL_ERROR_START;
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
// save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
// we don't have a big font for Cyrillic, Kana // we don't have a big font for Cyrillic, Kana
#if defined( MAPPER_C2C3 ) || defined( MAPPER_NON ) #if defined(MAPPER_C2C3) || defined(MAPPER_NON)
// #define USE_BIG_EDIT_FONT //#define USE_BIG_EDIT_FONT
#endif #endif
// If you have spare 2300Byte of progmem and want to use a // If you have spare 2300Byte of progmem and want to use a
...@@ -108,40 +108,25 @@ ...@@ -108,40 +108,25 @@
#define START_ROW 0 #define START_ROW 0
/* Custom characters defined in font font_6x10_marlin_symbols */
// \x00 intentionally skipped to avoid problems in strings
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
#define LCD_STR_ARROW_RIGHT "\x03"
#define LCD_STR_UPLEVEL "\x04"
#define LCD_STR_CLOCK "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_BEDTEMP "\x07"
#define LCD_STR_THERMOMETER "\x08"
#define LCD_STR_DEGREE "\x09"
#define LCD_STR_SPECIAL_MAX '\x09'
// Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
// Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
// LCD selection // LCD selection
#ifdef U8GLIB_ST7920 #ifdef U8GLIB_ST7920
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0); //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0); U8GLIB_ST7920_128X64_RRD u8g(0);
#elif defined(MAKRPANEL) #elif defined(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well // The MaKrPanel display, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(VIKI2) || defined(miniVIKI) #elif defined(VIKI2) || defined(miniVIKI)
// Mini Viki and Viki 2.0 LCD, ST7565 controller as well // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#else #else
// for regular DOGM128 display with HW-SPI // for regular DOGM128 display with HW-SPI
U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
#endif #endif
#include "utf_mapper.h" #include "utf_mapper.h"
int lcd_contrast; int lcd_contrast;
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
static char currentfont = 0; static char currentfont = 0;
static void lcd_setFont(char font_nr) { static void lcd_setFont(char font_nr) {
...@@ -185,8 +170,10 @@ char lcd_printPGM(const char* str) { ...@@ -185,8 +170,10 @@ char lcd_printPGM(const char* str) {
return n; return n;
} }
static void lcd_implementation_init() static bool show_splashscreen = true;
{
static void lcd_implementation_init() {
#ifdef LCD_PIN_BL // Enable LCD backlight #ifdef LCD_PIN_BL // Enable LCD backlight
pinMode(LCD_PIN_BL, OUTPUT); pinMode(LCD_PIN_BL, OUTPUT);
digitalWrite(LCD_PIN_BL, HIGH); digitalWrite(LCD_PIN_BL, HIGH);
...@@ -198,13 +185,13 @@ static void lcd_implementation_init() ...@@ -198,13 +185,13 @@ static void lcd_implementation_init()
// pinMode(17, OUTPUT); // Enable LCD backlight // pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH); // digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90 #ifdef LCD_SCREEN_ROT_90
u8g.setRot90(); // Rotate screen by 90 u8g.setRot90(); // Rotate screen by 90
#elif defined(LCD_SCREEN_ROT_180) #elif defined(LCD_SCREEN_ROT_180)
u8g.setRot180(); // Rotate screen by 180 u8g.setRot180(); // Rotate screen by 180
#elif defined(LCD_SCREEN_ROT_270) #elif defined(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270 u8g.setRot270(); // Rotate screen by 270
#endif #endif
// Show splashscreen // Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
...@@ -218,6 +205,7 @@ static void lcd_implementation_init() ...@@ -218,6 +205,7 @@ static void lcd_implementation_init()
u8g.firstPage(); u8g.firstPage();
do { do {
if (show_splashscreen) {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp); u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU); lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2 #ifndef STRING_SPLASH_LINE2
...@@ -227,7 +215,9 @@ static void lcd_implementation_init() ...@@ -227,7 +215,9 @@ static void lcd_implementation_init()
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1); u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT*3/2, STRING_SPLASH_LINE1);
u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2); u8g.drawStr(txt2X, u8g.getHeight() - DOG_CHAR_HEIGHT*1/2, STRING_SPLASH_LINE2);
#endif #endif
}
} while (u8g.nextPage()); } while (u8g.nextPage());
show_splashscreen = false;
} }
static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
...@@ -315,7 +305,6 @@ static void lcd_implementation_status_screen() { ...@@ -315,7 +305,6 @@ static void lcd_implementation_status_screen() {
#if HAS_FAN #if HAS_FAN
int per = ((fanSpeed + 1) * 100) / 256; int per = ((fanSpeed + 1) * 100) / 256;
if (per) { if (per) {
lcd_print(itostr3(per)); lcd_print(itostr3(per));
lcd_print('%'); lcd_print('%');
} }
...@@ -392,10 +381,10 @@ static void lcd_implementation_status_screen() { ...@@ -392,10 +381,10 @@ static void lcd_implementation_status_screen() {
#endif #endif
#if HAS_LCD_FILAMENT_SENSOR #if HAS_LCD_FILAMENT_SENSOR
else { else {
lcd_printPGM(PSTR("D:")); lcd_printPGM(PSTR("dia:"));
lcd_print(ftostr12ns(filament_width_meas)); lcd_print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR("mm F:")); lcd_printPGM(PSTR(" factor:"));
lcd_print(itostr3(volumetric_multiplier[active_extruder] * 100)); lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd_print('%'); lcd_print('%');
} }
#endif #endif
......
...@@ -153,7 +153,6 @@ ...@@ -153,7 +153,6 @@
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration" #define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm" #define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " 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_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
......
...@@ -163,7 +163,6 @@ ...@@ -163,7 +163,6 @@
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration" #define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm" #define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " 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_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
......
...@@ -159,7 +159,6 @@ ...@@ -159,7 +159,6 @@
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configurazione" #define MSG_CONFIG "Configurazione"
#define MSG_BAUDRATE "Baudrate"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm" #define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " 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_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
......
...@@ -4442,6 +4442,39 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -4442,6 +4442,39 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define Z_MAX_PIN -1 #define Z_MAX_PIN -1
#endif //Z_HOME_DIR > 0 #endif //Z_HOME_DIR > 0
#endif //!DELTA #endif //!DELTA
#if defined(DISABLE_Z_PROBE_ENDSTOP) || !defined(Z_PROBE_ENDSTOP) // Allow code to compile regardless of Z_PROBE_ENDSTOP setting.
#define Z_PROBE_PIN -1
#endif
#ifdef DISABLE_XMAX_ENDSTOP
#undef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#ifdef DISABLE_XMIN_ENDSTOP
#undef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#ifdef DISABLE_YMAX_ENDSTOP
#define Y_MAX_PIN -1
#endif
#ifdef DISABLE_YMIN_ENDSTOP
#undef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#ifdef DISABLE_ZMAX_ENDSTOP
#undef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#ifdef DISABLE_ZMIN_ENDSTOP
#undef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
/****************************************************************************************/ /****************************************************************************************/
...@@ -4498,27 +4531,32 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -4498,27 +4531,32 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#include "pins2tool.h" #include "pins2tool.h"
//List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those! //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, #define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, analogInputToDigitalPin(TEMP_0_PIN),
#if DRIVER_EXTRUDERS > 1 #if DRIVER_EXTRUDERS > 1
#define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, analogInputToDigitalPin(TEMP_1_PIN),
#else #else
#define _E1_PINS #define _E1_PINS
#endif #endif
#if DRIVER_EXTRUDERS > 2 #if DRIVER_EXTRUDERS > 2
#define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, analogInputToDigitalPin(TEMP_2_PIN),
#else #else
#define _E2_PINS #define _E2_PINS
#endif #endif
#if DRIVER_EXTRUDERS > 3 #if DRIVER_EXTRUDERS > 3
#define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, analogInputToDigitalPin(TEMP_3_PIN),
#else #else
#define _E3_PINS #define _E3_PINS
#endif #endif
#define SENSITIVE_PINS { 0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \ #define SENSITIVE_PINS { 0, 1, \
HEATER_BED_PIN, FAN_PIN, \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \
Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \
Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \
_E0_PINS _E1_PINS _E2_PINS _E3_PINS \ _E0_PINS _E1_PINS _E2_PINS _E3_PINS \
analogInputToDigitalPin(TEMP_0_PIN), analogInputToDigitalPin(TEMP_1_PIN), analogInputToDigitalPin(TEMP_2_PIN), analogInputToDigitalPin(TEMP_3_PIN), analogInputToDigitalPin(TEMP_BED_PIN) } analogInputToDigitalPin(TEMP_BED_PIN) \
}
#define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0) #define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0)
......
...@@ -886,7 +886,7 @@ float junction_deviation = 0.1; ...@@ -886,7 +886,7 @@ float junction_deviation = 0.1;
block->acceleration_st = acc_st; block->acceleration_st = acc_st;
block->acceleration = acc_st / steps_per_mm; block->acceleration = acc_st / steps_per_mm;
#if defined(__SAM3X8E__) #ifdef __SAM3X8E__
block->acceleration_rate = (long)(acc_st * ( 16777216.0 / HAL_TIMER_RATE)); block->acceleration_rate = (long)(acc_st * ( 16777216.0 / HAL_TIMER_RATE));
#else #else
block->acceleration_rate = (long)(acc_st * 16777216.0 / (F_CPU / 8.0)); block->acceleration_rate = (long)(acc_st * 16777216.0 / (F_CPU / 8.0));
......
...@@ -76,7 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone; ...@@ -76,7 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone;
static volatile bool endstop_x_hit = false; static volatile bool endstop_x_hit = false;
static volatile bool endstop_y_hit = false; static volatile bool endstop_y_hit = false;
static volatile bool endstop_z_hit = false; static volatile bool endstop_z_hit = false;
static volatile bool endstop_z_probe_hit = false; static volatile bool endstop_z_probe_hit = false; // Leaving this in even if Z_PROBE_ENDSTOP isn't defined, keeps code below cleaner. #ifdef it and usage below to save space.
#ifdef NPR2 #ifdef NPR2
static volatile bool endstop_e_hit = false; static volatile bool endstop_e_hit = false;
...@@ -787,7 +787,7 @@ ISR(TIMER1_COMPA_vect) { ...@@ -787,7 +787,7 @@ ISR(TIMER1_COMPA_vect) {
step_events_completed++; step_events_completed++;
if (step_events_completed >= current_block->step_event_count) break; if (step_events_completed >= current_block->step_event_count) break;
} }
// Calculare new timer value // Calculate new timer value
unsigned short timer; unsigned short timer;
unsigned short step_rate; unsigned short step_rate;
if (step_events_completed <= (unsigned long int)current_block->accelerate_until) { if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
......
...@@ -735,7 +735,7 @@ static float analog2temp(int raw, uint8_t e) { ...@@ -735,7 +735,7 @@ static float analog2temp(int raw, uint8_t e) {
return celsius; return celsius;
} }
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else #else
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
...@@ -766,7 +766,7 @@ static float analog2tempBed(int raw) { ...@@ -766,7 +766,7 @@ static float analog2tempBed(int raw) {
return celsius; return celsius;
#elif defined BED_USES_AD595 #elif defined BED_USES_AD595
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else #else
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET; return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
...@@ -782,7 +782,7 @@ static void updateTemperaturesFromRawValues() { ...@@ -782,7 +782,7 @@ static void updateTemperaturesFromRawValues() {
#ifdef HEATER_0_USES_MAX6675 #ifdef HEATER_0_USES_MAX6675
current_temperature_raw[0] = read_max6675(); current_temperature_raw[0] = read_max6675();
#endif #endif
for (int e = 0; e < HOTENDS; e++) { for (uint8_t e = 0; e < HOTENDS; e++) {
current_temperature[e] = analog2temp(current_temperature_raw[e], e); current_temperature[e] = analog2temp(current_temperature_raw[e], e);
} }
current_temperature_bed = analog2tempBed(current_temperature_bed_raw); current_temperature_bed = analog2tempBed(current_temperature_bed_raw);
...@@ -906,7 +906,7 @@ void tp_init() ...@@ -906,7 +906,7 @@ void tp_init()
#endif //HEATER_0_USES_MAX6675 #endif //HEATER_0_USES_MAX6675
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
// Use timer0 for temperature measurement // Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt // Interleave temperature interrupt with millies interrupt
HAL_temp_timer_start(TEMP_TIMER_NUM); HAL_temp_timer_start(TEMP_TIMER_NUM);
...@@ -1241,7 +1241,7 @@ static void set_current_temp_raw() { ...@@ -1241,7 +1241,7 @@ static void set_current_temp_raw() {
current_temperature_bed_raw = raw_temp_bed_value; current_temperature_bed_raw = raw_temp_bed_value;
#if HAS_POWER_CONSUMPTION_SENSOR #if HAS_POWER_CONSUMPTION_SENSOR
#if defined (__SAM3X8E__) #ifdef __SAM3X8E__
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 3.3; float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 3.3;
#else #else
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 5.0; float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 5.0;
...@@ -1591,7 +1591,7 @@ ISR(TIMER0_COMPB_vect) { ...@@ -1591,7 +1591,7 @@ ISR(TIMER0_COMPB_vect) {
raw_powconsumption_value = 0; raw_powconsumption_value = 0;
#endif #endif
#ifndef HEATER_0_USES_MAX6675 #if HAS_TEMP_0 && !defined(HEATER_0_USES_MAX6675)
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
#define GE0 <= #define GE0 <=
#else #else
......
...@@ -30,9 +30,6 @@ int gumPreheatHotendTemp; ...@@ -30,9 +30,6 @@ int gumPreheatHotendTemp;
int gumPreheatHPBTemp; int gumPreheatHPBTemp;
int gumPreheatFanSpeed; int gumPreheatFanSpeed;
const long baudrates[] = {9600,14400,19200,28800,38400,56000,115200,250000};
int baudrate_position = -1;
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR #if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
unsigned long message_millis = 0; unsigned long message_millis = 0;
#endif #endif
...@@ -47,7 +44,7 @@ int baudrate_position = -1; ...@@ -47,7 +44,7 @@ int baudrate_position = -1;
typedef void (*menuFunc_t)(); typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level; uint8_t lcd_status_message_level;
char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG; char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
#ifdef DOGLCD #ifdef DOGLCD
#include "dogm_lcd_implementation.h" #include "dogm_lcd_implementation.h"
...@@ -71,14 +68,13 @@ static void lcd_status_screen(); ...@@ -71,14 +68,13 @@ static void lcd_status_screen();
static void lcd_prepare_menu(); static void lcd_prepare_menu();
static void lcd_move_menu(); static void lcd_move_menu();
static void lcd_control_menu(); static void lcd_control_menu();
static void lcd_config_menu();
static void lcd_control_temperature_menu(); static void lcd_control_temperature_menu();
static void lcd_control_temperature_preheat_pla_settings_menu(); static void lcd_control_temperature_preheat_pla_settings_menu();
static void lcd_control_temperature_preheat_abs_settings_menu(); static void lcd_control_temperature_preheat_abs_settings_menu();
static void lcd_control_temperature_preheat_gum_settings_menu(); static void lcd_control_temperature_preheat_gum_settings_menu();
static void lcd_control_motion_menu(); static void lcd_control_motion_menu();
static void lcd_control_volumetric_menu(); static void lcd_control_volumetric_menu();
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #ifdef HAS_LCD_CONTRAST
static void lcd_set_contrast(); static void lcd_set_contrast();
#endif #endif
#ifdef FWRETRACT #ifdef FWRETRACT
...@@ -264,9 +260,10 @@ float raw_Ki, raw_Kd; ...@@ -264,9 +260,10 @@ float raw_Ki, raw_Kd;
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) { static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
if (currentMenu != menu) { if (currentMenu != menu) {
currentMenu = menu; currentMenu = menu;
#if defined(NEWPANEL)
encoderPosition = encoder; encoderPosition = encoder;
if (feedback) lcd_quick_feedback(); if (feedback) lcd_quick_feedback();
#endif
// For LCD_PROGRESS_BAR re-initialize the custom characters // For LCD_PROGRESS_BAR re-initialize the custom characters
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
lcd_set_custom_characters(menu == lcd_status_screen); lcd_set_custom_characters(menu == lcd_status_screen);
...@@ -446,11 +443,11 @@ static void lcd_main_menu() { ...@@ -446,11 +443,11 @@ static void lcd_main_menu() {
#endif #endif
} }
#endif //SDSUPPORT #endif //SDSUPPORT
MENU_ITEM(submenu, MSG_CONFIG, lcd_config_menu);
END_MENU(); END_MENU();
} }
#if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART ) #if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
static void lcd_autostart_sd() { static void lcd_autostart_sd() {
card.autostart_index = 0; card.autostart_index = 0;
card.setroot(); card.setroot();
...@@ -459,7 +456,7 @@ static void lcd_main_menu() { ...@@ -459,7 +456,7 @@ static void lcd_main_menu() {
#endif #endif
void lcd_set_home_offsets() { void lcd_set_home_offsets() {
for(int8_t i=0; i < NUM_AXIS; i++) { for (int8_t i=0; i < NUM_AXIS; i++) {
if (i != E_AXIS) { if (i != E_AXIS) {
home_offset[i] -= current_position[i]; home_offset[i] -= current_position[i];
current_position[i] = 0.0; current_position[i] = 0.0;
...@@ -912,48 +909,13 @@ static void lcd_control_menu() { ...@@ -912,48 +909,13 @@ static void lcd_control_menu() {
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu); MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #ifdef HAS_LCD_CONTRAST
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63); //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast); MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
#endif #endif
#ifdef FWRETRACT #ifdef FWRETRACT
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu); MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
#endif #endif
END_MENU();
}
static void config_baudrate() {
if(baudrate_position<0){
for (int8_t p = 0; p < 8; p++){
if (baudrates[p]==baudrate) baudrate_position = p;
}
}
if (encoderPosition != 0)
{
refresh_cmd_timeout();
baudrate_position += int(encoderPosition /2);
if(baudrate_position>7) baudrate_position=7;
if(baudrate_position<0) baudrate_position=0;
encoderPosition = 0;
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate)
{
lcd_implementation_drawedit(PSTR("Baudrate"), ltostr7(baudrates[baudrate_position]));
baudrate=baudrates[baudrate_position];
}
if (LCD_CLICKED)
{
lcd_quick_feedback();
currentMenu = lcd_config_menu;
encoderPosition = 0;
}
}
static void lcd_config_menu() {
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
MENU_ITEM(submenu, MSG_BAUDRATE, config_baudrate);
#ifdef EEPROM_SETTINGS #ifdef EEPROM_SETTINGS
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings); MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings);
...@@ -1182,26 +1144,22 @@ static void lcd_control_volumetric_menu() { ...@@ -1182,26 +1144,22 @@ static void lcd_control_volumetric_menu() {
END_MENU(); END_MENU();
} }
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #ifdef HAS_LCD_CONTRAST
static void lcd_set_contrast() {
static void lcd_set_contrast() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
lcd_contrast -= encoderPosition; lcd_contrast -= encoderPosition;
if (lcd_contrast < 0) lcd_contrast = 0; lcd_contrast &= 0x3F;
else if (lcd_contrast > 63) lcd_contrast = 63;
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu); if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
} }
#endif // HAS_LCD_CONTRAST
#endif //DOGLCD
#ifdef FWRETRACT #ifdef FWRETRACT
static void lcd_control_retract_menu() {
static void lcd_control_retract_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled); MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
...@@ -1217,9 +1175,8 @@ static void lcd_control_retract_menu() { ...@@ -1217,9 +1175,8 @@ static void lcd_control_retract_menu() {
#endif #endif
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999); MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
END_MENU(); END_MENU();
} }
#endif // FWRETRACT
#endif //FWRETRACT
#if SDCARDDETECT == -1 #if SDCARDDETECT == -1
static void lcd_sd_refresh() { static void lcd_sd_refresh() {
...@@ -1248,13 +1205,14 @@ void lcd_sdcard_menu() { ...@@ -1248,13 +1205,14 @@ void lcd_sdcard_menu() {
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir); MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
} }
for(uint16_t i = 0; i < fileCnt; i++) { for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuItemNr == _lineNr) { if (_menuItemNr == _lineNr) {
#ifndef SDCARD_RATHERRECENTFIRST card.getfilename(
card.getfilename(i); #ifdef SDCARD_RATHERRECENTFIRST
#else fileCnt-1 -
card.getfilename(fileCnt-1-i);
#endif #endif
i
);
if (card.filenameIsDir) if (card.filenameIsDir)
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename); MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
else else
...@@ -1379,6 +1337,8 @@ static void lcd_quick_feedback() { ...@@ -1379,6 +1337,8 @@ static void lcd_quick_feedback() {
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
delayMicroseconds(delay); delayMicroseconds(delay);
} }
const int j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0);
if (j) delayMicroseconds(j);
#endif #endif
} }
...@@ -1480,7 +1440,9 @@ int lcd_strlen_P(const char *s) { ...@@ -1480,7 +1440,9 @@ int lcd_strlen_P(const char *s) {
} }
void lcd_update() { void lcd_update() {
#ifdef ULTIPANEL
static unsigned long timeoutToStatus = 0; static unsigned long timeoutToStatus = 0;
#endif
#ifdef LCD_HAS_SLOW_BUTTONS #ifdef LCD_HAS_SLOW_BUTTONS
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
...@@ -1616,13 +1578,6 @@ void lcd_ignore_click(bool b) { ...@@ -1616,13 +1578,6 @@ void lcd_ignore_click(bool b) {
} }
void lcd_finishstatus(bool persist=false) { void lcd_finishstatus(bool persist=false) {
int len = lcd_strlen(lcd_status_message);
if (len > 0) {
while (len < LCD_WIDTH) {
lcd_status_message[len++] = ' ';
}
}
lcd_status_message[LCD_WIDTH] = '\0';
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
progressBarTick = millis(); progressBarTick = millis();
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
...@@ -1640,15 +1595,27 @@ void lcd_finishstatus(bool persist=false) { ...@@ -1640,15 +1595,27 @@ void lcd_finishstatus(bool persist=false) {
void dontExpireStatus() { expireStatusMillis = 0; } void dontExpireStatus() { expireStatusMillis = 0; }
#endif #endif
void set_utf_strlen(char *s, uint8_t n) {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
if ((s[i] & 0xc0u) != 0x80u) j++;
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = 0;
}
void lcd_setstatus(const char* message, bool persist) { void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0) return; if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, LCD_WIDTH); strncpy(lcd_status_message, message, 3*LCD_WIDTH);
set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_finishstatus(persist); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char* message, uint8_t level) { void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level) { if (level >= lcd_status_message_level) {
strncpy_P(lcd_status_message, message, LCD_WIDTH); strncpy_P(lcd_status_message, message, 3*LCD_WIDTH);
set_utf_strlen(lcd_status_message, LCD_WIDTH);
lcd_status_message_level = level; lcd_status_message_level = level;
lcd_finishstatus(level > 0); lcd_finishstatus(level > 0);
} }
...@@ -1663,9 +1630,9 @@ void lcd_setalertstatuspgm(const char* message) { ...@@ -1663,9 +1630,9 @@ void lcd_setalertstatuspgm(const char* message) {
void lcd_reset_alert_level() { lcd_status_message_level = 0; } void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if defined(DOGLCD) && LCD_CONTRAST >= 0 #ifdef HAS_LCD_CONTRAST
void lcd_setcontrast(uint8_t value) { void lcd_setcontrast(uint8_t value) {
lcd_contrast = value & 63; lcd_contrast = value & 0x3F;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
#endif #endif
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
void config_lcd_level_bed(void); void config_lcd_level_bed(void);
void lcd_level_bed(void); void lcd_level_bed(void);
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
......
...@@ -209,18 +209,6 @@ ...@@ -209,18 +209,6 @@
#define LCD_STR_PROGRESS "\x03\x04\x05" #define LCD_STR_PROGRESS "\x03\x04\x05"
#endif #endif
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00" // this will have 'unexpected' results when used in a string!
#define LCD_STR_DEGREE "\x01"
#define LCD_STR_THERMOMETER "\x02"
#define LCD_STR_UPLEVEL "\x03"
#define LCD_STR_REFRESH "\x04"
#define LCD_STR_FOLDER "\x05"
#define LCD_STR_FEEDRATE "\x06"
#define LCD_STR_CLOCK "\x07"
//#define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set. Only available on DISPLAY_CHARSET_HD44780_JAPAN - at this place!*/
#define LCD_STR_ARROW_RIGHT ">" /* from the default character set */
static void lcd_set_custom_characters( static void lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
bool progress_bar_set=true bool progress_bar_set=true
...@@ -465,7 +453,7 @@ Possible status screens: ...@@ -465,7 +453,7 @@ Possible status screens:
20x4 |01234567890123456789| 20x4 |01234567890123456789|
|T000/000D B000/000D | |T000/000D B000/000D |
|X+000.0 Y+000.0 Z+000.0| |X000 Y000 Z000.00|
|F100% SD100% T--:--| |F100% SD100% T--:--|
|Status line.........| |Status line.........|
...@@ -475,35 +463,38 @@ Possible status screens: ...@@ -475,35 +463,38 @@ Possible status screens:
|F100% SD100% T--:--| |F100% SD100% T--:--|
|Status line.........| |Status line.........|
*/ */
static void lcd_implementation_status_screen() static void lcd_implementation_status_screen() {
{ int tHotend = int(degHotend(0) + 0.5);
int tHotend=int(degHotend(0) + 0.5); int tTarget = int(degTargetHotend(0) + 0.5);
int tTarget=int(degTargetHotend(0) + 0.5);
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(itostr3(tHotend)); lcd.print(itostr3(tHotend));
lcd.print('/'); lcd.print('/');
lcd.print(itostr3left(tTarget)); lcd.print(itostr3left(tTarget));
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0 #if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
// If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(8, 0); lcd.setCursor(8, 0);
#if HOTENDS > 1 #if HOTENDS > 1
tHotend = int(degHotend(1) + 0.5); tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5); tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(LCD_STR_THERMOMETER[0]);
#else//Heated bed #else // Heated bed
tHotend=int(degBed() + 0.5); tHotend = int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5); tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]); lcd.print(LCD_STR_BEDTEMP[0]);
#endif #endif
lcd.print(itostr3(tHotend)); lcd.print(itostr3(tHotend));
lcd.print('/'); lcd.print('/');
lcd.print(itostr3left(tTarget)); lcd.print(itostr3left(tTarget));
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0
#else//LCD_WIDTH > 19 #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#else // LCD_WIDTH > 19
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(LCD_STR_THERMOMETER[0]);
lcd.print(itostr3(tHotend)); lcd.print(itostr3(tHotend));
...@@ -513,15 +504,15 @@ static void lcd_implementation_status_screen() ...@@ -513,15 +504,15 @@ static void lcd_implementation_status_screen()
if (tTarget < 10) lcd.print(' '); if (tTarget < 10) lcd.print(' ');
#if HOTENDS > 1 || TEMP_SENSOR_BED != 0 #if HOTENDS > 1 || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner // If we have an 2nd extruder or heated bed, show that in the top right corner
lcd.setCursor(10, 0); lcd.setCursor(10, 0);
#if HOTENDS > 1 #if HOTENDS > 1
tHotend = int(degHotend(1) + 0.5); tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5); tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]); lcd.print(LCD_STR_THERMOMETER[0]);
#else//Heated bed #else // Heated bed
tHotend=int(degBed() + 0.5); tHotend = int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5); tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]); lcd.print(LCD_STR_BEDTEMP[0]);
#endif #endif
lcd.print(itostr3(tHotend)); lcd.print(itostr3(tHotend));
...@@ -529,11 +520,13 @@ static void lcd_implementation_status_screen() ...@@ -529,11 +520,13 @@ static void lcd_implementation_status_screen()
lcd.print(itostr3left(tTarget)); lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
if (tTarget < 10) lcd.print(' '); if (tTarget < 10) lcd.print(' ');
#endif//HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif//LCD_WIDTH > 19 #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH > 19
#if LCD_HEIGHT > 2 #if LCD_HEIGHT > 2
//Lines 2 for 4 line LCD // Lines 2 for 4 line LCD
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
#ifdef SDSUPPORT #ifdef SDSUPPORT
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
...@@ -543,12 +536,14 @@ static void lcd_implementation_status_screen() ...@@ -543,12 +536,14 @@ static void lcd_implementation_status_screen()
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
lcd.print('%'); lcd.print('%');
#endif//SDSUPPORT #endif // SDSUPPORT
#else //LCD_WIDTH > 19
#else // LCD_WIDTH > 19
#if HOTENDS > 1 && TEMP_SENSOR_BED != 0 #if HOTENDS > 1 && TEMP_SENSOR_BED != 0
//If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps // If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
tHotend=int(degBed() + 0.5); tHotend = int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5); tTarget = int(degTargetBed() + 0.5);
lcd.setCursor(0, 1); lcd.setCursor(0, 1);
lcd.print(LCD_STR_BEDTEMP[0]); lcd.print(LCD_STR_BEDTEMP[0]);
...@@ -570,20 +565,25 @@ static void lcd_implementation_status_screen() ...@@ -570,20 +565,25 @@ static void lcd_implementation_status_screen()
lcd_printPGM(PSTR(" Y")); lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr3(current_position[Y_AXIS])); lcd.print(ftostr3(current_position[Y_AXIS]));
#endif // DELTA #endif // DELTA
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0 #endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif //LCD_WIDTH > 19
#endif // LCD_WIDTH > 19
lcd.setCursor(LCD_WIDTH - 8, 1); lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z'); lcd.print('Z');
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001)); lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif //LCD_HEIGHT > 2
#endif // LCD_HEIGHT > 2
#if LCD_HEIGHT > 3 #if LCD_HEIGHT > 3
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
lcd.print(LCD_STR_FEEDRATE[0]); lcd.print(LCD_STR_FEEDRATE[0]);
lcd.print(itostr3(feedmultiply)); lcd.print(itostr3(feedmultiply));
lcd.print('%'); lcd.print('%');
#if LCD_WIDTH > 19
#ifdef SDSUPPORT #if LCD_WIDTH > 19 && defined(SDSUPPORT)
lcd.setCursor(7, 2); lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING) if (IS_SD_PRINTING)
...@@ -591,11 +591,11 @@ static void lcd_implementation_status_screen() ...@@ -591,11 +591,11 @@ static void lcd_implementation_status_screen()
else else
lcd_printPGM(PSTR("---")); lcd_printPGM(PSTR("---"));
lcd.print('%'); lcd.print('%');
#endif //SDSUPPORT
#endif //LCD_WIDTH > 19 #endif // LCD_WIDTH > 19 && SDSUPPORT
lcd.setCursor(LCD_WIDTH - 6, 2); lcd.setCursor(LCD_WIDTH - 6, 2);
if(starttime != 0) if(starttime != 0) {
{
#if HAS_LCD_POWER_SENSOR #if HAS_LCD_POWER_SENSOR
if (millis() < print_millis + 1000) { if (millis() < print_millis + 1000) {
lcd.print(LCD_STR_CLOCK[0]); lcd.print(LCD_STR_CLOCK[0]);
...@@ -619,16 +619,19 @@ static void lcd_implementation_status_screen() ...@@ -619,16 +619,19 @@ static void lcd_implementation_status_screen()
else { else {
lcd_printPGM(PSTR("--:--")); lcd_printPGM(PSTR("--:--"));
} }
#endif
// Status message line at the bottom #endif // LCD_HEIGHT > 3
/**
* Display Progress Bar, Filament display, and/or Status Message on the last line
*/
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.setCursor(0, LCD_HEIGHT - 1);
#ifdef LCD_PROGRESS_BAR #ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) { if (card.isFileOpen()) {
uint16_t mil = millis(), diff = mil - progressBarTick; if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
// draw the progress bar // draw the progress bar
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100, int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH; cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
......
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