Browse Source

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 years ago
parent
commit
6a9bee27cc
10 changed files with 280 additions and 301 deletions
  1. 11
    13
      Marlin/ConfigurationStore.h
  2. 2
    1
      Marlin/Marlin.h
  3. 16
    14
      Marlin/Marlin_main.cpp
  4. 2
    2
      Marlin/cardreader.cpp
  5. 11
    0
      Marlin/cardreader.h
  6. 1
    1
      Marlin/planner.cpp
  7. 1
    1
      Marlin/stepper.cpp
  8. 8
    13
      Marlin/temperature.cpp
  9. 171
    177
      Marlin/ultralcd.cpp
  10. 57
    79
      Marlin/ultralcd.h

+ 11
- 13
Marlin/ConfigurationStore.h View File

@@ -1,24 +1,22 @@
1 1
 #ifndef CONFIG_STORE_H
2 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 8
 #ifdef EEPROM_CHITCHAT
9 9
 void Config_PrintSettings();
10
-#else
10
+#else
11 11
 FORCE_INLINE void Config_PrintSettings() {}
12
-#endif
12
+#endif
13 13
 
14 14
 #ifdef EEPROM_SETTINGS
15 15
 void Config_StoreSettings();
16
-void Config_RetrieveSettings();
17
-#else
16
+void Config_RetrieveSettings();
17
+#else
18 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 20
 #endif
23 21
 
24
-
22
+#endif//CONFIG_STORE_H

+ 2
- 1
Marlin/Marlin.h View File

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

+ 16
- 14
Marlin/Marlin_main.cpp View File

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

+ 2
- 2
Marlin/cardreader.cpp View File

@@ -279,7 +279,7 @@ void CardReader::openFile(char* name,bool read)
279 279
       sdpos = 0;
280 280
       
281 281
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
282
-      LCD_MESSAGE(fname);
282
+      lcd_setstatus(fname);
283 283
     }
284 284
     else
285 285
     {
@@ -301,7 +301,7 @@ void CardReader::openFile(char* name,bool read)
301 301
       saving = true;
302 302
       SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
303 303
       SERIAL_PROTOCOLLN(name);
304
-      LCD_MESSAGE(fname);
304
+      lcd_setstatus(fname);
305 305
     }
306 306
   }
307 307
   

+ 11
- 0
Marlin/cardreader.h View File

@@ -69,6 +69,17 @@ private:
69 69
 extern CardReader card;
70 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 83
 #else
73 84
 
74 85
 #define IS_SD_PRINTING (false)

+ 1
- 1
Marlin/planner.cpp View File

@@ -506,7 +506,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
506 506
   {
507 507
     manage_heater(); 
508 508
     manage_inactivity(); 
509
-    LCD_STATUS;
509
+    lcd_update();
510 510
   }
511 511
 
512 512
   // The target position of the tool in absolute steps

+ 1
- 1
Marlin/stepper.cpp View File

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

+ 8
- 13
Marlin/temperature.cpp View File

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

+ 171
- 177
Marlin/ultralcd.cpp
File diff suppressed because it is too large
View File


+ 57
- 79
Marlin/ultralcd.h View File

@@ -4,38 +4,47 @@
4 4
 #include "Marlin.h"
5 5
 
6 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 41
     #define EN_C (1<<BLEN_C)
33 42
     #define EN_B (1<<BLEN_B)
34 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 48
     //atomatic, do not change
40 49
     #define B_LE (1<<BL_LE)
41 50
     #define B_UP (1<<BL_UP)
@@ -46,28 +55,18 @@ extern volatile char buttons;  //the last checked buttons in a bit array.
46 55
     #define EN_B (1<<BLEN_B)
47 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 62
   // blocking time for recognizing a new keypress of one key, ms
66 63
   #define blocktime 500
67 64
   #define lcdslow 5
68 65
     
69 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 70
   class MainMenu{
72 71
   public:
73 72
     MainMenu();
@@ -146,50 +145,29 @@ extern volatile char buttons;  //the last checked buttons in a bit array.
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 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 158
   #define CLICKED false
171 159
   #define BLOCK ;
172 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 162
 char *itostr2(const uint8_t &x);
179
-char *ftostr31(const float &x);
180
-char *ftostr32(const float &x);
181 163
 char *itostr31(const int &xx);
182 164
 char *itostr3(const int &xx);
183 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 173
 #endif //ULTRALCD

Loading…
Cancel
Save