force inline
This commit is contained in:
parent
311627141b
commit
b19c8b74b9
3 changed files with 19 additions and 16 deletions
|
@ -32,6 +32,7 @@
|
|||
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
|
||||
|
||||
#include "MarlinSerial.h"
|
||||
#include "Marlin.h"
|
||||
|
||||
|
||||
|
||||
|
@ -41,7 +42,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
inline void store_char(unsigned char c)
|
||||
FORCE_INLINE void store_char(unsigned char c)
|
||||
{
|
||||
int i = (unsigned int)(rx_buffer.head + 1) % RX_BUFFER_SIZE;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
#include <Stream.h>
|
||||
#define FORCE_INLINE __attribute__((always_inline)) inline
|
||||
|
||||
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
|
@ -55,12 +57,12 @@ class MarlinSerial //: public Stream
|
|||
int read(void);
|
||||
void flush(void);
|
||||
|
||||
inline int available(void)
|
||||
FORCE_INLINE int available(void)
|
||||
{
|
||||
return (unsigned int)(RX_BUFFER_SIZE + rx_buffer.head - rx_buffer.tail) % RX_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
inline void write(uint8_t c)
|
||||
FORCE_INLINE void write(uint8_t c)
|
||||
{
|
||||
while (!((UCSR0A) & (1 << UDRE0)))
|
||||
;
|
||||
|
@ -69,7 +71,7 @@ class MarlinSerial //: public Stream
|
|||
}
|
||||
|
||||
|
||||
inline void checkRx(void)
|
||||
FORCE_INLINE void checkRx(void)
|
||||
{
|
||||
if((UCSR0A & (1<<RXC0)) != 0) {
|
||||
unsigned char c = UDR0;
|
||||
|
@ -94,27 +96,27 @@ class MarlinSerial //: public Stream
|
|||
|
||||
public:
|
||||
|
||||
inline void write(const char *str)
|
||||
FORCE_INLINE void write(const char *str)
|
||||
{
|
||||
while (*str)
|
||||
write(*str++);
|
||||
}
|
||||
|
||||
|
||||
inline void write(const uint8_t *buffer, size_t size)
|
||||
FORCE_INLINE void write(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
while (size--)
|
||||
write(*buffer++);
|
||||
}
|
||||
|
||||
inline void print(const String &s)
|
||||
FORCE_INLINE void print(const String &s)
|
||||
{
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
write(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
inline void print(const char *str)
|
||||
FORCE_INLINE void print(const char *str)
|
||||
{
|
||||
write(str);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ extern float Kp,Ki,Kd,Kc;
|
|||
FORCE_INLINE float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};
|
||||
FORCE_INLINE float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};
|
||||
FORCE_INLINE float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};
|
||||
inline float degHotend(uint8_t extruder){
|
||||
FORCE_INLINE float degHotend(uint8_t extruder){
|
||||
if(extruder == 0) return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);
|
||||
if(extruder == 1) return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);
|
||||
};
|
||||
|
@ -74,7 +74,7 @@ inline float degTargetHotend(uint8_t extruder){
|
|||
if(extruder == 1) return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);
|
||||
};
|
||||
|
||||
inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
|
||||
FORCE_INLINE float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};
|
||||
|
||||
FORCE_INLINE void setTargetHotend0(const float &celsius)
|
||||
{
|
||||
|
@ -84,27 +84,27 @@ FORCE_INLINE void setTargetHotend0(const float &celsius)
|
|||
#endif //PIDTEMP
|
||||
};
|
||||
FORCE_INLINE void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};
|
||||
inline float setTargetHotend(const float &celcius, uint8_t extruder){
|
||||
FORCE_INLINE float setTargetHotend(const float &celcius, uint8_t extruder){
|
||||
if(extruder == 0) setTargetHotend0(celcius);
|
||||
if(extruder == 1) setTargetHotend1(celcius);
|
||||
};
|
||||
inline void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
|
||||
FORCE_INLINE void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};
|
||||
|
||||
FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};
|
||||
FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};
|
||||
inline float isHeatingHotend(uint8_t extruder){
|
||||
FORCE_INLINE float isHeatingHotend(uint8_t extruder){
|
||||
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];
|
||||
};
|
||||
inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
|
||||
FORCE_INLINE bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};
|
||||
|
||||
FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};
|
||||
FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};
|
||||
inline float isCoolingHotend(uint8_t extruder){
|
||||
FORCE_INLINE float isCoolingHotend(uint8_t extruder){
|
||||
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];
|
||||
};
|
||||
inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
|
||||
FORCE_INLINE bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};
|
||||
|
||||
void disable_heater();
|
||||
void setWatch();
|
||||
|
|
Reference in a new issue