chiark / gitweb /
made many possible variables static, so they cannot be used extern.
authorBernhard Kubicek <kubicek@gmx.at>
Sun, 6 Nov 2011 18:36:29 +0000 (19:36 +0100)
committerBernhard Kubicek <kubicek@gmx.at>
Sun, 6 Nov 2011 18:36:29 +0000 (19:36 +0100)
Marlin/planner.cpp
Marlin/temperature.cpp
Marlin/ultralcd.pde

index b4271bab35e36e03f36a3a3e50542b2ce6369bd5..888fe45c8fd066efe919041b0c9e92bd53ed00b5 100644 (file)
@@ -65,6 +65,7 @@
 #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
@@ -76,14 +77,16 @@ float max_xy_jerk; //speed than can be stopped at once, if i understand correctl
 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
index c25b9c31204825dca05eddfb8edc22c235b80690..1121c654eecfc921a21c449aed8100072bee9a85 100644 (file)
 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
@@ -69,29 +73,29 @@ unsigned long previous_millis_heater, previous_millis_bed_heater;
 #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
index a45b3683e7cf91c688934e408a13212924d4c665..a0c56e926af4f1420cbbd2724a0148f50c67a580 100644 (file)
@@ -3,14 +3,17 @@
 \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
@@ -18,9 +21,9 @@ volatile char buttons=0;  //the last checked buttons in a bit array.
 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
@@ -31,10 +34,9 @@ void lcd_status(const char* message)
 \r
 inline void clear()\r
 {\r
-  \r
   lcd.clear();\r
 }\r
-long previous_millis_buttons=0;\r
+\r
 \r
 void lcd_init()\r
 {\r
@@ -228,7 +230,6 @@ MainMenu::MainMenu()
   linechanging=false;\r
 }\r
 \r
-extern volatile bool feedmultiplychanged;\r
 \r
 void MainMenu::showStatus()\r
 { \r