From 076f3a82849c9e0c5b87c2e5755c67d72c4d4af7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 24 Sep 2016 00:51:21 -0500 Subject: [PATCH 1/3] unsigned char => uint8_t --- Marlin/temperature.cpp | 24 ++++++++++++------------ Marlin/temperature.h | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 084559d03..3fbb0b06f 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -64,10 +64,10 @@ int Temperature::current_temperature_raw[HOTENDS] = { 0 }, float Temperature::redundant_temperature = 0.0; #endif -unsigned char Temperature::soft_pwm_bed; +uint8_t Temperature::soft_pwm_bed; #if ENABLED(FAN_SOFT_PWM) - unsigned char Temperature::fanSpeedSoftPwm[FAN_COUNT]; + uint8_t Temperature::fanSpeedSoftPwm[FAN_COUNT]; #endif #if ENABLED(PIDTEMP) @@ -188,10 +188,10 @@ int Temperature::minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_LO_TEMP , millis_t Temperature::next_auto_fan_check_ms = 0; #endif -unsigned char Temperature::soft_pwm[HOTENDS]; +uint8_t Temperature::soft_pwm[HOTENDS]; #if ENABLED(FAN_SOFT_PWM) - unsigned char Temperature::soft_pwm_fan[FAN_COUNT]; + uint8_t Temperature::soft_pwm_fan[FAN_COUNT]; #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) @@ -482,7 +482,7 @@ int Temperature::getHeaterPower(int heater) { for (uint8_t f = 0; f < COUNT(fanPin); f++) { int8_t pin = fanPin[f]; if (pin >= 0 && !TEST(fanDone, fanBit[f])) { - unsigned char newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0; + uint8_t newFanSpeed = TEST(fanState, fanBit[f]) ? EXTRUDER_AUTO_FAN_SPEED : 0; // this idiom allows both digital and PWM fan outputs (see M42 handling). digitalWrite(pin, newFanSpeed); analogWrite(pin, newFanSpeed); @@ -1414,19 +1414,19 @@ ISR(TIMER0_COMPB_vect) { Temperature::isr(); } void Temperature::isr() { - static unsigned char temp_count = 0; + static uint8_t temp_count = 0; static TempState temp_state = StartupDelay; - static unsigned char pwm_count = _BV(SOFT_PWM_SCALE); + static uint8_t pwm_count = _BV(SOFT_PWM_SCALE); // Static members for each heater #if ENABLED(SLOW_PWM_HEATERS) - static unsigned char slow_pwm_count = 0; + static uint8_t slow_pwm_count = 0; #define ISR_STATICS(n) \ - static unsigned char soft_pwm_ ## n; \ - static unsigned char state_heater_ ## n = 0; \ - static unsigned char state_timer_heater_ ## n = 0 + static uint8_t soft_pwm_ ## n; \ + static uint8_t state_heater_ ## n = 0; \ + static uint8_t state_timer_heater_ ## n = 0 #else - #define ISR_STATICS(n) static unsigned char soft_pwm_ ## n + #define ISR_STATICS(n) static uint8_t soft_pwm_ ## n #endif // Statics per heater diff --git a/Marlin/temperature.h b/Marlin/temperature.h index fe6e52220..72f55b317 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -65,10 +65,10 @@ class Temperature { static float redundant_temperature; #endif - static unsigned char soft_pwm_bed; + static uint8_t soft_pwm_bed; #if ENABLED(FAN_SOFT_PWM) - static unsigned char fanSpeedSoftPwm[FAN_COUNT]; + static uint8_t fanSpeedSoftPwm[FAN_COUNT]; #endif #if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) @@ -209,10 +209,10 @@ class Temperature { static millis_t next_auto_fan_check_ms; #endif - static unsigned char soft_pwm[HOTENDS]; + static uint8_t soft_pwm[HOTENDS]; #if ENABLED(FAN_SOFT_PWM) - static unsigned char soft_pwm_fan[FAN_COUNT]; + static uint8_t soft_pwm_fan[FAN_COUNT]; #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) From 1583d37edd2322449e7ffa02ed352f875ef11536 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 23 Sep 2016 01:01:22 -0500 Subject: [PATCH 2/3] Comment on M851 case --- Marlin/Marlin_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index de089f006..a676a145c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -7640,7 +7640,7 @@ void process_next_command() { #endif #if HAS_BED_PROBE - case 851: + case 851: // Set Z Probe Z Offset gcode_M851(); break; #endif // HAS_BED_PROBE From 16461900c2ac51af535d57105a892149baaf8250 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 24 Sep 2016 00:36:37 -0500 Subject: [PATCH 3/3] Fix for HEATERS_PARALLEL --- Marlin/temperature.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 3fbb0b06f..ba9d9706b 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -1286,9 +1286,7 @@ void Temperature::disable_all_heaters() { } #if HAS_TEMP_HOTEND - setTargetHotend(0, 0); - soft_pwm[0] = 0; - WRITE_HEATER_0P(LOW); // Should HEATERS_PARALLEL apply here? Then change to DISABLE_HEATER(0) + DISABLE_HEATER(0); #endif #if HOTENDS > 1 && HAS_TEMP_1 @@ -1431,7 +1429,7 @@ void Temperature::isr() { // Statics per heater ISR_STATICS(0); - #if (HOTENDS > 1) || ENABLED(HEATERS_PARALLEL) + #if HOTENDS > 1 ISR_STATICS(1); #if HOTENDS > 2 ISR_STATICS(2); @@ -1450,15 +1448,11 @@ void Temperature::isr() { #if DISABLED(SLOW_PWM_HEATERS) /** - * standard PWM modulation + * Standard PWM modulation */ if (pwm_count == 0) { soft_pwm_0 = soft_pwm[0]; - if (soft_pwm_0 > 0) { - WRITE_HEATER_0(1); - } - else WRITE_HEATER_0P(0); // If HEATERS_PARALLEL should apply, change to WRITE_HEATER_0 - + WRITE_HEATER_0(soft_pwm_0 > 0 ? 1 : 0); #if HOTENDS > 1 soft_pwm_1 = soft_pwm[1]; WRITE_HEATER_1(soft_pwm_1 > 0 ? 1 : 0); @@ -1535,7 +1529,7 @@ void Temperature::isr() { #define MIN_STATE_TIME 16 // MIN_STATE_TIME * 65.5 = time in milliseconds #endif - // Macros for Slow PWM timer logic - HEATERS_PARALLEL applies + // Macros for Slow PWM timer logic #define _SLOW_PWM_ROUTINE(NR, src) \ soft_pwm_ ## NR = src; \ if (soft_pwm_ ## NR > 0) { \