Bläddra i källkod

Changed the naming of some LCD functions, so the names match better what the function does. Also moved around some prototypes for general cleanup.

daid303 12 år sedan
förälder
incheckning
6a9bee27cc

+ 11
- 13
Marlin/ConfigurationStore.h Visa fil

1
 #ifndef CONFIG_STORE_H
1
 #ifndef CONFIG_STORE_H
2
 #define CONFIG_STORE_H
2
 #define CONFIG_STORE_H
3
-
4
-#include "Configuration.h"
5
-
6
-void Config_ResetDefault();
7
-
3
+
4
+#include "Configuration.h"
5
+
6
+void Config_ResetDefault();
7
+
8
 #ifdef EEPROM_CHITCHAT
8
 #ifdef EEPROM_CHITCHAT
9
 void Config_PrintSettings();
9
 void Config_PrintSettings();
10
-#else
10
+#else
11
 FORCE_INLINE void Config_PrintSettings() {}
11
 FORCE_INLINE void Config_PrintSettings() {}
12
-#endif
12
+#endif
13
 
13
 
14
 #ifdef EEPROM_SETTINGS
14
 #ifdef EEPROM_SETTINGS
15
 void Config_StoreSettings();
15
 void Config_StoreSettings();
16
-void Config_RetrieveSettings();
17
-#else
16
+void Config_RetrieveSettings();
17
+#else
18
 FORCE_INLINE void Config_StoreSettings() {}
18
 FORCE_INLINE void Config_StoreSettings() {}
19
-FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
20
-#endif
21
-
19
+FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
22
 #endif
20
 #endif
23
 
21
 
24
-
22
+#endif//CONFIG_STORE_H

+ 2
- 1
Marlin/Marlin.h Visa fil

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;
182
+extern int feedmultiply;
183
+extern bool feedmultiplychanged;
183
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
184
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
184
 extern float current_position[NUM_AXIS] ;
185
 extern float current_position[NUM_AXIS] ;
185
 extern float add_homeing[3];
186
 extern float add_homeing[3];

+ 16
- 14
Marlin/Marlin_main.cpp Visa fil

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
-int feedmultiply=100; //100->1 200->2
149
+int feedmultiply=100; //100->1 200->2
150
+bool feedmultiplychanged;
150
 int saved_feedmultiply;
151
 int saved_feedmultiply;
151
 int extrudemultiply=100; //100->1 200->2
152
 int extrudemultiply=100; //100->1 200->2
152
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
153
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
360
   st_init();    // Initialize stepper, this enables interrupts!
361
   st_init();    // Initialize stepper, this enables interrupts!
361
   setup_photpin();
362
   setup_photpin();
362
   
363
   
363
-  LCD_INIT;
364
+  lcd_init();
364
 }
365
 }
365
 
366
 
366
 
367
 
401
   manage_heater();
402
   manage_heater();
402
   manage_inactivity();
403
   manage_inactivity();
403
   checkHitEndstops();
404
   checkHitEndstops();
404
-  LCD_STATUS;
405
+  lcd_update();
405
 }
406
 }
406
 
407
 
407
 void get_command() 
408
 void get_command() 
534
         sprintf_P(time, PSTR("%i min, %i sec"),min,sec);
535
         sprintf_P(time, PSTR("%i min, %i sec"),min,sec);
535
         SERIAL_ECHO_START;
536
         SERIAL_ECHO_START;
536
         SERIAL_ECHOLN(time);
537
         SERIAL_ECHOLN(time);
537
-        LCD_MESSAGE(time);
538
+        lcd_setstatus(time);
538
         card.printingHasFinished();
539
         card.printingHasFinished();
539
         card.checkautostart(true);
540
         card.checkautostart(true);
540
         
541
         
683
       while(millis()  < codenum ){
684
       while(millis()  < codenum ){
684
         manage_heater();
685
         manage_heater();
685
         manage_inactivity();
686
         manage_inactivity();
686
-        LCD_STATUS;
687
+        lcd_update();
687
       }
688
       }
688
       break;
689
       break;
689
       #ifdef FWRETRACT  
690
       #ifdef FWRETRACT  
847
       previous_millis_cmd = millis();
848
       previous_millis_cmd = millis();
848
       if (codenum > 0){
849
       if (codenum > 0){
849
         codenum += millis();  // keep track of when we started waiting
850
         codenum += millis();  // keep track of when we started waiting
850
-        while(millis()  < codenum && !CLICKED){
851
+        while(millis()  < codenum && !LCD_CLICKED){
851
           manage_heater();
852
           manage_heater();
852
           manage_inactivity();
853
           manage_inactivity();
853
-          LCD_STATUS;
854
+          lcd_update();
854
         }
855
         }
855
       }else{
856
       }else{
856
-        while(!CLICKED){
857
+        while(!LCD_CLICKED){
857
           manage_heater();
858
           manage_heater();
858
           manage_inactivity();
859
           manage_inactivity();
859
-          LCD_STATUS;
860
+          lcd_update();
860
         }
861
         }
861
       }
862
       }
862
     }
863
     }
947
       sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
948
       sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
948
       SERIAL_ECHO_START;
949
       SERIAL_ECHO_START;
949
       SERIAL_ECHOLN(time);
950
       SERIAL_ECHOLN(time);
950
-      LCD_MESSAGE(time);
951
+      lcd_setstatus(time);
951
       autotempShutdown();
952
       autotempShutdown();
952
       }
953
       }
953
       break;
954
       break;
1075
           }
1076
           }
1076
           manage_heater();
1077
           manage_heater();
1077
           manage_inactivity();
1078
           manage_inactivity();
1078
-          LCD_STATUS;
1079
+          lcd_update();
1079
         #ifdef TEMP_RESIDENCY_TIME
1080
         #ifdef TEMP_RESIDENCY_TIME
1080
             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
1081
             /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
1081
               or when current temp falls outside the hysteresis after target temp was reached */
1082
               or when current temp falls outside the hysteresis after target temp was reached */
1113
           }
1114
           }
1114
           manage_heater();
1115
           manage_heater();
1115
           manage_inactivity();
1116
           manage_inactivity();
1116
-          LCD_STATUS;
1117
+          lcd_update();
1117
         }
1118
         }
1118
         LCD_MESSAGEPGM(MSG_BED_DONE);
1119
         LCD_MESSAGEPGM(MSG_BED_DONE);
1119
         previous_millis_cmd = millis();
1120
         previous_millis_cmd = millis();
1220
       SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
1221
       SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
1221
       break;
1222
       break;
1222
     case 117: // M117 display message
1223
     case 117: // M117 display message
1223
-      LCD_MESSAGE(cmdbuffer[bufindr]+5);
1224
+      lcd_setstatus(cmdbuffer[bufindr]+5);
1224
       break;
1225
       break;
1225
     case 114: // M114
1226
     case 114: // M114
1226
       SERIAL_PROTOCOLPGM("X:");
1227
       SERIAL_PROTOCOLPGM("X:");
1370
     {
1371
     {
1371
       if(code_seen('S')) 
1372
       if(code_seen('S')) 
1372
       {
1373
       {
1373
-        feedmultiply = code_value() ;
1374
+        feedmultiply = code_value() ;
1375
+        feedmultiplychanged = true;
1374
       }
1376
       }
1375
     }
1377
     }
1376
     break;
1378
     break;

+ 2
- 2
Marlin/cardreader.cpp Visa fil

279
       sdpos = 0;
279
       sdpos = 0;
280
       
280
       
281
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
281
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
282
-      LCD_MESSAGE(fname);
282
+      lcd_setstatus(fname);
283
     }
283
     }
284
     else
284
     else
285
     {
285
     {
301
       saving = true;
301
       saving = true;
302
       SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
302
       SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
303
       SERIAL_PROTOCOLLN(name);
303
       SERIAL_PROTOCOLLN(name);
304
-      LCD_MESSAGE(fname);
304
+      lcd_setstatus(fname);
305
     }
305
     }
306
   }
306
   }
307
   
307
   

+ 11
- 0
Marlin/cardreader.h Visa fil

69
 extern CardReader card;
69
 extern CardReader card;
70
 #define IS_SD_PRINTING (card.sdprinting)
70
 #define IS_SD_PRINTING (card.sdprinting)
71
 
71
 
72
+#if (SDCARDDETECT > -1)
73
+# ifdef SDCARDDETECTINVERTED 
74
+#  define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
75
+# else
76
+#  define IS_SD_INSERTED (READ(SDCARDDETECT)==0)
77
+# endif //SDCARDTETECTINVERTED
78
+#else
79
+//If we don't have a card detect line, aways asume the card is inserted
80
+# define IS_SD_INSERTED true
81
+#endif
82
+
72
 #else
83
 #else
73
 
84
 
74
 #define IS_SD_PRINTING (false)
85
 #define IS_SD_PRINTING (false)

+ 1
- 1
Marlin/planner.cpp Visa fil

506
   {
506
   {
507
     manage_heater(); 
507
     manage_heater(); 
508
     manage_inactivity(); 
508
     manage_inactivity(); 
509
-    LCD_STATUS;
509
+    lcd_update();
510
   }
510
   }
511
 
511
 
512
   // The target position of the tool in absolute steps
512
   // The target position of the tool in absolute steps

+ 1
- 1
Marlin/stepper.cpp Visa fil

905
     while( blocks_queued()) {
905
     while( blocks_queued()) {
906
     manage_heater();
906
     manage_heater();
907
     manage_inactivity();
907
     manage_inactivity();
908
-    LCD_STATUS;
908
+    lcd_update();
909
   }
909
   }
910
 }
910
 }
911
 
911
 

+ 8
- 13
Marlin/temperature.cpp Visa fil

190
  for(;;) {
190
  for(;;) {
191
 
191
 
192
     if(temp_meas_ready == true) { // temp sample ready
192
     if(temp_meas_ready == true) { // temp sample ready
193
+      //Reset the watchdog after we know we have a temperature measurement.
194
+      watchdog_reset();
195
+      
193
       CRITICAL_SECTION_START;
196
       CRITICAL_SECTION_START;
194
       temp_meas_ready = false;
197
       temp_meas_ready = false;
195
       CRITICAL_SECTION_END;
198
       CRITICAL_SECTION_END;
291
       SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
294
       SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
292
       return;
295
       return;
293
     }
296
     }
294
-    LCD_STATUS;
297
+    lcd_update();
295
   }
298
   }
296
 }
299
 }
297
 
300
 
957
         ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
960
         ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
958
         ADCSRA |= 1<<ADSC; // Start conversion
961
         ADCSRA |= 1<<ADSC; // Start conversion
959
       #endif
962
       #endif
960
-      #ifdef ULTIPANEL
961
-        buttons_check();
962
-      #endif
963
+      lcd_buttons_update();
963
       temp_state = 1;
964
       temp_state = 1;
964
       break;
965
       break;
965
     case 1: // Measure TEMP_0
966
     case 1: // Measure TEMP_0
981
         ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
982
         ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
982
         ADCSRA |= 1<<ADSC; // Start conversion
983
         ADCSRA |= 1<<ADSC; // Start conversion
983
       #endif
984
       #endif
984
-      #ifdef ULTIPANEL
985
-        buttons_check();
986
-      #endif
985
+      lcd_buttons_update();
987
       temp_state = 3;
986
       temp_state = 3;
988
       break;
987
       break;
989
     case 3: // Measure TEMP_BED
988
     case 3: // Measure TEMP_BED
1002
         ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
1001
         ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
1003
         ADCSRA |= 1<<ADSC; // Start conversion
1002
         ADCSRA |= 1<<ADSC; // Start conversion
1004
       #endif
1003
       #endif
1005
-      #ifdef ULTIPANEL
1006
-        buttons_check();
1007
-      #endif
1004
+      lcd_buttons_update();
1008
       temp_state = 5;
1005
       temp_state = 5;
1009
       break;
1006
       break;
1010
     case 5: // Measure TEMP_1
1007
     case 5: // Measure TEMP_1
1023
         ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
1020
         ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
1024
         ADCSRA |= 1<<ADSC; // Start conversion
1021
         ADCSRA |= 1<<ADSC; // Start conversion
1025
       #endif
1022
       #endif
1026
-      #ifdef ULTIPANEL
1027
-        buttons_check();
1028
-      #endif
1023
+      lcd_buttons_update();
1029
       temp_state = 7;
1024
       temp_state = 7;
1030
       break;
1025
       break;
1031
     case 7: // Measure TEMP_2
1026
     case 7: // Measure TEMP_2

+ 171
- 177
Marlin/ultralcd.cpp
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 57
- 79
Marlin/ultralcd.h Visa fil

4
 #include "Marlin.h"
4
 #include "Marlin.h"
5
 
5
 
6
 #ifdef ULTRA_LCD
6
 #ifdef ULTRA_LCD
7
-#include "language.h"
8
-
9
-#if LANGUAGE_CHOICE == 6
10
-#include "LiquidCrystalRus.h"
11
-#define LCD_CLASS LiquidCrystalRus
12
-#else
13
-#include <LiquidCrystal.h>
14
-#define LCD_CLASS LiquidCrystal
15
-#endif
16
-
17
-void lcd_status();
18
-void lcd_init();
19
-void lcd_status(const char* message);
20
-void beep();
21
-void buttons_init();
22
-void buttons_check();
23
-
24
-#define LCD_UPDATE_INTERVAL 100
25
-#define STATUSTIMEOUT 15000
26
-
27
-extern LCD_CLASS lcd;
28
-
29
-extern volatile char buttons;  //the last checked buttons in a bit array.
30
-  
31
-#ifdef NEWPANEL
7
+
8
+  #if LANGUAGE_CHOICE == 6
9
+  #include "LiquidCrystalRus.h"
10
+  #define LCD_CLASS LiquidCrystalRus
11
+  #else
12
+  #include <LiquidCrystal.h>
13
+  #define LCD_CLASS LiquidCrystal
14
+  #endif
15
+
16
+  void lcd_update();
17
+  void lcd_init();
18
+  void lcd_setstatus(const char* message);
19
+  void lcd_setstatuspgm(const char* message);
20
+  void lcd_setalertstatuspgm(const char* message);
21
+  void lcd_buttons_update();
22
+  void lcd_buttons_init();
23
+
24
+  #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
25
+  #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
26
+
27
+  #define LCD_UPDATE_INTERVAL 100
28
+  #define LCD_TIMEOUT_TO_STATUS 15000
29
+
30
+  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
31
+
32
+  extern int plaPreheatHotendTemp;
33
+  extern int plaPreheatHPBTemp;
34
+  extern int plaPreheatFanSpeed;
35
+
36
+  extern int absPreheatHotendTemp;
37
+  extern int absPreheatHPBTemp;
38
+  extern int absPreheatFanSpeed;
39
+    
40
+  #ifdef NEWPANEL
32
     #define EN_C (1<<BLEN_C)
41
     #define EN_C (1<<BLEN_C)
33
     #define EN_B (1<<BLEN_B)
42
     #define EN_B (1<<BLEN_B)
34
     #define EN_A (1<<BLEN_A)
43
     #define EN_A (1<<BLEN_A)
35
 
44
 
36
-    #define CLICKED (buttons&EN_C)
37
-    #define BLOCK {blocking=millis()+blocktime;}
38
-#else
45
+    #define LCD_CLICKED (buttons&EN_C)
46
+    #define LCD_BLOCK {blocking=millis()+blocktime;}
47
+  #else
39
     //atomatic, do not change
48
     //atomatic, do not change
40
     #define B_LE (1<<BL_LE)
49
     #define B_LE (1<<BL_LE)
41
     #define B_UP (1<<BL_UP)
50
     #define B_UP (1<<BL_UP)
46
     #define EN_B (1<<BLEN_B)
55
     #define EN_B (1<<BLEN_B)
47
     #define EN_A (1<<BLEN_A)
56
     #define EN_A (1<<BLEN_A)
48
     
57
     
49
-    #define CLICKED ((buttons&B_MI)||(buttons&B_ST))
50
-    #define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
51
-#endif
58
+    #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
59
+    #define LCD_BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
60
+  #endif
52
 
61
 
53
-#if (SDCARDDETECT > -1)
54
-#ifdef SDCARDDETECTINVERTED 
55
-#define CARDINSERTED (READ(SDCARDDETECT)!=0)
56
-#else
57
-#define CARDINSERTED (READ(SDCARDDETECT)==0)
58
-#endif //SDCARDTETECTINVERTED
59
-#else
60
-//If we don't have a card detect line, aways asume the card is inserted
61
-#define CARDINSERTED true
62
-#endif
63
-
64
-    
65
   // blocking time for recognizing a new keypress of one key, ms
62
   // blocking time for recognizing a new keypress of one key, ms
66
   #define blocktime 500
63
   #define blocktime 500
67
   #define lcdslow 5
64
   #define lcdslow 5
68
     
65
     
69
   enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings};
66
   enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings};
70
-
67
+  
68
+  extern LCD_CLASS lcd;
69
+  
71
   class MainMenu{
70
   class MainMenu{
72
   public:
71
   public:
73
     MainMenu();
72
     MainMenu();
146
       } 
145
       } 
147
     }
146
     }
148
   };
147
   };
149
-
150
-  //conversion routines, could need some overworking
151
-  char *ftostr51(const float &x);
152
-  char *ftostr52(const float &x);
153
-  char *ftostr31(const float &x);
154
-  char *ftostr3(const float &x);
155
-
156
-
157
-  #define LCD_INIT lcd_init();
158
-  #define LCD_MESSAGE(x) lcd_status(x);
159
-  #define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
160
-  #define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
161
-  #define LCD_STATUS lcd_status()
162
 #else //no lcd
148
 #else //no lcd
163
-  #define LCD_INIT
164
-  #define LCD_STATUS
165
-  #define LCD_MESSAGE(x)
166
-  #define LCD_MESSAGEPGM(x)
167
-  #define LCD_ALERTMESSAGEPGM(x)
168
-  FORCE_INLINE void lcd_status() {};
149
+  FORCE_INLINE void lcd_update() {}
150
+  FORCE_INLINE void lcd_init() {}
151
+  FORCE_INLINE void lcd_setstatus(const char* message) {}
152
+  FORCE_INLINE void lcd_buttons_init() {}
153
+  FORCE_INLINE void lcd_buttons_update() {}
154
+
155
+  #define LCD_MESSAGEPGM(x) 
156
+  #define LCD_ALERTMESSAGEPGM(x) 
169
 
157
 
170
   #define CLICKED false
158
   #define CLICKED false
171
   #define BLOCK ;
159
   #define BLOCK ;
172
 #endif 
160
 #endif 
173
-  
174
-void lcd_statuspgm(const char* message);
175
-void lcd_alertstatuspgm(const char* message);
176
-  
177
-char *ftostr3(const float &x);
161
+
178
 char *itostr2(const uint8_t &x);
162
 char *itostr2(const uint8_t &x);
179
-char *ftostr31(const float &x);
180
-char *ftostr32(const float &x);
181
 char *itostr31(const int &xx);
163
 char *itostr31(const int &xx);
182
 char *itostr3(const int &xx);
164
 char *itostr3(const int &xx);
183
 char *itostr4(const int &xx);
165
 char *itostr4(const int &xx);
184
-char *ftostr51(const float &x);
185
-
186
-//TODO: These do not belong here.
187
-extern int plaPreheatHotendTemp;
188
-extern int plaPreheatHPBTemp;
189
-extern int plaPreheatFanSpeed;
190
 
166
 
191
-extern int absPreheatHotendTemp;
192
-extern int absPreheatHPBTemp;
193
-extern int absPreheatFanSpeed;
167
+char *ftostr3(const float &x);
168
+char *ftostr31(const float &x);
169
+char *ftostr32(const float &x);
170
+char *ftostr51(const float &x);
171
+char *ftostr52(const float &x);
194
 
172
 
195
 #endif //ULTRALCD
173
 #endif //ULTRALCD

Laddar…
Avbryt
Spara