Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
eb09f322
Commit
eb09f322
authored
Dec 29, 2014
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add progress bar & Bowden easy load
parent
678d4f90
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1099 additions
and
876 deletions
+1099
-876
Configuration.h
MarlinKimbra/Configuration.h
+71
-45
ConfigurationStore.cpp
MarlinKimbra/ConfigurationStore.cpp
+136
-124
Configuration_Cartesian.h
MarlinKimbra/Configuration_Cartesian.h
+34
-3
Configuration_Delta.h
MarlinKimbra/Configuration_Delta.h
+1
-1
Configuration_adv.h
MarlinKimbra/Configuration_adv.h
+1
-1
Marlin.h
MarlinKimbra/Marlin.h
+19
-18
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+303
-219
language.h
MarlinKimbra/language.h
+8
-5
language_en.h
MarlinKimbra/language_en.h
+4
-0
motion_control.h
MarlinKimbra/motion_control.h
+1
-2
pins.h
MarlinKimbra/pins.h
+29
-18
planner.cpp
MarlinKimbra/planner.cpp
+10
-3
planner.h
MarlinKimbra/planner.h
+2
-3
stepper.cpp
MarlinKimbra/stepper.cpp
+1
-2
temperature.cpp
MarlinKimbra/temperature.cpp
+82
-28
temperature.h
MarlinKimbra/temperature.h
+16
-13
ultralcd.cpp
MarlinKimbra/ultralcd.cpp
+228
-354
ultralcd.h
MarlinKimbra/ultralcd.h
+3
-4
ultralcd_implementation_hitachi_HD44780.h
MarlinKimbra/ultralcd_implementation_hitachi_HD44780.h
+150
-33
No files found.
MarlinKimbra/Configuration.h
View file @
eb09f322
...
...
@@ -3,10 +3,12 @@
#include "boards.h"
// This configuration file contains the basic settings.
// Advanced settings can be found in Configuration_adv.h
// User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware.
#define STRING_VERSION_CONFIG_H __DATE__ "
21/12/2014
" __TIME__ // build date and time
#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(MagoKimbra: magokimbra@hotmail.com, Version 4.0)" // Who made the changes.
// SERIAL_PORT selects which serial port should be used for communication with the host.
...
...
@@ -187,22 +189,21 @@
// PID settings:
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
#define PID_MAX
255
// limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define BANG_MAX 255
// limits current to nozzle while in bang-bang mode; 255=full current
#define PID_MAX
BANG_MAX
// limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#ifdef PIDTEMP
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_INTEGRAL_DRIVE_MAX 255 //limit for the integral term
#define K1 0.95 //smoothing factor within the PID
#define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_INTEGRAL_DRIVE_MAX PID_MAX //limit for the integral term
#define K1 0.95 //smoothing factor within the PID
#define PID_dT ((OVERSAMPLENR * 10.0)/(F_CPU / 64.0 / 256.0)) //sampling period of the temperature routine
// HotEnd{HE0,HE1,HE2,HE3}
#define DEFAULT_Kp {40,41,41,41} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {7,7,7,7} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {59,59,59,59} // Kd for E0, E1, E2, E3
#define DEFAULT_Kp {40,41,41,41} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {7,7,7,7} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {59,59,59,59} // Kd for E0, E1, E2, E3
#endif // PIDTEMP
...
...
@@ -229,9 +230,9 @@
#ifdef PIDTEMPBED
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi .023
#define DEFAULT_bedKd 305.4
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi .023
#define DEFAULT_bedKd 305.4
//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
...
...
@@ -338,33 +339,33 @@
//automatic expansion
#if defined (MAKRPANEL)
#define DOGLCD
#define SDSUPPORT
#define ULTIPANEL
#define NEWPANEL
#define DEFAULT_LCD_CONTRAST 17
#define DOGLCD
#define SDSUPPORT
#define ULTIPANEL
#define NEWPANEL
#define DEFAULT_LCD_CONTRAST 17
#endif
#if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
#endif
#if defined(ULTIMAKERCONTROLLER) || defined(REPRAP_DISCOUNT_SMART_CONTROLLER) || defined(G3D_PANEL)
#define ULTIPANEL
#define NEWPANEL
#define ULTIPANEL
#define NEWPANEL
#endif
#if defined(REPRAPWORLD_KEYPAD)
#define NEWPANEL
#define ULTIPANEL
#define NEWPANEL
#define ULTIPANEL
#endif
#if defined(RA_CONTROL_PANEL)
#define ULTIPANEL
#define NEWPANEL
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#define ULTIPANEL
#define NEWPANEL
#define LCD_I2C_TYPE_PCA8574
#define LCD_I2C_ADDRESS 0x27 // I2C Address of the port expander
#endif
//I2C PANELS
...
...
@@ -426,11 +427,13 @@
// Shift register panels
// ---------------------
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
//#define SR_LCD
#ifdef SR_LCD
#define SR_LCD_2W_NL // Non latching 2 wire shift register
//#define NEWPANEL
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
//#define SAV_3DLCD
#ifdef SAV_3DLCD
#define SR_LCD_2W_NL // Non latching 2 wire shiftregister
#define NEWPANEL
#define ULTIPANEL
#endif
...
...
@@ -459,9 +462,9 @@
// default LCD contrast for dogm-like LCD displays
#ifdef DOGLCD
#
ifndef DEFAULT_LCD_CONTRAST
#
define DEFAULT_LCD_CONTRAST 32
#
endif
#
ifndef DEFAULT_LCD_CONTRAST
#
define DEFAULT_LCD_CONTRAST 32
#
endif
#endif
// option for invert rotary switch
...
...
@@ -500,6 +503,32 @@
// please keep turned on if you can.
//#define EEPROM_CHITCHAT
//Bowden Filament management
//#define EASY_LOAD
#ifdef EASY_LOAD
#define BOWDEN_LENGTH 560 // mm
#define LCD_PURGE_LENGTH 3 // mm
#define LCD_RETRACT_LENGTH 3 // mm
#define LCD_PURGE_FEEDRATE 3 // mm/s
#define LCD_RETRACT_FEEDRATE 10 // mm/s
#define LCD_LOAD_FEEDRATE 8 // mm/s
#define LCD_UNLOAD_FEEDRATE 8 // mm/s
#endif
// Show a progress bar on the LCD when printing from SD?
//#define LCD_PROGRESS_BAR
#ifdef LCD_PROGRESS_BAR
// Amount of time (ms) to show the bar
#define PROGRESS_BAR_BAR_TIME 2000
// Amount of time (ms) to show the status message
#define PROGRESS_BAR_MSG_TIME 3000
// Amount of time (ms) to retain the status message (0=forever)
#define PROGRESS_BAR_MSG_EXPIRE 0
// Enable this to show messages for MSG_TIME then hide them
//#define PROGRESS_BAR_MSG_ONCE
#endif
// Preheat Constants
#define PLA_PREHEAT_HOTEND_TEMP 190
#define PLA_PREHEAT_HPB_TEMP 60
...
...
@@ -607,9 +636,6 @@
#include "Configuration_adv.h"
#include "thermistortables.h"
...
...
MarlinKimbra/ConfigurationStore.cpp
View file @
eb09f322
...
...
@@ -36,14 +36,12 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#if defined(CARTESIAN)
#define EEPROM_VERSION "V10"
#elif defined(COREXY)
#define EEPROM_VERSION "V11"
#elif defined(DELTA)
#define EEPROM_VERSION "V12"
#elif defined(SCARA)
#define EEPROM_VERSION "V13"
#ifdef DELTA
#define EEPROM_VERSION "V11"
#endif
#ifdef SCARA
#define EEPROM_VERSION "V12"
#endif
#ifdef EEPROM_SETTINGS
...
...
@@ -121,142 +119,156 @@ void Config_StoreSettings()
#ifndef DISABLE_M503
void
Config_PrintSettings
()
{
// Always have this function, even with EEPROM_SETTINGS disabled, the current values will be shown
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
"Baudrate: "
,
baudrate
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHOLNPGM
(
"Steps per unit:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M92 X"
,
axis_steps_per_unit
[
0
]);
SERIAL_ECHOPAIR
(
" Y"
,
axis_steps_per_unit
[
1
]);
SERIAL_ECHOPAIR
(
" Z"
,
axis_steps_per_unit
[
2
]);
SERIAL_ECHOPAIR
(
" E0 "
,
axis_steps_per_unit
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
axis_steps_per_unit
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
axis_steps_per_unit
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
axis_steps_per_unit
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
"Baudrate: "
,
baudrate
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHOLNPGM
(
"Steps per unit:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M92 X"
,
axis_steps_per_unit
[
X_AXIS
]);
SERIAL_ECHOPAIR
(
" Y"
,
axis_steps_per_unit
[
Y_AXIS
]);
SERIAL_ECHOPAIR
(
" Z"
,
axis_steps_per_unit
[
Z_AXIS
]);
SERIAL_ECHOPAIR
(
" E0 "
,
axis_steps_per_unit
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
axis_steps_per_unit
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
axis_steps_per_unit
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
axis_steps_per_unit
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHO_START
;
#ifdef SCARA
SERIAL_ECHOLNPGM
(
"Scaling factors:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M365 X"
,
axis_scaling
[
0
]);
SERIAL_ECHOPAIR
(
" Y"
,
axis_scaling
[
1
]);
SERIAL_ECHOPAIR
(
" Z"
,
axis_scaling
[
2
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Scaling factors:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M365 X"
,
axis_scaling
[
X_AXIS
]);
SERIAL_ECHOPAIR
(
" Y"
,
axis_scaling
[
Y_AXIS
]);
SERIAL_ECHOPAIR
(
" Z"
,
axis_scaling
[
Z_AXIS
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
#endif
SERIAL_ECHOLNPGM
(
"Maximum feedrates (mm/s):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M203 X "
,
max_feedrate
[
0
]);
SERIAL_ECHOPAIR
(
" Y "
,
max_feedrate
[
1
]
);
SERIAL_ECHOPAIR
(
" Z "
,
max_feedrate
[
2
]
);
SERIAL_ECHOPAIR
(
" E0 "
,
max_feedrate
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_feedrate
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_feedrate
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_feedrate
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Retraction Steps per unit:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" E0 "
,
max_retraction_feedrate
[
0
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_retraction_feedrate
[
1
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_retraction_feedrate
[
2
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_retraction_feedrate
[
3
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Maximum Acceleration (mm/s2):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M201 X "
,
max_acceleration_units_per_sq_second
[
0
]
);
SERIAL_ECHOPAIR
(
" Y "
,
max_acceleration_units_per_sq_second
[
1
]
);
SERIAL_ECHOPAIR
(
" Z "
,
max_acceleration_units_per_sq_second
[
2
]
);
SERIAL_ECHOPAIR
(
" E0 "
,
max_acceleration_units_per_sq_second
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_acceleration_units_per_sq_second
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_acceleration_units_per_sq_second
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_acceleration_units_per_sq_second
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Acceleration: S=acceleration, T=retract acceleration"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M204 S"
,
acceleration
);
SERIAL_ECHOPAIR
(
" T"
,
retract_acceleration
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHOLNPGM
(
"Maximum feedrates (mm/s):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M203 X "
,
max_feedrate
[
X_AXIS
]);
SERIAL_ECHOPAIR
(
" Y "
,
max_feedrate
[
Y_AXIS
]
);
SERIAL_ECHOPAIR
(
" Z "
,
max_feedrate
[
Z_AXIS
]
);
SERIAL_ECHOPAIR
(
" E0 "
,
max_feedrate
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_feedrate
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_feedrate
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_feedrate
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M205 S"
,
minimumfeedrate
);
SERIAL_ECHOPAIR
(
" T"
,
mintravelfeedrate
);
SERIAL_ECHOPAIR
(
" B"
,
minsegmenttime
);
SERIAL_ECHOPAIR
(
" X"
,
max_xy_jerk
);
SERIAL_ECHOPAIR
(
" Z"
,
max_z_jerk
);
SERIAL_ECHOPAIR
(
" E"
,
max_e_jerk
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Retraction Steps per unit:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" E0 "
,
max_retraction_feedrate
[
0
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_retraction_feedrate
[
1
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_retraction_feedrate
[
2
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_retraction_feedrate
[
3
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Maximum Acceleration (mm/s2):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M201 X "
,
max_acceleration_units_per_sq_second
[
X_AXIS
]
);
SERIAL_ECHOPAIR
(
" Y "
,
max_acceleration_units_per_sq_second
[
Y_AXIS
]
);
SERIAL_ECHOPAIR
(
" Z "
,
max_acceleration_units_per_sq_second
[
Z_AXIS
]
);
SERIAL_ECHOPAIR
(
" E0 "
,
max_acceleration_units_per_sq_second
[
3
]);
SERIAL_ECHOPAIR
(
" E1 "
,
max_acceleration_units_per_sq_second
[
4
]);
SERIAL_ECHOPAIR
(
" E2 "
,
max_acceleration_units_per_sq_second
[
5
]);
SERIAL_ECHOPAIR
(
" E3 "
,
max_acceleration_units_per_sq_second
[
6
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Acceleration: S=acceleration, T=retract acceleration"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M204 S"
,
acceleration
);
SERIAL_ECHOPAIR
(
" T"
,
retract_acceleration
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Home offset (mm):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M206 X"
,
add_homing
[
0
]
);
SERIAL_ECHOPAIR
(
" Y"
,
add_homing
[
1
]
);
SERIAL_ECHOPAIR
(
" Z"
,
add_homing
[
2
]
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M205 S"
,
minimumfeedrate
);
SERIAL_ECHOPAIR
(
" T"
,
mintravelfeedrate
);
SERIAL_ECHOPAIR
(
" B"
,
minsegmenttime
);
SERIAL_ECHOPAIR
(
" X"
,
max_xy_jerk
);
SERIAL_ECHOPAIR
(
" Z"
,
max_z_jerk
);
SERIAL_ECHOPAIR
(
" E"
,
max_e_jerk
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Home offset (mm):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M206 X"
,
add_homing
[
X_AXIS
]
);
SERIAL_ECHOPAIR
(
" Y"
,
add_homing
[
Y_AXIS
]
);
SERIAL_ECHOPAIR
(
" Z"
,
add_homing
[
Z_AXIS
]
);
SERIAL_ECHOLN
(
""
);
#ifdef DELTA
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Endstop adjustment (mm):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M666 X"
,
endstop_adj
[
0
]);
SERIAL_ECHOPAIR
(
" Y"
,
endstop_adj
[
1
]);
SERIAL_ECHOPAIR
(
" Z"
,
endstop_adj
[
2
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Delta Geometry adjustment:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M666 A"
,
tower_adj
[
0
]);
SERIAL_ECHOPAIR
(
" B"
,
tower_adj
[
1
]);
SERIAL_ECHOPAIR
(
" C"
,
tower_adj
[
2
]);
SERIAL_ECHOPAIR
(
" E"
,
tower_adj
[
3
]);
SERIAL_ECHOPAIR
(
" F"
,
tower_adj
[
4
]);
SERIAL_ECHOPAIR
(
" G"
,
tower_adj
[
5
]);
SERIAL_ECHOPAIR
(
" R"
,
delta_radius
);
SERIAL_ECHOPAIR
(
" D"
,
delta_diagonal_rod
);
SERIAL_ECHOPAIR
(
" H"
,
max_pos
[
2
]);
SERIAL_ECHOPAIR
(
" P"
,
z_probe_offset
[
3
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Endstop adjustment (mm):"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M666 X"
,
endstop_adj
[
0
]);
SERIAL_ECHOPAIR
(
" Y"
,
endstop_adj
[
1
]);
SERIAL_ECHOPAIR
(
" Z"
,
endstop_adj
[
2
]);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Delta Geometry adjustment:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M666 A"
,
tower_adj
[
0
]);
SERIAL_ECHOPAIR
(
" B"
,
tower_adj
[
1
]);
SERIAL_ECHOPAIR
(
" C"
,
tower_adj
[
2
]);
SERIAL_ECHOPAIR
(
" E"
,
tower_adj
[
3
]);
SERIAL_ECHOPAIR
(
" F"
,
tower_adj
[
4
]);
SERIAL_ECHOPAIR
(
" G"
,
tower_adj
[
5
]);
SERIAL_ECHOPAIR
(
" R"
,
delta_radius
);
SERIAL_ECHOPAIR
(
" D"
,
delta_diagonal_rod
);
SERIAL_ECHOPAIR
(
" H"
,
max_pos
[
2
]);
SERIAL_ECHOPAIR
(
" P"
,
z_probe_offset
[
3
]);
SERIAL_ECHOLN
(
""
);
/*
SERIAL_ECHOLN("Tower Positions");
SERIAL_ECHOPAIR("Tower1 X:",delta_tower1_x);
SERIAL_ECHOPAIR(" Y:",delta_tower1_y);
SERIAL_ECHOLN("");
SERIAL_ECHOPAIR("Tower2 X:",delta_tower2_x);
SERIAL_ECHOPAIR(" Y:",delta_tower2_y);
SERIAL_ECHOLN("");
SERIAL_ECHOPAIR("Tower3 X:",delta_tower3_x);
SERIAL_ECHOPAIR(" Y:",delta_tower3_y);
SERIAL_ECHOLN("");
*/
SERIAL_ECHOPAIR("Tower1 X:",delta_tower1_x);
SERIAL_ECHOPAIR(" Y:",delta_tower1_y);
SERIAL_ECHOLN("");
SERIAL_ECHOPAIR("Tower2 X:",delta_tower2_x);
SERIAL_ECHOPAIR(" Y:",delta_tower2_y);
SERIAL_ECHOLN("");
SERIAL_ECHOPAIR("Tower3 X:",delta_tower3_x);
SERIAL_ECHOPAIR(" Y:",delta_tower3_y);
SERIAL_ECHOLN("");
*/
#endif // DELTA
#ifdef ENABLE_AUTO_BED_LEVELING
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
"Z Probe offset (mm):"
,
zprobe_zoffset
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
"Z Probe offset (mm):"
,
zprobe_zoffset
);
SERIAL_ECHOLN
(
""
);
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef PIDTEMP
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"PID settings:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M301 P"
,
Kp
[
active_extruder
]);
SERIAL_ECHOPAIR
(
" I"
,
unscalePID_i
(
Ki
[
active_extruder
]));
SERIAL_ECHOPAIR
(
" D"
,
unscalePID_d
(
Kd
[
active_extruder
]));
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"PID settings:"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M301 P"
,
Kp
[
active_extruder
]);
SERIAL_ECHOPAIR
(
" I"
,
unscalePID_i
(
Ki
[
active_extruder
]));
SERIAL_ECHOPAIR
(
" D"
,
unscalePID_d
(
Kd
[
active_extruder
]));
SERIAL_ECHOLN
(
""
);
#endif
#ifdef FWRETRACT
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Retract: S=Length (mm) F:Speed (mm/m) Z: ZLift (mm)"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M207 S"
,
retract_length
);
SERIAL_ECHOPAIR
(
" F"
,
retract_feedrate
*
60
);
SERIAL_ECHOPAIR
(
" Z"
,
retract_zlift
);
SERIAL_ECHOLN
(
""
);
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
"Recover: S=Extra length (mm) F:Speed (mm/m)"
);
SERIAL_ECHO_START
;
SERIAL_ECHOPAIR
(
" M208 S"
,
retract_recover_length
);
SERIAL_ECHOPAIR
(
" F"
,
retract_recover_feedrate
*
60
);
SERIAL_ECHOLN
(
""
);
#endif
}
#endif
#ifdef EEPROM_SETTINGS
void
Config_RetrieveSettings
()
{
...
...
MarlinKimbra/Configuration_Cartesian.h
View file @
eb09f322
// Define this to set a custom name for your generic Mendel,
#define CUSTOM_MENDEL_NAME "Prusa
I3
"
#define CUSTOM_MENDEL_NAME "Prusa"
// Define this to set a unique identifier for this printer, (Used by some programs to differentiate between machines)
// You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4)
...
...
@@ -172,10 +172,41 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the lo
// - Block Z homing only when the probe is outside bed area.
#ifdef Z_SAFE_HOMING
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#endif
#ifdef AUTO_BED_LEVELING_GRID // Check if Probe_Offset * Grid Points is greater than Probing Range
#if X_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((X_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION))
#error "The X axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#if Y_PROBE_OFFSET_FROM_EXTRUDER < 0
#if (-(Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#else
#if ((Y_PROBE_OFFSET_FROM_EXTRUDER * AUTO_BED_LEVELING_GRID_POINTS) >= (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION))
#define Z_SAFE_HOMING_X_POINT (X_MAX_LENGTH/2) // X point for Z homing when homing all axis (G28)
#define Z_SAFE_HOMING_Y_POINT (Y_MAX_LENGTH/2) // Y point for Z homing when homing all axis (G28)
#error "The Y axis probing range is not enough to fit all the points defined in AUTO_BED_LEVELING_GRID_POINTS"
#endif
#endif
#endif
#endif // ENABLE_AUTO_BED_LEVELING
...
...
MarlinKimbra/Configuration_Delta.h
View file @
eb09f322
...
...
@@ -134,7 +134,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// delta speeds must be the same on xyz
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,80,451,625,625,625} // X, Y, Z, E0, E1, E2, E3
#define DEFAULT_MAX_FEEDRATE {300,300,300,45,100,100,100} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {
8
0,150,150,150} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {
15
0,150,150,150} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {2000,2000,2000,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
...
...
MarlinKimbra/Configuration_adv.h
View file @
eb09f322
...
...
@@ -348,7 +348,7 @@
// extruder advance constant (s2/mm3)
//
// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTUDER_ADVANCE_K * cubic mm per second ^ 2
// advance (steps) = STEPS_PER_CUBIC_MM_E * EXT
R
UDER_ADVANCE_K * cubic mm per second ^ 2
//
// Hooke's law says: force = k * distance
// Bernoulli's principle says: v ^ 2 / 2 + g . h + pressure / density = constant
...
...
MarlinKimbra/Marlin.h
View file @
eb09f322
...
...
@@ -66,8 +66,9 @@
#define SERIAL_PROTOCOLLNPGM(x) (serialprintPGM(PSTR(x)),MYSERIAL.write('\n'))
const
char
errormagic
[]
PROGMEM
=
"Error:"
;
const
char
echomagic
[]
PROGMEM
=
"echo:"
;
extern
const
char
errormagic
[]
PROGMEM
;
extern
const
char
echomagic
[]
PROGMEM
;
#define SERIAL_ERROR_START (serialprintPGM(errormagic))
#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
...
...
@@ -151,31 +152,29 @@ void manage_inactivity();
#endif
#if (DRIVER_EXTRUDERS > 1) && defined(E1_ENABLE_PIN) && (E1_ENABLE_PIN > -1)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e1() WRITE(E1_ENABLE_PIN, E_ENABLE_ON)
#define disable_e1() WRITE(E1_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e1()
/* nothing */
#define disable_e1()
/* nothing */
#define enable_e1()
/* nothing */
#define disable_e1()
/* nothing */
#endif
#if (DRIVER_EXTRUDERS > 2) && defined(E2_ENABLE_PIN) && (E2_ENABLE_PIN > -1)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e2() WRITE(E2_ENABLE_PIN, E_ENABLE_ON)
#define disable_e2() WRITE(E2_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e2()
/* nothing */
#define disable_e2()
/* nothing */
#define enable_e2()
/* nothing */
#define disable_e2()
/* nothing */
#endif
#if (DRIVER_EXTRUDERS > 3) && defined(E3_ENABLE_PIN) && (E3_ENABLE_PIN > -1)
#define enable_e3() WRITE(E3_ENABLE_PIN, E_ENABLE_ON)
#define disable_e3() WRITE(E3_ENABLE_PIN,!E_ENABLE_ON)
#define enable_e3() WRITE(E3_ENABLE_PIN, E_ENABLE_ON)
#define disable_e3() WRITE(E3_ENABLE_PIN,!E_ENABLE_ON)
#else
#define enable_e3()
/* nothing */
#define disable_e3()
/* nothing */
#define enable_e3()
/* nothing */
#define disable_e3()
/* nothing */
#endif
enum
AxisEnum
{
X_AXIS
=
0
,
Y_AXIS
=
1
,
Z_AXIS
=
2
,
E_AXIS
=
3
};
...
...
@@ -183,7 +182,6 @@ void FlushSerialRequestResend();
void
ClearToSend
();
void
get_coordinates
();
#ifdef DELTA
float
probe_bed
(
float
x
,
float
y
);
void
set_delta_constants
();
...
...
@@ -202,7 +200,6 @@ extern float delta_tower1_x,delta_tower1_y;
extern
float
delta_tower2_x
,
delta_tower2_y
;
extern
float
delta_tower3_x
,
delta_tower3_y
;
#endif
#ifdef SCARA
void
calculate_delta
(
float
cartesian
[
3
]);
void
calculate_SCARA_forward_Transform
(
float
f_scara
[
3
]);
...
...
@@ -290,6 +287,10 @@ extern float retract_length, retract_length_swap, retract_feedrate, retract_zlif
extern
float
retract_recover_length
,
retract_recover_length_swap
,
retract_recover_feedrate
;
#endif
#ifdef EASY_LOAD
extern
bool
allow_lengthy_extrude_once
;
// for load/unload
#endif
#ifdef LASERBEAM
extern
int
laser_ttl_modulation
;
#endif
...
...
MarlinKimbra/Marlin_main.cpp
View file @
eb09f322
...
...
@@ -377,21 +377,24 @@ float axis_scaling[3]={1,1,1}; // Build size scaling, default to 1
bool
cancel_heatup
=
false
;
#ifdef FILAMENT_SENSOR
//Variables for Filament Sensor input
float
filament_width_nominal
=
DEFAULT_NOMINAL_FILAMENT_DIA
;
//Set nominal filament width, can be changed with M404
bool
filament_sensor
=
false
;
//M405 turns on filament_sensor control, M406 turns it off
float
filament_width_meas
=
DEFAULT_MEASURED_FILAMENT_DIA
;
//Stores the measured filament diameter
signed
char
measurement_delay
[
MAX_MEASUREMENT_DELAY
+
1
];
//ring buffer to delay measurement store extruder factor after subtracting 100
int
delay_index1
=
0
;
//index into ring buffer
int
delay_index2
=-
1
;
//index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
float
delay_dist
=
0
;
//delay distance counter
int
meas_delay_cm
=
MEASUREMENT_DELAY_CM
;
//distance delay setting
//Variables for Filament Sensor input
float
filament_width_nominal
=
DEFAULT_NOMINAL_FILAMENT_DIA
;
//Set nominal filament width, can be changed with M404
bool
filament_sensor
=
false
;
//M405 turns on filament_sensor control, M406 turns it off
float
filament_width_meas
=
DEFAULT_MEASURED_FILAMENT_DIA
;
//Stores the measured filament diameter
signed
char
measurement_delay
[
MAX_MEASUREMENT_DELAY
+
1
];
//ring buffer to delay measurement store extruder factor after subtracting 100
int
delay_index1
=
0
;
//index into ring buffer
int
delay_index2
=-
1
;
//index into ring buffer - set to -1 on startup to indicate ring buffer needs to be initialized
float
delay_dist
=
0
;
//delay distance counter
int
meas_delay_cm
=
MEASUREMENT_DELAY_CM
;
//distance delay setting
#endif
#ifdef LASERBEAM
int
laser_ttl_modulation
=
0
;
#endif
const
char
errormagic
[]
PROGMEM
=
"Error:"
;
const
char
echomagic
[]
PROGMEM
=
"echo:"
;
//===========================================================================
//=============================Private Variables=============================
//===========================================================================
...
...
@@ -456,13 +459,17 @@ static float color_position[] = COLOR_STEP; //variabile per la scelta del color
static
float
color_step_moltiplicator
=
(
DRIVER_MICROSTEP
/
MOTOR_ANGLE
)
*
CARTER_MOLTIPLICATOR
;
#endif // NPR2
#ifdef EASY_LOAD
bool
allow_lengthy_extrude_once
;
// for load/unload
#endif
bool
Stopped
=
false
;
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
bool
paused
=
false
;
#endif
#if NUM_SERVOS > 0
Servo
servos
[
NUM_SERVOS
];
Servo
servos
[
NUM_SERVOS
];
#endif
bool
CooldownNoWait
=
true
;
...
...
@@ -515,7 +522,8 @@ void serial_echopair_P(const char *s_P, unsigned long v)
//needs overworking someday
void
enquecommand
(
const
char
*
cmd
)
{
if
(
buflen
<
BUFSIZE
)
{
if
(
buflen
<
BUFSIZE
)
{
//this is dangerous if a mixing of serial and this happens
strcpy
(
&
(
cmdbuffer
[
bufindw
][
0
]),
cmd
);
SERIAL_ECHO_START
;
...
...
@@ -529,7 +537,8 @@ void enquecommand(const char *cmd)
void
enquecommand_P
(
const
char
*
cmd
)
{
if
(
buflen
<
BUFSIZE
)
{
if
(
buflen
<
BUFSIZE
)
{
//this is dangerous if a mixing of serial and this happens
strcpy_P
(
&
(
cmdbuffer
[
bufindw
][
0
]),
cmd
);
SERIAL_ECHO_START
;
...
...
@@ -541,97 +550,101 @@ void enquecommand_P(const char *cmd)
}
}
#if defined(KILL_PIN) && KILL_PIN > -1
void
setup_killpin
()
{
pinMode
(
KILL_PIN
,
INPUT
);
WRITE
(
KILL_PIN
,
HIGH
);
#if defined(KILL_PIN) && KILL_PIN > -1
SET_INPUT
(
KILL_PIN
);
WRITE
(
KILL_PIN
,
HIGH
);
#endif
}
// Set home pin
void
setup_homepin
(
void
)
{
#if defined(HOME_PIN) && HOME_PIN > -1
SET_INPUT
(
HOME_PIN
);
WRITE
(
HOME_PIN
,
HIGH
);
#endif
}
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
void
setup_pausepin
()
{
pinMode
(
PAUSE_PIN
,
INPUT
);
WRITE
(
PAUSE_PIN
,
HIGH
);
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
SET_INPUT
(
PAUSE_PIN
);
WRITE
(
PAUSE_PIN
,
HIGH
);
#endif
}
#endif
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
void
setup_photpin
()
{
SET_OUTPUT
(
PHOTOGRAPH_PIN
);
WRITE
(
PHOTOGRAPH_PIN
,
LOW
);
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
SET_OUTPUT
(
PHOTOGRAPH_PIN
);
WRITE
(
PHOTOGRAPH_PIN
,
LOW
);
#endif
}
#endif
void
setup_powerhold
()
{
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT
(
SUICIDE_PIN
);
WRITE
(
SUICIDE_PIN
,
HIGH
);
#endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
SET_OUTPUT
(
PS_ON_PIN
);
#if defined(PS_DEFAULT_OFF)
WRITE
(
PS_ON_PIN
,
PS_ON_ASLEEP
);
#else
WRITE
(
PS_ON_PIN
,
PS_ON_AWAKE
);
#endif // PS_DEFAULT_OFF
#endif // PS_ON_PIN
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT
(
SUICIDE_PIN
);
WRITE
(
SUICIDE_PIN
,
HIGH
);
#endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1
SET_OUTPUT
(
PS_ON_PIN
);
#if defined(PS_DEFAULT_OFF)
WRITE
(
PS_ON_PIN
,
PS_ON_ASLEEP
);
#else
WRITE
(
PS_ON_PIN
,
PS_ON_AWAKE
);
#endif
#endif
}
void
suicide
()
{
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT
(
SUICIDE_PIN
);
WRITE
(
SUICIDE_PIN
,
LOW
);
#endif
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT
(
SUICIDE_PIN
);
WRITE
(
SUICIDE_PIN
,
LOW
);
#endif
}
#if NUM_SERVOS > 0
void
servo_init
()
{
#if (NUM_SERVOS >= 1) && defined(SERVO0_PIN) && (SERVO0_PIN > -1)
servos
[
0
].
attach
(
SERVO0_PIN
);
#endif
#if (NUM_SERVOS >= 2) && defined(SERVO1_PIN) && (SERVO1_PIN > -1)
servos
[
1
].
attach
(
SERVO1_PIN
);
#endif
#if (NUM_SERVOS >= 3) && defined(SERVO2_PIN) && (SERVO2_PIN > -1)
servos
[
2
].
attach
(
SERVO2_PIN
);
#endif
#if (NUM_SERVOS >= 4) && defined(SERVO3_PIN) && (SERVO3_PIN > -1)
servos
[
3
].
attach
(
SERVO3_PIN
);
#endif
#if (NUM_SERVOS >= 5)
#error "TODO: enter initalisation code for more servos"
#endif
#if (NUM_SERVOS >= 1) && defined(SERVO0_PIN) && (SERVO0_PIN > -1)
servos
[
0
].
attach
(
SERVO0_PIN
);
#endif
#if (NUM_SERVOS >= 2) && defined(SERVO1_PIN) && (SERVO1_PIN > -1)
servos
[
1
].
attach
(
SERVO1_PIN
);
#endif
#if (NUM_SERVOS >= 3) && defined(SERVO2_PIN) && (SERVO2_PIN > -1)
servos
[
2
].
attach
(
SERVO2_PIN
);
#endif
#if (NUM_SERVOS >= 4) && defined(SERVO3_PIN) && (SERVO3_PIN > -1)
servos
[
3
].
attach
(
SERVO3_PIN
);
#endif
#if (NUM_SERVOS >= 5)
#error "TODO: enter initalisation code for more servos"
#endif
// Set position of Servo Endstops that are defined
#if defined(SERVO_ENDSTOPS) && (NUM_SERVOS > 0)
for
(
int8_t
i
=
0
;
i
<
3
;
i
++
)
{
#if (NUM_SERVOS > 0)
for
(
int8_t
i
=
0
;
i
<
3
;
i
++
)
{
if
(
servo_endstops
[
i
]
>
-
1
)
{
servos
[
servo_endstops
[
i
]].
write
(
servo_endstop_angles
[
i
*
2
+
1
]);
}
}
#endif // SERVO_ENDSTOP
S
#endif // NUM_SERVO
S
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay
(
PROBE_SERVO_DEACTIVATION_DELAY
);
servos
[
servo_endstops
[
Z_AXIS
]].
detach
();
#endif
#endif
}
#endif // NUM_SERVOS
void
setup
()
{
#if defined(KILL_PIN) && KILL_PIN > -1
setup_killpin
();
#endif
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
setup_pausepin
();
#endif
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
Config_RetrieveSettings
();
...
...
@@ -652,17 +665,17 @@ void setup()
SERIAL_ECHOPGM
(
MSG_MARLIN
);
SERIAL_ECHOLNPGM
(
VERSION_STRING
);
#ifdef STRING_VERSION_CONFIG_H
#ifdef STRING_CONFIG_H_AUTHOR
SERIAL_ECHO_START
;
SERIAL_ECHOPGM
(
MSG_CONFIGURATION_VER
);
SERIAL_ECHOPGM
(
STRING_VERSION_CONFIG_H
);
SERIAL_ECHOPGM
(
MSG_AUTHOR
);
SERIAL_ECHOLNPGM
(
STRING_CONFIG_H_AUTHOR
);
SERIAL_ECHOPGM
(
"Compiled: "
);
SERIAL_ECHOLNPGM
(
__DATE__
);
#endif // STRING_CONFIG_H_AUTHOR
#endif // STRING_VERSION_CONFIG_H
#ifdef STRING_VERSION_CONFIG_H
#ifdef STRING_CONFIG_H_AUTHOR
SERIAL_ECHO_START
;
SERIAL_ECHOPGM
(
MSG_CONFIGURATION_VER
);
SERIAL_ECHOPGM
(
STRING_VERSION_CONFIG_H
);
SERIAL_ECHOPGM
(
MSG_AUTHOR
);
SERIAL_ECHOLNPGM
(
STRING_CONFIG_H_AUTHOR
);
SERIAL_ECHOPGM
(
"Compiled: "
);
SERIAL_ECHOLNPGM
(
__DATE__
);
#endif // STRING_CONFIG_H_AUTHOR
#endif // STRING_VERSION_CONFIG_H
SERIAL_ECHO_START
;
SERIAL_ECHOPGM
(
MSG_FREE_MEMORY
);
SERIAL_ECHO
(
freeMemory
());
...
...
@@ -677,33 +690,31 @@ void setup()
plan_init
();
// Initialize planner;
watchdog_init
();
st_init
();
// Initialize stepper, this enables interrupts!
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
setup_photpin
();
#endif
#ifdef LASERBEAM // Initialize Laser beam
SET_OUTPUT
(
LASER_PWR_PIN
);
digitalWrite
(
LASER_PWR_PIN
,
LOW
);
SET_OUTPUT
(
LASER_TTL_PIN
);
digitalWrite
(
LASER_TTL_PIN
,
LOW
);
#endif
#if NUM_SERVOS > 0
servo_init
();
#endif
lcd_init
();
_delay_ms
(
1000
);
// wait 1sec to display the splash screen
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
SET_OUTPUT
(
CONTROLLERFAN_PIN
);
//Set pin used for driver cooling fan
#endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
SET_OUTPUT
(
CONTROLLERFAN_PIN
);
//Set pin used for driver cooling fan
#endif
#ifdef DIGIPOT_I2C
digipot_i2c_init
();
#endif
#ifdef DIGIPOT_I2C
digipot_i2c_init
();
#endif
#ifdef Z_PROBE_SLED
pinMode
(
SERVO0_PIN
,
OUTPUT
);
digitalWrite
(
SERVO0_PIN
,
LOW
);
// turn it off
#endif // Z_PROBE_SLED
setup_homepin
();
#ifdef FIRMWARE_TEST
FirmwareTest
();
#endif // FIRMWARE_TEST
...
...
@@ -714,40 +725,39 @@ void loop()
{
if
(
buflen
<
(
BUFSIZE
-
1
))
get_command
();
#ifdef SDSUPPORT
#ifdef SDSUPPORT
card
.
checkautostart
(
false
);
#endif
#endif
if
(
buflen
)
{
#ifdef SDSUPPORT
if
(
card
.
saving
)
{
if
(
strstr_P
(
cmdbuffer
[
bufindr
],
PSTR
(
"M29"
))
==
NULL
)
#ifdef SDSUPPORT
if
(
card
.
saving
)
{
card
.
write_command
(
cmdbuffer
[
bufindr
]);
if
(
card
.
logging
)
if
(
strstr_P
(
cmdbuffer
[
bufindr
],
PSTR
(
"M29"
))
==
NULL
)
{
process_commands
();
card
.
write_command
(
cmdbuffer
[
bufindr
]);
if
(
card
.
logging
)
{
process_commands
();
}
else
{
SERIAL_PROTOCOLLNPGM
(
MSG_OK
);
}
}
else
{
SERIAL_PROTOCOLLNPGM
(
MSG_OK
);
card
.
closefile
();
SERIAL_PROTOCOLLNPGM
(
MSG_FILE_SAVED
);
}
}
else
{
card
.
closefile
();
SERIAL_PROTOCOLLNPGM
(
MSG_FILE_SAVED
);
process_commands
();
}
}
else
{
#else
process_commands
();
}
#else // no SDSUPPORT
process_commands
();
#endif //SDSUPPORT
#endif //SDSUPPORT
buflen
=
(
buflen
-
1
);
bufindr
=
(
bufindr
+
1
)
%
BUFSIZE
;
}
...
...
@@ -763,9 +773,9 @@ void get_command()
while
(
MYSERIAL
.
available
()
>
0
&&
buflen
<
BUFSIZE
)
{
serial_char
=
MYSERIAL
.
read
();
if
(
serial_char
==
'\n'
||
serial_char
==
'\r'
||
(
serial_char
==
':'
&&
comment_mode
==
false
)
||
serial_count
>=
(
MAX_CMD_SIZE
-
1
)
)
serial_char
==
'\r'
||
(
serial_char
==
':'
&&
comment_mode
==
false
)
||
serial_count
>=
(
MAX_CMD_SIZE
-
1
)
)
{
if
(
!
serial_count
)
{
//if empty line
comment_mode
=
false
;
//for new command
...
...
@@ -779,7 +789,7 @@ void get_command()
{
strchr_pointer
=
strchr
(
cmdbuffer
[
bufindw
],
'N'
);
gcode_N
=
(
strtol
(
&
cmdbuffer
[
bufindw
][
strchr_pointer
-
cmdbuffer
[
bufindw
]
+
1
],
NULL
,
10
));
if
(
gcode_N
!=
gcode_LastN
+
1
&&
(
strstr_P
(
cmdbuffer
[
bufindw
],
PSTR
(
"M110"
))
==
NULL
))
{
if
(
gcode_N
!=
gcode_LastN
+
1
&&
(
strstr_P
(
cmdbuffer
[
bufindw
],
PSTR
(
"M110"
))
==
NULL
)
)
{
SERIAL_ERROR_START
;
SERIAL_ERRORPGM
(
MSG_ERR_LINE_NO
);
SERIAL_ERRORLN
(
gcode_LastN
);
...
...
@@ -789,7 +799,8 @@ void get_command()
return
;
}
if
(
strchr
(
cmdbuffer
[
bufindw
],
'*'
)
!=
NULL
)
{
if
(
strchr
(
cmdbuffer
[
bufindw
],
'*'
)
!=
NULL
)
{
byte
checksum
=
0
;
byte
count
=
0
;
while
(
cmdbuffer
[
bufindw
][
count
]
!=
'*'
)
checksum
=
checksum
^
cmdbuffer
[
bufindw
][
count
++
];
...
...
@@ -804,7 +815,9 @@ void get_command()
return
;
}
//if no errors, continue parsing
}
else
{
}
else
{
SERIAL_ERROR_START
;
SERIAL_ERRORPGM
(
MSG_ERR_NO_CHECKSUM
);
SERIAL_ERRORLN
(
gcode_LastN
);
...
...
@@ -815,8 +828,11 @@ void get_command()
gcode_LastN
=
gcode_N
;
//if no errors, continue parsing
}
else
{
// if we don't receive 'N' but still see '*'
if
((
strchr
(
cmdbuffer
[
bufindw
],
'*'
)
!=
NULL
))
{
}
else
// if we don't receive 'N' but still see '*'
{
if
((
strchr
(
cmdbuffer
[
bufindw
],
'*'
)
!=
NULL
))
{
SERIAL_ERROR_START
;
SERIAL_ERRORPGM
(
MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM
);
SERIAL_ERRORLN
(
gcode_LastN
);
...
...
@@ -824,9 +840,9 @@ void get_command()
return
;
}
}
if
((
strchr
(
cmdbuffer
[
bufindw
],
'G'
)
!=
NULL
))
{
if
((
strchr
(
cmdbuffer
[
bufindw
],
'G'
)
!=
NULL
)){
strchr_pointer
=
strchr
(
cmdbuffer
[
bufindw
],
'G'
);
switch
((
int
)((
strtod
(
&
cmdbuffer
[
bufindw
][
strchr_pointer
-
cmdbuffer
[
bufindw
]
+
1
],
NULL
))))
{
switch
((
int
)((
strtod
(
&
cmdbuffer
[
bufindw
][
strchr_pointer
-
cmdbuffer
[
bufindw
]
+
1
],
NULL
)))){
case
0
:
case
1
:
case
2
:
...
...
@@ -857,7 +873,7 @@ void get_command()
if
(
!
comment_mode
)
cmdbuffer
[
bufindw
][
serial_count
++
]
=
serial_char
;
}
}
#ifdef SDSUPPORT
#ifdef SDSUPPORT
if
(
!
card
.
sdprinting
||
serial_count
!=
0
){
return
;
}
...
...
@@ -917,7 +933,9 @@ void get_command()
if
(
!
comment_mode
)
cmdbuffer
[
bufindw
][
serial_count
++
]
=
serial_char
;
}
}
#endif //SDSUPPORT
#endif //SDSUPPORT
}
...
...
@@ -974,6 +992,7 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir, HOME_DIR);
#define DXC_AUTO_PARK_MODE 1
#define DXC_DUPLICATION_MODE 2
static
int
dual_x_carriage_mode
=
DEFAULT_DUAL_X_CARRIAGE_MODE
;
static
float
x_home_pos
(
int
extruder
)
{
if
(
extruder
==
0
)
return
base_home_pos
(
X_AXIS
)
+
add_homing
[
X_AXIS
];
...
...
@@ -2190,7 +2209,7 @@ void process_commands()
destination
[
X_AXIS
]
=
round
(
Z_SAFE_HOMING_X_POINT
-
X_PROBE_OFFSET_FROM_EXTRUDER
);
destination
[
Y_AXIS
]
=
round
(
Z_SAFE_HOMING_Y_POINT
-
Y_PROBE_OFFSET_FROM_EXTRUDER
);
destination
[
Z_AXIS
]
=
Z_RAISE_BEFORE_HOMING
*
home_dir
(
Z_AXIS
)
*
(
-
1
);
// Set destination away from bed
feedrate
=
XY_TRAVEL_SPEED
;
feedrate
=
XY_TRAVEL_SPEED
/
60
;
current_position
[
Z_AXIS
]
=
0
;
plan_set_position
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
]);
...
...
@@ -5351,7 +5370,14 @@ void clamp_to_software_endstops(float target[3])
if
(
min_software_endstops
)
{
if
(
target
[
X_AXIS
]
<
min_pos
[
X_AXIS
])
target
[
X_AXIS
]
=
min_pos
[
X_AXIS
];
if
(
target
[
Y_AXIS
]
<
min_pos
[
Y_AXIS
])
target
[
Y_AXIS
]
=
min_pos
[
Y_AXIS
];
if
(
target
[
Z_AXIS
]
<
min_pos
[
Z_AXIS
])
target
[
Z_AXIS
]
=
min_pos
[
Z_AXIS
];
float
negative_z_offset
=
0
;
#ifdef ENABLE_AUTO_BED_LEVELING
if
(
Z_PROBE_OFFSET_FROM_EXTRUDER
<
0
)
negative_z_offset
=
negative_z_offset
+
Z_PROBE_OFFSET_FROM_EXTRUDER
;
if
(
add_homing
[
Z_AXIS
]
<
0
)
negative_z_offset
=
negative_z_offset
+
add_homing
[
Z_AXIS
];
#endif
if
(
target
[
Z_AXIS
]
<
min_pos
[
Z_AXIS
]
+
negative_z_offset
)
target
[
Z_AXIS
]
=
min_pos
[
Z_AXIS
]
+
negative_z_offset
;
}
if
(
max_software_endstops
)
{
...
...
@@ -5755,6 +5781,18 @@ void handle_status_leds(void)
void
manage_inactivity
()
{
#if defined(KILL_PIN) && KILL_PIN > -1
static
int
killCount
=
0
;
// make the inactivity button a bit less responsive
const
int
KILL_DELAY
=
10000
;
#endif
#if defined(HOME_PIN) && HOME_PIN > -1
static
int
homeDebounceCount
=
0
;
// poor man's debouncing count
const
int
HOME_DEBOUNCE_DELAY
=
10000
;
#endif
if
(
buflen
<
(
BUFSIZE
-
1
))
get_command
();
...
...
@@ -5775,47 +5813,83 @@ void manage_inactivity()
}
}
}
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
if
(
beeptemponoff
)
temptone
();
#endif
#ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH
if
(
chdkActive
&&
(
millis
()
-
chdkHigh
>
CHDK_DELAY
))
{
chdkActive
=
false
;
WRITE
(
CHDK
,
LOW
);
}
#endif
#if defined(KILL_PIN) && KILL_PIN > -1
if
(
0
==
READ
(
KILL_PIN
))
kill
();
#endif
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
if
(
0
==
READ
(
PAUSE_PIN
)
&&
!
paused
)
pause
();
#endif
#ifdef CHDK //Check if pin should be set to LOW after M240 set it to HIGH
if
(
chdkActive
&&
(
millis
()
-
chdkHigh
>
CHDK_DELAY
))
{
chdkActive
=
false
;
WRITE
(
CHDK
,
LOW
);
}
#endif
#if defined(KILL_PIN) && KILL_PIN > -1
// Check if the kill button was pressed and wait just in case it was an accidental
// key kill key press
// -------------------------------------------------------------------------------
if
(
0
==
READ
(
KILL_PIN
)
)
{
killCount
++
;
}
else
if
(
killCount
>
0
)
{
killCount
--
;
}
// Exceeded threshold and we can confirm that it was not accidental
// KILL the machine
// ----------------------------------------------------------------
if
(
killCount
>=
KILL_DELAY
)
{
kill
();
}
#endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
controllerFan
();
//Check if fan should be turned on to cool stepper drivers down
#endif
#ifdef EXTRUDER_RUNOUT_PREVENT
if
(
(
millis
()
-
previous_millis_cmd
)
>
EXTRUDER_RUNOUT_SECONDS
*
1000
)
#if defined(HOME_PIN) && HOME_PIN > -1
// Check to see if we have to home, use poor man's debouncer
// ---------------------------------------------------------
if
(
0
==
READ
(
HOME_PIN
)
)
{
if
(
homeDebounceCount
==
0
)
{
enquecommand_P
((
PSTR
(
"G28"
)));
homeDebounceCount
++
;
LCD_ALERTMESSAGEPGM
(
MSG_AUTO_HOME
);
}
else
if
(
homeDebounceCount
<
HOME_DEBOUNCE_DELAY
)
{
homeDebounceCount
++
;
}
else
{
homeDebounceCount
=
0
;
}
}
#endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
controllerFan
();
//Check if fan should be turned on to cool stepper drivers down
#endif
#ifdef EXTRUDER_RUNOUT_PREVENT
if
(
(
millis
()
-
previous_millis_cmd
)
>
EXTRUDER_RUNOUT_SECONDS
*
1000
)
if
(
degHotend
(
active_extruder
)
>
EXTRUDER_RUNOUT_MINTEMP
)
{
bool
oldstatus
=
READ
(
E0_ENABLE_PIN
);
enable_e0
();
float
oldepos
=
current_position
[
E_AXIS
];
float
oldedes
=
destination
[
E_AXIS
];
plan_buffer_line
(
destination
[
X_AXIS
],
destination
[
Y_AXIS
],
destination
[
Z_AXIS
],
destination
[
E_AXIS
]
+
EXTRUDER_RUNOUT_EXTRUDE
*
EXTRUDER_RUNOUT_ESTEPS
/
axis_steps_per_unit
[
active_extruder
+
3
],
EXTRUDER_RUNOUT_SPEED
/
60.
*
EXTRUDER_RUNOUT_ESTEPS
/
axis_steps_per_unit
[
active_extruder
+
3
],
active_extruder
,
active_driver
);
current_position
[
E_AXIS
]
=
oldepos
;
destination
[
E_AXIS
]
=
oldedes
;
plan_set_e_position
(
oldepos
);
previous_millis_cmd
=
millis
();
st_synchronize
();
WRITE
(
E0_ENABLE_PIN
,
oldstatus
);
bool
oldstatus
=
READ
(
E0_ENABLE_PIN
);
enable_e0
();
float
oldepos
=
current_position
[
E_AXIS
];
float
oldedes
=
destination
[
E_AXIS
];
plan_buffer_line
(
destination
[
X_AXIS
],
destination
[
Y_AXIS
],
destination
[
Z_AXIS
],
destination
[
E_AXIS
]
+
EXTRUDER_RUNOUT_EXTRUDE
*
EXTRUDER_RUNOUT_ESTEPS
/
axis_steps_per_unit
[
active_extruder
+
3
],
EXTRUDER_RUNOUT_SPEED
/
60.
*
EXTRUDER_RUNOUT_ESTEPS
/
axis_steps_per_unit
[
active_extruder
+
3
],
active_extruder
,
active_driver
);
current_position
[
E_AXIS
]
=
oldepos
;
destination
[
E_AXIS
]
=
oldedes
;
plan_set_e_position
(
oldepos
);
previous_millis_cmd
=
millis
();
st_synchronize
();
WRITE
(
E0_ENABLE_PIN
,
oldstatus
);
}
#endif
#if defined(DUAL_X_CARRIAGE)
...
...
@@ -5836,9 +5910,9 @@ void manage_inactivity()
void
kill
()
{
#if defined(KILL_PIN) && KILL_PIN > -1
cli
();
// Stop interrupts
disable_heater
();
disable_x
();
disable_y
();
disable_z
();
...
...
@@ -5853,9 +5927,16 @@ void kill()
SERIAL_ERROR_START
;
SERIAL_ERRORLNPGM
(
MSG_ERR_KILLED
);
LCD_ALERTMESSAGEPGM
(
MSG_KILLED
);
// FMC small patch to update the LCD before ending
sei
();
// enable interrupts
for
(
int
i
=
5
;
i
--
;
lcd_update
())
{
delay
(
200
);
}
cli
();
// disable interrupts
suicide
();
while
(
1
)
{
/* Intentionally left empty */
}
// Wait for reset
#endif
}
#if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
...
...
@@ -5901,16 +5982,17 @@ void temptone()
}
#endif // (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
void
pause
()
{
paused
=
true
;
enquecommand
(
"M600 X0 Z+5"
);
enquecommand
(
"G4 P0"
);
enquecommand
(
"G4 P0"
);
enquecommand
(
"G4 P0"
);
#if defined(PAUSE_PIN) && PAUSE_PIN > -1
paused
=
true
;
enquecommand
(
"M600 X0 Z+5"
);
enquecommand
(
"G4 P0"
);
enquecommand
(
"G4 P0"
);
enquecommand
(
"G4 P0"
);
#endif // defined(PAUSE_PIN) && PAUSE_PIN > -1
}
#endif // defined(PAUSE_PIN) && PAUSE_PIN > -1
void
Stop
()
{
...
...
@@ -5930,77 +6012,79 @@ bool IsStopped() { return Stopped; };
void
setPwmFrequency
(
uint8_t
pin
,
int
val
)
{
val
&=
0x07
;
switch
(
digitalPinToTimer
(
pin
))
{
#if defined(TCCR0A)
case
TIMER0A
:
case
TIMER0B
:
//TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS02));
//TCCR0B |= val;
break
;
#endif
switch
(
digitalPinToTimer
(
pin
))
{
#if defined(TCCR1
A)
case
TIMER1
A
:
case
TIMER1
B
:
//TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS1
2));
//TCCR1
B |= val;
break
;
#endif
#if defined(TCCR0
A)
case
TIMER0
A
:
case
TIMER0
B
:
// TCCR0B &= ~(_BV(CS00) | _BV(CS01) | _BV(CS0
2));
// TCCR0
B |= val;
break
;
#endif
#if defined(TCCR2
)
case
TIMER2
:
case
TIMER2
:
TCCR2
&=
~
(
_BV
(
CS10
)
|
_BV
(
CS11
)
|
_BV
(
CS12
));
TCCR2
|=
val
;
break
;
#endif
#if defined(TCCR1A
)
case
TIMER1A
:
case
TIMER1B
:
// TCCR1B
&= ~(_BV(CS10) | _BV(CS11) | _BV(CS12));
// TCCR1B
|= val;
break
;
#endif
#if defined(TCCR2A
)
case
TIMER2A
:
case
TIMER2B
:
TCCR2B
&=
~
(
_BV
(
CS20
)
|
_BV
(
CS21
)
|
_BV
(
CS2
2
));
TCCR2B
|=
val
;
break
;
#endif
#if defined(TCCR2
)
case
TIMER2
:
case
TIMER2
:
TCCR2
&=
~
(
_BV
(
CS10
)
|
_BV
(
CS11
)
|
_BV
(
CS1
2
));
TCCR2
|=
val
;
break
;
#endif
#if defined(TCCR3A)
case
TIMER3A
:
case
TIMER3B
:
case
TIMER3C
:
TCCR3B
&=
~
(
_BV
(
CS30
)
|
_BV
(
CS31
)
|
_BV
(
CS32
));
TCCR3B
|=
val
;
break
;
#endif
#if defined(TCCR2A)
case
TIMER2A
:
case
TIMER2B
:
TCCR2B
&=
~
(
_BV
(
CS20
)
|
_BV
(
CS21
)
|
_BV
(
CS22
));
TCCR2B
|=
val
;
break
;
#endif
#if defined(TCCR4
A)
case
TIMER4
A
:
case
TIMER4
B
:
case
TIMER4
C
:
TCCR4B
&=
~
(
_BV
(
CS40
)
|
_BV
(
CS41
)
|
_BV
(
CS4
2
));
TCCR4
B
|=
val
;
break
;
#endif
#if defined(TCCR3
A)
case
TIMER3
A
:
case
TIMER3
B
:
case
TIMER3
C
:
TCCR3B
&=
~
(
_BV
(
CS30
)
|
_BV
(
CS31
)
|
_BV
(
CS3
2
));
TCCR3
B
|=
val
;
break
;
#endif
#if defined(TCCR5A)
case
TIMER5A
:
case
TIMER5B
:
case
TIMER5C
:
TCCR5B
&=
~
(
_BV
(
CS50
)
|
_BV
(
CS51
)
|
_BV
(
CS52
));
TCCR5B
|=
val
;
break
;
#endif
#if defined(TCCR4A)
case
TIMER4A
:
case
TIMER4B
:
case
TIMER4C
:
TCCR4B
&=
~
(
_BV
(
CS40
)
|
_BV
(
CS41
)
|
_BV
(
CS42
));
TCCR4B
|=
val
;
break
;
#endif
#if defined(TCCR5A)
case
TIMER5A
:
case
TIMER5B
:
case
TIMER5C
:
TCCR5B
&=
~
(
_BV
(
CS50
)
|
_BV
(
CS51
)
|
_BV
(
CS52
));
TCCR5B
|=
val
;
break
;
#endif
}
}
#endif //FAST_PWM_FAN
bool
setTargetedHotend
(
int
code
)
{
bool
setTargetedHotend
(
int
code
){
tmp_extruder
=
active_extruder
;
if
(
code_seen
(
'T'
))
{
tmp_extruder
=
code_value
();
if
(
tmp_extruder
>=
EXTRUDERS
)
{
SERIAL_ECHO_START
;
switch
(
code
)
{
switch
(
code
){
case
104
:
SERIAL_ECHO
(
MSG_M104_INVALID_EXTRUDER
);
break
;
...
...
@@ -6022,4 +6106,4 @@ bool setTargetedHotend(int code) {
}
}
return
false
;
}
\ No newline at end of file
}
MarlinKimbra/language.h
View file @
eb09f322
...
...
@@ -32,21 +32,24 @@
#define FIRMWARE_URL "http://firmware.ultimaker.com"
#elif MB(RUMBA)
#define MACHINE_NAME "Rumba"
#define FIRMWARE_URL "https://github.com/
ErikZalm/Marlin/
"
#define FIRMWARE_URL "https://github.com/
MagoKimbra/MarlinKimbra
"
#elif MB(3DRAG)
#define MACHINE_NAME "3Drag"
#define FIRMWARE_URL "http://3dprint.elettronicain.it/"
#elif MB(5DPRINT)
#define MACHINE_NAME "Makibox"
#define FIRMWARE_URL "https://github.com/ErikZalm/Marlin/"
#define FIRMWARE_URL "https://github.com/MagoKimbra/MarlinKimbra"
#elif MB(SAV_MKI)
#define MACHINE_NAME "SAV MkI"
#define FIRMWARE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config"
#else
#ifdef CUSTOM_MENDEL_NAME
#define MACHINE_NAME CUSTOM_MENDEL_NAME
#else
#define MACHINE_NAME "
Mendel
"
#define MACHINE_NAME "
Prusa
"
#endif
// Default firmware set to Mendel
// Default firmware set to
Prusa/
Mendel
#define FIRMWARE_URL "https://github.com/MagoKimbra/MarlinKimbra"
#endif
...
...
@@ -118,7 +121,7 @@
#define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open"
#define MSG_HOTEND_OFFSET "Hotend offsets:"
#define MSG_EMPTY_PLANE
"Autolevel can only be execute on an actual plane, make sure width and height are not 0!"
#define MSG_EMPTY_PLANE
"Autolevel can only be execute on an actual plane, make sure width and height are not 0!"
#define MSG_SD_CANT_OPEN_SUBDIR "Cannot open subdir"
#define MSG_SD_INIT_FAIL "SD init fail"
...
...
MarlinKimbra/language_en.h
View file @
eb09f322
...
...
@@ -143,6 +143,10 @@
#define MSG_CONFIG "Configuration"
#define MSG_BAUDRATE "Baudrate"
#define MSG_RECTRACT "Rectract"
#define MSG_E_BOWDEN_LENGTH "Extrude " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_R_BOWDEN_LENGTH "Retract " STRINGIFY(BOWDEN_LENGTH) "mm"
#define MSG_PURGE_XMM "Purge " STRINGIFY(LCD_PURGE_LENGTH) "mm"
#define MSG_RETRACT_XMM "Retract " STRINGIFY(LCD_RETRACT_LENGTH) "mm"
#ifdef FIRMWARE_TEST
#define MSG_FWTEST_YES "Put the Y command to go next"
...
...
MarlinKimbra/motion_control.h
View file @
eb09f322
...
...
@@ -27,7 +27,6 @@
// the direction of helical travel, radius == circle radius, isclockwise boolean. Used
// for vector transformation direction.
void
mc_arc
(
float
*
position
,
float
*
target
,
float
*
offset
,
unsigned
char
axis_0
,
unsigned
char
axis_1
,
unsigned
char
axis_linear
,
float
feed_rate
,
float
radius
,
unsigned
char
isclockwise
,
uint8_t
extruder
,
uint8_t
driver
);
unsigned
char
axis_linear
,
float
feed_rate
,
float
radius
,
unsigned
char
isclockwise
,
uint8_t
extruder
,
uint8_t
driver
);
#endif
MarlinKimbra/pins.h
View file @
eb09f322
...
...
@@ -1899,24 +1899,24 @@
#define ORIG_HEATER_2_PIN -1
#define ORIG_HEATER_BED_PIN 20 // Bed
#define ORIG_FAN_PIN 16 // Fan -- from Teensyduino environment.
// For the fan and Teensyduino uses a different pin mapping.
// For the fan and Teensyduino uses a different pin mapping.
#define X_STOP_PIN 13
#define Y_STOP_PIN 14
#define Z_STOP_PIN 15
//#define Z_STOP_PIN 36 // For inductive sensor.
#define X_STOP_PIN 13
#define Y_STOP_PIN 14
#define Z_STOP_PIN 15
#define ORIG_TEMP_0_PIN 7 // Extruder / Analog pin numbering
#define ORIG_TEMP_BED_PIN 6 // Bed / Analog pin numbering
#define ORIG_TEMP_0_PIN 7 // Extruder / Analog pin numbering
#define ORIG_TEMP_BED_PIN 6 // Bed / Analog pin numbering
#define ORIG_TEMP_1_PIN -1
#define ORIG_TEMP_2_PIN -1
#define SDPOWER -1
#define SDSS 20 // PB0 - 8 in marlin env.
#define LED_PIN -1
#define PS_ON_PIN -1
#define KILL_PIN -1
#define ALARM_PIN -1
#define SDCARDDETECT -1
#define SDPOWER -1
#define SDSS 20 // PB0 - 8 in marlin env.
#define LED_PIN -1
#define PS_ON_PIN -1
#define ALARM_PIN -1
#define SDCARDDETECT -1
#ifndef SDSUPPORT
...
...
@@ -1933,13 +1933,24 @@
#define LCD_PINS_D5 -1
#define LCD_PINS_D6 -1
#define LCD_PINS_D7 -1
#define BTN_EN1 -1
#define BTN_EN2 -1
#define BTN_ENC -1
#ifdef SAV_3DLCD
// For LCD SHIFT register LCD
#define SR_DATA_PIN 0
#define SR_CLK_PIN 1
#define SR_DATA_PIN 1
#define SR_CLK_PIN 0
#define BTN_EN1 41
#define BTN_EN2 40
#define BTN_ENC 12
#define KILL_PIN 42 // A2 = 42 - teensy = 40
#define HOME_PIN -1 // A4 = marlin 44 - teensy = 42
#ifdef NUM_SERVOS
#define SERVO0_PIN 41 // In teensy's pin definition for pinMode (in Servo.cpp)
#endif
#endif
#endif // SAV_MKI
...
...
MarlinKimbra/planner.cpp
View file @
eb09f322
...
...
@@ -601,9 +601,16 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
#ifdef PREVENT_LENGTHY_EXTRUDE
if
(
labs
(
target
[
E_AXIS
]
-
position
[
E_AXIS
])
>
axis_steps_per_unit
[
active_extruder
+
3
]
*
EXTRUDE_MAXLENGTH
)
{
position
[
E_AXIS
]
=
target
[
E_AXIS
];
//behave as if the move really took place, but ignore E part
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
MSG_ERR_LONG_EXTRUDE_STOP
);
#ifdef EASY_LOAD
if
(
!
allow_lengthy_extrude_once
)
{
#endif
position
[
E_AXIS
]
=
target
[
E_AXIS
];
//behave as if the move really took place, but ignore E part
SERIAL_ECHO_START
;
SERIAL_ECHOLNPGM
(
MSG_ERR_LONG_EXTRUDE_STOP
);
#ifdef EASY_LOAD
}
allow_lengthy_extrude_once
=
false
;
#endif
}
#endif // PREVENT_LENGTHY_EXTRUDE
}
...
...
MarlinKimbra/planner.h
View file @
eb09f322
...
...
@@ -49,7 +49,7 @@ typedef struct {
#endif
// Fields used by the motion planner to manage acceleration
// float speed_x, speed_y, speed_z, speed_e;
// Nominal mm/sec for each axis
// float speed_x, speed_y, speed_z, speed_e; // Nominal mm/sec for each axis
float
nominal_speed
;
// The nominal speed for this block in mm/sec
float
entry_speed
;
// Entry speed at previous-current junction in mm/sec
float
max_entry_speed
;
// Maximum allowable junction entry speed in mm/sec
...
...
@@ -72,8 +72,7 @@ typedef struct {
unsigned
long
laser_ttlmodulation
;
#endif
volatile
char
busy
;
}
block_t
;
}
block_t
;
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
...
...
MarlinKimbra/stepper.cpp
View file @
eb09f322
...
...
@@ -78,9 +78,8 @@ static volatile bool endstop_z_hit=false;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
bool
abort_on_endstop_hit
=
false
;
#endif
#ifdef MOTOR_CURRENT_PWM_XY_PIN
int
motor_current_setting
[
3
]
=
DEFAULT_PWM_MOTOR_CURRENT
;
int
motor_current_setting
[
3
]
=
DEFAULT_PWM_MOTOR_CURRENT
;
#endif
static
bool
old_x_min_endstop
=
false
;
...
...
MarlinKimbra/temperature.cpp
View file @
eb09f322
...
...
@@ -232,6 +232,13 @@ void PID_autotune(float temp, int extruder, int ncycles)
float
Kp
,
Ki
,
Kd
;
float
max
=
0
,
min
=
10000
;
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1)
unsigned
long
extruder_autofan_last_check
=
millis
();
#endif
if
((
extruder
>=
EXTRUDERS
)
#if (TEMP_BED_PIN <= -1)
||
(
extruder
<
0
)
...
...
@@ -268,6 +275,17 @@ void PID_autotune(float temp, int extruder, int ncycles)
max
=
max
(
max
,
input
);
min
=
min
(
min
,
input
);
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1)
if
(
millis
()
-
extruder_autofan_last_check
>
2500
)
{
checkExtruderAutoFans
();
extruder_autofan_last_check
=
millis
();
}
#endif
if
(
heating
==
true
&&
input
>
temp
)
{
if
(
millis
()
-
t2
>
5000
)
{
heating
=
false
;
...
...
@@ -424,6 +442,8 @@ void checkExtruderAutoFans()
if
(
current_temperature
[
0
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
fanState
|=
1
;
#endif
#ifndef SINGLENOZZLE
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
if
(
current_temperature
[
1
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
...
...
@@ -444,11 +464,27 @@ void checkExtruderAutoFans()
fanState
|=
4
;
}
#endif
#if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
if
(
current_temperature
[
3
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
fanState
|=
1
;
else
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_1_AUTO_FAN_PIN
)
fanState
|=
2
;
else
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_2_AUTO_FAN_PIN
)
fanState
|=
4
;
else
fanState
|=
8
;
}
#endif
#endif // !SINLGENOZZE
// update extruder auto fan states
#if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
setExtruderAutoFanState
(
EXTRUDER_0_AUTO_FAN_PIN
,
(
fanState
&
1
)
!=
0
);
#endif
#ifndef SINGLENOZZLE
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
if
(
EXTRUDER_1_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
)
setExtruderAutoFanState
(
EXTRUDER_1_AUTO_FAN_PIN
,
(
fanState
&
2
)
!=
0
);
...
...
@@ -457,7 +493,14 @@ void checkExtruderAutoFans()
if
(
EXTRUDER_2_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
&&
EXTRUDER_2_AUTO_FAN_PIN
!=
EXTRUDER_1_AUTO_FAN_PIN
)
setExtruderAutoFanState
(
EXTRUDER_2_AUTO_FAN_PIN
,
(
fanState
&
4
)
!=
0
);
#endif
#endif
#if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
if
(
EXTRUDER_3_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
&&
EXTRUDER_3_AUTO_FAN_PIN
!=
EXTRUDER_1_AUTO_FAN_PIN
)
&&
EXTRUDER_3_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
)
setExtruderAutoFanState
(
EXTRUDER_3_AUTO_FAN_PIN
,
(
fanState
&
8
)
!=
0
);
#endif
#endif // !SINLGENOZZE
}
#endif // any extruder auto fan pins set
...
...
@@ -477,9 +520,9 @@ void manage_heater()
#else
for
(
int
e
=
0
;
e
<
1
;
e
++
)
{
#endif
#endif
// !SINLGENOZZE
#ifdef THERMAL_RUNAWAY_PROTECTION_PERIOD
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD)
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
thermal_runaway_protection
(
&
thermal_runaway_state_machine
[
e
],
&
thermal_runaway_timer
[
e
],
current_temperature
[
e
],
target_temperature
[
e
],
e
,
THERMAL_RUNAWAY_PROTECTION_PERIOD
,
THERMAL_RUNAWAY_PROTECTION_HYSTERESIS
);
#endif
...
...
@@ -509,7 +552,14 @@ void manage_heater()
//K1 defined in Configuration.h in the PID settings
#define K2 (1.0-K1)
dTerm
[
e
]
=
(
Kd
[
e
]
*
(
pid_input
-
temp_dState
[
e
]))
*
K2
+
(
K1
*
dTerm
[
e
]);
pid_output
=
constrain
(
pTerm
[
e
]
+
iTerm
[
e
]
-
dTerm
[
e
],
0
,
PID_MAX
);
pid_output
=
pTerm
[
e
]
+
iTerm
[
e
]
-
dTerm
[
e
];
if
(
pid_output
>
PID_MAX
)
{
if
(
pid_error
[
e
]
>
0
)
temp_iState
[
e
]
-=
pid_error
[
e
];
// conditional un-integration
pid_output
=
PID_MAX
;
}
else
if
(
pid_output
<
0
){
if
(
pid_error
[
e
]
<
0
)
temp_iState
[
e
]
-=
pid_error
[
e
];
// conditional un-integration
pid_output
=
0
;
}
}
temp_dState
[
e
]
=
pid_input
;
#else
...
...
@@ -612,7 +662,14 @@ void manage_heater()
dTerm_bed
=
(
bedKd
*
(
pid_input
-
temp_dState_bed
))
*
K2
+
(
K1
*
dTerm_bed
);
temp_dState_bed
=
pid_input
;
pid_output
=
constrain
(
pTerm_bed
+
iTerm_bed
-
dTerm_bed
,
0
,
MAX_BED_POWER
);
pid_output
=
pTerm_bed
+
iTerm_bed
-
dTerm_bed
;
if
(
pid_output
>
MAX_BED_PID
)
{
if
(
pid_error_bed
>
0
)
temp_iState_bed
-=
pid_error_bed
;
// conditional un-integration
pid_output
=
PID_MAX
;
}
else
if
(
pid_output
<
0
){
if
(
pid_error_bed
<
0
)
temp_iState_bed
-=
pid_error_bed
;
// conditional un-integration
pid_output
=
0
;
}
#else
pid_output
=
constrain
(
target_temperature_bed
,
0
,
MAX_BED_POWER
);
...
...
@@ -777,14 +834,14 @@ static void updateTemperaturesFromRawValues()
#else
for
(
uint8_t
e
=
0
;
e
<
1
;
e
++
)
{
#endif //SINGLENOZZLE
#endif //
!
SINGLENOZZLE
current_temperature
[
e
]
=
analog2temp
(
current_temperature_raw
[
e
],
e
);
}
current_temperature_bed
=
analog2tempBed
(
current_temperature_bed_raw
);
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
redundant_temperature
=
analog2temp
(
redundant_temperature_raw
,
1
);
#endif
#if
def FILAMENT_SENSOR
&& (FILWIDTH_PIN > -1) //check if a sensor is supported
#if
defined (FILAMENT_SENSOR)
&& (FILWIDTH_PIN > -1) //check if a sensor is supported
filament_width_meas
=
analog2widthFil
();
#endif
//Reset the watchdog after we know we have a temperature measurement.
...
...
@@ -827,7 +884,7 @@ return(filament_width_nominal/temp*100);
void
tp_init
()
{
#if
(MOTHERBOARD == 80
) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
#if
MB(RUMBA
) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR
=
(
1
<<
JTD
);
MCUCR
=
(
1
<<
JTD
);
...
...
@@ -840,7 +897,7 @@ void tp_init()
#else
for
(
int
e
=
0
;
e
<
1
;
e
++
)
{
#endif
#endif
// !SINGLENOZZLE
// populate with the first value
maxttemp
[
e
]
=
maxttemp
[
0
];
#ifdef PIDTEMP
...
...
@@ -866,7 +923,7 @@ void tp_init()
#if defined(HEATER_3_PIN) && (HEATER_3_PIN > -1)
SET_OUTPUT
(
HEATER_3_PIN
);
#endif
#endif //
END
SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1)
SET_OUTPUT
(
HEATER_BED_PIN
);
...
...
@@ -936,7 +993,7 @@ void tp_init()
DIDR2
|=
1
<<
(
TEMP_3_PIN
-
8
);
#endif
#endif
#endif //
END
SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if defined(TEMP_BED_PIN) && (TEMP_BED_PIN > -1)
#if TEMP_BED_PIN < 8
...
...
@@ -1047,8 +1104,8 @@ void tp_init()
maxttemp_raw
[
3
]
+=
OVERSAMPLENR
;
#endif
}
#endif //MAXTEMP 3
#endif
//
SINGLENOZZLE
#endif //
MAXTEMP 3
#endif
// !
SINGLENOZZLE
#ifdef BED_MINTEMP
/* No bed MINTEMP error implemented?!? */
/*
...
...
@@ -1081,7 +1138,7 @@ void setWatch()
#else
for
(
int
e
=
0
;
e
<
1
;
e
++
)
{
#endif
#endif
// !SINGLENOZZLE
if
(
degHotend
(
e
)
<
degTargetHotend
(
e
)
-
(
WATCH_TEMP_INCREASE
*
2
))
{
watch_start_temp
[
e
]
=
degHotend
(
e
);
...
...
@@ -1091,7 +1148,7 @@ void setWatch()
#endif
}
#if
def THERMAL_RUNAWAY_PROTECTION_PERIOD
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
#if
defined (THERMAL_RUNAWAY_PROTECTION_PERIOD)
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void
thermal_runaway_protection
(
int
*
state
,
unsigned
long
*
timer
,
float
temperature
,
float
target_temperature
,
int
heater_id
,
int
period_seconds
,
int
hysteresis_degc
)
{
/*
...
...
@@ -1159,7 +1216,7 @@ void disable_heater()
for
(
int
i
=
0
;
i
<
EXTRUDERS
;
i
++
)
#else
for
(
int
i
=
0
;
i
<
1
;
i
++
)
#endif
#endif
// !SINGLENOZZLE
setTargetHotend
(
0
,
i
);
setTargetBed
(
0
);
#if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
...
...
@@ -1194,7 +1251,7 @@ void disable_heater()
WRITE
(
HEATER_3_PIN
,
LOW
);
#endif
#endif
#endif //
END
SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
target_temperature_bed
=
0
;
...
...
@@ -1322,10 +1379,10 @@ ISR(TIMER0_COMPB_vect)
#if EXTRUDERS > 2
static
unsigned
char
soft_pwm_2
;
#endif
#if EXTRUDERS > 3
#if EXTRUDERS > 3
static
unsigned
char
soft_pwm_3
;
#endif
#endif
#endif
// !SINGLENOZZLE
#if HEATER_BED_PIN > -1
static
unsigned
char
soft_pwm_b
;
#endif
...
...
@@ -1355,13 +1412,12 @@ ISR(TIMER0_COMPB_vect)
soft_pwm_3
=
soft_pwm
[
3
];
if
(
soft_pwm_3
>
0
)
WRITE
(
HEATER_3_PIN
,
1
);
else
WRITE
(
HEATER_3_PIN
,
0
);
#endif
#endif //SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
soft_pwm_b
=
soft_pwm_bed
;
if
(
soft_pwm_b
>
0
)
WRITE
(
HEATER_BED_PIN
,
1
);
else
WRITE
(
HEATER_BED_PIN
,
0
);
#endif
#ifdef FAN_SOFT_PWM
soft_pwm_fan
=
fanSpeedSoftPwm
/
2
;
if
(
soft_pwm_fan
>
0
)
WRITE
(
FAN_PIN
,
1
);
else
WRITE
(
FAN_PIN
,
0
);
...
...
@@ -1383,7 +1439,7 @@ ISR(TIMER0_COMPB_vect)
#if EXTRUDERS > 3
if
(
soft_pwm_3
<
pwm_count
)
WRITE
(
HEATER_3_PIN
,
0
);
#endif
#endif
#endif
// !SINGLENOZZLE
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
if
(
soft_pwm_b
<
pwm_count
)
WRITE
(
HEATER_BED_PIN
,
0
);
#endif
...
...
@@ -1531,7 +1587,7 @@ ISR(TIMER0_COMPB_vect)
// break;
}
if
(
temp_count
>=
OVERSAMPLENR
)
// 1
2 * 16 * 1/(16000000/64/256) = 197
ms.
if
(
temp_count
>=
OVERSAMPLENR
)
// 1
0 * 16 * 1/(16000000/64/256) = 164
ms.
{
if
(
!
temp_meas_ready
)
//Only update the raw values if they have been read. Else we could be updating them during reading.
{
...
...
@@ -1549,7 +1605,7 @@ ISR(TIMER0_COMPB_vect)
#if EXTRUDERS > 3
current_temperature_raw
[
3
]
=
raw_temp_3_value
;
#endif
#endif
#endif
// !SINGLENOZZLE
current_temperature_bed_raw
=
raw_temp_bed_value
;
}
...
...
@@ -1564,7 +1620,7 @@ ISR(TIMER0_COMPB_vect)
raw_temp_0_value
=
0
;
raw_temp_1_value
=
0
;
raw_temp_2_value
=
0
;
raw_temp_3_value
=
0
;
raw_temp_3_value
=
0
;
raw_temp_bed_value
=
0
;
#if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP
...
...
@@ -1631,7 +1687,7 @@ ISR(TIMER0_COMPB_vect)
min_temp_error
(
3
);
}
#endif
#endif //SINGLENOZZLE
#endif //
!
SINGLENOZZLE
/* No bed MINTEMP error? */
#if defined(BED_MAXTEMP) && (TEMP_SENSOR_BED != 0)
...
...
@@ -1691,5 +1747,3 @@ float unscalePID_d(float d)
}
#endif //PIDTEMP
MarlinKimbra/temperature.h
View file @
eb09f322
...
...
@@ -60,30 +60,29 @@ extern int current_temperature_bed_raw;
extern
int
target_temperature_bed
;
extern
float
current_temperature_bed
;
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
extern
float
redundant_temperature
;
extern
float
redundant_temperature
;
#endif
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
extern
unsigned
char
soft_pwm_bed
;
extern
unsigned
char
soft_pwm_bed
;
#endif
#ifdef PIDTEMP
extern
float
Kp
[
4
],
Ki
[
4
],
Kd
[
4
],
Kc
;
float
scalePID_i
(
float
i
);
float
scalePID_d
(
float
d
);
float
unscalePID_i
(
float
i
);
float
unscalePID_d
(
float
d
);
extern
float
Kp
[
4
],
Ki
[
4
],
Kd
[
4
],
Kc
;
float
scalePID_i
(
float
i
);
float
scalePID_d
(
float
d
);
float
unscalePID_i
(
float
i
);
float
unscalePID_d
(
float
d
);
#endif
#ifdef PIDTEMPBED
extern
float
bedKp
,
bedKi
,
bedKd
;
extern
float
bedKp
,
bedKi
,
bedKd
;
#endif
#ifdef BABYSTEPPING
extern
volatile
int
babystepsTodo
[
3
];
extern
volatile
int
babystepsTodo
[
3
];
#endif
//high level conversion routines, for use outside of temperature.cpp
//inline so that there is no performance decrease.
//deg=degreeCelsius
...
...
@@ -205,7 +204,7 @@ void disable_heater();
void
setWatch
();
void
updatePID
();
#if
def THERMAL_RUNAWAY_PROTECTION_PERIOD
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
#if
defined (THERMAL_RUNAWAY_PROTECTION_PERIOD)
&& THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void
thermal_runaway_protection
(
int
*
state
,
unsigned
long
*
timer
,
float
temperature
,
float
target_temperature
,
int
heater_id
,
int
period_seconds
,
int
hysteresis_degc
);
static
int
thermal_runaway_state_machine
[
4
];
// = {0,0,0,0};
static
unsigned
long
thermal_runaway_timer
[
4
];
// = {0,0,0,0};
...
...
@@ -229,4 +228,8 @@ FORCE_INLINE void autotempShutdown(){
void
PID_autotune
(
float
temp
,
int
extruder
,
int
ncycles
);
void
setExtruderAutoFanState
(
int
pin
,
bool
state
);
void
checkExtruderAutoFans
();
#endif
MarlinKimbra/ultralcd.cpp
View file @
eb09f322
...
...
@@ -26,13 +26,11 @@ int gumPreheatFanSpeed;
const
long
baudrates
[]
=
{
9600
,
14400
,
19200
,
28800
,
38400
,
56000
,
115200
,
250000
};
int
baudrate_position
=
-
1
;
#ifdef FILAMENT_LCD_DISPLAY
unsigned
long
message_millis
=
0
;
unsigned
long
message_millis
=
0
;
#endif
#ifdef ULTIPANEL
static
float
manual_feedrate
[]
=
MANUAL_FEEDRATE
;
static
float
manual_feedrate
[]
=
MANUAL_FEEDRATE
;
#endif // ULTIPANEL
/* !Configuration settings */
...
...
@@ -170,7 +168,7 @@ uint32_t encoderPosition;
#if (SDCARDDETECT > 0)
bool
lcd_oldcardstatus
;
#endif
#endif//ULTIPANEL
#endif
//ULTIPANEL
menuFunc_t
currentMenu
=
lcd_status_screen
;
/* function pointer to the currently active menu */
uint32_t
lcd_next_update_millis
;
...
...
@@ -191,9 +189,50 @@ menuFunc_t callbackFunc;
// place-holders for Ki and Kd edits
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
();
// For LCD_PROGRESS_BAR re-initialize the custom characters
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
lcd_set_custom_characters
(
menu
==
lcd_status_screen
);
#endif
}
}
/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
static
void
lcd_status_screen
()
{
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
uint16_t
mil
=
millis
();
#ifndef PROGRESS_BAR_MSG_ONCE
if
(
mil
>
progressBarTick
+
PROGRESS_BAR_MSG_TIME
+
PROGRESS_BAR_BAR_TIME
)
{
progressBarTick
=
mil
;
}
#endif
#if PROGRESS_BAR_MSG_EXPIRE > 0
// keep the message alive if paused, count down otherwise
if
(
messageTick
>
0
)
{
if
(
card
.
isFileOpen
())
{
if
(
IS_SD_PRINTING
)
{
if
((
mil
-
messageTick
)
>=
PROGRESS_BAR_MSG_EXPIRE
)
{
lcd_status_message
[
0
]
=
'\0'
;
messageTick
=
0
;
}
}
else
{
messageTick
+=
LCD_UPDATE_INTERVAL
;
}
}
else
{
messageTick
=
0
;
}
}
#endif
#endif //LCD_PROGRESS_BAR
if
(
lcd_status_update_delay
)
lcd_status_update_delay
--
;
else
...
...
@@ -225,13 +264,15 @@ static void lcd_status_screen()
if
(
current_click
)
{
currentMenu
=
lcd_main_menu
;
encoderPosition
=
0
;
lcd_quick_feedback
();
lcd_implementation_init
();
// to maybe revive the LCD if static electricity killed it.
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
//get status message to show up for a while
#endif
lcd_goto_menu
(
lcd_main_menu
);
lcd_implementation_init
(
// to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
currentMenu
==
lcd_status_screen
#endif
);
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
// get status message to show up for a while
#endif
}
#ifdef ULTIPANEL_FEEDMULTIPLY
...
...
@@ -258,30 +299,22 @@ static void lcd_status_screen()
feedmultiply
+=
int
(
encoderPosition
);
encoderPosition
=
0
;
}
#endif//ULTIPANEL_FEEDMULTIPLY
#endif
//ULTIPANEL_FEEDMULTIPLY
if
(
feedmultiply
<
10
)
feedmultiply
=
10
;
if
(
feedmultiply
>
999
)
else
if
(
feedmultiply
>
999
)
feedmultiply
=
999
;
#endif//ULTIPANEL
#endif
//ULTIPANEL
}
#ifdef ULTIPANEL
static
void
lcd_return_to_status
()
{
encoderPosition
=
0
;
currentMenu
=
lcd_status_screen
;
}
static
void
lcd_sdcard_pause
()
{
card
.
pauseSDPrint
();
}
static
void
lcd_sdcard_resume
()
{
card
.
startFileprint
();
}
static
void
lcd_return_to_status
()
{
lcd_goto_menu
(
lcd_status_screen
,
0
,
false
);
}
static
void
lcd_sdcard_pause
()
{
card
.
pauseSDPrint
();
}
static
void
lcd_sdcard_resume
()
{
card
.
startFileprint
();
}
static
void
lcd_sdcard_stop
()
{
...
...
@@ -365,65 +398,20 @@ void lcd_set_home_offsets()
#ifdef BABYSTEPPING
static
void
lcd_babystep_x
()
{
if
(
encoderPosition
!=
0
)
{
babystepsTodo
[
X_AXIS
]
+=
(
int
)
encoderPosition
;
encoderPosition
=
0
;
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
MSG_BABYSTEPPING_X
),
""
);
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_tune_menu
;
encoderPosition
=
0
;
}
}
static
void
lcd_babystep_y
()
{
if
(
encoderPosition
!=
0
)
{
babystepsTodo
[
Y_AXIS
]
+=
(
int
)
encoderPosition
;
encoderPosition
=
0
;
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
MSG_BABYSTEPPING_Y
),
""
);
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_tune_menu
;
encoderPosition
=
0
;
static
void
_lcd_babystep
(
int
axis
,
const
char
*
msg
)
{
if
(
encoderPosition
!=
0
)
{
babystepsTodo
[
axis
]
+=
(
int
)
encoderPosition
;
encoderPosition
=
0
;
lcdDrawUpdate
=
1
;
}
}
if
(
lcdDrawUpdate
)
lcd_implementation_drawedit
(
msg
,
""
);
if
(
LCD_CLICKED
)
lcd_goto_menu
(
lcd_tune_menu
);
}
static
void
lcd_babystep_x
()
{
_lcd_babystep
(
X_AXIS
,
PSTR
(
MSG_BABYSTEPPING_X
));
}
static
void
lcd_babystep_y
()
{
_lcd_babystep
(
Y_AXIS
,
PSTR
(
MSG_BABYSTEPPING_Y
));
}
static
void
lcd_babystep_z
()
{
_lcd_babystep
(
Z_AXIS
,
PSTR
(
MSG_BABYSTEPPING_Z
));
}
static
void
lcd_babystep_z
()
{
if
(
encoderPosition
!=
0
)
{
babystepsTodo
[
Z_AXIS
]
+=
BABYSTEP_Z_MULTIPLICATOR
*
(
int
)
encoderPosition
;
encoderPosition
=
0
;
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
MSG_BABYSTEPPING_Z
),
""
);
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_tune_menu
;
encoderPosition
=
0
;
}
}
#endif //BABYSTEPPING
static
void
lcd_tune_menu
()
...
...
@@ -445,7 +433,7 @@ static void lcd_tune_menu()
#if TEMP_SENSOR_3 != 0
MENU_ITEM_EDIT
(
int3
,
MSG_NOZZLE3
,
&
target_temperature
[
3
],
0
,
HEATER_3_MAXTEMP
-
15
);
#endif
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT
(
int3
,
MSG_BED
,
&
target_temperature_bed
,
0
,
BED_MAXTEMP
-
15
);
...
...
@@ -464,7 +452,7 @@ static void lcd_tune_menu()
#if TEMP_SENSOR_3 != 0
MENU_ITEM_EDIT
(
int3
,
MSG_FLOW3
,
&
extruder_multiply
[
3
],
10
,
999
);
#endif
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#ifdef BABYSTEPPING
#ifdef BABYSTEP_XY
...
...
@@ -479,6 +467,31 @@ static void lcd_tune_menu()
END_MENU
();
}
#if defined(EASY_LOAD)
static
void
lcd_extrude
(
float
length
,
float
feedrate
)
{
current_position
[
E_AXIS
]
+=
length
;
#ifdef DELTA
calculate_delta
(
current_position
);
plan_buffer_line
(
delta
[
X_AXIS
],
delta
[
Y_AXIS
],
delta
[
Z_AXIS
],
current_position
[
E_AXIS
],
feedrate
,
active_extruder
,
active_driver
);
#else
plan_buffer_line
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
],
feedrate
,
active_extruder
,
active_driver
);
#endif
}
static
void
lcd_purge
()
{
lcd_extrude
(
LCD_PURGE_LENGTH
,
LCD_PURGE_FEEDRATE
);}
static
void
lcd_retract
()
{
lcd_extrude
(
-
LCD_RETRACT_LENGTH
,
LCD_RETRACT_FEEDRATE
);}
static
void
lcd_easy_load
()
{
allow_lengthy_extrude_once
=
true
;
lcd_extrude
(
BOWDEN_LENGTH
,
LCD_LOAD_FEEDRATE
);
lcd_return_to_status
();
}
static
void
lcd_easy_unload
()
{
allow_lengthy_extrude_once
=
true
;
lcd_extrude
(
-
BOWDEN_LENGTH
,
LCD_UNLOAD_FEEDRATE
);
lcd_return_to_status
();
}
#endif // EASY_LOAD
void
lcd_preheat_pla0
()
{
setTargetHotend0
(
plaPreheatHotendTemp
);
...
...
@@ -593,9 +606,8 @@ void lcd_preheat_gum3()
setWatch
();
// heater sanity check timer
}
#endif //4 extruder preheat
#endif // SINGLENOZZLE
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0
|| !defined(SINGLENOZZLE)
//more than one extruder present
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present
void
lcd_preheat_pla0123
()
{
setTargetHotend0
(
plaPreheatHotendTemp
);
...
...
@@ -620,6 +632,7 @@ void lcd_preheat_abs0123()
setWatch
();
// heater sanity check timer
}
#endif //more than one extruder present
#endif // !SINGLENOZZLE
void
lcd_preheat_pla_bedonly
()
{
...
...
@@ -664,7 +677,7 @@ static void lcd_preheat_pla_menu()
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
MENU_ITEM
(
function
,
MSG_PREHEAT_PLA0123
,
lcd_preheat_pla0123
);
#endif //all extruder preheat
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM
(
function
,
MSG_PREHEAT_PLA_BEDONLY
,
lcd_preheat_pla_bedonly
);
...
...
@@ -691,7 +704,7 @@ static void lcd_preheat_abs_menu()
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
MENU_ITEM
(
function
,
MSG_PREHEAT_ABS0123
,
lcd_preheat_abs0123
);
#endif //all extruder preheat
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM
(
function
,
MSG_PREHEAT_ABS_BEDONLY
,
lcd_preheat_abs_bedonly
);
...
...
@@ -715,7 +728,7 @@ static void lcd_preheat_gum_menu()
#if TEMP_SENSOR_3 != 0 //4 extruder preheat
MENU_ITEM
(
function
,
MSG_PREHEAT_GUM3
,
lcd_preheat_gum3
);
#endif //3 extruder preheat
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM
(
function
,
MSG_PREHEAT_GUM_BEDONLY
,
lcd_preheat_gum_bedonly
);
...
...
@@ -731,7 +744,7 @@ void lcd_cooldown()
setTargetHotend1
(
0
);
setTargetHotend2
(
0
);
setTargetHotend3
(
0
);
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
setTargetBed
(
0
);
fanSpeed
=
0
;
...
...
@@ -773,6 +786,12 @@ static void lcd_prepare_menu()
#endif
#endif
MENU_ITEM
(
function
,
MSG_COOLDOWN
,
lcd_cooldown
);
#if defined(EASY_LOAD)
MENU_ITEM
(
function
,
MSG_E_BOWDEN_LENGTH
,
lcd_easy_load
);
MENU_ITEM
(
function
,
MSG_R_BOWDEN_LENGTH
,
lcd_easy_unload
);
MENU_ITEM
(
function
,
MSG_PURGE_XMM
,
lcd_purge
);
MENU_ITEM
(
function
,
MSG_RETRACT_XMM
,
lcd_retract
);
#endif // EASY_LOAD
#if defined(POWER_SUPPLY) && POWER_SUPPLY > 0 && defined(PS_ON_PIN) && PS_ON_PIN > -1
if
(
powersupply
)
{
...
...
@@ -788,96 +807,28 @@ static void lcd_prepare_menu()
float
move_menu_scale
;
static
void
lcd_move_menu_axis
();
static
void
lcd_move_x
()
{
if
(
encoderPosition
!=
0
)
{
refresh_cmd_timeout
();
current_position
[
X_AXIS
]
+=
float
((
int
)
encoderPosition
)
*
move_menu_scale
;
if
(
min_software_endstops
&&
current_position
[
X_AXIS
]
<
X_MIN_POS
)
current_position
[
X_AXIS
]
=
X_MIN_POS
;
if
(
max_software_endstops
&&
current_position
[
X_AXIS
]
>
X_MAX_POS
)
current_position
[
X_AXIS
]
=
X_MAX_POS
;
encoderPosition
=
0
;
#ifdef DELTA
calculate_delta
(
current_position
);
plan_buffer_line
(
delta
[
X_AXIS
],
delta
[
Y_AXIS
],
delta
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
X_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#else
plan_buffer_line
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
X_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#endif
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
"X"
),
ftostr31
(
current_position
[
X_AXIS
]));
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_move_menu_axis
;
encoderPosition
=
0
;
}
}
static
void
lcd_move_y
()
{
if
(
encoderPosition
!=
0
)
{
refresh_cmd_timeout
();
current_position
[
Y_AXIS
]
+=
float
((
int
)
encoderPosition
)
*
move_menu_scale
;
if
(
min_software_endstops
&&
current_position
[
Y_AXIS
]
<
Y_MIN_POS
)
current_position
[
Y_AXIS
]
=
Y_MIN_POS
;
if
(
max_software_endstops
&&
current_position
[
Y_AXIS
]
>
Y_MAX_POS
)
current_position
[
Y_AXIS
]
=
Y_MAX_POS
;
encoderPosition
=
0
;
#ifdef DELTA
calculate_delta
(
current_position
);
plan_buffer_line
(
delta
[
X_AXIS
],
delta
[
Y_AXIS
],
delta
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
Y_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#else
plan_buffer_line
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
Y_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#endif
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
"Y"
),
ftostr31
(
current_position
[
Y_AXIS
]));
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_move_menu_axis
;
encoderPosition
=
0
;
}
}
static
void
lcd_move_z
()
{
if
(
encoderPosition
!=
0
)
{
refresh_cmd_timeout
();
current_position
[
Z_AXIS
]
+=
float
((
int
)
encoderPosition
)
*
move_menu_scale
;
if
(
min_software_endstops
&&
current_position
[
Z_AXIS
]
<
Z_MIN_POS
)
current_position
[
Z_AXIS
]
=
Z_MIN_POS
;
if
(
max_software_endstops
&&
current_position
[
Z_AXIS
]
>
Z_MAX_POS
)
current_position
[
Z_AXIS
]
=
Z_MAX_POS
;
encoderPosition
=
0
;
#ifdef DELTA
calculate_delta
(
current_position
);
plan_buffer_line
(
delta
[
X_AXIS
],
delta
[
Y_AXIS
],
delta
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
Z_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#else
plan_buffer_line
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
Z_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#endif
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
{
lcd_implementation_drawedit
(
PSTR
(
"Z"
),
ftostr31
(
current_position
[
Z_AXIS
]));
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_move_menu_axis
;
encoderPosition
=
0
;
}
static
void
_lcd_move
(
const
char
*
name
,
int
axis
,
int
min
,
int
max
)
{
if
(
encoderPosition
!=
0
)
{
refresh_cmd_timeout
();
current_position
[
axis
]
+=
float
((
int
)
encoderPosition
)
*
move_menu_scale
;
if
(
min_software_endstops
&&
current_position
[
axis
]
<
min
)
current_position
[
axis
]
=
min
;
if
(
max_software_endstops
&&
current_position
[
axis
]
>
max
)
current_position
[
axis
]
=
max
;
encoderPosition
=
0
;
#ifdef DELTA
calculate_delta
(
current_position
);
plan_buffer_line
(
delta
[
X_AXIS
],
delta
[
Y_AXIS
],
delta
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
X_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#else
plan_buffer_line
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
],
manual_feedrate
[
X_AXIS
]
/
60
,
active_extruder
,
active_driver
);
#endif
lcdDrawUpdate
=
1
;
}
if
(
lcdDrawUpdate
)
lcd_implementation_drawedit
(
name
,
ftostr31
(
current_position
[
axis
]));
if
(
LCD_CLICKED
)
lcd_goto_menu
(
lcd_move_menu_axis
);
}
static
void
lcd_move_x
()
{
_lcd_move
(
PSTR
(
"X"
),
X_AXIS
,
X_MIN_POS
,
X_MAX_POS
);
}
static
void
lcd_move_y
()
{
_lcd_move
(
PSTR
(
"Y"
),
Y_AXIS
,
Y_MIN_POS
,
Y_MAX_POS
);
}
static
void
lcd_move_z
()
{
_lcd_move
(
PSTR
(
"Z"
),
Z_AXIS
,
Z_MIN_POS
,
Z_MAX_POS
);
}
static
void
lcd_move_e
()
{
if
(
encoderPosition
!=
0
)
...
...
@@ -896,12 +847,7 @@ static void lcd_move_e()
{
lcd_implementation_drawedit
(
PSTR
(
"Extruder"
),
ftostr31
(
current_position
[
E_AXIS
]));
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_move_menu_axis
;
encoderPosition
=
0
;
}
if
(
LCD_CLICKED
)
lcd_goto_menu
(
lcd_move_menu_axis
);
}
static
void
lcd_move_menu_axis
()
...
...
@@ -1027,7 +973,7 @@ static void lcd_control_temperature_menu()
#if TEMP_SENSOR_3 != 0
MENU_ITEM_EDIT
(
int3
,
MSG_NOZZLE3
,
&
target_temperature
[
3
],
0
,
HEATER_3_MAXTEMP
-
15
);
#endif
#endif // SINGLENOZZLE
#endif //
!
SINGLENOZZLE
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT
(
int3
,
MSG_BED
,
&
target_temperature_bed
,
0
,
BED_MAXTEMP
-
15
);
...
...
@@ -1164,12 +1110,7 @@ static void lcd_set_contrast()
{
lcd_implementation_drawedit
(
PSTR
(
MSG_CONTRAST
),
itostr2
(
lcd_contrast
));
}
if
(
LCD_CLICKED
)
{
lcd_quick_feedback
();
currentMenu
=
lcd_control_menu
;
encoderPosition
=
0
;
}
if
(
LCD_CLICKED
)
lcd_goto_menu
(
lcd_control_menu
);
}
#endif
...
...
@@ -1192,7 +1133,7 @@ static void lcd_control_retract_menu()
MENU_ITEM_EDIT
(
float3
,
MSG_CONTROL_RETRACT_RECOVERF
,
&
retract_recover_feedrate
,
1
,
999
);
END_MENU
();
}
#endif
#endif
//FWRETRACT
#if SDCARDDETECT == -1
static
void
lcd_sd_refresh
()
...
...
@@ -1217,9 +1158,9 @@ void lcd_sdcard_menu()
card
.
getWorkDirName
();
if
(
card
.
filename
[
0
]
==
'/'
)
{
#if SDCARDDETECT == -1
#if SDCARDDETECT == -1
MENU_ITEM
(
function
,
LCD_STR_REFRESH
MSG_REFRESH
,
lcd_sd_refresh
);
#endif
#endif
}
else
{
MENU_ITEM
(
function
,
LCD_STR_FOLDER
".."
,
lcd_sd_updir
);
}
...
...
@@ -1228,23 +1169,16 @@ void lcd_sdcard_menu()
{
if
(
_menuItemNr
==
_lineNr
)
{
#if defined(SDCARD_RATHERRECENTFIRST) && !defined(SDCARD_SORT_ALPHA)
int
nr
=
fileCnt
-
1
-
i
;
#else
int
nr
=
i
;
#endif
#ifdef SDCARD_SORT_ALPHA
card
.
getfilename_sorted
(
nr
);
#ifndef SDCARD_RATHERRECENTFIRST
card
.
getfilename
(
i
);
#else
card
.
getfilename
(
nr
);
card
.
getfilename
(
fileCnt
-
1
-
i
);
#endif
if
(
card
.
filenameIsDir
)
{
MENU_ITEM
(
sddirectory
,
MSG_CARD_MENU
,
card
.
filename
,
card
.
longFilename
);
}
else
{
MENU_ITEM
(
sdfile
,
MSG_CARD_MENU
,
card
.
filename
,
card
.
longFilename
);
if
(
card
.
filenameIsDir
)
{
MENU_ITEM
(
sddirectory
,
MSG_CARD_MENU
,
card
.
filename
,
card
.
longFilename
);
}
else
{
MENU_ITEM
(
sdfile
,
MSG_CARD_MENU
,
card
.
filename
,
card
.
longFilename
);
}
}
else
{
MENU_ITEM_DUMMY
();
...
...
@@ -1256,36 +1190,19 @@ void lcd_sdcard_menu()
#define menu_edit_type(_type, _name, _strFunc, scale) \
void menu_edit_ ## _name () \
{ \
if ((int32_t)encoderPosition < 0) \
encoderPosition = 0; \
if ((int32_t)encoderPosition > maxEditValue) \
encoderPosition = maxEditValue; \
if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
if (lcdDrawUpdate) \
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
if (LCD_CLICKED) \
{ \
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
lcd_quick_feedback(); \
currentMenu = prevMenu; \
encoderPosition = prevEncoderPosition; \
lcd_goto_menu(prevMenu, prevEncoderPosition); \
} \
} \
void menu_edit_callback_ ## _name () \
{ \
if ((int32_t)encoderPosition < 0) \
encoderPosition = 0; \
if ((int32_t)encoderPosition > maxEditValue) \
encoderPosition = maxEditValue; \
if (lcdDrawUpdate) \
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
if (LCD_CLICKED) \
{ \
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
lcd_quick_feedback(); \
currentMenu = prevMenu; \
encoderPosition = prevEncoderPosition; \
(*callbackFunc)();\
} \
void menu_edit_callback_ ## _name () { \
menu_edit_ ## _name (); \
if (LCD_CLICKED) (*callbackFunc)(); \
} \
static void menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) \
{ \
...
...
@@ -1370,24 +1287,10 @@ static void lcd_quick_feedback()
}
/** Menu action functions **/
static
void
menu_action_back
(
menuFunc_t
data
)
{
currentMenu
=
data
;
encoderPosition
=
0
;
}
static
void
menu_action_submenu
(
menuFunc_t
data
)
{
currentMenu
=
data
;
encoderPosition
=
0
;
}
static
void
menu_action_gcode
(
const
char
*
pgcode
)
{
enquecommand_P
(
pgcode
);
}
static
void
menu_action_function
(
menuFunc_t
data
)
{
(
*
data
)();
}
static
void
menu_action_back
(
menuFunc_t
data
)
{
lcd_goto_menu
(
data
);
}
static
void
menu_action_submenu
(
menuFunc_t
data
)
{
lcd_goto_menu
(
data
);
}
static
void
menu_action_gcode
(
const
char
*
pgcode
)
{
enquecommand_P
(
pgcode
);
}
static
void
menu_action_function
(
menuFunc_t
data
)
{
(
*
data
)();
}
static
void
menu_action_sdfile
(
const
char
*
filename
,
char
*
longFilename
)
{
char
cmd
[
30
];
...
...
@@ -1414,32 +1317,33 @@ static void menu_action_setting_edit_bool(const char* pstr, bool* ptr)
void
lcd_init
()
{
lcd_implementation_init
();
lcd_message_init
();
#ifdef NEWPANEL
pinMode
(
BTN_EN1
,
INPUT
);
pinMode
(
BTN_EN2
,
INPUT
);
SET_INPUT
(
BTN_EN1
);
SET_INPUT
(
BTN_EN2
);
WRITE
(
BTN_EN1
,
HIGH
);
WRITE
(
BTN_EN2
,
HIGH
);
#if BTN_ENC > 0
pinMode
(
BTN_ENC
,
INPUT
);
SET_INPUT
(
BTN_ENC
);
WRITE
(
BTN_ENC
,
HIGH
);
#endif
#ifdef REPRAPWORLD_KEYPAD
pinMode
(
SHIFT_CLK
,
OUTPUT
);
pinMode
(
SHIFT_LD
,
OUTPUT
);
pinMode
(
SHIFT_OUT
,
INP
UT
);
SET_OUTPUT
(
SHIFT_CLK
);
SET_OUTPUT
(
SHIFT_LD
);
SET_INPUT
(
SHIFT_O
UT
);
WRITE
(
SHIFT_OUT
,
HIGH
);
WRITE
(
SHIFT_LD
,
HIGH
);
#endif
#else // Not NEWPANEL
#ifdef SR_LCD_2W_NL // Non latching 2 wire shift register
pinMode
(
SR_DATA_PIN
,
OUTPUT
);
pinMode
(
SR_CLK_PIN
,
OUTPUT
);
#elif defined(SHIFT_CLK)
pinMode
(
SHIFT_CLK
,
OUTPUT
);
pinMode
(
SHIFT_LD
,
OUTPUT
);
pinMode
(
SHIFT_EN
,
OUTPUT
);
pinMode
(
SHIFT_OUT
,
INP
UT
);
SET_OUTPUT
(
SR_DATA_PIN
);
SET_OUTPUT
(
SR_CLK_PIN
);
#elif defined(SHIFT_CLK)
SET_OUTPUT
(
SHIFT_CLK
);
SET_OUTPUT
(
SHIFT_LD
);
SET_OUTPUT
(
SHIFT_EN
);
SET_INPUT
(
SHIFT_O
UT
);
WRITE
(
SHIFT_OUT
,
HIGH
);
WRITE
(
SHIFT_LD
,
HIGH
);
WRITE
(
SHIFT_EN
,
LOW
);
...
...
@@ -1450,8 +1354,8 @@ void lcd_init()
#endif // SR_LCD_2W_NL
#endif//!NEWPANEL
#if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode
(
SDCARDDETECT
,
INPU
T
);
#if defined
(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
SET_INPUT
(
SDCARDDETEC
T
);
WRITE
(
SDCARDDETECT
,
HIGH
);
lcd_oldcardstatus
=
IS_SD_INSERTED
;
#endif//(SDCARDDETECT > 0)
...
...
@@ -1479,7 +1383,11 @@ void lcd_update()
{
lcdDrawUpdate
=
2
;
lcd_oldcardstatus
=
IS_SD_INSERTED
;
lcd_implementation_init
();
// to maybe revive the LCD if static electricity killed it.
lcd_implementation_init
(
// to maybe revive the LCD if static electricity killed it.
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
currentMenu
==
lcd_status_screen
#endif
);
if
(
lcd_oldcardstatus
)
{
...
...
@@ -1559,11 +1467,9 @@ void lcd_update()
lcdDrawUpdate
=
2
;
}
#endif//ULTIPANEL
if
(
lcdDrawUpdate
==
2
)
lcd_implementation_clear
();
if
(
lcdDrawUpdate
)
lcdDrawUpdate
--
;
lcd_next_update_millis
=
millis
()
+
100
;
if
(
lcdDrawUpdate
==
2
)
lcd_implementation_clear
();
if
(
lcdDrawUpdate
)
lcdDrawUpdate
--
;
lcd_next_update_millis
=
millis
()
+
LCD_UPDATE_INTERVAL
;
}
}
...
...
@@ -1573,35 +1479,39 @@ void lcd_ignore_click(bool b)
wait_for_unclick
=
false
;
}
void
lcd_finishstatus
()
{
int
len
=
strlen
(
lcd_status_message
);
if
(
len
>
0
)
{
while
(
len
<
LCD_WIDTH
)
{
lcd_status_message
[
len
++
]
=
' '
;
}
}
lcd_status_message
[
LCD_WIDTH
]
=
'\0'
;
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
#if PROGRESS_BAR_MSG_EXPIRE > 0
messageTick
=
#endif
progressBarTick
=
millis
();
#endif
lcdDrawUpdate
=
2
;
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
//get status message to show up for a while
#endif
}
void
lcd_setstatus
(
const
char
*
message
)
{
if
(
lcd_status_message_level
>
0
)
return
;
strncpy
(
lcd_status_message
,
message
,
LCD_WIDTH
);
size_t
i
=
strlen
(
lcd_status_message
);
memset
(
lcd_status_message
+
i
,
' '
,
LCD_WIDTH
-
i
);
lcd_status_message
[
LCD_WIDTH
]
=
'\0'
;
lcdDrawUpdate
=
2
;
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
//get status message to show up for a while
#endif
lcd_finishstatus
();
}
void
lcd_setstatuspgm
(
const
char
*
message
)
{
if
(
lcd_status_message_level
>
0
)
return
;
strncpy_P
(
lcd_status_message
,
message
,
LCD_WIDTH
);
size_t
i
=
strlen
(
lcd_status_message
);
memset
(
lcd_status_message
+
i
,
' '
,
LCD_WIDTH
-
i
);
lcd_status_message
[
LCD_WIDTH
]
=
'\0'
;
lcdDrawUpdate
=
2
;
#ifdef FILAMENT_LCD_DISPLAY
message_millis
=
millis
();
//get status message to show up for a while
#endif
lcd_finishstatus
();
}
void
lcd_setalertstatuspgm
(
const
char
*
message
)
{
...
...
@@ -1677,10 +1587,8 @@ void lcd_buttons_update()
//manage encoder rotation
uint8_t
enc
=
0
;
if
(
buttons
&
EN_A
)
enc
|=
(
1
<<
0
);
if
(
buttons
&
EN_B
)
enc
|=
(
1
<<
1
);
if
(
buttons
&
EN_A
)
enc
|=
B01
;
if
(
buttons
&
EN_B
)
enc
|=
B10
;
if
(
enc
!=
lastEncoderBits
)
{
switch
(
enc
)
...
...
@@ -1756,7 +1664,7 @@ char *itostr2(const uint8_t &x)
return
conv
;
}
//
convert float to string with +123.4 format
//
Convert float to string with 123.4 format, dropping sign
char
*
ftostr31
(
const
float
&
x
)
{
int
xx
=
x
*
10
;
...
...
@@ -1771,7 +1679,7 @@ char *ftostr31(const float &x)
return
conv
;
}
//
c
onvert float to string with 123.4 format
//
C
onvert float to string with 123.4 format
char
*
ftostr31ns
(
const
float
&
x
)
{
int
xx
=
x
*
10
;
...
...
@@ -1803,7 +1711,7 @@ char *ftostr32(const float &x)
return
conv
;
}
//
F
loat to string with 1.23 format
//
Convert f
loat to string with 1.23 format
char
*
ftostr12ns
(
const
float
&
x
)
{
long
xx
=
x
*
100
;
...
...
@@ -1817,21 +1725,7 @@ char *ftostr12ns(const float &x)
return
conv
;
}
// convert float to space-padded string with -_23.4_ format
char
*
ftostr32np
(
const
float
&
x
)
{
char
*
c
=
ftostr32
(
x
);
if
(
c
[
0
]
==
'0'
||
c
[
0
]
==
'-'
)
{
if
(
c
[
0
]
==
'0'
)
c
[
0
]
=
' '
;
if
(
c
[
1
]
==
'0'
)
c
[
1
]
=
' '
;
}
if
(
c
[
5
]
==
'0'
)
{
c
[
5
]
=
' '
;
if
(
c
[
4
]
==
'0'
)
c
[
4
]
=
c
[
3
]
=
' '
;
}
return
c
;
}
// Convert int to lj string with +123.0 format
char
*
itostr31
(
const
int
&
xx
)
{
conv
[
0
]
=
(
xx
>=
0
)
?
'+'
:
'-'
;
...
...
@@ -1844,6 +1738,7 @@ char *itostr31(const int &xx)
return
conv
;
}
// Convert int to rj string with 123 or -12 format
char
*
itostr3
(
const
int
&
x
)
{
int
xx
=
x
;
...
...
@@ -1863,6 +1758,7 @@ char *itostr3(const int &x)
return
conv
;
}
// Convert int to lj string with 123 format
char
*
itostr3left
(
const
int
&
xx
)
{
if
(
xx
>=
100
)
...
...
@@ -1886,22 +1782,13 @@ char *itostr3left(const int &xx)
return
conv
;
}
char
*
itostr4
(
const
int
&
xx
)
{
if
(
xx
>=
1000
)
conv
[
0
]
=
(
xx
/
1000
)
%
10
+
'0'
;
else
conv
[
0
]
=
' '
;
if
(
xx
>=
100
)
conv
[
1
]
=
(
xx
/
100
)
%
10
+
'0'
;
else
conv
[
1
]
=
' '
;
if
(
xx
>=
10
)
conv
[
2
]
=
(
xx
/
10
)
%
10
+
'0'
;
else
conv
[
2
]
=
' '
;
conv
[
3
]
=
(
xx
)
%
10
+
'0'
;
conv
[
4
]
=
0
;
// Convert int to rj string with 1234 format
char
*
itostr4
(
const
int
&
xx
)
{
conv
[
0
]
=
xx
>=
1000
?
(
xx
/
1000
)
%
10
+
'0'
:
' '
;
conv
[
1
]
=
xx
>=
100
?
(
xx
/
100
)
%
10
+
'0'
:
' '
;
conv
[
2
]
=
xx
>=
10
?
(
xx
/
10
)
%
10
+
'0'
:
' '
;
conv
[
3
]
=
xx
%
10
+
'0'
;
conv
[
4
]
=
0
;
return
conv
;
}
...
...
@@ -1949,32 +1836,19 @@ char *ftostr30(const float &x)
return
conv
;
}
// convert float to string with 12345 format
char
*
ftostr5
(
const
float
&
x
)
{
long
xx
=
abs
(
x
);
if
(
xx
>=
10000
)
conv
[
0
]
=
(
xx
/
10000
)
%
10
+
'0'
;
else
conv
[
0
]
=
' '
;
if
(
xx
>=
1000
)
conv
[
1
]
=
(
xx
/
1000
)
%
10
+
'0'
;
else
conv
[
1
]
=
' '
;
if
(
xx
>=
100
)
conv
[
2
]
=
(
xx
/
100
)
%
10
+
'0'
;
else
conv
[
2
]
=
' '
;
if
(
xx
>=
10
)
conv
[
3
]
=
(
xx
/
10
)
%
10
+
'0'
;
else
conv
[
3
]
=
' '
;
conv
[
4
]
=
(
xx
)
%
10
+
'0'
;
conv
[
5
]
=
0
;
// Convert float to rj string with 12345 format
char
*
ftostr5
(
const
float
&
x
)
{
long
xx
=
abs
(
x
);
conv
[
0
]
=
xx
>=
10000
?
(
xx
/
10000
)
%
10
+
'0'
:
' '
;
conv
[
1
]
=
xx
>=
1000
?
(
xx
/
1000
)
%
10
+
'0'
:
' '
;
conv
[
2
]
=
xx
>=
100
?
(
xx
/
100
)
%
10
+
'0'
:
' '
;
conv
[
3
]
=
xx
>=
10
?
(
xx
/
10
)
%
10
+
'0'
:
' '
;
conv
[
4
]
=
xx
%
10
+
'0'
;
conv
[
5
]
=
0
;
return
conv
;
}
//
c
onvert float to string with +1234.5 format
//
C
onvert float to string with +1234.5 format
char
*
ftostr51
(
const
float
&
x
)
{
long
xx
=
x
*
10
;
...
...
@@ -1990,7 +1864,7 @@ char *ftostr51(const float &x)
return
conv
;
}
//
c
onvert float to string with +123.45 format
//
C
onvert float to string with +123.45 format
char
*
ftostr52
(
const
float
&
x
)
{
long
xx
=
x
*
100
;
...
...
MarlinKimbra/ultralcd.h
View file @
eb09f322
...
...
@@ -50,9 +50,9 @@
extern
bool
cancel_heatup
;
#ifdef FILAMENT_LCD_DISPLAY
#ifdef FILAMENT_LCD_DISPLAY
extern
unsigned
long
message_millis
;
#endif
#endif
void
lcd_buzz
(
long
duration
,
uint16_t
freq
);
bool
lcd_clicked
();
...
...
@@ -125,8 +125,7 @@ char *ftostr30(const float &x);
char
*
ftostr31ns
(
const
float
&
x
);
// float to string without sign character
char
*
ftostr31
(
const
float
&
x
);
char
*
ftostr32
(
const
float
&
x
);
char
*
ftostr32np
(
const
float
&
x
);
// remove zero-padding from ftostr32
char
*
ftostr12ns
(
const
float
&
x
);
char
*
ftostr12ns
(
const
float
&
x
);
char
*
ftostr5
(
const
float
&
x
);
char
*
ftostr51
(
const
float
&
x
);
char
*
ftostr52
(
const
float
&
x
);
...
...
MarlinKimbra/ultralcd_implementation_hitachi_HD44780.h
View file @
eb09f322
...
...
@@ -190,7 +190,8 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#elif defined(SR_LCD_2W_NL)
extern
"C"
void
__cxa_pure_virtual
()
{
while
(
1
);
}
#include <LCD.h>
#include <LiquidCrystal_SR.h>
#define LCD_CLASS LiquidCrystal_SR
...
...
@@ -208,6 +209,14 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
LCD_CLASS
lcd
(
LCD_PINS_RS
,
LCD_PINS_ENABLE
,
LCD_PINS_D4
,
LCD_PINS_D5
,
LCD_PINS_D6
,
LCD_PINS_D7
);
//RS,Enable,D4,D5,D6,D7
#endif
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
static
uint16_t
progressBarTick
=
0
;
#if PROGRESS_BAR_MSG_EXPIRE > 0
static
uint16_t
messageTick
=
0
;
#endif
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
/* Custom characters defined in the first 8 characters of the LCD */
#define LCD_STR_BEDTEMP "\x00"
#define LCD_STR_DEGREE "\x01"
...
...
@@ -219,8 +228,11 @@ extern volatile uint16_t buttons; //an extended version of the last checked but
#define LCD_STR_CLOCK "\x07"
#define LCD_STR_ARROW_RIGHT "\x7E"
/* from the default character set */
static
void
lcd_implementation_init
()
{
static
void
lcd_set_custom_characters
(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
bool
progress_bar_set
=
true
#endif
)
{
#ifdef DELTA
byte
bedTemp
[
8
]
=
{
...
...
@@ -319,6 +331,72 @@ static void lcd_implementation_init()
B00000
};
//thanks Sonny Mounicou
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
static
bool
char_mode
=
false
;
byte
progress
[
3
][
8
]
=
{
{
B00000
,
B10000
,
B10000
,
B10000
,
B10000
,
B10000
,
B10000
,
B00000
},
{
B00000
,
B10100
,
B10100
,
B10100
,
B10100
,
B10100
,
B10100
,
B00000
},
{
B00000
,
B10101
,
B10101
,
B10101
,
B10101
,
B10101
,
B10101
,
B00000
}
};
if
(
progress_bar_set
!=
char_mode
)
{
char_mode
=
progress_bar_set
;
lcd
.
createChar
(
LCD_STR_BEDTEMP
[
0
],
bedTemp
);
lcd
.
createChar
(
LCD_STR_DEGREE
[
0
],
degree
);
lcd
.
createChar
(
LCD_STR_THERMOMETER
[
0
],
thermometer
);
lcd
.
createChar
(
LCD_STR_FEEDRATE
[
0
],
feedrate
);
lcd
.
createChar
(
LCD_STR_CLOCK
[
0
],
clock
);
if
(
progress_bar_set
)
{
// Progress bar characters for info screen
for
(
int
i
=
3
;
i
--
;)
lcd
.
createChar
(
LCD_STR_PROGRESS
[
i
],
progress
[
i
]);
}
else
{
// Custom characters for submenus
lcd
.
createChar
(
LCD_STR_UPLEVEL
[
0
],
uplevel
);
lcd
.
createChar
(
LCD_STR_REFRESH
[
0
],
refresh
);
lcd
.
createChar
(
LCD_STR_FOLDER
[
0
],
folder
);
}
}
#else
lcd
.
createChar
(
LCD_STR_BEDTEMP
[
0
],
bedTemp
);
lcd
.
createChar
(
LCD_STR_DEGREE
[
0
],
degree
);
lcd
.
createChar
(
LCD_STR_THERMOMETER
[
0
],
thermometer
);
lcd
.
createChar
(
LCD_STR_UPLEVEL
[
0
],
uplevel
);
lcd
.
createChar
(
LCD_STR_REFRESH
[
0
],
refresh
);
lcd
.
createChar
(
LCD_STR_FOLDER
[
0
],
folder
);
lcd
.
createChar
(
LCD_STR_FEEDRATE
[
0
],
feedrate
);
lcd
.
createChar
(
LCD_STR_CLOCK
[
0
],
clock
);
#endif
}
static
void
lcd_implementation_init
(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
bool
progress_bar_set
=
true
#endif
)
{
#if defined(LCD_I2C_TYPE_PCF8575)
lcd
.
begin
(
LCD_WIDTH
,
LCD_HEIGHT
);
#ifdef LCD_I2C_PIN_BL
...
...
@@ -343,14 +421,12 @@ static void lcd_implementation_init()
lcd
.
begin
(
LCD_WIDTH
,
LCD_HEIGHT
);
#endif
lcd
.
createChar
(
LCD_STR_BEDTEMP
[
0
],
bedTemp
);
lcd
.
createChar
(
LCD_STR_DEGREE
[
0
],
degree
);
lcd
.
createChar
(
LCD_STR_THERMOMETER
[
0
],
thermometer
);
lcd
.
createChar
(
LCD_STR_UPLEVEL
[
0
],
uplevel
);
lcd
.
createChar
(
LCD_STR_REFRESH
[
0
],
refresh
);
lcd
.
createChar
(
LCD_STR_FOLDER
[
0
],
folder
);
lcd
.
createChar
(
LCD_STR_FEEDRATE
[
0
],
feedrate
);
lcd
.
createChar
(
LCD_STR_CLOCK
[
0
],
clock
);
lcd_set_custom_characters
(
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
progress_bar_set
#endif
);
lcd
.
clear
();
}
static
void
lcd_implementation_clear
()
...
...
@@ -405,7 +481,7 @@ static void lcd_implementation_status_screen()
lcd
.
print
(
'/'
);
lcd
.
print
(
itostr3left
(
tTarget
));
# if
EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 && !defined(SINGLENOZZLE)
# if
(EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd
.
setCursor
(
8
,
0
);
# if EXTRUDERS > 1 && !defined(SINGLENOZZLE)
...
...
@@ -420,7 +496,7 @@ static void lcd_implementation_status_screen()
lcd
.
print
(
itostr3
(
tHotend
));
lcd
.
print
(
'/'
);
lcd
.
print
(
itostr3left
(
tTarget
));
# endif
//EXTRUDERS > 1
|| TEMP_SENSOR_BED != 0
# endif
(EXTRUDERS > 1 && !defined(SINGLENOZZLE))
|| TEMP_SENSOR_BED != 0
#else//LCD_WIDTH > 19
lcd
.
setCursor
(
0
,
0
);
...
...
@@ -432,7 +508,7 @@ static void lcd_implementation_status_screen()
if
(
tTarget
<
10
)
lcd
.
print
(
' '
);
# if
EXTRUDERS > 1 || TEMP_SENSOR_BED != 0 && !defined(SINGLENOZZLE)
# if
(EXTRUDERS > 1 && !defined(SINGLENOZZLE)) || TEMP_SENSOR_BED != 0
//If we have an 2nd extruder or heated bed, show that in the top right corner
lcd
.
setCursor
(
10
,
0
);
# if EXTRUDERS > 1 && !defined(SINGLENOZZLE)
...
...
@@ -450,8 +526,8 @@ static void lcd_implementation_status_screen()
lcd_printPGM
(
PSTR
(
LCD_STR_DEGREE
" "
));
if
(
tTarget
<
10
)
lcd
.
print
(
' '
);
# endif
//EXTRUDERS > 1
|| TEMP_SENSOR_BED != 0
#endif//LCD_WIDTH > 19
# endif
(EXTRUDERS > 1 && !defined(SINGLENOZZLE))
|| TEMP_SENSOR_BED != 0
#endif
//LCD_WIDTH > 19
#if LCD_HEIGHT > 2
//Lines 2 for 4 line LCD
...
...
@@ -496,7 +572,7 @@ static void lcd_implementation_status_screen()
# endif//LCD_WIDTH > 19
lcd
.
setCursor
(
LCD_WIDTH
-
8
,
1
);
lcd
.
print
(
'Z'
);
lcd
.
print
(
ftostr32
np
(
current_position
[
Z_AXIS
]
+
0
.
00001
));
lcd
.
print
(
ftostr32
(
current_position
[
Z_AXIS
]
+
0
.
00001
));
#endif//LCD_HEIGHT > 2
#if LCD_HEIGHT > 3
...
...
@@ -528,23 +604,46 @@ static void lcd_implementation_status_screen()
}
#endif
//Display both Status message line and Filament display on the last line
#ifdef FILAMENT_LCD_DISPLAY
if
(
message_millis
+
5000
>
millis
()){
//display any status for the first 5 sec after screen is initiated
lcd
.
setCursor
(
0
,
LCD_HEIGHT
-
1
);
lcd
.
print
(
lcd_status_message
);
}
else
{
lcd
.
setCursor
(
0
,
LCD_HEIGHT
-
1
);
lcd_printPGM
(
PSTR
(
"Dia "
));
lcd
.
print
(
ftostr12ns
(
filament_width_meas
));
lcd_printPGM
(
PSTR
(
" V"
));
lcd
.
print
(
itostr3
(
100
.
0
*
volumetric_multiplier
[
FILAMENT_SENSOR_EXTRUDER_NUM
]));
lcd
.
print
(
'%'
);
// Status message line at the bottom
lcd
.
setCursor
(
0
,
LCD_HEIGHT
-
1
);
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT)
if
(
card
.
isFileOpen
())
{
uint16_t
mil
=
millis
(),
diff
=
mil
-
progressBarTick
;
if
(
diff
>=
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
;
char
msg
[
LCD_WIDTH
+
1
],
b
=
' '
;
msg
[
i
]
=
'\0'
;
while
(
i
--
)
{
if
(
i
==
cel
-
1
)
b
=
LCD_STR_PROGRESS
[
2
];
else
if
(
i
==
cel
&&
rem
!=
0
)
b
=
LCD_STR_PROGRESS
[
rem
-
1
];
msg
[
i
]
=
b
;
}
#else
lcd
.
setCursor
(
0
,
LCD_HEIGHT
-
1
);
lcd
.
print
(
lcd_status_message
);
#endif
lcd
.
print
(
msg
);
return
;
}
}
//card.isFileOpen
#endif //LCD_PROGRESS_BAR
//Display both Status message line and Filament display on the last line
#ifdef FILAMENT_LCD_DISPLAY
if
(
message_millis
+
5000
<=
millis
())
{
//display any status for the first 5 sec after screen is initiated
lcd_printPGM
(
PSTR
(
"Dia "
));
lcd
.
print
(
ftostr12ns
(
filament_width_meas
));
lcd_printPGM
(
PSTR
(
" V"
));
lcd
.
print
(
itostr3
(
100
.
0
*
volumetric_multiplier
[
FILAMENT_SENSOR_EXTRUDER_NUM
]));
lcd
.
print
(
'%'
);
return
;
}
#endif //FILAMENT_LCD_DISPLAY
lcd
.
print
(
lcd_status_message
);
}
static
void
lcd_implementation_drawmenu_generic
(
uint8_t
row
,
const
char
*
pstr
,
char
pre_char
,
char
post_char
)
{
...
...
@@ -824,4 +923,22 @@ static uint8_t lcd_implementation_read_slow_buttons()
}
#endif
static
void
lcd_message_init
()
{
static
String
message
[
4
];
message
[
0
]
=
"MARLINKIMBRA V4.0"
;
message
[
1
]
=
"By MagoKimbra"
;
message
[
2
]
=
"magokimbra@hotmail"
;
message
[
3
]
=
".com"
;
lcd
.
clear
();
for
(
int8_t
i
=
0
;
i
<
4
;
i
++
){
lcd
.
setCursor
(
0
,
i
);
lcd
.
print
(
message
[
i
]);
}
delay
(
5000
);
lcd
.
clear
();
}
#endif//ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment