Bernhard 13 lat temu
rodzic
commit
26a1de1e44

+ 2
- 2
Marlin/EEPROMwrite.h Wyświetl plik

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

+ 3
- 1
Marlin/Marlin.h Wyświetl plik

@@ -8,6 +8,8 @@
8 8
 #include <avr/pgmspace.h>
9 9
 #include "Configuration.h"
10 10
 
11
+
12
+#define  FORCE_INLINE __attribute__((always_inline)) inline
11 13
 //#define SERIAL_ECHO(x) Serial << "echo: " << x;
12 14
 //#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
13 15
 //#define SERIAL_ERROR(x) Serial << "Error: " << x;
@@ -41,7 +43,7 @@ const char echomagic[] PROGMEM ="echo:";
41 43
 
42 44
 //things to write to serial from Programmemory. saves 400 to 2k of RAM.
43 45
 #define SerialprintPGM(x) serialprintPGM(PSTR(x))
44
-inline void serialprintPGM(const char *str)
46
+FORCE_INLINE void serialprintPGM(const char *str)
45 47
 {
46 48
   char ch=pgm_read_byte(str);
47 49
   while(ch)

+ 24
- 24
Marlin/cardreader.h Wyświetl plik

@@ -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

+ 5
- 3
Marlin/planner.cpp Wyświetl plik

@@ -132,7 +132,8 @@ static int8_t prev_block_index(int8_t block_index) {
132 132
 
133 133
 // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the 
134 134
 // given acceleration:
135
-inline float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) {
135
+FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
136
+{
136 137
   if (acceleration!=0) {
137 138
   return((target_rate*target_rate-initial_rate*initial_rate)/
138 139
          (2.0*acceleration));
@@ -147,7 +148,8 @@ inline float estimate_acceleration_distance(float initial_rate, float target_rat
147 148
 // a total travel of distance. This can be used to compute the intersection point between acceleration and
148 149
 // deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
149 150
 
150
-inline float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) {
151
+FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) 
152
+{
151 153
  if (acceleration!=0) {
152 154
   return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
153 155
          (4.0*acceleration) );
@@ -211,7 +213,7 @@ void calculate_trapezoid_for_block(block_t *block, float entry_factor, float exi
211 213
 
212 214
 // Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the 
213 215
 // acceleration within the allotted distance.
214
-inline float max_allowable_speed(float acceleration, float target_velocity, float distance) {
216
+FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity, float distance) {
215 217
   return  sqrt(target_velocity*target_velocity-2*acceleration*distance);
216 218
 }
217 219
 

+ 5
- 2
Marlin/planner.h Wyświetl plik

@@ -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.
@@ -106,14 +107,16 @@ extern volatile unsigned char block_buffer_head;           // Index of the next
106 107
 extern volatile unsigned char block_buffer_tail; 
107 108
 // Called when the current block is no longer needed. Discards the block and makes the memory
108 109
 // availible for new blocks.    
109
-inline void plan_discard_current_block() {
110
+FORCE_INLINE void plan_discard_current_block()  
111
+{
110 112
   if (block_buffer_head != block_buffer_tail) {
111 113
     block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);  
112 114
   }
113 115
 }
114 116
 
115 117
 // Gets the current block. Returns NULL if buffer empty
116
-inline block_t *plan_get_current_block() {
118
+FORCE_INLINE block_t *plan_get_current_block() 
119
+{
117 120
   if (block_buffer_head == block_buffer_tail) { 
118 121
     return(NULL); 
119 122
   }

+ 15
- 15
Marlin/temperature.h Wyświetl plik

@@ -59,31 +59,31 @@ 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
 
66
-inline float degTargetHotend0() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
67
-inline float degTargetHotend1() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
68
-inline float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
66
+FORCE_INLINE float degTargetHotend0() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};
67
+FORCE_INLINE float degTargetHotend1() {  return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};
68
+FORCE_INLINE float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
69 69
 
70
-inline void setTargetHotend0(const float &celsius) 
70
+FORCE_INLINE void setTargetHotend0(const float &celsius) 
71 71
 {  
72 72
   target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);
73 73
   #ifdef PIDTEMP
74 74
     pid_setpoint = celsius;
75 75
   #endif //PIDTEMP
76 76
 };
77
-inline void setTargetHotend1(const float &celsius) {  target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
78
-inline void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
77
+FORCE_INLINE void setTargetHotend1(const float &celsius) {  target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
78
+FORCE_INLINE void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
79 79
 
80
-inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
81
-inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
82
-inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
80
+FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
81
+FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
82
+FORCE_INLINE bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
83 83
 
84
-inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
85
-inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
86
-inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
84
+FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
85
+FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
86
+FORCE_INLINE bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
87 87
 
88 88
 void disable_heater();
89 89
 void setWatch();

+ 3
- 3
Marlin/ultralcd.h Wyświetl plik

@@ -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  

+ 2
- 2
Marlin/watchdog.h Wyświetl plik

@@ -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

Ładowanie…
Anuluj
Zapisz