Browse Source

Merge branch 'smallopt' into Marlin_v1

Conflicts:
	Marlin/temperature.h
Bernhard 13 years ago
parent
commit
311627141b
11 changed files with 246 additions and 74 deletions
  1. 2
    2
      Marlin/EEPROMwrite.h
  2. 4
    1
      Marlin/Marlin.h
  3. 18
    3
      Marlin/Marlin.pde
  4. 24
    24
      Marlin/cardreader.h
  5. 12
    19
      Marlin/planner.cpp
  6. 27
    5
      Marlin/planner.h
  7. 2
    2
      Marlin/stepper.cpp
  8. 11
    11
      Marlin/temperature.h
  9. 3
    3
      Marlin/ultralcd.h
  10. 141
    2
      Marlin/ultralcd.pde
  11. 2
    2
      Marlin/watchdog.h

+ 2
- 2
Marlin/EEPROMwrite.h View File

39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
39
 // ALSO:  always make sure the variables in the Store and retrieve sections are in the same order.
40
 #define EEPROM_VERSION "V04"  
40
 #define EEPROM_VERSION "V04"  
41
 
41
 
42
-inline void StoreSettings() 
42
+FORCE_INLINE void StoreSettings() 
43
 {
43
 {
44
 #ifdef EEPROM_SETTINGS
44
 #ifdef EEPROM_SETTINGS
45
   char ver[4]= "000";
45
   char ver[4]= "000";
72
 #endif //EEPROM_SETTINGS
72
 #endif //EEPROM_SETTINGS
73
 }
73
 }
74
 
74
 
75
-inline void RetrieveSettings(bool def=false)
75
+FORCE_INLINE void RetrieveSettings(bool def=false)
76
 {  // if def=true, the default values will be used
76
 {  // if def=true, the default values will be used
77
   #ifdef EEPROM_SETTINGS
77
   #ifdef EEPROM_SETTINGS
78
     int i=EEPROM_OFFSET;
78
     int i=EEPROM_OFFSET;

+ 4
- 1
Marlin/Marlin.h View File

10
 #include "Configuration.h"
10
 #include "Configuration.h"
11
 #include "MarlinSerial.h"
11
 #include "MarlinSerial.h"
12
 
12
 
13
+
14
+#define  FORCE_INLINE __attribute__((always_inline)) inline
13
 //#define SERIAL_ECHO(x) Serial << "echo: " << x;
15
 //#define SERIAL_ECHO(x) Serial << "echo: " << x;
14
 //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
16
 //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
15
 //#define SERIAL_ERROR(x) Serial << "Error: " << x;
17
 //#define SERIAL_ERROR(x) Serial << "Error: " << x;
43
 
45
 
44
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
46
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
45
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
47
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
46
-inline void serialprintPGM(const char *str)
48
+FORCE_INLINE void serialprintPGM(const char *str)
47
 {
49
 {
48
   char ch=pgm_read_byte(str);
50
   char ch=pgm_read_byte(str);
49
   while(ch)
51
   while(ch)
112
 extern float homing_feedrate[];
114
 extern float homing_feedrate[];
113
 extern bool axis_relative_modes[];
115
 extern bool axis_relative_modes[];
114
 extern float current_position[NUM_AXIS] ;
116
 extern float current_position[NUM_AXIS] ;
117
+extern float add_homeing[3];
115
 
118
 
116
 #endif
119
 #endif

+ 18
- 3
Marlin/Marlin.pde View File

94
 // M92  - Set axis_steps_per_unit - same syntax as G92
94
 // M92  - Set axis_steps_per_unit - same syntax as G92
95
 // M114 - Output current position to serial port 
95
 // M114 - Output current position to serial port 
96
 // M115	- Capabilities string
96
 // M115	- Capabilities string
97
+// M117 - display message
97
 // M119 - Output Endstop status to serial port
98
 // M119 - Output Endstop status to serial port
98
 // M140 - Set bed target temp
99
 // M140 - Set bed target temp
99
 // M190 - Wait for bed current temp to reach target temp.
100
 // M190 - Wait for bed current temp to reach target temp.
103
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
104
 // M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
104
 // 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
105
 // 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
105
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
106
 // M205 -  advanced settings:  minimum travel speed S=while printing T=travel only,  B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk
107
+// M206 - set additional homeing offset
106
 // M220 - set speed factor override percentage S:factor in percent
108
 // M220 - set speed factor override percentage S:factor in percent
107
 // M301 - Set PID parameters P I and D
109
 // M301 - Set PID parameters P I and D
108
 // M400 - Finish all moves
110
 // M400 - Finish all moves
130
 int saved_feedmultiply;
132
 int saved_feedmultiply;
131
 volatile bool feedmultiplychanged=false;
133
 volatile bool feedmultiplychanged=false;
132
 float current_position[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
134
 float current_position[NUM_AXIS] = {  0.0, 0.0, 0.0, 0.0};
133
-
135
+float add_homeing[3]={0,0,0};
134
 
136
 
135
 //===========================================================================
137
 //===========================================================================
136
 //=============================private variables=============================
138
 //=============================private variables=============================
528
       }
530
       }
529
       feedrate = 0.0;
531
       feedrate = 0.0;
530
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
532
       home_all_axis = !((code_seen(axis_codes[0])) || (code_seen(axis_codes[1])) || (code_seen(axis_codes[2])));
531
-
533
+      
532
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
534
       if((home_all_axis) || (code_seen(axis_codes[X_AXIS]))) 
533
       {
535
       {
534
         HOMEAXIS(X);
536
         HOMEAXIS(X);
537
+	current_position[0]=code_value()+add_homeing[0];
535
       }
538
       }
536
 
539
 
537
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
540
       if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
538
        HOMEAXIS(Y);
541
        HOMEAXIS(Y);
542
+       current_position[1]=code_value()+add_homeing[1];
539
       }
543
       }
540
 
544
 
541
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
545
       if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
542
         HOMEAXIS(Z);
546
         HOMEAXIS(Z);
547
+	current_position[2]=code_value()+add_homeing[2];
543
       }       
548
       }       
549
+      
544
       feedrate = saved_feedrate;
550
       feedrate = saved_feedrate;
545
       feedmultiply = saved_feedmultiply;
551
       feedmultiply = saved_feedmultiply;
546
       previous_millis_cmd = millis();
552
       previous_millis_cmd = millis();
557
         st_synchronize();
563
         st_synchronize();
558
       for(int8_t i=0; i < NUM_AXIS; i++) {
564
       for(int8_t i=0; i < NUM_AXIS; i++) {
559
         if(code_seen(axis_codes[i])) { 
565
         if(code_seen(axis_codes[i])) { 
560
-           current_position[i] = code_value();  
566
+           current_position[i] = code_value()+add_homeing[i];  
561
            if(i == E_AXIS) {
567
            if(i == E_AXIS) {
562
              plan_set_e_position(current_position[E_AXIS]);
568
              plan_set_e_position(current_position[E_AXIS]);
563
            }
569
            }
869
     case 115: // M115
875
     case 115: // M115
870
       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");
876
       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");
871
       break;
877
       break;
878
+    case 117: // M117 display message
879
+      LCD_MESSAGE(cmdbuffer[bufindr]+5);
880
+      break;
872
     case 114: // M114
881
     case 114: // M114
873
       SERIAL_PROTOCOLPGM("X:");
882
       SERIAL_PROTOCOLPGM("X:");
874
       SERIAL_PROTOCOL(current_position[X_AXIS]);
883
       SERIAL_PROTOCOL(current_position[X_AXIS]);
949
       if(code_seen('Z')) max_z_jerk = code_value() ;
958
       if(code_seen('Z')) max_z_jerk = code_value() ;
950
     }
959
     }
951
     break;
960
     break;
961
+    case 206: // M206 additional homeing offset
962
+      for(int8_t i=0; i < 3; i++) 
963
+      {
964
+        if(code_seen(axis_codes[i])) add_homeing[i] = code_value();
965
+      }
966
+      break;
952
     case 220: // M220 S<factor in percent>- set speed factor override percentage
967
     case 220: // M220 S<factor in percent>- set speed factor override percentage
953
     {
968
     {
954
       if(code_seen('S')) 
969
       if(code_seen('S')) 

+ 24
- 24
Marlin/cardreader.h View File

32
   void chdir(const char * relpath);
32
   void chdir(const char * relpath);
33
   void updir();
33
   void updir();
34
 
34
 
35
-  inline bool eof() { return sdpos>=filesize ;};
36
-  inline int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
37
-  inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
38
-  inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
39
-  inline char* getWorkDirName(){workDir.getFilename(filename);return filename;};
35
+  FORCE_INLINE bool eof() { return sdpos>=filesize ;};
36
+  FORCE_INLINE int16_t get() {  sdpos = file.curPosition();return (int16_t)file.read();};
37
+  FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
38
+  FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
39
+  FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
40
 
40
 
41
 public:
41
 public:
42
   bool saving;
42
   bool saving;
69
 class CardReader
69
 class CardReader
70
 {
70
 {
71
 public:
71
 public:
72
-  inline CardReader(){};
72
+  FORCE_INLINE CardReader(){};
73
   
73
   
74
-  inline static void initsd(){};
75
-  inline static void write_command(char *buf){};
74
+  FORCE_INLINE static void initsd(){};
75
+  FORCE_INLINE static void write_command(char *buf){};
76
   
76
   
77
-  inline static void checkautostart(bool x) {}; 
77
+  FORCE_INLINE static void checkautostart(bool x) {}; 
78
   
78
   
79
-  inline static void openFile(char* name,bool read){};
80
-  inline static void closefile() {};
81
-  inline static void release(){};
82
-  inline static void startFileprint(){};
83
-  inline static void startFilewrite(char *name){};
84
-  inline static void pauseSDPrint(){};
85
-  inline static void getStatus(){};
79
+  FORCE_INLINE static void openFile(char* name,bool read){};
80
+  FORCE_INLINE static void closefile() {};
81
+  FORCE_INLINE static void release(){};
82
+  FORCE_INLINE static void startFileprint(){};
83
+  FORCE_INLINE static void startFilewrite(char *name){};
84
+  FORCE_INLINE static void pauseSDPrint(){};
85
+  FORCE_INLINE static void getStatus(){};
86
   
86
   
87
-  inline static void selectFile(char* name){};
88
-  inline static void getfilename(const uint8_t nr){};
89
-  inline static uint8_t getnrfilenames(){return 0;};
87
+  FORCE_INLINE static void selectFile(char* name){};
88
+  FORCE_INLINE static void getfilename(const uint8_t nr){};
89
+  FORCE_INLINE static uint8_t getnrfilenames(){return 0;};
90
   
90
   
91
 
91
 
92
-  inline static void ls() {};
93
-  inline static bool eof() {return true;};
94
-  inline static char get() {return 0;};
95
-  inline static void setIndex(){};
96
-  inline uint8_t percentDone(){return 0;};
92
+  FORCE_INLINE static void ls() {};
93
+  FORCE_INLINE static bool eof() {return true;};
94
+  FORCE_INLINE static char get() {return 0;};
95
+  FORCE_INLINE static void setIndex(){};
96
+  FORCE_INLINE uint8_t percentDone(){return 0;};
97
 };
97
 };
98
 #endif //SDSUPPORT
98
 #endif //SDSUPPORT
99
 #endif
99
 #endif

+ 12
- 19
Marlin/planner.cpp View File

95
     bool autotemp_enabled=false;
95
     bool autotemp_enabled=false;
96
 #endif
96
 #endif
97
 
97
 
98
+    
99
+//===========================================================================
100
+//=================semi-private variables, used in inline  functions    =====
101
+//===========================================================================
102
+block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
103
+volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
104
+volatile unsigned char block_buffer_tail;           // Index of the block to process now
98
 
105
 
99
 //===========================================================================
106
 //===========================================================================
100
 //=============================private variables ============================
107
 //=============================private variables ============================
101
 //===========================================================================
108
 //===========================================================================
102
-static block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
103
-static volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
104
-static volatile unsigned char block_buffer_tail;           // Index of the block to process now
105
 
109
 
106
 // Used for the frequency limit
110
 // Used for the frequency limit
107
 static unsigned char old_direction_bits = 0;               // Old direction bits. Used for speed calculations
111
 static unsigned char old_direction_bits = 0;               // Old direction bits. Used for speed calculations
130
 
134
 
131
 // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the 
135
 // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the 
132
 // given acceleration:
136
 // given acceleration:
133
-inline float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) {
137
+FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
138
+{
134
   if (acceleration!=0) {
139
   if (acceleration!=0) {
135
   return((target_rate*target_rate-initial_rate*initial_rate)/
140
   return((target_rate*target_rate-initial_rate*initial_rate)/
136
          (2.0*acceleration));
141
          (2.0*acceleration));
145
 // a total travel of distance. This can be used to compute the intersection point between acceleration and
150
 // a total travel of distance. This can be used to compute the intersection point between acceleration and
146
 // deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
151
 // deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
147
 
152
 
148
-inline float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) {
153
+FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) 
154
+{
149
  if (acceleration!=0) {
155
  if (acceleration!=0) {
150
   return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
156
   return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
151
          (4.0*acceleration) );
157
          (4.0*acceleration) );
209
 
215
 
210
 // Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the 
216
 // Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the 
211
 // acceleration within the allotted distance.
217
 // acceleration within the allotted distance.
212
-inline float max_allowable_speed(float acceleration, float target_velocity, float distance) {
218
+FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity, float distance) {
213
   return  sqrt(target_velocity*target_velocity-2*acceleration*distance);
219
   return  sqrt(target_velocity*target_velocity-2*acceleration*distance);
214
 }
220
 }
215
 
221
 
366
 }
372
 }
367
 
373
 
368
 
374
 
369
-void plan_discard_current_block() {
370
-  if (block_buffer_head != block_buffer_tail) {
371
-    block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);  
372
-  }
373
-}
374
 
375
 
375
-block_t *plan_get_current_block() {
376
-  if (block_buffer_head == block_buffer_tail) { 
377
-    return(NULL); 
378
-  }
379
-  block_t *block = &block_buffer[block_buffer_tail];
380
-  block->busy = true;
381
-  return(block);
382
-}
383
 
376
 
384
 #ifdef AUTOTEMP
377
 #ifdef AUTOTEMP
385
 void getHighESpeed()
378
 void getHighESpeed()

+ 27
- 5
Marlin/planner.h View File

25
 #define planner_h
25
 #define planner_h
26
 
26
 
27
 #include "Configuration.h"
27
 #include "Configuration.h"
28
+#include "Marlin.h"
28
 
29
 
29
 // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
30
 // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
30
 // the source g-code and may never actually be reached if acceleration management is active.
31
 // the source g-code and may never actually be reached if acceleration management is active.
72
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);
73
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);
73
 void plan_set_e_position(const float &e);
74
 void plan_set_e_position(const float &e);
74
 
75
 
75
-// Called when the current block is no longer needed. Discards the block and makes the memory
76
-// availible for new blocks.
77
-void plan_discard_current_block();
78
 
76
 
79
-// Gets the current block. Returns NULL if buffer empty
80
-block_t *plan_get_current_block();
81
 
77
 
82
 void check_axes_activity();
78
 void check_axes_activity();
83
 uint8_t movesplanned(); //return the nr of buffered moves
79
 uint8_t movesplanned(); //return the nr of buffered moves
103
     extern float autotemp_factor;
99
     extern float autotemp_factor;
104
 #endif
100
 #endif
105
 
101
 
102
+    
103
+/////semi-private stuff
104
+#include <WProgram.h>
105
+
106
+extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
107
+extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
108
+extern volatile unsigned char block_buffer_tail; 
109
+// Called when the current block is no longer needed. Discards the block and makes the memory
110
+// availible for new blocks.    
111
+FORCE_INLINE void plan_discard_current_block()  
112
+{
113
+  if (block_buffer_head != block_buffer_tail) {
114
+    block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);  
115
+  }
116
+}
117
+
118
+// Gets the current block. Returns NULL if buffer empty
119
+FORCE_INLINE block_t *plan_get_current_block() 
120
+{
121
+  if (block_buffer_head == block_buffer_tail) { 
122
+    return(NULL); 
123
+  }
124
+  block_t *block = &block_buffer[block_buffer_tail];
125
+  block->busy = true;
126
+  return(block);
127
+}
106
 #endif
128
 #endif

+ 2
- 2
Marlin/stepper.cpp View File

212
   ENABLE_STEPPER_DRIVER_INTERRUPT();  
212
   ENABLE_STEPPER_DRIVER_INTERRUPT();  
213
 }
213
 }
214
 
214
 
215
-inline unsigned short calc_timer(unsigned short step_rate) {
215
+FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
216
   unsigned short timer;
216
   unsigned short timer;
217
   if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
217
   if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
218
   
218
   
249
 
249
 
250
 // Initializes the trapezoid generator from the current block. Called whenever a new 
250
 // Initializes the trapezoid generator from the current block. Called whenever a new 
251
 // block begins.
251
 // block begins.
252
-inline void trapezoid_generator_reset() {
252
+FORCE_INLINE void trapezoid_generator_reset() {
253
   #ifdef ADVANCE
253
   #ifdef ADVANCE
254
     advance = current_block->initial_advance;
254
     advance = current_block->initial_advance;
255
     final_advance = current_block->final_advance;
255
     final_advance = current_block->final_advance;

+ 11
- 11
Marlin/temperature.h View File

59
 //inline so that there is no performance decrease.
59
 //inline so that there is no performance decrease.
60
 //deg=degreeCelsius
60
 //deg=degreeCelsius
61
 
61
 
62
-inline float degHotend0(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
63
-inline float degHotend1(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
64
-inline float degBed() {  return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
62
+FORCE_INLINE float degHotend0(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
63
+FORCE_INLINE float degHotend1(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
64
+FORCE_INLINE float degBed() {  return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
65
 inline float degHotend(uint8_t extruder){  
65
 inline float degHotend(uint8_t extruder){  
66
   if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
66
   if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
67
   if(extruder == 1) return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);
67
   if(extruder == 1) return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);
68
 };
68
 };
69
 
69
 
70
-inline float degTargetHotend0() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
71
-inline float degTargetHotend1() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
70
+FORCE_INLINE float degTargetHotend0() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
71
+FORCE_INLINE float degTargetHotend1() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
72
 inline float degTargetHotend(uint8_t extruder){  
72
 inline float degTargetHotend(uint8_t extruder){  
73
   if(extruder == 0) return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
73
   if(extruder == 0) return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
74
   if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
74
   if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
76
 
76
 
77
 inline float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
77
 inline float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
78
 
78
 
79
-inline void setTargetHotend0(const float &celsius) 
79
+FORCE_INLINE void setTargetHotend0(const float &celsius) 
80
 {  
80
 {  
81
   target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
81
   target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
82
   #ifdef PIDTEMP
82
   #ifdef PIDTEMP
83
     pid_setpoint = celsius;
83
     pid_setpoint = celsius;
84
   #endif //PIDTEMP
84
   #endif //PIDTEMP
85
 };
85
 };
86
-inline void setTargetHotend1(const float &celsius) {  target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
86
+FORCE_INLINE void setTargetHotend1(const float &celsius) {  target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
87
 inline float setTargetHotend(const float &celcius, uint8_t extruder){  
87
 inline float setTargetHotend(const float &celcius, uint8_t extruder){  
88
   if(extruder == 0) setTargetHotend0(celcius);
88
   if(extruder == 0) setTargetHotend0(celcius);
89
   if(extruder == 1) setTargetHotend1(celcius);
89
   if(extruder == 1) setTargetHotend1(celcius);
90
 };
90
 };
91
 inline void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
91
 inline void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
92
 
92
 
93
-inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
94
-inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
93
+FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
94
+FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
95
 inline float isHeatingHotend(uint8_t extruder){  
95
 inline float isHeatingHotend(uint8_t extruder){  
96
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];
96
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];
97
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];
97
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];
98
 };
98
 };
99
 inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
99
 inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
100
 
100
 
101
-inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
102
-inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
101
+FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
102
+FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
103
 inline float isCoolingHotend(uint8_t extruder){  
103
 inline float isCoolingHotend(uint8_t extruder){  
104
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];
104
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];
105
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];
105
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];

+ 3
- 3
Marlin/ultralcd.h View File

79
     bool tune;
79
     bool tune;
80
     
80
     
81
   private:
81
   private:
82
-    inline void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
82
+    FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
83
     {
83
     {
84
       if(linechanging) return; // an item is changint its value, do not switch lines hence
84
       if(linechanging) return; // an item is changint its value, do not switch lines hence
85
       lastlineoffset=lineoffset; 
85
       lastlineoffset=lineoffset; 
119
       } 
119
       } 
120
     }
120
     }
121
     
121
     
122
-    inline void clearIfNecessary()
122
+    FORCE_INLINE void clearIfNecessary()
123
     {
123
     {
124
       if(lastlineoffset!=lineoffset ||force_lcd_update)
124
       if(lastlineoffset!=lineoffset ||force_lcd_update)
125
       {
125
       {
143
   #define LCD_STATUS
143
   #define LCD_STATUS
144
   #define LCD_MESSAGE(x)
144
   #define LCD_MESSAGE(x)
145
   #define LCD_MESSAGEPGM(x)
145
   #define LCD_MESSAGEPGM(x)
146
-  inline void lcd_status() {};
146
+  FORCE_INLINE void lcd_status() {};
147
 #endif
147
 #endif
148
   
148
   
149
 #ifndef ULTIPANEL  
149
 #ifndef ULTIPANEL  

+ 141
- 2
Marlin/ultralcd.pde View File

660
 //   
660
 //   
661
 
661
 
662
 enum {
662
 enum {
663
-  ItemCT_exit, ItemCT_nozzle, ItemCT_fan,
663
+  ItemCT_exit,ItemCT_nozzle,
664
+#ifdef AUTOTEMP
665
+  ItemCT_autotempactive,
666
+  ItemCT_autotempmin,ItemCT_autotempmax,ItemCT_autotempfact,
667
+#endif
668
+  ItemCT_fan,
664
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
669
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
665
 };
670
 };
666
 
671
 
708
           }
713
           }
709
         }
714
         }
710
       }break;
715
       }break;
711
-      
716
+      #ifdef AUTOTEMP
717
+      case ItemCT_autotempmin:
718
+      {
719
+        if(force_lcd_update)
720
+        {
721
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Min:");
722
+          lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
723
+        }
724
+        
725
+        if((activeline==line) )
726
+        {
727
+          if(CLICKED)
728
+          {
729
+            linechanging=!linechanging;
730
+            if(linechanging)
731
+            {
732
+               encoderpos=intround(autotemp_max);
733
+            }
734
+            else
735
+            {
736
+              autotemp_max=encoderpos;
737
+              encoderpos=activeline*lcdslow;
738
+              beepshort();
739
+            }
740
+            BLOCK;
741
+          }
742
+          if(linechanging)
743
+          {
744
+            if(encoderpos<0) encoderpos=0;
745
+            if(encoderpos>260) encoderpos=260;
746
+            lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
747
+          }
748
+        }
749
+      }break;  
750
+      case ItemCT_autotempmax:
751
+      {
752
+        if(force_lcd_update)
753
+        {
754
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Max:");
755
+          lcd.setCursor(13,line);lcd.print(ftostr3(autotemp_max));
756
+        }
757
+        
758
+        if((activeline==line) )
759
+        {
760
+          if(CLICKED)
761
+          {
762
+            linechanging=!linechanging;
763
+            if(linechanging)
764
+            {
765
+               encoderpos=intround(autotemp_max);
766
+            }
767
+            else
768
+            {
769
+              autotemp_max=encoderpos;
770
+              encoderpos=activeline*lcdslow;
771
+              beepshort();
772
+            }
773
+            BLOCK;
774
+          }
775
+          if(linechanging)
776
+          {
777
+            if(encoderpos<0) encoderpos=0;
778
+            if(encoderpos>260) encoderpos=260;
779
+            lcd.setCursor(13,line);lcd.print(itostr3(encoderpos));
780
+          }
781
+        }
782
+      }break;  
783
+      case ItemCT_autotempfact:
784
+      {
785
+        if(force_lcd_update)
786
+        {
787
+          lcd.setCursor(0,line);lcdprintPGM(" \002 Fact:");
788
+          lcd.setCursor(13,line);lcd.print(ftostr32(autotemp_factor));
789
+        }
790
+        
791
+        if((activeline==line) )
792
+        {
793
+          if(CLICKED)
794
+          {
795
+            linechanging=!linechanging;
796
+            if(linechanging)
797
+            {
798
+               encoderpos=intround(autotemp_factor*100);
799
+            }
800
+            else
801
+            {
802
+              autotemp_max=encoderpos;
803
+              encoderpos=activeline*lcdslow;
804
+              beepshort();
805
+            }
806
+            BLOCK;
807
+          }
808
+          if(linechanging)
809
+          {
810
+            if(encoderpos<0) encoderpos=0;
811
+            if(encoderpos>99) encoderpos=99;
812
+            lcd.setCursor(13,line);lcd.print(ftostr32(encoderpos/100.));
813
+          }
814
+        }
815
+      }break;
816
+      case ItemCT_autotempactive:
817
+      {
818
+        if(force_lcd_update)
819
+        {
820
+          lcd.setCursor(0,line);lcdprintPGM(" Autotemp:");
821
+          lcd.setCursor(13,line);
822
+	  if(autotemp_enabled)
823
+	    lcdprintPGM("On");
824
+	  else
825
+	    lcdprintPGM("Off");
826
+        }
827
+        
828
+        if((activeline==line) )
829
+        {
830
+          if(CLICKED)
831
+          {
832
+            autotemp_enabled=!autotemp_enabled;
833
+            BLOCK;
834
+          }
835
+        }
836
+      }break;  
837
+      #endif //autotemp
712
       case ItemCT_fan:
838
       case ItemCT_fan:
713
       {
839
       {
714
         if(force_lcd_update)
840
         if(force_lcd_update)
1620
   return conv;
1746
   return conv;
1621
 }
1747
 }
1622
 
1748
 
1749
+char *ftostr32(const float &x)
1750
+{
1751
+  int xx=x*100;
1752
+  conv[0]=(xx>=0)?'+':'-';
1753
+  xx=abs(xx);
1754
+  conv[1]=(xx/100)%10+'0';
1755
+  conv[2]='.';
1756
+  conv[3]=(xx/10)%10+'0';
1757
+  conv[4]=(xx)%10+'0';
1758
+  conv[6]=0;
1759
+  return conv;
1760
+}
1761
+
1623
 char *itostr31(const int &xx)
1762
 char *itostr31(const int &xx)
1624
 {
1763
 {
1625
   conv[0]=(xx>=0)?'+':'-';
1764
   conv[0]=(xx>=0)?'+':'-';

+ 2
- 2
Marlin/watchdog.h View File

9
   void wd_reset();
9
   void wd_reset();
10
 
10
 
11
 #else
11
 #else
12
-  inline void wd_init() {};
13
-  inline void wd_reset() {};
12
+  FORCE_INLINE void wd_init() {};
13
+  FORCE_INLINE void wd_reset() {};
14
 #endif
14
 #endif
15
 
15
 
16
 #endif
16
 #endif

Loading…
Cancel
Save