Bernhard 13 år sedan
förälder
incheckning
b19c8b74b9
3 ändrade filer med 19 tillägg och 16 borttagningar
  1. 2
    1
      Marlin/MarlinSerial.cpp
  2. 9
    7
      Marlin/MarlinSerial.h
  3. 8
    8
      Marlin/temperature.h

+ 2
- 1
Marlin/MarlinSerial.cpp Visa fil

@@ -32,6 +32,7 @@
32 32
 #if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
33 33
 
34 34
 #include "MarlinSerial.h"
35
+#include "Marlin.h"
35 36
 
36 37
 
37 38
 
@@ -41,7 +42,7 @@
41 42
 #endif
42 43
 
43 44
 
44
-inline void store_char(unsigned char c)
45
+FORCE_INLINE void store_char(unsigned char c)
45 46
 {
46 47
   int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
47 48
 

+ 9
- 7
Marlin/MarlinSerial.h Visa fil

@@ -24,6 +24,8 @@
24 24
 
25 25
 #include <inttypes.h>
26 26
 #include <Stream.h>
27
+#define  FORCE_INLINE __attribute__((always_inline)) inline
28
+
27 29
 
28 30
 
29 31
 // Define constants and variables for buffering incoming serial data.  We're
@@ -55,12 +57,12 @@ class MarlinSerial //: public Stream
55 57
     int read(void);
56 58
     void flush(void);
57 59
     
58
-    inline int available(void)
60
+    FORCE_INLINE int available(void)
59 61
     {
60 62
       return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
61 63
     }
62 64
     
63
-    inline void write(uint8_t c)
65
+    FORCE_INLINE void write(uint8_t c)
64 66
     {
65 67
       while (!((UCSR0A) & (1 << UDRE0)))
66 68
         ;
@@ -69,7 +71,7 @@ class MarlinSerial //: public Stream
69 71
     }
70 72
     
71 73
     
72
-    inline void checkRx(void)
74
+    FORCE_INLINE void checkRx(void)
73 75
     {
74 76
       if((UCSR0A & (1<<RXC0)) != 0) {
75 77
         unsigned char c  =  UDR0;
@@ -94,27 +96,27 @@ class MarlinSerial //: public Stream
94 96
     
95 97
   public:
96 98
     
97
-    inline void write(const char *str)
99
+    FORCE_INLINE void write(const char *str)
98 100
     {
99 101
       while (*str)
100 102
         write(*str++);
101 103
     }
102 104
 
103 105
 
104
-    inline void write(const uint8_t *buffer, size_t size)
106
+    FORCE_INLINE void write(const uint8_t *buffer, size_t size)
105 107
     {
106 108
       while (size--)
107 109
         write(*buffer++);
108 110
     }
109 111
 
110
-    inline void print(const String &s)
112
+    FORCE_INLINE void print(const String &s)
111 113
     {
112 114
       for (int i = 0; i < s.length(); i++) {
113 115
         write(s[i]);
114 116
       }
115 117
     }
116 118
     
117
-    inline void print(const char *str)
119
+    FORCE_INLINE void print(const char *str)
118 120
     {
119 121
       write(str);
120 122
     }

+ 8
- 8
Marlin/temperature.h Visa fil

@@ -62,7 +62,7 @@ extern float Kp,Ki,Kd,Kc;
62 62
 FORCE_INLINE float degHotend0(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
63 63
 FORCE_INLINE float degHotend1(){  return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
64 64
 FORCE_INLINE float degBed() {  return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
65
-inline float degHotend(uint8_t extruder){  
65
+FORCE_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
 };
@@ -74,7 +74,7 @@ inline float degTargetHotend(uint8_t extruder){
74 74
   if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
75 75
 };
76 76
 
77
-inline float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
77
+FORCE_INLINE float degTargetBed() {   return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
78 78
 
79 79
 FORCE_INLINE void setTargetHotend0(const float &celsius) 
80 80
 {  
@@ -84,27 +84,27 @@ FORCE_INLINE void setTargetHotend0(const float &celsius)
84 84
   #endif //PIDTEMP
85 85
 };
86 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
+FORCE_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
-inline void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
91
+FORCE_INLINE void setTargetBed(const float &celsius)     {  target_raw[TEMPSENSOR_BED     ]=temp2analogBed(celsius);};
92 92
 
93 93
 FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
94 94
 FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
95
-inline float isHeatingHotend(uint8_t extruder){  
95
+FORCE_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
-inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
99
+FORCE_INLINE bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
100 100
 
101 101
 FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
102 102
 FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
103
-inline float isCoolingHotend(uint8_t extruder){  
103
+FORCE_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];
106 106
 };
107
-inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
107
+FORCE_INLINE bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
108 108
 
109 109
 void disable_heater();
110 110
 void setWatch();

Laddar…
Avbryt
Spara