Merge branch 'smallopt' into Marlin_v1
Conflicts: Marlin/temperature.h
This commit is contained in:
commit
311627141b
11 changed files with 246 additions and 74 deletions
|
@ -39,7 +39,7 @@ template <class T> int EEPROM_readAnything(int &ee, T& value)
|
||||||
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
|
||||||
#define EEPROM_VERSION "V04"
|
#define EEPROM_VERSION "V04"
|
||||||
|
|
||||||
inline void StoreSettings()
|
FORCE_INLINE void StoreSettings()
|
||||||
{
|
{
|
||||||
#ifdef EEPROM_SETTINGS
|
#ifdef EEPROM_SETTINGS
|
||||||
char ver[4]= "000";
|
char ver[4]= "000";
|
||||||
|
@ -72,7 +72,7 @@ inline void StoreSettings()
|
||||||
#endif //EEPROM_SETTINGS
|
#endif //EEPROM_SETTINGS
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RetrieveSettings(bool def=false)
|
FORCE_INLINE void RetrieveSettings(bool def=false)
|
||||||
{ // if def=true, the default values will be used
|
{ // if def=true, the default values will be used
|
||||||
#ifdef EEPROM_SETTINGS
|
#ifdef EEPROM_SETTINGS
|
||||||
int i=EEPROM_OFFSET;
|
int i=EEPROM_OFFSET;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "MarlinSerial.h"
|
#include "MarlinSerial.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||||
//#define SERIAL_ECHO(x) Serial << "echo: " << x;
|
//#define SERIAL_ECHO(x) Serial << "echo: " << x;
|
||||||
//#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
|
//#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
|
||||||
//#define SERIAL_ERROR(x) Serial << "Error: " << x;
|
//#define SERIAL_ERROR(x) Serial << "Error: " << x;
|
||||||
|
@ -43,7 +45,7 @@ const char echomagic[] PROGMEM ="echo:";
|
||||||
|
|
||||||
//things to write to serial from Programmemory. saves 400 to 2k of RAM.
|
//things to write to serial from Programmemory. saves 400 to 2k of RAM.
|
||||||
#define SerialprintPGM(x) serialprintPGM(PSTR(x))
|
#define SerialprintPGM(x) serialprintPGM(PSTR(x))
|
||||||
inline void serialprintPGM(const char *str)
|
FORCE_INLINE void serialprintPGM(const char *str)
|
||||||
{
|
{
|
||||||
char ch=pgm_read_byte(str);
|
char ch=pgm_read_byte(str);
|
||||||
while(ch)
|
while(ch)
|
||||||
|
@ -112,5 +114,6 @@ void prepare_arc_move(char isclockwise);
|
||||||
extern float homing_feedrate[];
|
extern float homing_feedrate[];
|
||||||
extern bool axis_relative_modes[];
|
extern bool axis_relative_modes[];
|
||||||
extern float current_position[NUM_AXIS] ;
|
extern float current_position[NUM_AXIS] ;
|
||||||
|
extern float add_homeing[3];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
// M92 - Set axis_steps_per_unit - same syntax as G92
|
// M92 - Set axis_steps_per_unit - same syntax as G92
|
||||||
// M114 - Output current position to serial port
|
// M114 - Output current position to serial port
|
||||||
// M115 - Capabilities string
|
// M115 - Capabilities string
|
||||||
|
// M117 - display message
|
||||||
// M119 - Output Endstop status to serial port
|
// M119 - Output Endstop status to serial port
|
||||||
// M140 - Set bed target temp
|
// M140 - Set bed target temp
|
||||||
// M190 - Wait for bed current temp to reach target temp.
|
// M190 - Wait for bed current temp to reach target temp.
|
||||||
|
@ -103,6 +104,7 @@
|
||||||
// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
|
// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
|
||||||
// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
|
// M204 - Set default acceleration: S normal moves T filament only moves (M204 S3000 T7000) im mm/sec^2 also sets minimum segment time in ms (B20000) to prevent buffer underruns and M20 minimum feedrate
|
||||||
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
|
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
|
||||||
|
// M206 - set additional homeing offset
|
||||||
// M220 - set speed factor override percentage S:factor in percent
|
// M220 - set speed factor override percentage S:factor in percent
|
||||||
// M301 - Set PID parameters P I and D
|
// M301 - Set PID parameters P I and D
|
||||||
// M400 - Finish all moves
|
// M400 - Finish all moves
|
||||||
|
@ -130,7 +132,7 @@ volatile int feedmultiply=100; //100->1 200->2
|
||||||
int saved_feedmultiply;
|
int saved_feedmultiply;
|
||||||
volatile bool feedmultiplychanged=false;
|
volatile bool feedmultiplychanged=false;
|
||||||
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
|
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0};
|
||||||
|
float add_homeing[3]={0,0,0};
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================private variables=============================
|
//=============================private variables=============================
|
||||||
|
@ -528,19 +530,23 @@ inline void process_commands()
|
||||||
}
|
}
|
||||||
feedrate = 0.0;
|
feedrate = 0.0;
|
||||||
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
|
||||||
|
|
||||||
if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
|
if((home_all_axis) || (code_seen(axis_codes[X_AXIS])))
|
||||||
{
|
{
|
||||||
HOMEAXIS(X);
|
HOMEAXIS(X);
|
||||||
|
current_position[0]=code_value()+add_homeing[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
|
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
|
current_position[1]=code_value()+add_homeing[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
||||||
HOMEAXIS(Z);
|
HOMEAXIS(Z);
|
||||||
|
current_position[2]=code_value()+add_homeing[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
feedrate = saved_feedrate;
|
feedrate = saved_feedrate;
|
||||||
feedmultiply = saved_feedmultiply;
|
feedmultiply = saved_feedmultiply;
|
||||||
previous_millis_cmd = millis();
|
previous_millis_cmd = millis();
|
||||||
|
@ -557,7 +563,7 @@ inline void process_commands()
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
for(int8_t i=0; i < NUM_AXIS; i++) {
|
for(int8_t i=0; i < NUM_AXIS; i++) {
|
||||||
if(code_seen(axis_codes[i])) {
|
if(code_seen(axis_codes[i])) {
|
||||||
current_position[i] = code_value();
|
current_position[i] = code_value()+add_homeing[i];
|
||||||
if(i == E_AXIS) {
|
if(i == E_AXIS) {
|
||||||
plan_set_e_position(current_position[E_AXIS]);
|
plan_set_e_position(current_position[E_AXIS]);
|
||||||
}
|
}
|
||||||
|
@ -869,6 +875,9 @@ inline void process_commands()
|
||||||
case 115: // M115
|
case 115: // M115
|
||||||
SerialprintPGM("FIRMWARE_NAME:Marlin; Sprinter/grbl mashup for gen6 FIRMWARE_URL:http://www.mendel-parts.com PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1");
|
SerialprintPGM("FIRMWARE_NAME:Marlin; Sprinter/grbl mashup for gen6 FIRMWARE_URL:http://www.mendel-parts.com PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1");
|
||||||
break;
|
break;
|
||||||
|
case 117: // M117 display message
|
||||||
|
LCD_MESSAGE(cmdbuffer[bufindr]+5);
|
||||||
|
break;
|
||||||
case 114: // M114
|
case 114: // M114
|
||||||
SERIAL_PROTOCOLPGM("X:");
|
SERIAL_PROTOCOLPGM("X:");
|
||||||
SERIAL_PROTOCOL(current_position[X_AXIS]);
|
SERIAL_PROTOCOL(current_position[X_AXIS]);
|
||||||
|
@ -949,6 +958,12 @@ inline void process_commands()
|
||||||
if(code_seen('Z')) max_z_jerk = code_value() ;
|
if(code_seen('Z')) max_z_jerk = code_value() ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 206: // M206 additional homeing offset
|
||||||
|
for(int8_t i=0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
||||||
{
|
{
|
||||||
if(code_seen('S'))
|
if(code_seen('S'))
|
||||||
|
|
|
@ -32,11 +32,11 @@ public:
|
||||||
void chdir(const char * relpath);
|
void chdir(const char * relpath);
|
||||||
void updir();
|
void updir();
|
||||||
|
|
||||||
inline bool eof() { return sdpos>=filesize ;};
|
FORCE_INLINE bool eof() { return sdpos>=filesize ;};
|
||||||
inline int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
|
FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
|
||||||
inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
|
FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
|
||||||
inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
|
FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
|
||||||
inline char* getWorkDirName(){workDir.getFilename(filename);return filename;};
|
FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool saving;
|
bool saving;
|
||||||
|
@ -69,31 +69,31 @@ private:
|
||||||
class CardReader
|
class CardReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline CardReader(){};
|
FORCE_INLINE CardReader(){};
|
||||||
|
|
||||||
inline static void initsd(){};
|
FORCE_INLINE static void initsd(){};
|
||||||
inline static void write_command(char *buf){};
|
FORCE_INLINE static void write_command(char *buf){};
|
||||||
|
|
||||||
inline static void checkautostart(bool x) {};
|
FORCE_INLINE static void checkautostart(bool x) {};
|
||||||
|
|
||||||
inline static void openFile(char* name,bool read){};
|
FORCE_INLINE static void openFile(char* name,bool read){};
|
||||||
inline static void closefile() {};
|
FORCE_INLINE static void closefile() {};
|
||||||
inline static void release(){};
|
FORCE_INLINE static void release(){};
|
||||||
inline static void startFileprint(){};
|
FORCE_INLINE static void startFileprint(){};
|
||||||
inline static void startFilewrite(char *name){};
|
FORCE_INLINE static void startFilewrite(char *name){};
|
||||||
inline static void pauseSDPrint(){};
|
FORCE_INLINE static void pauseSDPrint(){};
|
||||||
inline static void getStatus(){};
|
FORCE_INLINE static void getStatus(){};
|
||||||
|
|
||||||
inline static void selectFile(char* name){};
|
FORCE_INLINE static void selectFile(char* name){};
|
||||||
inline static void getfilename(const uint8_t nr){};
|
FORCE_INLINE static void getfilename(const uint8_t nr){};
|
||||||
inline static uint8_t getnrfilenames(){return 0;};
|
FORCE_INLINE static uint8_t getnrfilenames(){return 0;};
|
||||||
|
|
||||||
|
|
||||||
inline static void ls() {};
|
FORCE_INLINE static void ls() {};
|
||||||
inline static bool eof() {return true;};
|
FORCE_INLINE static bool eof() {return true;};
|
||||||
inline static char get() {return 0;};
|
FORCE_INLINE static char get() {return 0;};
|
||||||
inline static void setIndex(){};
|
FORCE_INLINE static void setIndex(){};
|
||||||
inline uint8_t percentDone(){return 0;};
|
FORCE_INLINE uint8_t percentDone(){return 0;};
|
||||||
};
|
};
|
||||||
#endif //SDSUPPORT
|
#endif //SDSUPPORT
|
||||||
#endif
|
#endif
|
|
@ -95,13 +95,17 @@ static float previous_nominal_speed; // Nominal speed of previous path line segm
|
||||||
bool autotemp_enabled=false;
|
bool autotemp_enabled=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//=================semi-private variables, used in inline functions =====
|
||||||
|
//===========================================================================
|
||||||
|
block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
|
||||||
|
volatile unsigned char block_buffer_head; // Index of the next block to be pushed
|
||||||
|
volatile unsigned char block_buffer_tail; // Index of the block to process now
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//=============================private variables ============================
|
//=============================private variables ============================
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
|
|
||||||
static volatile unsigned char block_buffer_head; // Index of the next block to be pushed
|
|
||||||
static volatile unsigned char block_buffer_tail; // Index of the block to process now
|
|
||||||
|
|
||||||
// Used for the frequency limit
|
// Used for the frequency limit
|
||||||
static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations
|
static unsigned char old_direction_bits = 0; // Old direction bits. Used for speed calculations
|
||||||
|
@ -130,7 +134,8 @@ static int8_t prev_block_index(int8_t block_index) {
|
||||||
|
|
||||||
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
|
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
|
||||||
// given acceleration:
|
// given acceleration:
|
||||||
inline float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) {
|
FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
|
||||||
|
{
|
||||||
if (acceleration!=0) {
|
if (acceleration!=0) {
|
||||||
return((target_rate*target_rate-initial_rate*initial_rate)/
|
return((target_rate*target_rate-initial_rate*initial_rate)/
|
||||||
(2.0*acceleration));
|
(2.0*acceleration));
|
||||||
|
@ -145,7 +150,8 @@ inline float estimate_acceleration_distance(float initial_rate, float target_rat
|
||||||
// a total travel of distance. This can be used to compute the intersection point between acceleration and
|
// a total travel of distance. This can be used to compute the intersection point between acceleration and
|
||||||
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
|
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
|
||||||
|
|
||||||
inline float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) {
|
FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance)
|
||||||
|
{
|
||||||
if (acceleration!=0) {
|
if (acceleration!=0) {
|
||||||
return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
|
return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
|
||||||
(4.0*acceleration) );
|
(4.0*acceleration) );
|
||||||
|
@ -209,7 +215,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
|
||||||
|
|
||||||
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
|
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
|
||||||
// acceleration within the allotted distance.
|
// acceleration within the allotted distance.
|
||||||
inline float max_allowable_speed(float acceleration, float target_velocity, float distance) {
|
FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity, float distance) {
|
||||||
return sqrt(target_velocity*target_velocity-2*acceleration*distance);
|
return sqrt(target_velocity*target_velocity-2*acceleration*distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,20 +372,7 @@ void plan_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void plan_discard_current_block() {
|
|
||||||
if (block_buffer_head != block_buffer_tail) {
|
|
||||||
block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
block_t *plan_get_current_block() {
|
|
||||||
if (block_buffer_head == block_buffer_tail) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
block_t *block = &block_buffer[block_buffer_tail];
|
|
||||||
block->busy = true;
|
|
||||||
return(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef AUTOTEMP
|
#ifdef AUTOTEMP
|
||||||
void getHighESpeed()
|
void getHighESpeed()
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define planner_h
|
#define planner_h
|
||||||
|
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
|
#include "Marlin.h"
|
||||||
|
|
||||||
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
|
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
|
||||||
// the source g-code and may never actually be reached if acceleration management is active.
|
// the source g-code and may never actually be reached if acceleration management is active.
|
||||||
|
@ -72,12 +73,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
|
||||||
void plan_set_position(const float &x, const float &y, const float &z, const float &e);
|
void plan_set_position(const float &x, const float &y, const float &z, const float &e);
|
||||||
void plan_set_e_position(const float &e);
|
void plan_set_e_position(const float &e);
|
||||||
|
|
||||||
// Called when the current block is no longer needed. Discards the block and makes the memory
|
|
||||||
// availible for new blocks.
|
|
||||||
void plan_discard_current_block();
|
|
||||||
|
|
||||||
// Gets the current block. Returns NULL if buffer empty
|
|
||||||
block_t *plan_get_current_block();
|
|
||||||
|
|
||||||
void check_axes_activity();
|
void check_axes_activity();
|
||||||
uint8_t movesplanned(); //return the nr of buffered moves
|
uint8_t movesplanned(); //return the nr of buffered moves
|
||||||
|
@ -103,4 +99,30 @@ extern uint8_t active_extruder;
|
||||||
extern float autotemp_factor;
|
extern float autotemp_factor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/////semi-private stuff
|
||||||
|
#include <WProgram.h>
|
||||||
|
|
||||||
|
extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
|
||||||
|
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed
|
||||||
|
extern volatile unsigned char block_buffer_tail;
|
||||||
|
// Called when the current block is no longer needed. Discards the block and makes the memory
|
||||||
|
// availible for new blocks.
|
||||||
|
FORCE_INLINE void plan_discard_current_block()
|
||||||
|
{
|
||||||
|
if (block_buffer_head != block_buffer_tail) {
|
||||||
|
block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the current block. Returns NULL if buffer empty
|
||||||
|
FORCE_INLINE block_t *plan_get_current_block()
|
||||||
|
{
|
||||||
|
if (block_buffer_head == block_buffer_tail) {
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
block_t *block = &block_buffer[block_buffer_tail];
|
||||||
|
block->busy = true;
|
||||||
|
return(block);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -212,7 +212,7 @@ void st_wake_up() {
|
||||||
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
ENABLE_STEPPER_DRIVER_INTERRUPT();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned short calc_timer(unsigned short step_rate) {
|
FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
|
||||||
unsigned short timer;
|
unsigned short timer;
|
||||||
if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
|
if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ inline unsigned short calc_timer(unsigned short step_rate) {
|
||||||
|
|
||||||
// Initializes the trapezoid generator from the current block. Called whenever a new
|
// Initializes the trapezoid generator from the current block. Called whenever a new
|
||||||
// block begins.
|
// block begins.
|
||||||
inline void trapezoid_generator_reset() {
|
FORCE_INLINE void trapezoid_generator_reset() {
|
||||||
#ifdef ADVANCE
|
#ifdef ADVANCE
|
||||||
advance = current_block->initial_advance;
|
advance = current_block->initial_advance;
|
||||||
final_advance = current_block->final_advance;
|
final_advance = current_block->final_advance;
|
||||||
|
|
|
@ -59,16 +59,16 @@ extern float Kp,Ki,Kd,Kc;
|
||||||
//inline so that there is no performance decrease.
|
//inline so that there is no performance decrease.
|
||||||
//deg=degreeCelsius
|
//deg=degreeCelsius
|
||||||
|
|
||||||
inline float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
|
FORCE_INLINE float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
|
||||||
inline float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
|
FORCE_INLINE float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
|
||||||
inline float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
|
FORCE_INLINE float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
|
||||||
inline float degHotend(uint8_t extruder){
|
inline float degHotend(uint8_t extruder){
|
||||||
if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
||||||
if(extruder == 1) return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);
|
if(extruder == 1) return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
|
FORCE_INLINE float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
|
||||||
inline float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
|
FORCE_INLINE float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
|
||||||
inline float degTargetHotend(uint8_t extruder){
|
inline float degTargetHotend(uint8_t extruder){
|
||||||
if(extruder == 0) return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
|
if(extruder == 0) return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
|
||||||
if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
|
if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
|
||||||
|
@ -76,30 +76,30 @@ inline float degTargetHotend(uint8_t extruder){
|
||||||
|
|
||||||
inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
|
inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
|
||||||
|
|
||||||
inline void setTargetHotend0(const float &celsius)
|
FORCE_INLINE void setTargetHotend0(const float &celsius)
|
||||||
{
|
{
|
||||||
target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
|
target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
|
||||||
#ifdef PIDTEMP
|
#ifdef PIDTEMP
|
||||||
pid_setpoint = celsius;
|
pid_setpoint = celsius;
|
||||||
#endif //PIDTEMP
|
#endif //PIDTEMP
|
||||||
};
|
};
|
||||||
inline void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
|
FORCE_INLINE void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
|
||||||
inline float setTargetHotend(const float &celcius, uint8_t extruder){
|
inline float setTargetHotend(const float &celcius, uint8_t extruder){
|
||||||
if(extruder == 0) setTargetHotend0(celcius);
|
if(extruder == 0) setTargetHotend0(celcius);
|
||||||
if(extruder == 1) setTargetHotend1(celcius);
|
if(extruder == 1) setTargetHotend1(celcius);
|
||||||
};
|
};
|
||||||
inline void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
|
inline void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
|
||||||
|
|
||||||
inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
|
FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
|
||||||
inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
|
FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
|
||||||
inline float isHeatingHotend(uint8_t extruder){
|
inline float isHeatingHotend(uint8_t extruder){
|
||||||
if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];
|
if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];
|
||||||
if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];
|
if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];
|
||||||
};
|
};
|
||||||
inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
|
inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
|
||||||
|
|
||||||
inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
|
FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
|
||||||
inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
|
FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
|
||||||
inline float isCoolingHotend(uint8_t extruder){
|
inline float isCoolingHotend(uint8_t extruder){
|
||||||
if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];
|
if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];
|
||||||
if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];
|
if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
bool tune;
|
bool tune;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
|
FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
|
||||||
{
|
{
|
||||||
if(linechanging) return; // an item is changint its value, do not switch lines hence
|
if(linechanging) return; // an item is changint its value, do not switch lines hence
|
||||||
lastlineoffset=lineoffset;
|
lastlineoffset=lineoffset;
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void clearIfNecessary()
|
FORCE_INLINE void clearIfNecessary()
|
||||||
{
|
{
|
||||||
if(lastlineoffset!=lineoffset ||force_lcd_update)
|
if(lastlineoffset!=lineoffset ||force_lcd_update)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
#define LCD_STATUS
|
#define LCD_STATUS
|
||||||
#define LCD_MESSAGE(x)
|
#define LCD_MESSAGE(x)
|
||||||
#define LCD_MESSAGEPGM(x)
|
#define LCD_MESSAGEPGM(x)
|
||||||
inline void lcd_status() {};
|
FORCE_INLINE void lcd_status() {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ULTIPANEL
|
#ifndef ULTIPANEL
|
||||||
|
|
|
@ -660,7 +660,12 @@ void MainMenu::showTune()
|
||||||
//
|
//
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ItemCT_exit, ItemCT_nozzle, ItemCT_fan,
|
ItemCT_exit,ItemCT_nozzle,
|
||||||
|
#ifdef AUTOTEMP
|
||||||
|
ItemCT_autotempactive,
|
||||||
|
ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
|
||||||
|
#endif
|
||||||
|
ItemCT_fan,
|
||||||
ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
|
ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -708,7 +713,128 @@ void MainMenu::showControlTemp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
#ifdef AUTOTEMP
|
||||||
|
case ItemCT_autotempmin:
|
||||||
|
{
|
||||||
|
if(force_lcd_update)
|
||||||
|
{
|
||||||
|
lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
|
||||||
|
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
|
||||||
|
}
|
||||||
|
|
||||||
|
if((activeline==line) )
|
||||||
|
{
|
||||||
|
if(CLICKED)
|
||||||
|
{
|
||||||
|
linechanging=!linechanging;
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
encoderpos=intround(autotemp_max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
autotemp_max=encoderpos;
|
||||||
|
encoderpos=activeline*lcdslow;
|
||||||
|
beepshort();
|
||||||
|
}
|
||||||
|
BLOCK;
|
||||||
|
}
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
if(encoderpos<0) encoderpos=0;
|
||||||
|
if(encoderpos>260) encoderpos=260;
|
||||||
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case ItemCT_autotempmax:
|
||||||
|
{
|
||||||
|
if(force_lcd_update)
|
||||||
|
{
|
||||||
|
lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
|
||||||
|
lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
|
||||||
|
}
|
||||||
|
|
||||||
|
if((activeline==line) )
|
||||||
|
{
|
||||||
|
if(CLICKED)
|
||||||
|
{
|
||||||
|
linechanging=!linechanging;
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
encoderpos=intround(autotemp_max);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
autotemp_max=encoderpos;
|
||||||
|
encoderpos=activeline*lcdslow;
|
||||||
|
beepshort();
|
||||||
|
}
|
||||||
|
BLOCK;
|
||||||
|
}
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
if(encoderpos<0) encoderpos=0;
|
||||||
|
if(encoderpos>260) encoderpos=260;
|
||||||
|
lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case ItemCT_autotempfact:
|
||||||
|
{
|
||||||
|
if(force_lcd_update)
|
||||||
|
{
|
||||||
|
lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
|
||||||
|
lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if((activeline==line) )
|
||||||
|
{
|
||||||
|
if(CLICKED)
|
||||||
|
{
|
||||||
|
linechanging=!linechanging;
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
encoderpos=intround(autotemp_factor*100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
autotemp_max=encoderpos;
|
||||||
|
encoderpos=activeline*lcdslow;
|
||||||
|
beepshort();
|
||||||
|
}
|
||||||
|
BLOCK;
|
||||||
|
}
|
||||||
|
if(linechanging)
|
||||||
|
{
|
||||||
|
if(encoderpos<0) encoderpos=0;
|
||||||
|
if(encoderpos>99) encoderpos=99;
|
||||||
|
lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case ItemCT_autotempactive:
|
||||||
|
{
|
||||||
|
if(force_lcd_update)
|
||||||
|
{
|
||||||
|
lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
|
||||||
|
lcd.setCursor(13,line);
|
||||||
|
if(autotemp_enabled)
|
||||||
|
lcdprintPGM("On");
|
||||||
|
else
|
||||||
|
lcdprintPGM("Off");
|
||||||
|
}
|
||||||
|
|
||||||
|
if((activeline==line) )
|
||||||
|
{
|
||||||
|
if(CLICKED)
|
||||||
|
{
|
||||||
|
autotemp_enabled=!autotemp_enabled;
|
||||||
|
BLOCK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
#endif //autotemp
|
||||||
case ItemCT_fan:
|
case ItemCT_fan:
|
||||||
{
|
{
|
||||||
if(force_lcd_update)
|
if(force_lcd_update)
|
||||||
|
@ -1620,6 +1746,19 @@ char *ftostr31(const float &x)
|
||||||
return conv;
|
return conv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ftostr32(const float &x)
|
||||||
|
{
|
||||||
|
int xx=x*100;
|
||||||
|
conv[0]=(xx>=0)?'+':'-';
|
||||||
|
xx=abs(xx);
|
||||||
|
conv[1]=(xx/100)%10+'0';
|
||||||
|
conv[2]='.';
|
||||||
|
conv[3]=(xx/10)%10+'0';
|
||||||
|
conv[4]=(xx)%10+'0';
|
||||||
|
conv[6]=0;
|
||||||
|
return conv;
|
||||||
|
}
|
||||||
|
|
||||||
char *itostr31(const int &xx)
|
char *itostr31(const int &xx)
|
||||||
{
|
{
|
||||||
conv[0]=(xx>=0)?'+':'-';
|
conv[0]=(xx>=0)?'+':'-';
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
void wd_reset();
|
void wd_reset();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
inline void wd_init() {};
|
FORCE_INLINE void wd_init() {};
|
||||||
inline void wd_reset() {};
|
FORCE_INLINE void wd_reset() {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in a new issue