#include "temperature.h"\r
#include "ultralcd.h"\r
\r
+//public variables\r
unsigned long minsegmenttime;\r
float max_feedrate[4]; // set the max speeds\r
float axis_steps_per_unit[4];\r
float max_z_jerk;\r
float mintravelfeedrate;\r
unsigned long axis_steps_per_sqr_second[NUM_AXIS];\r
-// Manage heater variables.\r
+long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode\r
\r
+\r
+//private variables\r
static block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions\r
static volatile unsigned char block_buffer_head; // Index of the next block to be pushed\r
static volatile unsigned char block_buffer_tail; // Index of the block to process now\r
\r
// The current position of the tool in absolute steps\r
-long position[4]; \r
+\r
\r
#define ONE_MINUTE_OF_MICROSECONDS 60000000.0\r
\r
int target_raw[3] = {0, 0, 0};\r
int current_raw[3] = {0, 0, 0};\r
\r
-bool temp_meas_ready = false;\r
+static bool temp_meas_ready = false;\r
\r
-unsigned long previous_millis_heater, previous_millis_bed_heater;\r
+static unsigned long previous_millis_heater, previous_millis_bed_heater;\r
\r
#ifdef PIDTEMP\r
- float temp_iState = 0;\r
- float temp_dState = 0;\r
- float pTerm;\r
- float iTerm;\r
- float dTerm;\r
+ //static cannot be external:\r
+ static float temp_iState = 0;\r
+ static float temp_dState = 0;\r
+ static float pTerm;\r
+ static float iTerm;\r
+ static float dTerm;\r
//int output;\r
- float pid_error;\r
- float temp_iState_min;\r
- float temp_iState_max;\r
- float pid_setpoint = 0.0;\r
- float pid_input;\r
- float pid_output;\r
- bool pid_reset;\r
+ static float pid_error;\r
+ static float temp_iState_min;\r
+ static float temp_iState_max;\r
+ static float pid_input;\r
+ static float pid_output;\r
+ static bool pid_reset;\r
+ \r
+ // probably used external\r
float HeaterPower;\r
+ float pid_setpoint = 0.0;\r
+\r
\r
float Kp=DEFAULT_Kp;\r
float Ki=DEFAULT_Ki;\r
#endif //PIDTEMP\r
\r
#ifdef WATCHPERIOD\r
- int watch_raw[3] = {-1000,-1000,-1000};\r
- unsigned long watchmillis = 0;\r
+ static int watch_raw[3] = {-1000,-1000,-1000};\r
+ static unsigned long watchmillis = 0;\r
#endif //WATCHPERIOD\r
\r
#ifdef HEATER_0_MINTEMP\r
- int minttemp_0 = temp2analog(HEATER_0_MINTEMP);\r
+ static int minttemp_0 = temp2analog(HEATER_0_MINTEMP);\r
#endif //MINTEMP\r
#ifdef HEATER_0_MAXTEMP\r
- int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);\r
+ static int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);\r
#endif //MAXTEMP\r
\r
#ifdef HEATER_1_MINTEMP\r
- int minttemp_1 = temp2analog(HEATER_1_MINTEMP);\r
+ static int minttemp_1 = temp2analog(HEATER_1_MINTEMP);\r
#endif //MINTEMP\r
#ifdef HEATER_1_MAXTEMP\r
- int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);\r
+ static int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);\r
#endif //MAXTEMP\r
\r
#ifdef BED_MINTEMP\r
- int bed_minttemp = temp2analog(BED_MINTEMP);\r
+ static int bed_minttemp = temp2analog(BED_MINTEMP);\r
#endif //BED_MINTEMP\r
#ifdef BED_MAXTEMP\r
- int bed_maxttemp = temp2analog(BED_MAXTEMP);\r
+ static int bed_maxttemp = temp2analog(BED_MAXTEMP);\r
#endif //BED_MAXTEMP\r
\r
void manage_heater()\r
\r
\r
extern volatile int feedmultiply;\r
+extern volatile bool feedmultiplychanged;\r
+\r
extern long position[4]; \r
\r
-char messagetext[LCD_WIDTH]="";\r
+static char messagetext[LCD_WIDTH]="";\r
\r
#include <LiquidCrystal.h>\r
LiquidCrystal lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 \r
\r
-unsigned long previous_millis_lcd=0;\r
+static unsigned long previous_millis_lcd=0;\r
+static long previous_millis_buttons=0;\r
\r
inline int intround(const float &x){return int(0.5+x);}\r
\r
int encoderpos=0;\r
short lastenc=0;\r
#ifdef NEWPANEL\r
- long blocking=0;\r
+ static long blocking=0;\r
#else\r
- long blocking[8]={0,0,0,0,0,0,0,0};\r
+ static long blocking[8]={0,0,0,0,0,0,0,0};\r
#endif\r
MainMenu menu;\r
\r
\r
inline void clear()\r
{\r
- \r
lcd.clear();\r
}\r
-long previous_millis_buttons=0;\r
+\r
\r
void lcd_init()\r
{\r
linechanging=false;\r
}\r
\r
-extern volatile bool feedmultiplychanged;\r
\r
void MainMenu::showStatus()\r
{ \r