ソースを参照

made many possible variables static, so they cannot be used extern.

Bernhard Kubicek 13年前
コミット
79d1bfb5c0
3個のファイルの変更39行の追加31行の削除
  1. 5
    2
      Marlin/planner.cpp
  2. 26
    22
      Marlin/temperature.cpp
  3. 8
    7
      Marlin/ultralcd.pde

+ 5
- 2
Marlin/planner.cpp ファイルの表示

@@ -65,6 +65,7 @@
65 65
 #include "temperature.h"
66 66
 #include "ultralcd.h"
67 67
 
68
+//public variables
68 69
 unsigned long minsegmenttime;
69 70
 float max_feedrate[4]; // set the max speeds
70 71
 float axis_steps_per_unit[4];
@@ -76,14 +77,16 @@ float max_xy_jerk; //speed than can be stopped at once, if i understand correctl
76 77
 float max_z_jerk;
77 78
 float mintravelfeedrate;
78 79
 unsigned long axis_steps_per_sqr_second[NUM_AXIS];
79
-// Manage heater variables.
80
+long position[4];   //rescaled from extern when axis_steps_per_unit are changed by gcode
80 81
 
82
+
83
+//private variables
81 84
 static block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
82 85
 static volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
83 86
 static volatile unsigned char block_buffer_tail;           // Index of the block to process now
84 87
 
85 88
 // The current position of the tool in absolute steps
86
-long position[4];   
89
+
87 90
 
88 91
 #define ONE_MINUTE_OF_MICROSECONDS 60000000.0
89 92
 

+ 26
- 22
Marlin/temperature.cpp ファイルの表示

@@ -42,25 +42,29 @@
42 42
 int target_raw[3] = {0, 0, 0};
43 43
 int current_raw[3] = {0, 0, 0};
44 44
 
45
-bool temp_meas_ready = false;
45
+static bool temp_meas_ready = false;
46 46
 
47
-unsigned long previous_millis_heater, previous_millis_bed_heater;
47
+static unsigned long previous_millis_heater, previous_millis_bed_heater;
48 48
 
49 49
 #ifdef PIDTEMP
50
-  float temp_iState = 0;
51
-  float temp_dState = 0;
52
-  float pTerm;
53
-  float iTerm;
54
-  float dTerm;
50
+  //static cannot be external:
51
+  static float temp_iState = 0;
52
+  static float temp_dState = 0;
53
+  static float pTerm;
54
+  static float iTerm;
55
+  static float dTerm;
55 56
       //int output;
56
-  float pid_error;
57
-  float temp_iState_min;
58
-  float temp_iState_max;
59
-  float pid_setpoint = 0.0;
60
-  float pid_input;
61
-  float pid_output;
62
-  bool pid_reset;
57
+  static float pid_error;
58
+  static float temp_iState_min;
59
+  static float temp_iState_max;
60
+  static float pid_input;
61
+  static float pid_output;
62
+  static bool pid_reset;
63
+  
64
+  // probably used external
63 65
   float HeaterPower;
66
+  float pid_setpoint = 0.0;
67
+
64 68
   
65 69
   float Kp=DEFAULT_Kp;
66 70
   float Ki=DEFAULT_Ki;
@@ -69,29 +73,29 @@ unsigned long previous_millis_heater, previous_millis_bed_heater;
69 73
 #endif //PIDTEMP
70 74
   
71 75
 #ifdef WATCHPERIOD
72
-  int watch_raw[3] = {-1000,-1000,-1000};
73
-  unsigned long watchmillis = 0;
76
+  static int watch_raw[3] = {-1000,-1000,-1000};
77
+  static unsigned long watchmillis = 0;
74 78
 #endif //WATCHPERIOD
75 79
 
76 80
 #ifdef HEATER_0_MINTEMP
77
-  int minttemp_0 = temp2analog(HEATER_0_MINTEMP);
81
+  static int minttemp_0 = temp2analog(HEATER_0_MINTEMP);
78 82
 #endif //MINTEMP
79 83
 #ifdef HEATER_0_MAXTEMP
80
-  int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);
84
+  static int maxttemp_0 = temp2analog(HEATER_0_MAXTEMP);
81 85
 #endif //MAXTEMP
82 86
 
83 87
 #ifdef HEATER_1_MINTEMP
84
-  int minttemp_1 = temp2analog(HEATER_1_MINTEMP);
88
+  static int minttemp_1 = temp2analog(HEATER_1_MINTEMP);
85 89
 #endif //MINTEMP
86 90
 #ifdef HEATER_1_MAXTEMP
87
-  int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);
91
+  static int maxttemp_1 = temp2analog(HEATER_1_MAXTEMP);
88 92
 #endif //MAXTEMP
89 93
 
90 94
 #ifdef BED_MINTEMP
91
-  int bed_minttemp = temp2analog(BED_MINTEMP);
95
+  static int bed_minttemp = temp2analog(BED_MINTEMP);
92 96
 #endif //BED_MINTEMP
93 97
 #ifdef BED_MAXTEMP
94
-  int bed_maxttemp = temp2analog(BED_MAXTEMP);
98
+  static int bed_maxttemp = temp2analog(BED_MAXTEMP);
95 99
 #endif //BED_MAXTEMP
96 100
 
97 101
 void manage_heater()

+ 8
- 7
Marlin/ultralcd.pde ファイルの表示

@@ -3,14 +3,17 @@
3 3
 
4 4
 
5 5
 extern volatile int feedmultiply;
6
+extern volatile bool feedmultiplychanged;
7
+
6 8
 extern long position[4];   
7 9
 
8
-char messagetext[LCD_WIDTH]="";
10
+static char messagetext[LCD_WIDTH]="";
9 11
 
10 12
 #include <LiquidCrystal.h>
11 13
 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 
12 14
 
13
-unsigned long previous_millis_lcd=0;
15
+static unsigned long previous_millis_lcd=0;
16
+static long previous_millis_buttons=0;
14 17
 
15 18
 inline int intround(const float &x){return int(0.5+x);}
16 19
 
@@ -18,9 +21,9 @@ volatile char buttons=0;  //the last checked buttons in a bit array.
18 21
 int encoderpos=0;
19 22
 short lastenc=0;
20 23
 #ifdef NEWPANEL
21
- long blocking=0;
24
+ static long blocking=0;
22 25
 #else
23
- long blocking[8]={0,0,0,0,0,0,0,0};
26
+ static long blocking[8]={0,0,0,0,0,0,0,0};
24 27
 #endif
25 28
 MainMenu menu;
26 29
 
@@ -31,10 +34,9 @@ void lcd_status(const char* message)
31 34
 
32 35
 inline void clear()
33 36
 {
34
-  
35 37
   lcd.clear();
36 38
 }
37
-long previous_millis_buttons=0;
39
+
38 40
 
39 41
 void lcd_init()
40 42
 {
@@ -228,7 +230,6 @@ MainMenu::MainMenu()
228 230
   linechanging=false;
229 231
 }
230 232
 
231
-extern volatile bool feedmultiplychanged;
232 233
 
233 234
 void MainMenu::showStatus()
234 235
 { 

読み込み中…
キャンセル
保存