Browse Source

Fix LCD click

- Make the default LCD click sound more pleasant
- Fix warnings about bed temperature runaway
Scott Lahteine 9 years ago
parent
commit
571652c49b
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
 #ifdef FILAMENT_SENSOR
83
 #ifdef FILAMENT_SENSOR
84
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
84
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
85
 #endif  
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
 #endif
100
 #endif
96
 
101
 
97
 //===========================================================================
102
 //===========================================================================
650
 
655
 
651
   #if TEMP_SENSOR_BED != 0
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
       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);
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
     #endif
660
     #endif
656
 
661
 
1008
   #endif 
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
 void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
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
     if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
136
     if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
137
     uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
137
     uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
138
     bool wasClicked = LCD_CLICKED, itemSelected; \
138
     bool wasClicked = LCD_CLICKED, itemSelected; \
139
-    if (wasClicked) lcd_quick_feedback(); \
140
     for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
139
     for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
141
       _menuItemNr = 0;
140
       _menuItemNr = 0;
142
 
141
 
167
       if (lcdDrawUpdate) \
166
       if (lcdDrawUpdate) \
168
         lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
167
         lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
169
       if (wasClicked && itemSelected) { \
168
       if (wasClicked && itemSelected) { \
169
+        lcd_quick_feedback(); \
170
         menu_action_ ## type(args); \
170
         menu_action_ ## type(args); \
171
         return; \
171
         return; \
172
       } \
172
       } \
1155
   #elif defined(BEEPER) && BEEPER > -1
1155
   #elif defined(BEEPER) && BEEPER > -1
1156
     SET_OUTPUT(BEEPER);
1156
     SET_OUTPUT(BEEPER);
1157
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1157
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1158
-      #define LCD_FEEDBACK_FREQUENCY_HZ 500
1158
+      #define LCD_FEEDBACK_FREQUENCY_HZ 5000
1159
     #endif
1159
     #endif
1160
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1160
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1161
-      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50
1161
+      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
1162
     #endif
1162
     #endif
1163
     const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
1163
     const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
1164
     int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
1164
     int i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;

Loading…
Cancel
Save