Merge pull request #11978 from thinkyhead/bf2_minmax_no_pragma
Ensure MIN/MAX override, reduce STM32F4 build warnings
This commit is contained in:
commit
366fae684c
|
@ -110,6 +110,7 @@
|
||||||
#define NUM_SERIAL 1
|
#define NUM_SERIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef _BV
|
||||||
#define _BV(b) (1 << (b))
|
#define _BV(b) (1 << (b))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef _FASTIO_STM32F4_H
|
#ifndef _FASTIO_STM32F4_H
|
||||||
#define _FASTIO_STM32F4_H
|
#define _FASTIO_STM32F4_H
|
||||||
|
|
||||||
|
#undef _BV
|
||||||
#define _BV(b) (1 << (b))
|
#define _BV(b) (1 << (b))
|
||||||
|
|
||||||
#define USEABLE_HARDWARE_PWM(p) true
|
#define USEABLE_HARDWARE_PWM(p) true
|
||||||
|
|
|
@ -69,20 +69,4 @@ typedef enum {
|
||||||
TEMPUNIT_F
|
TEMPUNIT_F
|
||||||
} TempUnit;
|
} TempUnit;
|
||||||
|
|
||||||
/**
|
|
||||||
* SD Card
|
|
||||||
*/
|
|
||||||
enum LsAction : char { LS_SerialPrint, LS_Count, LS_GetFilename };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ultra LCD
|
|
||||||
*/
|
|
||||||
enum LCDViewAction : char {
|
|
||||||
LCDVIEW_NONE,
|
|
||||||
LCDVIEW_REDRAW_NOW,
|
|
||||||
LCDVIEW_CALL_REDRAW_NEXT,
|
|
||||||
LCDVIEW_CLEAR_CALL_REDRAW,
|
|
||||||
LCDVIEW_CALL_NO_REDRAW
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __ENUM_H__
|
#endif // __ENUM_H__
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
|
#define NANOSECONDS_PER_CYCLE (1000000000.0 / F_CPU)
|
||||||
|
|
||||||
// Remove compiler warning on an unused variable
|
// Remove compiler warning on an unused variable
|
||||||
#define UNUSED(x) (void) (x)
|
#define UNUSED(x) ((void)(x))
|
||||||
|
|
||||||
// Macros to make a string from a macro
|
// Macros to make a string from a macro
|
||||||
#define STRINGIFY_(M) #M
|
#define STRINGIFY_(M) #M
|
||||||
|
|
|
@ -20,26 +20,29 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#undef MIN
|
#undef MIN
|
||||||
#undef MAX
|
#undef MAX
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
extern "C++" {
|
#ifndef _MINMAX_H_
|
||||||
|
#define _MINMAX_H_
|
||||||
|
|
||||||
// C++11 solution that is standards compliant. Return type is deduced automatically
|
extern "C++" {
|
||||||
template <class L, class R> static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
|
||||||
return lhs < rhs ? lhs : rhs;
|
|
||||||
}
|
|
||||||
template <class L, class R> static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
|
||||||
return lhs > rhs ? lhs : rhs;
|
|
||||||
}
|
|
||||||
template<class T, class ... Ts> static inline constexpr const T MIN(T V, Ts... Vs) { return MIN(V, MIN(Vs...)); }
|
|
||||||
template<class T, class ... Ts> static inline constexpr const T MAX(T V, Ts... Vs) { return MAX(V, MAX(Vs...)); }
|
|
||||||
|
|
||||||
}
|
// C++11 solution that is standards compliant. Return type is deduced automatically
|
||||||
|
template <class L, class R> static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||||
|
return lhs < rhs ? lhs : rhs;
|
||||||
|
}
|
||||||
|
template <class L, class R> static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) {
|
||||||
|
return lhs > rhs ? lhs : rhs;
|
||||||
|
}
|
||||||
|
template<class T, class ... Ts> static inline constexpr const T MIN(T V, Ts... Vs) { return MIN(V, MIN(Vs...)); }
|
||||||
|
template<class T, class ... Ts> static inline constexpr const T MAX(T V, Ts... Vs) { return MAX(V, MAX(Vs...)); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,6 @@
|
||||||
#include "../core/language.h"
|
#include "../core/language.h"
|
||||||
#include "../core/utility.h"
|
#include "../core/utility.h"
|
||||||
#include "../core/serial.h"
|
#include "../core/serial.h"
|
||||||
|
#include "../core/minmax.h"
|
||||||
|
|
||||||
#endif // _MARLIN_CONFIG_H_
|
#endif // _MARLIN_CONFIG_H_
|
||||||
|
|
|
@ -117,10 +117,9 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed
|
||||||
// The main status screen
|
// The main status screen
|
||||||
void lcd_status_screen();
|
void lcd_status_screen();
|
||||||
|
|
||||||
millis_t next_lcd_update_ms;
|
LCDViewAction lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
||||||
|
|
||||||
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)
|
|
||||||
uint16_t max_display_update_time = 0;
|
uint16_t max_display_update_time = 0;
|
||||||
|
millis_t next_lcd_update_ms;
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,15 @@
|
||||||
void lcd_kill_screen();
|
void lcd_kill_screen();
|
||||||
void kill_screen(PGM_P lcd_msg);
|
void kill_screen(PGM_P lcd_msg);
|
||||||
|
|
||||||
extern uint8_t lcdDrawUpdate;
|
enum LCDViewAction : uint8_t {
|
||||||
|
LCDVIEW_NONE,
|
||||||
|
LCDVIEW_REDRAW_NOW,
|
||||||
|
LCDVIEW_CALL_REDRAW_NEXT,
|
||||||
|
LCDVIEW_CLEAR_CALL_REDRAW,
|
||||||
|
LCDVIEW_CALL_NO_REDRAW
|
||||||
|
};
|
||||||
|
|
||||||
|
extern LCDViewAction lcdDrawUpdate;
|
||||||
inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
|
inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
|
||||||
|
|
||||||
#if HAS_BUZZER
|
#if HAS_BUZZER
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
#include "SdFile.h"
|
#include "SdFile.h"
|
||||||
|
|
||||||
|
enum LsAction : uint8_t { LS_SerialPrint, LS_Count, LS_GetFilename };
|
||||||
|
|
||||||
class CardReader {
|
class CardReader {
|
||||||
public:
|
public:
|
||||||
CardReader();
|
CardReader();
|
||||||
|
|
|
@ -145,8 +145,6 @@ typedef int32_t(*PFI)();
|
||||||
/* External data/function define */
|
/* External data/function define */
|
||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
|
|
||||||
#include "../../../../src/core/minmax.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue