Commit c4586e04 authored by MagoKimbra's avatar MagoKimbra

Same fix LCD

parent 50d309d1
......@@ -138,7 +138,6 @@
#define NEWPANEL
#endif
#ifdef ULTIPANEL
#define NEWPANEL //enable this if you have a click-encoder panel
#define SDSUPPORT
......@@ -152,16 +151,45 @@
#endif
#else //no panel but just LCD
#ifdef ULTRA_LCD
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#endif
#ifdef DOGLCD // Change number of lines to match the 128x64 graphics display
#define LCD_WIDTH 22
#define LCD_HEIGHT 5
#else
#define LCD_WIDTH 16
#define LCD_HEIGHT 2
#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
*/
......@@ -169,11 +197,18 @@
#define DEFAULT_LCD_CONTRAST 32
#endif
#ifdef DOGLCD
#define HAS_LCD_CONTRAST
#ifdef U8GLIB_ST7920
#undef HAS_LCD_CONTRAST
#endif
#endif
#else // CONFIGURATION_LCD
#define CONDITIONALS_H
#if !defined (__SAM3X8E__)
#ifndef __SAM3X8E__
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
......
......@@ -14,13 +14,12 @@
*
*/
#define EEPROM_VERSION "V19"
#define EEPROM_VERSION "V20"
/**
* V19 EEPROM Layout:
*
* ver
* baudrate
* axis_steps_per_unit (x7)
* max_feedrate (x7)
* retraction_feedrate (x4)
......@@ -140,7 +139,6 @@ void Config_StoreSettings() {
char ver[4] = "000";
int i = EEPROM_OFFSET;
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, max_feedrate);
EEPROM_WRITE_VAR(i, max_retraction_feedrate);
......@@ -291,8 +289,6 @@ void Config_RetrieveSettings() {
float dummy = 0;
// 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, max_feedrate);
EEPROM_READ_VAR(i, max_retraction_feedrate);
......@@ -446,9 +442,6 @@ void Config_RetrieveSettings() {
void Config_ResetDefault() {
//Setting default baudrate for serial
baudrate = BAUDRATE;
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE;
float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
......@@ -587,10 +580,6 @@ void Config_ResetDefault() {
void Config_PrintSettings(bool forReplay) {
// 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) {
SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START;
......
......@@ -16,6 +16,7 @@
// #define ENDSTOPPULLUP_XMIN
// #define ENDSTOPPULLUP_YMIN
// #define ENDSTOPPULLUP_ZMIN
// #define ENDSTOPPULLUP_ZPROBE
// #define ENDSTOPPULLUP_EMIN
#endif
......@@ -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 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_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:
// 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
#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
......
......@@ -130,7 +130,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the log
// 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
// delta speeds must be the same on xyz
......
......@@ -393,55 +393,55 @@ const unsigned int dropsegments=5; //everything with less than this number of st
//#define HAVE_TMCDRIVER
#ifdef HAVE_TMCDRIVER
// #define X_IS_TMC
#define X_MAX_CURRENT 1000 //in mA
#define X_SENSE_RESISTOR 91 //in mOhms
#define X_MICROSTEPS 16 //number of microsteps
// #define X2_IS_TMC
#define X2_MAX_CURRENT 1000 //in mA
#define X2_SENSE_RESISTOR 91 //in mOhms
#define X2_MICROSTEPS 16 //number of microsteps
// #define Y_IS_TMC
#define Y_MAX_CURRENT 1000 //in mA
#define Y_SENSE_RESISTOR 91 //in mOhms
#define Y_MICROSTEPS 16 //number of microsteps
// #define Y2_IS_TMC
#define Y2_MAX_CURRENT 1000 //in mA
#define Y2_SENSE_RESISTOR 91 //in mOhms
#define Y2_MICROSTEPS 16 //number of microsteps
// #define Z_IS_TMC
#define Z_MAX_CURRENT 1000 //in mA
#define Z_SENSE_RESISTOR 91 //in mOhms
#define Z_MICROSTEPS 16 //number of microsteps
// #define Z2_IS_TMC
#define Z2_MAX_CURRENT 1000 //in mA
#define Z2_SENSE_RESISTOR 91 //in mOhms
#define Z2_MICROSTEPS 16 //number of microsteps
// #define E0_IS_TMC
#define E0_MAX_CURRENT 1000 //in mA
#define E0_SENSE_RESISTOR 91 //in mOhms
#define E0_MICROSTEPS 16 //number of microsteps
// #define E1_IS_TMC
#define E1_MAX_CURRENT 1000 //in mA
#define E1_SENSE_RESISTOR 91 //in mOhms
#define E1_MICROSTEPS 16 //number of microsteps
// #define E2_IS_TMC
#define E2_MAX_CURRENT 1000 //in mA
#define E2_SENSE_RESISTOR 91 //in mOhms
#define E2_MICROSTEPS 16 //number of microsteps
// #define E3_IS_TMC
#define E3_MAX_CURRENT 1000 //in mA
#define E3_SENSE_RESISTOR 91 //in mOhms
#define E3_MICROSTEPS 16 //number of microsteps
// #define X_IS_TMC
#define X_MAX_CURRENT 1000 //in mA
#define X_SENSE_RESISTOR 91 //in mOhms
#define X_MICROSTEPS 16 //number of microsteps
// #define X2_IS_TMC
#define X2_MAX_CURRENT 1000 //in mA
#define X2_SENSE_RESISTOR 91 //in mOhms
#define X2_MICROSTEPS 16 //number of microsteps
// #define Y_IS_TMC
#define Y_MAX_CURRENT 1000 //in mA
#define Y_SENSE_RESISTOR 91 //in mOhms
#define Y_MICROSTEPS 16 //number of microsteps
// #define Y2_IS_TMC
#define Y2_MAX_CURRENT 1000 //in mA
#define Y2_SENSE_RESISTOR 91 //in mOhms
#define Y2_MICROSTEPS 16 //number of microsteps
// #define Z_IS_TMC
#define Z_MAX_CURRENT 1000 //in mA
#define Z_SENSE_RESISTOR 91 //in mOhms
#define Z_MICROSTEPS 16 //number of microsteps
// #define Z2_IS_TMC
#define Z2_MAX_CURRENT 1000 //in mA
#define Z2_SENSE_RESISTOR 91 //in mOhms
#define Z2_MICROSTEPS 16 //number of microsteps
// #define E0_IS_TMC
#define E0_MAX_CURRENT 1000 //in mA
#define E0_SENSE_RESISTOR 91 //in mOhms
#define E0_MICROSTEPS 16 //number of microsteps
// #define E1_IS_TMC
#define E1_MAX_CURRENT 1000 //in mA
#define E1_SENSE_RESISTOR 91 //in mOhms
#define E1_MICROSTEPS 16 //number of microsteps
// #define E2_IS_TMC
#define E2_MAX_CURRENT 1000 //in mA
#define E2_SENSE_RESISTOR 91 //in mOhms
#define E2_MICROSTEPS 16 //number of microsteps
// #define E3_IS_TMC
#define E3_MAX_CURRENT 1000 //in mA
#define E3_SENSE_RESISTOR 91 //in mOhms
#define E3_MICROSTEPS 16 //number of microsteps
#endif
......@@ -453,69 +453,69 @@ const unsigned int dropsegments=5; //everything with less than this number of st
//#define HAVE_L6470DRIVER
#ifdef HAVE_L6470DRIVER
// #define X_IS_L6470
#define X_MICROSTEPS 16 //number of microsteps
#define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define X2_IS_L6470
#define X2_MICROSTEPS 16 //number of microsteps
#define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y_IS_L6470
#define Y_MICROSTEPS 16 //number of microsteps
#define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y2_IS_L6470
#define Y2_MICROSTEPS 16 //number of microsteps
#define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z_IS_L6470
#define Z_MICROSTEPS 16 //number of microsteps
#define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z2_IS_L6470
#define Z2_MICROSTEPS 16 //number of microsteps
#define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E0_IS_L6470
#define E0_MICROSTEPS 16 //number of microsteps
#define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E1_IS_L6470
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E2_IS_L6470
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E3_IS_L6470
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define X_IS_L6470
#define X_MICROSTEPS 16 //number of microsteps
#define X_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define X2_IS_L6470
#define X2_MICROSTEPS 16 //number of microsteps
#define X2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define X2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y_IS_L6470
#define Y_MICROSTEPS 16 //number of microsteps
#define Y_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Y2_IS_L6470
#define Y2_MICROSTEPS 16 //number of microsteps
#define Y2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Y2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z_IS_L6470
#define Z_MICROSTEPS 16 //number of microsteps
#define Z_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define Z2_IS_L6470
#define Z2_MICROSTEPS 16 //number of microsteps
#define Z2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define Z2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E0_IS_L6470
#define E0_MICROSTEPS 16 //number of microsteps
#define E0_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E0_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E1_IS_L6470
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_MICROSTEPS 16 //number of microsteps
#define E1_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E1_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E2_IS_L6470
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_MICROSTEPS 16 //number of microsteps
#define E2_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E2_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
// #define E3_IS_L6470
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_MICROSTEPS 16 //number of microsteps
#define E3_K_VAL 50 // 0 - 255, Higher values, are higher power. Be carefull not to go too high
#define E3_OVERCURRENT 2000 //maxc current in mA. If the current goes over this value, the driver will switch off
#define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall
#endif
#include "Conditionals.h"
......
......@@ -12,7 +12,7 @@
#include <string.h>
#include <inttypes.h>
#if defined (__SAM3X8E__)
#ifdef __SAM3X8E__
#include "HAL.h"
#else
#include <util/delay.h>
......@@ -44,7 +44,7 @@
#include "HardwareSerial.h"
#endif
#if !defined (__SAM3X8E__)
#ifndef __SAM3X8E__
#include "MarlinSerial.h"
#endif
......@@ -64,7 +64,7 @@
#define MYSERIAL Serial
#endif // BTENABLED
#else
#if defined (__SAM3X8E__)
#ifdef __SAM3X8E__
#define MYSERIAL Serial
#else
#define MYSERIAL MSerial
......@@ -259,7 +259,6 @@ inline void refresh_cmd_timeout() { previous_millis_cmd = millis(); }
#define CRITICAL_SECTION_END SREG = _sreg;
#endif
extern unsigned long baudrate;
extern float homing_feedrate[];
extern bool axis_relative_modes[];
extern int feedmultiply;
......
......@@ -200,7 +200,6 @@ M999 - Restart after being stopped by error
CardReader card;
#endif
unsigned long baudrate;
float homing_feedrate[] = HOMING_FEEDRATE;
int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
......@@ -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)
{ serialprintPGM(s_P); SERIAL_ECHO(v); }
#if !defined (__SAM3X8E__)
#ifndef __SAM3X8E__
#ifdef SDSUPPORT
#include "SdFatUtil.h"
int freeMemory() { return SdFatUtil::FreeRam(); }
......@@ -665,12 +664,8 @@ void setup()
#endif
setup_killpin();
setup_filrunoutpin();
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
setup_powerhold();
MYSERIAL.begin(baudrate);
MYSERIAL.begin(BAUDRATE);
SERIAL_PROTOCOLLNPGM("start");
SERIAL_ECHO_START;
......@@ -708,6 +703,9 @@ void setup()
}
#endif //!SDSUPPORT
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings();
tp_init(); // Initialize temperature loop
plan_init(); // Initialize planner;
watchdog_init();
......@@ -2052,7 +2050,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
}
feedrate = oldFeedrate;
retracted[active_extruder] = retract;
retracted[active_extruder] = retracting;
} // retract()
#endif //FWRETRACT
......@@ -4229,7 +4227,7 @@ inline void gcode_M104() {
*/
inline void gcode_M105() {
if (setTargetedHotend(105)) return;
if (debugDryrun()) return;
#if HAS_TEMP_0 || HAS_TEMP_BED
SERIAL_PROTOCOLPGM("ok");
#if HAS_TEMP_0
......@@ -6846,7 +6844,7 @@ void kill()
disable_all_steppers();
#if HAS_POWER_SWITCH
pinMode(PS_ON_PIN, INPUT);
SET_INPUT(PS_ON_PIN);
#endif
SERIAL_ERROR_START;
......
......@@ -37,8 +37,8 @@
// save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
// we don't have a big font for Cyrillic, Kana
#if defined( MAPPER_C2C3 ) || defined( MAPPER_NON )
// #define USE_BIG_EDIT_FONT
#if defined(MAPPER_C2C3) || defined(MAPPER_NON)
//#define USE_BIG_EDIT_FONT
#endif
// If you have spare 2300Byte of progmem and want to use a
......@@ -108,40 +108,25 @@
#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
#ifdef U8GLIB_ST7920
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0);
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0);
#elif defined(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
// The MaKrPanel display, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(VIKI2) || defined(miniVIKI)
// Mini Viki and Viki 2.0 LCD, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
// Mini Viki and Viki 2.0 LCD, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#else
// for regular DOGM128 display with HW-SPI
U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
// for regular DOGM128 display with HW-SPI
U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
#endif
#include "utf_mapper.h"
int lcd_contrast;
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
static char currentfont = 0;
static void lcd_setFont(char font_nr) {
......@@ -185,8 +170,10 @@ char lcd_printPGM(const char* str) {
return n;
}
static void lcd_implementation_init()
{
static bool show_splashscreen = true;
static void lcd_implementation_init() {
#ifdef LCD_PIN_BL // Enable LCD backlight
pinMode(LCD_PIN_BL, OUTPUT);
digitalWrite(LCD_PIN_BL, HIGH);
......@@ -195,16 +182,16 @@ static void lcd_implementation_init()
u8g.setContrast(lcd_contrast);
// FIXME: remove this workaround
// Uncomment this if you have the first generation (V1.10) of STBs board
// pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90
u8g.setRot90(); // Rotate screen by 90
#elif defined(LCD_SCREEN_ROT_180)
u8g.setRot180(); // Rotate screen by 180
#elif defined(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270
#endif
// pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90
u8g.setRot90(); // Rotate screen by 90
#elif defined(LCD_SCREEN_ROT_180)
u8g.setRot180(); // Rotate screen by 180
#elif defined(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270
#endif
// Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
......@@ -217,17 +204,20 @@ static void lcd_implementation_init()
int txt1X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE1) - 1)*DOG_CHAR_WIDTH) / 2;
u8g.firstPage();
do {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
#else
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
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);
#endif
} while (u8g.nextPage());
do {
if (show_splashscreen) {
u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
lcd_setFont(FONT_MENU);
#ifndef STRING_SPLASH_LINE2
u8g.drawStr(txt1X, u8g.getHeight() - DOG_CHAR_HEIGHT, STRING_SPLASH_LINE1);
#else
int txt2X = (u8g.getWidth() - (sizeof(STRING_SPLASH_LINE2) - 1)*DOG_CHAR_WIDTH) / 2;
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);
#endif
}
} while (u8g.nextPage());
show_splashscreen = false;
}
static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
......@@ -302,20 +292,19 @@ static void lcd_implementation_status_screen() {
lcd_printPGM(PSTR("--:--"));
}
#endif
// Extruders
for (int i=0; i<EXTRUDERS; i++) _draw_heater_status(6 + i * 25, i);
// Heatbed
if (EXTRUDERS < 4) _draw_heater_status(81, -1);
// Fan
lcd_setFont(FONT_STATUSMENU);
u8g.setPrintPos(104,27);
#if HAS_FAN
int per = ((fanSpeed + 1) * 100) / 256;
if (per) {
lcd_print(itostr3(per));
lcd_print('%');
}
......@@ -367,9 +356,9 @@ static void lcd_implementation_status_screen() {
// Status line
lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT
u8g.setPrintPos(0,62);
u8g.setPrintPos(0,62);
#else
u8g.setPrintPos(0,63);
u8g.setPrintPos(0,63);
#endif
#if HAS_LCD_FILAMENT_SENSOR || HAS_LCD_POWER_SENSOR
......@@ -392,10 +381,10 @@ static void lcd_implementation_status_screen() {
#endif
#if HAS_LCD_FILAMENT_SENSOR
else {
lcd_printPGM(PSTR("D:"));
lcd_printPGM(PSTR("dia:"));
lcd_print(ftostr12ns(filament_width_meas));
lcd_printPGM(PSTR("mm F:"));
lcd_print(itostr3(volumetric_multiplier[active_extruder] * 100));
lcd_printPGM(PSTR(" factor:"));
lcd_print(itostr3(volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM]));
lcd_print('%');
}
#endif
......
......@@ -153,7 +153,6 @@
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#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"
......
......@@ -163,7 +163,6 @@
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#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"
......
......@@ -159,7 +159,6 @@
#define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configurazione"
#define MSG_BAUDRATE "Baudrate"
#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"
......
......@@ -4442,6 +4442,39 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define Z_MAX_PIN -1
#endif //Z_HOME_DIR > 0
#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
#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!
#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
#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
#define _E1_PINS
#endif
#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
#define _E2_PINS
#endif
#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
#define _E3_PINS
#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, \
HEATER_BED_PIN, FAN_PIN, \
#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, Z_PROBE_PIN, \
PS_ON_PIN, HEATER_BED_PIN, FAN_PIN, \
_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)
......
......@@ -886,7 +886,7 @@ float junction_deviation = 0.1;
block->acceleration_st = acc_st;
block->acceleration = acc_st / steps_per_mm;
#if defined(__SAM3X8E__)
#ifdef __SAM3X8E__
block->acceleration_rate = (long)(acc_st * ( 16777216.0 / HAL_TIMER_RATE));
#else
block->acceleration_rate = (long)(acc_st * 16777216.0 / (F_CPU / 8.0));
......
......@@ -76,7 +76,7 @@ volatile long endstops_stepsTotal, endstops_stepsDone;
static volatile bool endstop_x_hit = false;
static volatile bool endstop_y_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
static volatile bool endstop_e_hit = false;
......@@ -787,7 +787,7 @@ ISR(TIMER1_COMPA_vect) {
step_events_completed++;
if (step_events_completed >= current_block->step_event_count) break;
}
// Calculare new timer value
// Calculate new timer value
unsigned short timer;
unsigned short step_rate;
if (step_events_completed <= (unsigned long int)current_block->accelerate_until) {
......
......@@ -735,7 +735,7 @@ static float analog2temp(int raw, uint8_t e) {
return celsius;
}
#if defined (__SAM3X8E__)
#ifdef __SAM3X8E__
return ((raw * ((3.3 * 100) / 1024) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
#else
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) {
return celsius;
#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;
#else
return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
......@@ -782,7 +782,7 @@ static void updateTemperaturesFromRawValues() {
#ifdef HEATER_0_USES_MAX6675
current_temperature_raw[0] = read_max6675();
#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_bed = analog2tempBed(current_temperature_bed_raw);
......@@ -906,7 +906,7 @@ void tp_init()
#endif //HEATER_0_USES_MAX6675
#if defined (__SAM3X8E__)
#ifdef __SAM3X8E__
// Use timer0 for temperature measurement
// Interleave temperature interrupt with millies interrupt
HAL_temp_timer_start(TEMP_TIMER_NUM);
......@@ -1241,7 +1241,7 @@ static void set_current_temp_raw() {
current_temperature_bed_raw = raw_temp_bed_value;
#if HAS_POWER_CONSUMPTION_SENSOR
#if defined (__SAM3X8E__)
#ifdef __SAM3X8E__
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 3.3;
#else
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 5.0;
......@@ -1591,7 +1591,7 @@ ISR(TIMER0_COMPB_vect) {
raw_powconsumption_value = 0;
#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
#define GE0 <=
#else
......
......@@ -30,9 +30,6 @@ int gumPreheatHotendTemp;
int gumPreheatHPBTemp;
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
unsigned long message_millis = 0;
#endif
......@@ -47,7 +44,7 @@ int baudrate_position = -1;
typedef void (*menuFunc_t)();
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
#include "dogm_lcd_implementation.h"
......@@ -71,14 +68,13 @@ static void lcd_status_screen();
static void lcd_prepare_menu();
static void lcd_move_menu();
static void lcd_control_menu();
static void lcd_config_menu();
static void lcd_control_temperature_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_gum_settings_menu();
static void lcd_control_motion_menu();
static void lcd_control_volumetric_menu();
#if defined(DOGLCD) && LCD_CONTRAST >= 0
#ifdef HAS_LCD_CONTRAST
static void lcd_set_contrast();
#endif
#ifdef FWRETRACT
......@@ -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) {
if (currentMenu != menu) {
currentMenu = menu;
encoderPosition = encoder;
if (feedback) lcd_quick_feedback();
#if defined(NEWPANEL)
encoderPosition = encoder;
if (feedback) lcd_quick_feedback();
#endif
// For LCD_PROGRESS_BAR re-initialize the custom characters
#ifdef LCD_PROGRESS_BAR
lcd_set_custom_characters(menu == lcd_status_screen);
......@@ -446,11 +443,11 @@ static void lcd_main_menu() {
#endif
}
#endif //SDSUPPORT
MENU_ITEM(submenu, MSG_CONFIG, lcd_config_menu);
END_MENU();
}
#if defined( SDSUPPORT ) && defined( MENU_ADDAUTOSTART )
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
static void lcd_autostart_sd() {
card.autostart_index = 0;
card.setroot();
......@@ -459,7 +456,7 @@ static void lcd_main_menu() {
#endif
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) {
home_offset[i] -= current_position[i];
current_position[i] = 0.0;
......@@ -911,49 +908,14 @@ static void lcd_control_menu() {
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_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(submenu, MSG_CONTRAST, lcd_set_contrast);
#endif
#ifdef FWRETRACT
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
#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
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings);
......@@ -1182,44 +1144,39 @@ static void lcd_control_volumetric_menu() {
END_MENU();
}
#if defined(DOGLCD) && LCD_CONTRAST >= 0
static void lcd_set_contrast() {
if (encoderPosition != 0) {
lcd_contrast -= encoderPosition;
if (lcd_contrast < 0) lcd_contrast = 0;
else if (lcd_contrast > 63) lcd_contrast = 63;
encoderPosition = 0;
lcdDrawUpdate = 1;
u8g.setContrast(lcd_contrast);
#ifdef HAS_LCD_CONTRAST
static void lcd_set_contrast() {
if (encoderPosition != 0) {
lcd_contrast -= encoderPosition;
lcd_contrast &= 0x3F;
encoderPosition = 0;
lcdDrawUpdate = 1;
u8g.setContrast(lcd_contrast);
}
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
}
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
}
#endif //DOGLCD
#endif // HAS_LCD_CONTRAST
#ifdef FWRETRACT
static void lcd_control_retract_menu() {
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
#if EXTRUDERS > 1
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
#endif
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
#if EXTRUDERS > 1
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
#endif
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
END_MENU();
}
#endif //FWRETRACT
static void lcd_control_retract_menu() {
START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
#if EXTRUDERS > 1
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_SWAP, &retract_length_swap, 0, 100);
#endif
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACTF, &retract_feedrate, 1, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_ZLIFT, &retract_zlift, 0, 999);
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER, &retract_recover_length, 0, 100);
#if EXTRUDERS > 1
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &retract_recover_length_swap, 0, 100);
#endif
MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &retract_recover_feedrate, 1, 999);
END_MENU();
}
#endif // FWRETRACT
#if SDCARDDETECT == -1
static void lcd_sd_refresh() {
......@@ -1248,13 +1205,14 @@ void lcd_sdcard_menu() {
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) {
#ifndef SDCARD_RATHERRECENTFIRST
card.getfilename(i);
#else
card.getfilename(fileCnt-1-i);
#endif
card.getfilename(
#ifdef SDCARD_RATHERRECENTFIRST
fileCnt-1 -
#endif
i
);
if (card.filenameIsDir)
MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
else
......@@ -1378,7 +1336,9 @@ static void lcd_quick_feedback() {
delayMicroseconds(delay);
WRITE(BEEPER,LOW);
delayMicroseconds(delay);
}
}
const int j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0);
if (j) delayMicroseconds(j);
#endif
}
......@@ -1480,7 +1440,9 @@ int lcd_strlen_P(const char *s) {
}
void lcd_update() {
static unsigned long timeoutToStatus = 0;
#ifdef ULTIPANEL
static unsigned long timeoutToStatus = 0;
#endif
#ifdef LCD_HAS_SLOW_BUTTONS
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) {
}
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
progressBarTick = millis();
#if PROGRESS_MSG_EXPIRE > 0
......@@ -1640,15 +1595,27 @@ void lcd_finishstatus(bool persist=false) {
void dontExpireStatus() { expireStatusMillis = 0; }
#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) {
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);
}
void lcd_setstatuspgm(const char* message, uint8_t 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_finishstatus(level > 0);
}
......@@ -1663,9 +1630,9 @@ void lcd_setalertstatuspgm(const char* message) {
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) {
lcd_contrast = value & 63;
lcd_contrast = value & 0x3F;
u8g.setContrast(lcd_contrast);
}
#endif
......
......@@ -28,8 +28,6 @@
void config_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_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
......
......@@ -209,18 +209,6 @@
#define LCD_STR_PROGRESS "\x03\x04\x05"
#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(
#ifdef LCD_PROGRESS_BAR
bool progress_bar_set=true
......@@ -465,7 +453,7 @@ Possible status screens:
20x4 |01234567890123456789|
|T000/000D B000/000D |
|X+000.0 Y+000.0 Z+000.0|
|X000 Y000 Z000.00|
|F100% SD100% T--:--|
|Status line.........|
......@@ -475,35 +463,38 @@ Possible status screens:
|F100% SD100% T--:--|
|Status line.........|
*/
static void lcd_implementation_status_screen()
{
int tHotend=int(degHotend(0) + 0.5);
int tTarget=int(degTargetHotend(0) + 0.5);
static void lcd_implementation_status_screen() {
int tHotend = int(degHotend(0) + 0.5);
int tTarget = int(degTargetHotend(0) + 0.5);
#if LCD_WIDTH < 20
lcd.setCursor(0, 0);
lcd.print(itostr3(tHotend));
lcd.print('/');
lcd.print(itostr3left(tTarget));
#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);
#if HOTENDS > 1
tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]);
#else//Heated bed
tHotend=int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5);
#else // Heated bed
tHotend = int(degBed() + 0.5);
tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]);
#endif
lcd.print(itostr3(tHotend));
lcd.print('/');
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.print(LCD_STR_THERMOMETER[0]);
lcd.print(itostr3(tHotend));
......@@ -513,15 +504,15 @@ static void lcd_implementation_status_screen()
if (tTarget < 10) lcd.print(' ');
#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);
#if HOTENDS > 1
tHotend = int(degHotend(1) + 0.5);
tTarget = int(degTargetHotend(1) + 0.5);
lcd.print(LCD_STR_THERMOMETER[0]);
#else//Heated bed
tHotend=int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5);
#else // Heated bed
tHotend = int(degBed() + 0.5);
tTarget = int(degTargetBed() + 0.5);
lcd.print(LCD_STR_BEDTEMP[0]);
#endif
lcd.print(itostr3(tHotend));
......@@ -529,11 +520,13 @@ static void lcd_implementation_status_screen()
lcd.print(itostr3left(tTarget));
lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
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
//Lines 2 for 4 line LCD
// Lines 2 for 4 line LCD
#if LCD_WIDTH < 20
#ifdef SDSUPPORT
lcd.setCursor(0, 2);
......@@ -543,12 +536,14 @@ static void lcd_implementation_status_screen()
else
lcd_printPGM(PSTR("---"));
lcd.print('%');
#endif//SDSUPPORT
#else //LCD_WIDTH > 19
#endif // SDSUPPORT
#else // LCD_WIDTH > 19
#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
tHotend=int(degBed() + 0.5);
tTarget=int(degTargetBed() + 0.5);
// 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);
tTarget = int(degTargetBed() + 0.5);
lcd.setCursor(0, 1);
lcd.print(LCD_STR_BEDTEMP[0]);
......@@ -567,35 +562,40 @@ static void lcd_implementation_status_screen()
#else
lcd.print('X');
lcd.print(ftostr3(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y"));
lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr3(current_position[Y_AXIS]));
#endif // DELTA
#endif //HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif //LCD_WIDTH > 19
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z');
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif //LCD_HEIGHT > 2
#endif // HOTENDS > 1 || TEMP_SENSOR_BED != 0
#endif // LCD_WIDTH > 19
lcd.setCursor(LCD_WIDTH - 8, 1);
lcd.print('Z');
lcd.print(ftostr32sp(current_position[Z_AXIS] + 0.00001));
#endif // LCD_HEIGHT > 2
#if LCD_HEIGHT > 3
lcd.setCursor(0, 2);
lcd.print(LCD_STR_FEEDRATE[0]);
lcd.print(itostr3(feedmultiply));
lcd.print('%');
#if LCD_WIDTH > 19
#ifdef SDSUPPORT
lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING)
lcd.print(itostr3(card.percentDone()));
else
lcd_printPGM(PSTR("---"));
lcd.print('%');
#endif //SDSUPPORT
#endif //LCD_WIDTH > 19
#if LCD_WIDTH > 19 && defined(SDSUPPORT)
lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING)
lcd.print(itostr3(card.percentDone()));
else
lcd_printPGM(PSTR("---"));
lcd.print('%');
#endif // LCD_WIDTH > 19 && SDSUPPORT
lcd.setCursor(LCD_WIDTH - 6, 2);
if(starttime != 0)
{
if(starttime != 0) {
#if HAS_LCD_POWER_SENSOR
if (millis() < print_millis + 1000) {
lcd.print(LCD_STR_CLOCK[0]);
......@@ -619,16 +619,19 @@ static void lcd_implementation_status_screen()
else {
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);
#ifdef LCD_PROGRESS_BAR
if (card.isFileOpen()) {
uint16_t mil = millis(), diff = mil - progressBarTick;
if (diff >= PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
// draw the progress bar
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
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