浏览代码

Some minor changes on code style. And a bugfix where the counters for positioning in the stepper where wrong depending on compiler settings. (Caused strange values to reported back with M114 and endstop triggers). Also fixed compiling with FWRETRACT enabled.

daid303 12 年前
父节点
当前提交
94ea26ff46
共有 6 个文件被更改,包括 24 次插入18 次删除
  1. 10
    1
      Marlin/Marlin.h
  2. 6
    8
      Marlin/Marlin_main.cpp
  3. 1
    0
      Marlin/cardreader.h
  4. 5
    7
      Marlin/planner.cpp
  5. 1
    1
      Marlin/stepper.cpp
  6. 1
    1
      Marlin/temperature.cpp

+ 10
- 1
Marlin/Marlin.h 查看文件

@@ -179,11 +179,20 @@ void setPwmFrequency(uint8_t pin, int val);
179 179
 
180 180
 extern float homing_feedrate[];
181 181
 extern bool axis_relative_modes[];
182
+extern int feedmultiply;
183
+extern int extrudemultiply; // Sets extrude multiply factor (in percent)
182 184
 extern float current_position[NUM_AXIS] ;
183 185
 extern float add_homeing[3];
184 186
 extern float min_pos[3];
185 187
 extern float max_pos[3];
186
-extern unsigned char FanSpeed;
188
+extern int fanSpeed;
189
+
190
+#ifdef FWRETRACT
191
+extern bool autoretract_enabled;
192
+extern bool retracted;
193
+extern float retract_length, retract_feedrate, retract_zlift;
194
+extern float retract_recover_length, retract_recover_feedrate;
195
+#endif
187 196
 
188 197
 extern unsigned long starttime;
189 198
 extern unsigned long stoptime;

+ 6
- 8
Marlin/Marlin_main.cpp 查看文件

@@ -146,16 +146,15 @@ CardReader card;
146 146
 #endif
147 147
 float homing_feedrate[] = HOMING_FEEDRATE;
148 148
 bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
149
-volatile int feedmultiply=100; //100->1 200->2
149
+int feedmultiply=100; //100->1 200->2
150 150
 int saved_feedmultiply;
151
-volatile bool feedmultiplychanged=false;
152
-volatile int extrudemultiply=100; //100->1 200->2
151
+int extrudemultiply=100; //100->1 200->2
153 152
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
154 153
 float add_homeing[3]={0,0,0};
155 154
 float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
156 155
 float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
157 156
 uint8_t active_extruder = 0;
158
-unsigned char FanSpeed=0;
157
+int fanSpeed=0;
159 158
 
160 159
 #ifdef FWRETRACT
161 160
   bool autoretract_enabled=true;
@@ -1124,14 +1123,14 @@ void process_commands()
1124 1123
     #if FAN_PIN > -1
1125 1124
       case 106: //M106 Fan On
1126 1125
         if (code_seen('S')){
1127
-           FanSpeed=constrain(code_value(),0,255);
1126
+           fanSpeed=constrain(code_value(),0,255);
1128 1127
         }
1129 1128
         else {
1130
-          FanSpeed=255;			
1129
+          fanSpeed=255;			
1131 1130
         }
1132 1131
         break;
1133 1132
       case 107: //M107 Fan Off
1134
-        FanSpeed = 0;
1133
+        fanSpeed = 0;
1135 1134
         break;
1136 1135
     #endif //FAN_PIN
1137 1136
 
@@ -1372,7 +1371,6 @@ void process_commands()
1372 1371
       if(code_seen('S')) 
1373 1372
       {
1374 1373
         feedmultiply = code_value() ;
1375
-        feedmultiplychanged=true;
1376 1374
       }
1377 1375
     }
1378 1376
     break;

+ 1
- 0
Marlin/cardreader.h 查看文件

@@ -66,6 +66,7 @@ private:
66 66
   char* diveDirName;
67 67
   void lsDive(const char *prepend,SdFile parent);
68 68
 };
69
+extern CardReader card;
69 70
 #define IS_SD_PRINTING (card.sdprinting)
70 71
 
71 72
 #else

+ 5
- 7
Marlin/planner.cpp 查看文件

@@ -80,8 +80,6 @@ long position[4];   //rescaled from extern when axis_steps_per_unit are changed
80 80
 static float previous_speed[4]; // Speed of previous path line segment
81 81
 static float previous_nominal_speed; // Nominal speed of previous path line segment
82 82
 
83
-extern volatile int extrudemultiply; // Sets extrude multiply factor (in percent)
84
-
85 83
 #ifdef AUTOTEMP
86 84
 float autotemp_max=250;
87 85
 float autotemp_min=210;
@@ -462,8 +460,8 @@ void check_axes_activity()
462 460
   else
463 461
   {
464 462
     #if FAN_PIN > -1
465
-    if (FanSpeed != 0){
466
-      analogWrite(FAN_PIN,FanSpeed); // If buffer is empty use current fan speed
463
+    if (fanSpeed != 0){
464
+      analogWrite(FAN_PIN,fanSpeed); // If buffer is empty use current fan speed
467 465
     }
468 466
     #endif
469 467
   }
@@ -477,12 +475,12 @@ void check_axes_activity()
477 475
     disable_e2(); 
478 476
   }
479 477
 #if FAN_PIN > -1
480
-  if((FanSpeed == 0) && (fan_speed ==0))
478
+  if((fanSpeed == 0) && (fan_speed ==0))
481 479
   {
482 480
     analogWrite(FAN_PIN, 0);
483 481
   }
484 482
 
485
-  if (FanSpeed != 0 && tail_fan_speed !=0)
483
+  if (fanSpeed != 0 && tail_fan_speed !=0)
486 484
   {
487 485
     analogWrite(FAN_PIN,tail_fan_speed);
488 486
   }
@@ -562,7 +560,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
562 560
     return; 
563 561
   }
564 562
 
565
-  block->fan_speed = FanSpeed;
563
+  block->fan_speed = fanSpeed;
566 564
 
567 565
   // Compute direction bits for this block 
568 566
   block->direction_bits = 0;

+ 1
- 1
Marlin/stepper.cpp 查看文件

@@ -78,7 +78,7 @@ static bool old_z_max_endstop=false;
78 78
 static bool check_endstops = true;
79 79
 
80 80
 volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
81
-volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
81
+volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
82 82
 
83 83
 //===========================================================================
84 84
 //=============================functions         ============================

+ 1
- 1
Marlin/temperature.cpp 查看文件

@@ -567,7 +567,7 @@ float analog2temp(int raw, uint8_t e) {
567 567
     }
568 568
   #endif
569 569
 
570
-  if(heater_ttbl_map[e] != 0)
570
+  if(heater_ttbl_map[e] != NULL)
571 571
   {
572 572
     float celsius = 0;
573 573
     byte i;  

正在加载...
取消
保存