// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.
#define EEPROM_VERSION "V04"
-inline void StoreSettings()
+FORCE_INLINE void StoreSettings()
{
#ifdef EEPROM_SETTINGS
char ver[4]= "000";
#endif //EEPROM_SETTINGS
}
-inline void RetrieveSettings(bool def=false)
+FORCE_INLINE void RetrieveSettings(bool def=false)
{ // if def=true, the default values will be used
#ifdef EEPROM_SETTINGS
int i=EEPROM_OFFSET;
#include <avr/pgmspace.h>
#include "Configuration.h"
+
+#define FORCE_INLINE __attribute__((always_inline)) inline
//#define SERIAL_ECHO(x) Serial << "echo: " << x;
//#define SERIAL_ECHOLN(x) Serial << "echo: "<<x<<endl;
//#define SERIAL_ERROR(x) Serial << "Error: " << x;
//things to write to serial from Programmemory. saves 400 to 2k of RAM.
#define SerialprintPGM(x) serialprintPGM(PSTR(x))
-inline void serialprintPGM(const char *str)
+FORCE_INLINE void serialprintPGM(const char *str)
{
char ch=pgm_read_byte(str);
while(ch)
void chdir(const char * relpath);
void updir();
- inline bool eof() { return sdpos>=filesize ;};
- inline int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
- inline void setIndex(long index) {sdpos = index;file.seekSet(index);};
- inline uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
- inline char* getWorkDirName(){workDir.getFilename(filename);return filename;};
+ FORCE_INLINE bool eof() { return sdpos>=filesize ;};
+ FORCE_INLINE int16_t get() { sdpos = file.curPosition();return (int16_t)file.read();};
+ FORCE_INLINE void setIndex(long index) {sdpos = index;file.seekSet(index);};
+ FORCE_INLINE uint8_t percentDone(){if(!sdprinting) return 0; if(filesize) return sdpos*100/filesize; else return 0;};
+ FORCE_INLINE char* getWorkDirName(){workDir.getFilename(filename);return filename;};
public:
bool saving;
class CardReader
{
public:
- inline CardReader(){};
+ FORCE_INLINE CardReader(){};
- inline static void initsd(){};
- inline static void write_command(char *buf){};
+ FORCE_INLINE static void initsd(){};
+ FORCE_INLINE static void write_command(char *buf){};
- inline static void checkautostart(bool x) {};
+ FORCE_INLINE static void checkautostart(bool x) {};
- inline static void openFile(char* name,bool read){};
- inline static void closefile() {};
- inline static void release(){};
- inline static void startFileprint(){};
- inline static void startFilewrite(char *name){};
- inline static void pauseSDPrint(){};
- inline static void getStatus(){};
+ FORCE_INLINE static void openFile(char* name,bool read){};
+ FORCE_INLINE static void closefile() {};
+ FORCE_INLINE static void release(){};
+ FORCE_INLINE static void startFileprint(){};
+ FORCE_INLINE static void startFilewrite(char *name){};
+ FORCE_INLINE static void pauseSDPrint(){};
+ FORCE_INLINE static void getStatus(){};
- inline static void selectFile(char* name){};
- inline static void getfilename(const uint8_t nr){};
- inline static uint8_t getnrfilenames(){return 0;};
+ FORCE_INLINE static void selectFile(char* name){};
+ FORCE_INLINE static void getfilename(const uint8_t nr){};
+ FORCE_INLINE static uint8_t getnrfilenames(){return 0;};
- inline static void ls() {};
- inline static bool eof() {return true;};
- inline static char get() {return 0;};
- inline static void setIndex(){};
- inline uint8_t percentDone(){return 0;};
+ FORCE_INLINE static void ls() {};
+ FORCE_INLINE static bool eof() {return true;};
+ FORCE_INLINE static char get() {return 0;};
+ FORCE_INLINE static void setIndex(){};
+ FORCE_INLINE uint8_t percentDone(){return 0;};
};
#endif //SDSUPPORT
#endif
\ No newline at end of file
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// given acceleration:
-inline float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) {
+FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
+{
if (acceleration!=0) {
return((target_rate*target_rate-initial_rate*initial_rate)/
(2.0*acceleration));
// a total travel of distance. This can be used to compute the intersection point between acceleration and
// deceleration in the cases where the trapezoid has no plateau (i.e. never reaches maximum speed)
-inline float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance) {
+FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, float acceleration, float distance)
+{
if (acceleration!=0) {
return((2.0*acceleration*distance-initial_rate*initial_rate+final_rate*final_rate)/
(4.0*acceleration) );
// Calculates the maximum allowable speed at this point when you must be able to reach target_velocity using the
// acceleration within the allotted distance.
-inline float max_allowable_speed(float acceleration, float target_velocity, float distance) {
+FORCE_INLINE float max_allowable_speed(float acceleration, float target_velocity, float distance) {
return sqrt(target_velocity*target_velocity-2*acceleration*distance);
}
#define planner_h
#include "Configuration.h"
+#include "Marlin.h"
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
extern volatile unsigned char block_buffer_tail;
// Called when the current block is no longer needed. Discards the block and makes the memory
// availible for new blocks.
-inline void plan_discard_current_block() {
+FORCE_INLINE void plan_discard_current_block()
+{
if (block_buffer_head != block_buffer_tail) {
block_buffer_tail = (block_buffer_tail + 1) & (BLOCK_BUFFER_SIZE - 1);
}
}
// Gets the current block. Returns NULL if buffer empty
-inline block_t *plan_get_current_block() {
+FORCE_INLINE block_t *plan_get_current_block()
+{
if (block_buffer_head == block_buffer_tail) {
return(NULL);
}
//inline so that there is no performance decrease.\r
//deg=degreeCelsius\r
\r
-inline float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};\r
-inline float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};\r
-inline float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};\r
+FORCE_INLINE float degHotend0(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_0]);};\r
+FORCE_INLINE float degHotend1(){ return analog2temp(current_raw[TEMPSENSOR_HOTEND_1]);};\r
+FORCE_INLINE float degBed() { return analog2tempBed(current_raw[TEMPSENSOR_BED]);};\r
\r
-inline float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};\r
-inline float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};\r
-inline float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};\r
+FORCE_INLINE float degTargetHotend0() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_0]);};\r
+FORCE_INLINE float degTargetHotend1() { return analog2temp(target_raw[TEMPSENSOR_HOTEND_1]);};\r
+FORCE_INLINE float degTargetBed() { return analog2tempBed(target_raw[TEMPSENSOR_BED]);};\r
\r
-inline void setTargetHotend0(const float &celsius) \r
+FORCE_INLINE void setTargetHotend0(const float &celsius) \r
{ \r
target_raw[TEMPSENSOR_HOTEND_0]=temp2analog(celsius);\r
#ifdef PIDTEMP\r
pid_setpoint = celsius;\r
#endif //PIDTEMP\r
};\r
-inline void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};\r
-inline void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};\r
+FORCE_INLINE void setTargetHotend1(const float &celsius) { target_raw[TEMPSENSOR_HOTEND_1]=temp2analog(celsius);};\r
+FORCE_INLINE void setTargetBed(const float &celsius) { target_raw[TEMPSENSOR_BED ]=temp2analogBed(celsius);};\r
\r
-inline bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};\r
-inline bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};\r
-inline bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};\r
+FORCE_INLINE bool isHeatingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] > current_raw[TEMPSENSOR_HOTEND_0];};\r
+FORCE_INLINE bool isHeatingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] > current_raw[TEMPSENSOR_HOTEND_1];};\r
+FORCE_INLINE bool isHeatingBed() {return target_raw[TEMPSENSOR_BED] > current_raw[TEMPSENSOR_BED];};\r
\r
-inline bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};\r
-inline bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};\r
-inline bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};\r
+FORCE_INLINE bool isCoolingHotend0() {return target_raw[TEMPSENSOR_HOTEND_0] < current_raw[TEMPSENSOR_HOTEND_0];};\r
+FORCE_INLINE bool isCoolingHotend1() {return target_raw[TEMPSENSOR_HOTEND_1] < current_raw[TEMPSENSOR_HOTEND_1];};\r
+FORCE_INLINE bool isCoolingBed() {return target_raw[TEMPSENSOR_BED] < current_raw[TEMPSENSOR_BED];};\r
\r
void disable_heater();\r
void setWatch();\r
bool tune;
private:
- inline void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
+ FORCE_INLINE void updateActiveLines(const uint8_t &maxlines,volatile int &encoderpos)
{
if(linechanging) return; // an item is changint its value, do not switch lines hence
lastlineoffset=lineoffset;
}
}
- inline void clearIfNecessary()
+ FORCE_INLINE void clearIfNecessary()
{
if(lastlineoffset!=lineoffset ||force_lcd_update)
{
#define LCD_STATUS
#define LCD_MESSAGE(x)
#define LCD_MESSAGEPGM(x)
- inline void lcd_status() {};
+ FORCE_INLINE void lcd_status() {};
#endif
#ifndef ULTIPANEL
void wd_reset();
#else
- inline void wd_init() {};
- inline void wd_reset() {};
+ FORCE_INLINE void wd_init() {};
+ FORCE_INLINE void wd_reset() {};
#endif
#endif