Browse Source

Merge pull request #1752 from thinkyhead/fix_lcd_click

Fix LCD click
Scott Lahteine 9 years ago
parent
commit
db4d8e835c
2 changed files with 19 additions and 14 deletions
  1. 16
    11
      Marlin/temperature.cpp
  2. 3
    3
      Marlin/ultralcd.cpp

+ 16
- 11
Marlin/temperature.cpp View File

@@ -83,15 +83,20 @@ unsigned char soft_pwm_bed;
83 83
 #ifdef FILAMENT_SENSOR
84 84
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
85 85
 #endif  
86
-#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
87
-void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
88
-static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
89
-static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
90
-static bool thermal_runaway = false;
91
-#if TEMP_SENSOR_BED != 0
92
-  static int thermal_runaway_bed_state_machine;
93
-  static unsigned long thermal_runaway_bed_timer;
94
-#endif
86
+
87
+#define HAS_HEATER_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0)
88
+#define HAS_BED_THERMAL_PROTECTION (defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0 && TEMP_SENSOR_BED != 0)
89
+#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
90
+  static bool thermal_runaway = false;
91
+  void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
92
+  #if HAS_HEATER_THERMAL_PROTECTION
93
+    static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
94
+    static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
95
+  #endif
96
+  #if HAS_BED_THERMAL_PROTECTION
97
+    static int thermal_runaway_bed_state_machine;
98
+    static unsigned long thermal_runaway_bed_timer;
99
+  #endif
95 100
 #endif
96 101
 
97 102
 //===========================================================================
@@ -650,7 +655,7 @@ void manage_heater() {
650 655
 
651 656
   #if TEMP_SENSOR_BED != 0
652 657
   
653
-    #if defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0
658
+    #if HAS_BED_THERMAL_PROTECTION
654 659
       thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS);
655 660
     #endif
656 661
 
@@ -1008,7 +1013,7 @@ void setWatch() {
1008 1013
   #endif 
1009 1014
 }
1010 1015
 
1011
-#if defined(THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
1016
+#if HAS_HEATER_THERMAL_PROTECTION || HAS_BED_THERMAL_PROTECTION
1012 1017
 void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
1013 1018
 {
1014 1019
 /*

+ 3
- 3
Marlin/ultralcd.cpp View File

@@ -136,7 +136,6 @@ static void lcd_status_screen();
136 136
     if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
137 137
     uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
138 138
     bool wasClicked = LCD_CLICKED, itemSelected; \
139
-    if (wasClicked) lcd_quick_feedback(); \
140 139
     for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
141 140
       _menuItemNr = 0;
142 141
 
@@ -167,6 +166,7 @@ static void lcd_status_screen();
167 166
       if (lcdDrawUpdate) \
168 167
         lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
169 168
       if (wasClicked && itemSelected) { \
169
+        lcd_quick_feedback(); \
170 170
         menu_action_ ## type(args); \
171 171
         return; \
172 172
       } \
@@ -1155,10 +1155,10 @@ static void lcd_quick_feedback() {
1155 1155
   #elif defined(BEEPER) && BEEPER > -1
1156 1156
     SET_OUTPUT(BEEPER);
1157 1157
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1158
-      #define LCD_FEEDBACK_FREQUENCY_HZ 500
1158
+      #define LCD_FEEDBACK_FREQUENCY_HZ 5000
1159 1159
     #endif
1160 1160
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1161
-      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50
1161
+      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
1162 1162
     #endif
1163 1163
     const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
1164 1164
     int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;

Loading…
Cancel
Save