Commit d3046f1a authored by MagoKimbra's avatar MagoKimbra

Add LCD menu Configuration + BAUDRATE

Add LCD menu Configuration
Add LCD configuration Baudrate
parent 27cbf4f3
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#define SERIAL_PORT 0 #define SERIAL_PORT 0
// This determines the communication speed of the printer // This determines the communication speed of the printer
#define BAUDRATE 115000 #define BAUDRATE 115200
//#define BAUDRATE 250000 //#define BAUDRATE 250000
// This enables the serial port associated to the Bluetooth interface // This enables the serial port associated to the Bluetooth interface
......
...@@ -52,6 +52,7 @@ void Config_StoreSettings() ...@@ -52,6 +52,7 @@ 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);
...@@ -121,6 +122,8 @@ void Config_StoreSettings() ...@@ -121,6 +122,8 @@ void Config_StoreSettings()
void Config_PrintSettings() void Config_PrintSettings()
{ // 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_ECHO_START;
SERIAL_ECHOPAIR("Baudrate: ", baudrate);
SERIAL_ECHOLN("");
SERIAL_ECHOLNPGM("Steps per unit:"); SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]); SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]);
...@@ -262,6 +265,7 @@ void Config_RetrieveSettings() ...@@ -262,6 +265,7 @@ void Config_RetrieveSettings()
if (strncmp(ver,stored_ver,3) == 0) if (strncmp(ver,stored_ver,3) == 0)
{ {
// version number match // version number match
EEPROM_READ_VAR(i,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);
...@@ -338,6 +342,9 @@ void Config_RetrieveSettings() ...@@ -338,6 +342,9 @@ 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;
......
...@@ -142,13 +142,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o ...@@ -142,13 +142,13 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe) // these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 #define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 20 #define Y_PROBE_OFFSET_FROM_EXTRUDER 20
#define Z_PROBE_OFFSET_FROM_EXTRUDER -3.35 #define Z_PROBE_OFFSET_FROM_EXTRUDER -2.95
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance. #define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case // Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before traveling to the first probing point. #define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 4 //How much the extruder will be raised when traveling from between next probing points #define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when traveling from between next probing points
//#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell //#define Z_PROBE_SLED // turn on if you have a z-probe mounted on a sled like those designed by Charles Bell
//#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. //#define SLED_DOCKING_OFFSET 5 // the extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.
......
...@@ -231,6 +231,7 @@ void setPwmFrequency(uint8_t pin, int val); ...@@ -231,6 +231,7 @@ void setPwmFrequency(uint8_t pin, int val);
#define CRITICAL_SECTION_END SREG = _sreg; #define CRITICAL_SECTION_END SREG = _sreg;
#endif //CRITICAL_SECTION_START #endif //CRITICAL_SECTION_START
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;
......
...@@ -206,6 +206,8 @@ ...@@ -206,6 +206,8 @@
//=========================================================================== //===========================================================================
//=============================public variables============================= //=============================public variables=============================
//=========================================================================== //===========================================================================
unsigned long baudrate;
#ifdef SDSUPPORT #ifdef SDSUPPORT
CardReader card; CardReader card;
#endif #endif
...@@ -619,8 +621,11 @@ void setup() ...@@ -619,8 +621,11 @@ void setup()
setup_pausepin(); setup_pausepin();
#endif #endif
// 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;
...@@ -656,9 +661,6 @@ void setup() ...@@ -656,9 +661,6 @@ void setup()
fromsd[i] = false; fromsd[i] = false;
} }
// 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();
......
...@@ -283,6 +283,8 @@ ...@@ -283,6 +283,8 @@
#define MSG_BABYSTEP_Z "Babystep Z" #define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -413,6 +415,8 @@ ...@@ -413,6 +415,8 @@
#define MSG_ENDSTOP_ABORT "Blad wyl. kranc." #define MSG_ENDSTOP_ABORT "Blad wyl. kranc."
#define MSG_CONTRAST "Kontrast" #define MSG_CONTRAST "Kontrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -543,6 +547,8 @@ ...@@ -543,6 +547,8 @@
#define MSG_ENDSTOP_ABORT "Butee abandon" #define MSG_ENDSTOP_ABORT "Butee abandon"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -674,6 +680,8 @@ ...@@ -674,6 +680,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -810,6 +818,8 @@ ...@@ -810,6 +818,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -938,6 +948,8 @@ ...@@ -938,6 +948,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1078,6 +1090,8 @@ ...@@ -1078,6 +1090,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1211,6 +1225,8 @@ ...@@ -1211,6 +1225,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1338,6 +1354,8 @@ ...@@ -1338,6 +1354,8 @@
#define MSG_BABYSTEP_Z "Babystep Z" #define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1472,6 +1490,8 @@ ...@@ -1472,6 +1490,8 @@
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_CONTRAST "Contrast" #define MSG_CONTRAST "Contrast"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1597,6 +1617,8 @@ ...@@ -1597,6 +1617,8 @@
#define MSG_BABYSTEP_Z "Babystap Z" #define MSG_BABYSTEP_Z "Babystap Z"
#define MSG_ENDSTOP_ABORT "Endstop afbr." #define MSG_ENDSTOP_ABORT "Endstop afbr."
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1723,6 +1745,8 @@ ...@@ -1723,6 +1745,8 @@
#define MSG_BABYSTEP_Z "Babystep Z" #define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort" #define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
...@@ -1848,6 +1872,8 @@ ...@@ -1848,6 +1872,8 @@
#define MSG_BABYSTEP_Z "Babystep Z" #define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop deuseztat" #define MSG_ENDSTOP_ABORT "Endstop deuseztat"
#define MSG_LASER "Laser Preset" #define MSG_LASER "Laser Preset"
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#endif #endif
......
...@@ -23,6 +23,9 @@ int gumPreheatHotendTemp; ...@@ -23,6 +23,9 @@ 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;
#ifdef ULTIPANEL #ifdef ULTIPANEL
static float manual_feedrate[] = MANUAL_FEEDRATE; static float manual_feedrate[] = MANUAL_FEEDRATE;
#endif // ULTIPANEL #endif // ULTIPANEL
...@@ -55,6 +58,7 @@ static void lcd_tune_menu(); ...@@ -55,6 +58,7 @@ static void lcd_tune_menu();
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();
...@@ -299,6 +303,7 @@ static void lcd_main_menu() ...@@ -299,6 +303,7 @@ static void lcd_main_menu()
#endif #endif
} }
#endif #endif
MENU_ITEM(submenu, MSG_CONFIG, lcd_config_menu);
END_MENU(); END_MENU();
} }
...@@ -922,6 +927,43 @@ static void lcd_control_menu() ...@@ -922,6 +927,43 @@ static void lcd_control_menu()
#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);
...@@ -1751,6 +1793,37 @@ char *itostr4(const int &xx) ...@@ -1751,6 +1793,37 @@ char *itostr4(const int &xx)
return conv; return conv;
} }
char *ltostr7(const long &xx)
{
if (xx >= 1000000)
conv[0]=(xx/1000000)%10+'0';
else
conv[0]=' ';
if (xx >= 100000)
conv[1]=(xx/100000)%10+'0';
else
conv[1]=' ';
if (xx >= 10000)
conv[2]=(xx/10000)%10+'0';
else
conv[2]=' ';
if (xx >= 1000)
conv[3]=(xx/1000)%10+'0';
else
conv[3]=' ';
if (xx >= 100)
conv[4]=(xx/100)%10+'0';
else
conv[4]=' ';
if (xx >= 10)
conv[5]=(xx/10)%10+'0';
else
conv[5]=' ';
conv[6]=(xx)%10+'0';
conv[7]=0;
return conv;
}
// convert float to string with +123 format // convert float to string with +123 format
char *ftostr30(const float &x) char *ftostr30(const float &x)
{ {
......
...@@ -109,6 +109,8 @@ char *itostr3(const int &xx); ...@@ -109,6 +109,8 @@ char *itostr3(const int &xx);
char *itostr3left(const int &xx); char *itostr3left(const int &xx);
char *itostr4(const int &xx); char *itostr4(const int &xx);
char *ltostr7(const long &xx);
char *ftostr3(const float &x); char *ftostr3(const float &x);
char *ftostr30(const float &x); char *ftostr30(const float &x);
char *ftostr31ns(const float &x); // float to string without sign character char *ftostr31ns(const float &x); // float to string without sign character
......
...@@ -213,6 +213,19 @@ extern volatile uint16_t buttons; //an extended version of the last checked but ...@@ -213,6 +213,19 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
static void lcd_implementation_init() static void lcd_implementation_init()
{ {
#ifdef DELTA
byte bedTemp[8] =
{
B00000,
B01110,
B11111,
B11011,
B11111,
B01110,
B00000,
B00000
};
#else
byte bedTemp[8] = byte bedTemp[8] =
{ {
B00000, B00000,
...@@ -224,12 +237,13 @@ static void lcd_implementation_init() ...@@ -224,12 +237,13 @@ static void lcd_implementation_init()
B00000, B00000,
B00000 B00000
}; //thanks Sonny Mounicou }; //thanks Sonny Mounicou
#endif //DELTA
byte degree[8] = byte degree[8] =
{ {
B01100, B00100,
B10010, B01010,
B10010, B00100,
B01100, B00000,
B00000, B00000,
B00000, B00000,
B00000, B00000,
...@@ -242,18 +256,18 @@ static void lcd_implementation_init() ...@@ -242,18 +256,18 @@ static void lcd_implementation_init()
B01010, B01010,
B01010, B01010,
B01010, B01010,
B10001, B11111,
B10001, B11111,
B01110 B01110
}; };
byte uplevel[8]={ byte uplevel[8]={
B00100, B00100,
B01110, B01110,
B11111, B10101,
B00100,
B00100, B00100,
B11100, B11100,
B00000, B00000,
B00000,
B00000 B00000
}; //thanks joris }; //thanks joris
byte refresh[8]={ byte refresh[8]={
...@@ -459,17 +473,17 @@ static void lcd_implementation_status_screen() ...@@ -459,17 +473,17 @@ static void lcd_implementation_status_screen()
lcd.print(' '); lcd.print(' ');
# else # else
lcd.setCursor(0,1); lcd.setCursor(0,1);
#ifdef DELTA # ifdef DELTA
lcd.print('X'); lcd.print('X');
lcd.print(ftostr30(current_position[X_AXIS])); lcd.print(ftostr30(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y")); lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr30(current_position[Y_AXIS])); lcd.print(ftostr30(current_position[Y_AXIS]));
#else # else
lcd.print('X'); lcd.print('X');
lcd.print(ftostr3(current_position[X_AXIS])); lcd.print(ftostr3(current_position[X_AXIS]));
lcd_printPGM(PSTR(" Y")); lcd_printPGM(PSTR(" Y"));
lcd.print(ftostr3(current_position[Y_AXIS])); lcd.print(ftostr3(current_position[Y_AXIS]));
#endif # endif // DELTA
# endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 # endif//EXTRUDERS > 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);
......
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