瀏覽代碼

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
 
179
 
180
 extern float homing_feedrate[];
180
 extern float homing_feedrate[];
181
 extern bool axis_relative_modes[];
181
 extern bool axis_relative_modes[];
182
+extern int feedmultiply;
183
+extern int extrudemultiply; // Sets extrude multiply factor (in percent)
182
 extern float current_position[NUM_AXIS] ;
184
 extern float current_position[NUM_AXIS] ;
183
 extern float add_homeing[3];
185
 extern float add_homeing[3];
184
 extern float min_pos[3];
186
 extern float min_pos[3];
185
 extern float max_pos[3];
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
 extern unsigned long starttime;
197
 extern unsigned long starttime;
189
 extern unsigned long stoptime;
198
 extern unsigned long stoptime;

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

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

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

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

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

80
 static float previous_speed[4]; // Speed of previous path line segment
80
 static float previous_speed[4]; // Speed of previous path line segment
81
 static float previous_nominal_speed; // Nominal speed of previous path line segment
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
 #ifdef AUTOTEMP
83
 #ifdef AUTOTEMP
86
 float autotemp_max=250;
84
 float autotemp_max=250;
87
 float autotemp_min=210;
85
 float autotemp_min=210;
462
   else
460
   else
463
   {
461
   {
464
     #if FAN_PIN > -1
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
     #endif
466
     #endif
469
   }
467
   }
477
     disable_e2(); 
475
     disable_e2(); 
478
   }
476
   }
479
 #if FAN_PIN > -1
477
 #if FAN_PIN > -1
480
-  if((FanSpeed == 0) && (fan_speed ==0))
478
+  if((fanSpeed == 0) && (fan_speed ==0))
481
   {
479
   {
482
     analogWrite(FAN_PIN, 0);
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
     analogWrite(FAN_PIN,tail_fan_speed);
485
     analogWrite(FAN_PIN,tail_fan_speed);
488
   }
486
   }
562
     return; 
560
     return; 
563
   }
561
   }
564
 
562
 
565
-  block->fan_speed = FanSpeed;
563
+  block->fan_speed = fanSpeed;
566
 
564
 
567
   // Compute direction bits for this block 
565
   // Compute direction bits for this block 
568
   block->direction_bits = 0;
566
   block->direction_bits = 0;

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

78
 static bool check_endstops = true;
78
 static bool check_endstops = true;
79
 
79
 
80
 volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
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
 //=============================functions         ============================
84
 //=============================functions         ============================

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

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

Loading…
取消
儲存