From 0f1bd6e4a7036bacfd62fb82cb55e42c9dec17d0 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 30 Mar 2015 01:40:58 +0200 Subject: [PATCH 1/4] In ST7920_SWSPI_SND_8BIT(uint8_t val) parameter is unsigned therefor in macro ST7920_WRITE_BYTE(a) cast a to uint8_t to make the compiler happy. --- Marlin/ultralcd_st7920_u8glib_rrd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/ultralcd_st7920_u8glib_rrd.h b/Marlin/ultralcd_st7920_u8glib_rrd.h index 6b6c005ada..fbf0109824 100644 --- a/Marlin/ultralcd_st7920_u8glib_rrd.h +++ b/Marlin/ultralcd_st7920_u8glib_rrd.h @@ -43,7 +43,7 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val) #define ST7920_NCS() {WRITE(ST7920_CS_PIN,0);} #define ST7920_SET_CMD() {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();} #define ST7920_SET_DAT() {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();} -#define ST7920_WRITE_BYTE(a) {ST7920_SWSPI_SND_8BIT((a)&0xf0);ST7920_SWSPI_SND_8BIT((a)<<4);u8g_10MicroDelay();} +#define ST7920_WRITE_BYTE(a) {ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xf0u));ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u));u8g_10MicroDelay();} #define ST7920_WRITE_BYTES(p,l) {uint8_t i;for(i=0;i Date: Mon, 30 Mar 2015 01:42:35 +0200 Subject: [PATCH 2/4] Some additional {} to make the compiler happy. --- Marlin/stepper.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index bb45fe2a8d..d0500ac2c1 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -459,7 +459,7 @@ ISR(TIMER1_COMPA_vect) { #ifdef COREXY // Head direction in -X axis for CoreXY bots. // If DeltaX == -DeltaY, the movement is only in Y axis - if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) + if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if (TEST(out_bits, X_HEAD)) #else if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular cartesians bot) @@ -487,9 +487,10 @@ ISR(TIMER1_COMPA_vect) { } } #ifdef COREXY + } // Head direction in -Y axis for CoreXY bots. // If DeltaX == DeltaY, the movement is only in X axis - if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) + if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) { if (TEST(out_bits, Y_HEAD)) #else if (TEST(out_bits, Y_AXIS)) // -direction @@ -504,6 +505,9 @@ ISR(TIMER1_COMPA_vect) { UPDATE_ENDSTOP(y, Y, max, MAX); #endif } + #ifdef COREXY + } + #endif } if (TEST(out_bits, Z_AXIS)) { // -direction From 507efa771b762e72ebb4d19998dccd0b49944768 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 30 Mar 2015 01:46:38 +0200 Subject: [PATCH 3/4] Remove unused variable fan_rot and satisfy the compiler about the implicit compare. --- Marlin/dogm_lcd_implementation.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index ae3468582a..89cd5e835c 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -256,9 +256,6 @@ static void _draw_heater_status(int x, int heater) { } static void lcd_implementation_status_screen() { - - static unsigned char fan_rot = 0; - u8g.setColorIndex(1); // black on white // Symbols menu graphics, animated fan @@ -485,7 +482,7 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c lcd_implementation_mark_as_selected(row, isSelected); if (isDir) lcd_print(LCD_STR_FOLDER[0]); - while (c = *filename) { + while ((c = *filename)) { n -= lcd_print(c); filename++; } From 7b2550a604e33da35b88176381c044a396eb0392 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Mon, 30 Mar 2015 01:58:46 +0200 Subject: [PATCH 4/4] Times can't be negative. cardreader.cpp needs temperature.h for autotempShutdown() when AUTOTEMP is defined but warns about unused variables. Unpublished variables by putting them in to temperature.cpp. --- Marlin/temperature.cpp | 15 +++++++++++++-- Marlin/temperature.h | 18 ++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 18f9d6c004..d0720c5ec2 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -83,6 +83,17 @@ unsigned char soft_pwm_bed; #ifdef FILAMENT_SENSOR int current_raw_filwidth = 0; //Holds measured filament diameter - one extruder only #endif +#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 +void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); +static int thermal_runaway_state_machine[4]; // = {0,0,0,0}; +static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0}; +static bool thermal_runaway = false; +#if TEMP_SENSOR_BED != 0 + static int thermal_runaway_bed_state_machine; + static unsigned long thermal_runaway_bed_timer; +#endif +#endif + //=========================================================================== //=============================private variables============================ //=========================================================================== @@ -1100,8 +1111,8 @@ void disable_heater() { } #ifdef HEATER_0_USES_MAX6675 - #define MAX6675_HEAT_INTERVAL 250 - long max6675_previous_millis = MAX6675_HEAT_INTERVAL; + #define MAX6675_HEAT_INTERVAL 250u + unsigned long max6675_previous_millis = MAX6675_HEAT_INTERVAL; int max6675_temp = 2000; static int read_max6675() { diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 853179be52..79146a3556 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -146,16 +146,10 @@ void disable_heater(); void setWatch(); void updatePID(); -#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0 -void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc); -static int thermal_runaway_state_machine[4]; // = {0,0,0,0}; -static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0}; -static bool thermal_runaway = false; -#if TEMP_SENSOR_BED != 0 - static int thermal_runaway_bed_state_machine; - static unsigned long thermal_runaway_bed_timer; -#endif -#endif +void PID_autotune(float temp, int extruder, int ncycles); + +void setExtruderAutoFanState(int pin, bool state); +void checkExtruderAutoFans(); FORCE_INLINE void autotempShutdown() { #ifdef AUTOTEMP @@ -167,9 +161,5 @@ FORCE_INLINE void autotempShutdown() { #endif } -void PID_autotune(float temp, int extruder, int ncycles); - -void setExtruderAutoFanState(int pin, bool state); -void checkExtruderAutoFans(); #endif