Procházet zdrojové kódy

Merge pull request #88 from daid/Marlin_v1

Made plan_buffer_line arguments const...
ErikZalm před 13 roky
rodič
revize
1d5809d458
6 změnil soubory, kde provedl 29 přidání a 55 odebrání
  1. 3
    31
      Marlin/cardreader.h
  2. 11
    13
      Marlin/pins.h
  3. 1
    1
      Marlin/planner.cpp
  4. 1
    1
      Marlin/planner.h
  5. 3
    5
      Marlin/ultralcd.h
  6. 10
    4
      Marlin/ultralcd.pde

+ 3
- 31
Marlin/cardreader.h Zobrazit soubor

64
   char* diveDirName;
64
   char* diveDirName;
65
   void lsDive(const char *prepend,SdFile parent);
65
   void lsDive(const char *prepend,SdFile parent);
66
 };
66
 };
67
-  
67
+#define IS_SD_PRINTING (card.sdprinting)
68
 
68
 
69
 #else
69
 #else
70
 
70
 
71
-#define dir_t bool 
72
-class CardReader
73
-{
74
-public:
75
-  FORCE_INLINE CardReader(){};
76
-  
77
-  FORCE_INLINE static void initsd(){};
78
-  FORCE_INLINE static void write_command(char *buf){};
79
-  
80
-  FORCE_INLINE static void checkautostart(bool x) {}; 
81
-  
82
-  FORCE_INLINE static void openFile(char* name,bool read){};
83
-  FORCE_INLINE static void closefile() {};
84
-  FORCE_INLINE static void release(){};
85
-  FORCE_INLINE static void startFileprint(){};
86
-  FORCE_INLINE static void startFilewrite(char *name){};
87
-  FORCE_INLINE static void pauseSDPrint(){};
88
-  FORCE_INLINE static void getStatus(){};
89
-  
90
-  FORCE_INLINE static void selectFile(char* name){};
91
-  FORCE_INLINE static void getfilename(const uint8_t nr){};
92
-  FORCE_INLINE static uint8_t getnrfilenames(){return 0;};
93
-  
71
+#define IS_SD_PRINTING (false)
94
 
72
 
95
-  FORCE_INLINE static void ls() {};
96
-  FORCE_INLINE static bool eof() {return true;};
97
-  FORCE_INLINE static char get() {return 0;};
98
-  FORCE_INLINE static void setIndex(){};
99
-  FORCE_INLINE uint8_t percentDone(){return 0;};
100
-};
101
 #endif //SDSUPPORT
73
 #endif //SDSUPPORT
102
-#endif
74
+#endif

+ 11
- 13
Marlin/pins.h Zobrazit soubor

940
 #endif
940
 #endif
941
 
941
 
942
 //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
942
 //List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!
943
-#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN
944
-#if EXTRUDERS == 3
945
-  #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN
946
-  #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN
947
-#elif EXTRUDERS == 2
948
-  #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN
949
-  #define _E2_PINS -1
950
-#elif EXTRUDERS == 1
951
-  #define _E1_PINS -1 
952
-  #define _E2_PINS -1
943
+#define _E0_PINS E0_STEP_PIN, E0_DIR_PIN, E0_ENABLE_PIN, HEATER_0_PIN, 
944
+#if EXTRUDERS > 1
945
+  #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN,
953
 #else
946
 #else
954
-  #error Unsupported number of extruders
947
+  #define _E1_PINS
955
 #endif
948
 #endif
949
+#if EXTRUDERS > 2
950
+  #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN,
951
+#else
952
+  #define _E2_PINS
953
+#endif
954
+
956
 #define SENSITIVE_PINS {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, LED_PIN, PS_ON_PIN, \
955
 #define SENSITIVE_PINS {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, LED_PIN, PS_ON_PIN, \
957
-                        HEATER_0_PIN, HEATER_1_PIN, HEATER_2_PIN, \
958
                         HEATER_BED_PIN, FAN_PIN,                  \
956
                         HEATER_BED_PIN, FAN_PIN,                  \
959
-                        _E0_PINS, _E1_PINS, _E2_PINS,             \
957
+                        _E0_PINS _E1_PINS _E2_PINS             \
960
                         TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN }
958
                         TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN }
961
 #endif
959
 #endif

+ 1
- 1
Marlin/planner.cpp Zobrazit soubor

441
 // Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in 
441
 // Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in 
442
 // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
442
 // mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
443
 // calculation the caller must also provide the physical length of the line in millimeters.
443
 // calculation the caller must also provide the physical length of the line in millimeters.
444
-void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder)
444
+void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder)
445
 {
445
 {
446
   // Calculate the buffer head after we push this byte
446
   // Calculate the buffer head after we push this byte
447
   int next_buffer_head = next_block_index(block_buffer_head);
447
   int next_buffer_head = next_block_index(block_buffer_head);

+ 1
- 1
Marlin/planner.h Zobrazit soubor

67
 
67
 
68
 // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
68
 // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
69
 // millimaters. Feed rate specifies the speed of the motion.
69
 // millimaters. Feed rate specifies the speed of the motion.
70
-void plan_buffer_line(float &x, float &y, float &z, float &e, float feed_rate, uint8_t &extruder);
70
+void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
71
 
71
 
72
 // Set position. Used for G92 instructions.
72
 // Set position. Used for G92 instructions.
73
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);
73
 void plan_set_position(const float &x, const float &y, const float &z, const float &e);

+ 3
- 5
Marlin/ultralcd.h Zobrazit soubor

129
 
129
 
130
   //conversion routines, could need some overworking
130
   //conversion routines, could need some overworking
131
   char *ftostr51(const float &x);
131
   char *ftostr51(const float &x);
132
+  char *ftostr52(const float &x);
132
   char *ftostr31(const float &x);
133
   char *ftostr31(const float &x);
133
   char *ftostr3(const float &x);
134
   char *ftostr3(const float &x);
134
 
135
 
142
   #define LCD_MESSAGE(x)
143
   #define LCD_MESSAGE(x)
143
   #define LCD_MESSAGEPGM(x)
144
   #define LCD_MESSAGEPGM(x)
144
   FORCE_INLINE void lcd_status() {};
145
   FORCE_INLINE void lcd_status() {};
145
-#endif
146
-  
147
-#ifndef ULTIPANEL  
148
- #define CLICKED false
146
+
147
+  #define CLICKED false
149
   #define BLOCK ;
148
   #define BLOCK ;
150
 #endif 
149
 #endif 
151
   
150
   
160
 char *itostr4(const int &xx);
159
 char *itostr4(const int &xx);
161
 char *ftostr51(const float &x);
160
 char *ftostr51(const float &x);
162
 #endif //ULTRALCD
161
 #endif //ULTRALCD
163
-

+ 10
- 4
Marlin/ultralcd.pde Zobrazit soubor

12
 extern volatile int extrudemultiply;
12
 extern volatile int extrudemultiply;
13
 
13
 
14
 extern long position[4];   
14
 extern long position[4];   
15
+#ifdef SDSUPPORT
15
 extern CardReader card;
16
 extern CardReader card;
17
+#endif
16
 
18
 
17
 //===========================================================================
19
 //===========================================================================
18
 //=============================public variables============================
20
 //=============================public variables============================
480
       MENUITEM(  lcdprintPGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
482
       MENUITEM(  lcdprintPGM(MSG_MAIN)  ,  BLOCK;status=Main_Menu;beepshort(); ) ;
481
       break;
483
       break;
482
     case ItemP_autostart:
484
     case ItemP_autostart:
483
-      MENUITEM(  lcdprintPGM(MSG_AUTOSTART)  ,  BLOCK;card.lastnr=0;card.setroot();card.checkautostart(true);beepshort(); ) ;
485
+      MENUITEM(  lcdprintPGM(MSG_AUTOSTART)  ,  BLOCK;
486
+#ifdef SDSUPPORT
487
+          card.lastnr=0;card.setroot();card.checkautostart(true);
488
+#endif
489
+          beepshort(); ) ;
484
       break;
490
       break;
485
     case ItemP_disstep:
491
     case ItemP_disstep:
486
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
492
       MENUITEM(  lcdprintPGM(MSG_DISABLE_STEPPERS)  ,  BLOCK;enquecommand("M84");beepshort(); ) ;
1629
         if(linechanging)
1635
         if(linechanging)
1630
         {
1636
         {
1631
           if(encoderpos<5) encoderpos=5;
1637
           if(encoderpos<5) encoderpos=5;
1632
-          if(encoderpos>99999) encoderpos=99999;
1638
+          if(encoderpos>32000) encoderpos=32000;//TODO: This is a problem, encoderpos is 16bit, but steps_per_unit for e can be wel over 800
1633
           lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1639
           lcd.setCursor(11,line);lcd.print(ftostr52(encoderpos/100.0));
1634
         }
1640
         }
1635
         
1641
         
1957
   #endif
1963
   #endif
1958
   if(tune)
1964
   if(tune)
1959
   {
1965
   {
1960
-    if(!(movesplanned() ||card.sdprinting))
1966
+    if(!(movesplanned() || IS_SD_PRINTING))
1961
     {
1967
     {
1962
       force_lcd_update=true;
1968
       force_lcd_update=true;
1963
       tune=false;
1969
       tune=false;
1965
   }
1971
   }
1966
   else 
1972
   else 
1967
   {
1973
   {
1968
-    if(movesplanned() ||card.sdprinting)
1974
+    if(movesplanned() || IS_SD_PRINTING)
1969
     {
1975
     {
1970
       force_lcd_update=true;
1976
       force_lcd_update=true;
1971
       tune=true;
1977
       tune=true;

Loading…
Zrušit
Uložit