소스 검색

Merge pull request #11978 from thinkyhead/bf2_minmax_no_pragma

Ensure MIN/MAX override, reduce STM32F4 build warnings
Scott Lahteine 6 년 전
부모
커밋
366fae684c
No account linked to committer's email address

+ 1
- 0
Marlin/src/HAL/HAL_STM32F4/HAL.h 파일 보기

@@ -110,6 +110,7 @@
110 110
   #define NUM_SERIAL 1
111 111
 #endif
112 112
 
113
+#undef _BV
113 114
 #define _BV(b) (1 << (b))
114 115
 
115 116
 /**

+ 1
- 0
Marlin/src/HAL/HAL_STM32F4/fastio_STM32F4.h 파일 보기

@@ -29,6 +29,7 @@
29 29
 #ifndef _FASTIO_STM32F4_H
30 30
 #define _FASTIO_STM32F4_H
31 31
 
32
+#undef _BV
32 33
 #define _BV(b) (1 << (b))
33 34
 
34 35
 #define USEABLE_HARDWARE_PWM(p) true

+ 0
- 16
Marlin/src/core/enum.h 파일 보기

@@ -69,20 +69,4 @@ typedef enum {
69 69
   TEMPUNIT_F
70 70
 } TempUnit;
71 71
 
72
-/**
73
- * SD Card
74
- */
75
-enum LsAction : char { LS_SerialPrint, LS_Count, LS_GetFilename };
76
-
77
-/**
78
- * Ultra LCD
79
- */
80
-enum LCDViewAction : char {
81
-  LCDVIEW_NONE,
82
-  LCDVIEW_REDRAW_NOW,
83
-  LCDVIEW_CALL_REDRAW_NEXT,
84
-  LCDVIEW_CLEAR_CALL_REDRAW,
85
-  LCDVIEW_CALL_NO_REDRAW
86
-};
87
-
88 72
 #endif // __ENUM_H__

+ 1
- 1
Marlin/src/core/macros.h 파일 보기

@@ -57,7 +57,7 @@
57 57
 #define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
58 58
 
59 59
 // Remove compiler warning on an unused variable
60
-#define UNUSED(x) (void) (x)
60
+#define UNUSED(x) ((void)(x))
61 61
 
62 62
 // Macros to make a string from a macro
63 63
 #define STRINGIFY_(M) #M

+ 15
- 12
Marlin/src/core/minmax.h 파일 보기

@@ -20,26 +20,29 @@
20 20
  *
21 21
  */
22 22
 
23
-#pragma once
24
-
25 23
 #undef MIN
26 24
 #undef MAX
27 25
 
28 26
 #ifdef __cplusplus
29 27
 
30
-  extern "C++" {
28
+  #ifndef _MINMAX_H_
29
+  #define _MINMAX_H_
30
+
31
+    extern "C++" {
32
+
33
+      // C++11 solution that is standards compliant. Return type is deduced automatically
34
+      template <class L, class R> static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
35
+        return lhs < rhs ? lhs : rhs;
36
+      }
37
+      template <class L, class R> static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
38
+        return lhs > rhs ? lhs : rhs;
39
+      }
40
+      template<class T, class ... Ts> static inline constexpr const T MIN(T V, Ts... Vs) { return MIN(V, MIN(Vs...)); }
41
+      template<class T, class ... Ts> static inline constexpr const T MAX(T V, Ts... Vs) { return MAX(V, MAX(Vs...)); }
31 42
 
32
-    // C++11 solution that is standards compliant. Return type is deduced automatically
33
-    template <class L, class R> static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
34
-      return lhs < rhs ? lhs : rhs;
35
-    }
36
-    template <class L, class R> static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
37
-      return lhs > rhs ? lhs : rhs;
38 43
     }
39
-    template<class T, class ... Ts> static inline constexpr const T MIN(T V, Ts... Vs) { return MIN(V, MIN(Vs...)); }
40
-    template<class T, class ... Ts> static inline constexpr const T MAX(T V, Ts... Vs) { return MAX(V, MAX(Vs...)); }
41 44
 
42
-  }
45
+  #endif
43 46
 
44 47
 #else
45 48
 

+ 1
- 0
Marlin/src/inc/MarlinConfig.h 파일 보기

@@ -43,5 +43,6 @@
43 43
 #include "../core/language.h"
44 44
 #include "../core/utility.h"
45 45
 #include "../core/serial.h"
46
+#include "../core/minmax.h"
46 47
 
47 48
 #endif // _MARLIN_CONFIG_H_

+ 2
- 3
Marlin/src/lcd/ultralcd.cpp 파일 보기

@@ -117,10 +117,9 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed
117 117
 // The main status screen
118 118
 void lcd_status_screen();
119 119
 
120
-millis_t next_lcd_update_ms;
121
-
122
-uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
120
+LCDViewAction lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
123 121
 uint16_t max_display_update_time = 0;
122
+millis_t next_lcd_update_ms;
124 123
 
125 124
 #if ENABLED(ULTIPANEL)
126 125
 

+ 9
- 1
Marlin/src/lcd/ultralcd.h 파일 보기

@@ -57,7 +57,15 @@
57 57
   void lcd_kill_screen();
58 58
   void kill_screen(PGM_P lcd_msg);
59 59
 
60
-  extern uint8_t lcdDrawUpdate;
60
+  enum LCDViewAction : uint8_t {
61
+    LCDVIEW_NONE,
62
+    LCDVIEW_REDRAW_NOW,
63
+    LCDVIEW_CALL_REDRAW_NEXT,
64
+    LCDVIEW_CLEAR_CALL_REDRAW,
65
+    LCDVIEW_CALL_NO_REDRAW
66
+  };
67
+
68
+  extern LCDViewAction lcdDrawUpdate;
61 69
   inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
62 70
 
63 71
   #if HAS_BUZZER

+ 2
- 0
Marlin/src/sd/cardreader.h 파일 보기

@@ -33,6 +33,8 @@
33 33
 
34 34
 #include "SdFile.h"
35 35
 
36
+enum LsAction : uint8_t { LS_SerialPrint, LS_Count, LS_GetFilename };
37
+
36 38
 class CardReader {
37 39
 public:
38 40
   CardReader();

+ 0
- 2
frameworks/CMSIS/LPC1768/include/lpc_types.h 파일 보기

@@ -145,8 +145,6 @@ typedef int32_t(*PFI)();
145 145
 /* External data/function define */
146 146
 #define EXTERN extern
147 147
 
148
-#include "../../../../src/core/minmax.h"
149
-
150 148
 /**
151 149
  * @}
152 150
  */

Loading…
취소
저장