Kaynağa Gözat

Merge branch 'smallopt' into Marlin_v1

Conflicts:
	Marlin/temperature.h
Bernhard 12 yıl önce
ebeveyn
işleme
311627141b

+ 2
- 2
Marlin/EEPROMwrite.h Dosyayı Görüntüle

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

+ 4
- 1
Marlin/Marlin.h Dosyayı Görüntüle

@@ -10,6 +10,8 @@
10 10
 #include "Configuration.h"
11 11
 #include "MarlinSerial.h"
12 12
 
13
+
14
+#define  FORCE_INLINE __attribute__((always_inline)) inline
13 15
 //#define SERIAL_ECHO(x) Serial << "echo: " << x;
14 16
 //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
15 17
 //#define SERIAL_ERROR(x) Serial << "Error: " << x;
@@ -43,7 +45,7 @@ const char echomagic[] PROGMEM ="echo:";
43 45
 
44 46
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
45 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 50
   char ch=pgm_read_byte(str);
49 51
   while(ch)
@@ -112,5 +114,6 @@ void prepare_arc_move(char isclockwise);
112 114
 extern float homing_feedrate[];
113 115
 extern bool axis_relative_modes[];
114 116
 extern float current_position[NUM_AXIS] ;
117
+extern float add_homeing[3];
115 118
 
116 119
 #endif

+ 18
- 3
Marlin/Marlin.pde Dosyayı Görüntüle

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

+ 24
- 24
Marlin/cardreader.h Dosyayı Görüntüle

@@ -32,11 +32,11 @@ public:
32 32
   void chdir(const char * relpath);
33 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 41
 public:
42 42
   bool saving;
@@ -69,31 +69,31 @@ private:
69 69
 class CardReader
70 70
 {
71 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 98
 #endif //SDSUPPORT
99 99
 #endif

+ 12
- 19
Marlin/planner.cpp Dosyayı Görüntüle

@@ -95,13 +95,17 @@ static float previous_nominal_speed; // Nominal speed of previous path line segm
95 95
     bool autotemp_enabled=false;
96 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 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 110
 // Used for the frequency limit
107 111
 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) {
130 134
 
131 135
 // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the 
132 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 139
   if (acceleration!=0) {
135 140
   return((target_rate*target_rate-initial_rate*initial_rate)/
136 141
          (2.0*acceleration));
@@ -145,7 +150,8 @@ inline float estimate_acceleration_distance(float initial_rate, float target_rat
145 150
 // a total travel of distance. This can be used to compute the intersection point between acceleration and
146 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 155
  if (acceleration!=0) {
150 156
   return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
151 157
          (4.0*acceleration) );
@@ -209,7 +215,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
209 215
 
210 216
 // Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the 
211 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 219
   return  sqrt(target_velocity*target_velocity-2*acceleration*distance);
214 220
 }
215 221
 
@@ -366,20 +372,7 @@ void plan_init() {
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 377
 #ifdef AUTOTEMP
385 378
 void getHighESpeed()

+ 27
- 5
Marlin/planner.h Dosyayı Görüntüle

@@ -25,6 +25,7 @@
25 25
 #define planner_h
26 26
 
27 27
 #include "Configuration.h"
28
+#include "Marlin.h"
28 29
 
29 30
 // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 
30 31
 // 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
72 73
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);
73 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 78
 void check_axes_activity();
83 79
 uint8_t movesplanned(); //return the nr of buffered moves
@@ -103,4 +99,30 @@ extern uint8_t active_extruder;
103 99
     extern float autotemp_factor;
104 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 128
 #endif

+ 2
- 2
Marlin/stepper.cpp Dosyayı Görüntüle

@@ -212,7 +212,7 @@ void st_wake_up() {
212 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 216
   unsigned short timer;
217 217
   if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
218 218
   
@@ -249,7 +249,7 @@ inline unsigned short calc_timer(unsigned short step_rate) {
249 249
 
250 250
 // Initializes the trapezoid generator from the current block. Called whenever a new 
251 251
 // block begins.
252
-inline void trapezoid_generator_reset() {
252
+FORCE_INLINE void trapezoid_generator_reset() {
253 253
   #ifdef ADVANCE
254 254
     advance = current_block->initial_advance;
255 255
     final_advance = current_block->final_advance;

+ 11
- 11
Marlin/temperature.h Dosyayı Görüntüle

@@ -59,16 +59,16 @@ extern float Kp,Ki,Kd,Kc;
59 59
 //inline so that there is no performance decrease.
60 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 65
 inline float degHotend(uint8_t extruder){  
66 66
   if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
67 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 72
 inline float degTargetHotend(uint8_t extruder){  
73 73
   if(extruder == 0) return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);
74 74
   if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
@@ -76,30 +76,30 @@ inline float degTargetHotend(uint8_t extruder){
76 76
 
77 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 81
   target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
82 82
   #ifdef PIDTEMP
83 83
     pid_setpoint = celsius;
84 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 87
 inline float setTargetHotend(const float &celcius, uint8_t extruder){  
88 88
   if(extruder == 0) setTargetHotend0(celcius);
89 89
   if(extruder == 1) setTargetHotend1(celcius);
90 90
 };
91 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 95
 inline float isHeatingHotend(uint8_t extruder){  
96 96
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];
97 97
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];
98 98
 };
99 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 103
 inline float isCoolingHotend(uint8_t extruder){  
104 104
   if(extruder == 0) return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];
105 105
   if(extruder == 1) return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];

+ 3
- 3
Marlin/ultralcd.h Dosyayı Görüntüle

@@ -79,7 +79,7 @@
79 79
     bool tune;
80 80
     
81 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 84
       if(linechanging) return; // an item is changint its value, do not switch lines hence
85 85
       lastlineoffset=lineoffset; 
@@ -119,7 +119,7 @@
119 119
       } 
120 120
     }
121 121
     
122
-    inline void clearIfNecessary()
122
+    FORCE_INLINE void clearIfNecessary()
123 123
     {
124 124
       if(lastlineoffset!=lineoffset ||force_lcd_update)
125 125
       {
@@ -143,7 +143,7 @@
143 143
   #define LCD_STATUS
144 144
   #define LCD_MESSAGE(x)
145 145
   #define LCD_MESSAGEPGM(x)
146
-  inline void lcd_status() {};
146
+  FORCE_INLINE void lcd_status() {};
147 147
 #endif
148 148
   
149 149
 #ifndef ULTIPANEL  

+ 141
- 2
Marlin/ultralcd.pde Dosyayı Görüntüle

@@ -660,7 +660,12 @@ void MainMenu::showTune()
660 660
 //   
661 661
 
662 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 669
   ItemCT_PID_P,ItemCT_PID_I,ItemCT_PID_D,ItemCT_PID_C
665 670
 };
666 671
 
@@ -708,7 +713,128 @@ void MainMenu::showControlTemp()
708 713
           }
709 714
         }
710 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 838
       case ItemCT_fan:
713 839
       {
714 840
         if(force_lcd_update)
@@ -1620,6 +1746,19 @@ char *ftostr31(const float &x)
1620 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 1762
 char *itostr31(const int &xx)
1624 1763
 {
1625 1764
   conv[0]=(xx>=0)?'+':'-';

+ 2
- 2
Marlin/watchdog.h Dosyayı Görüntüle

@@ -9,8 +9,8 @@
9 9
   void wd_reset();
10 10
 
11 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 14
 #endif
15 15
 
16 16
 #endif

Loading…
İptal
Kaydet