From 976c90b315a873b73bb19f4bbf1f8907cab37d82 Mon Sep 17 00:00:00 2001 From: OhmEye Date: Mon, 30 Apr 2012 23:59:53 -1000 Subject: Bug: turn on SD_FAST_XFER_AKTIV and compilation fails if PID is enabled. Fix: If SD_FAST_XFER_AKTIV is defined, fast_xfer() only declares g_heater_pwm_val if PIDTEMP is defined, but later assigns g_heater_pwm_val=0 regardless whether PIDTEMP is defined or not. If PIDTEMP is undefined, g_heater_pwm_val is undeclared at compile time and generates the appropriate error. I solved by not using g_heater_pwm_val if PIDTEMP is undefined (and therefor undeclared.) Also, the extern declaration was as an int, when g_heater_pwm_val is defined as a volatile unsigned char. This caused a duplicate declaration error, which was solved by changing the declaration in fast_xfer() to match the definition. I didn't dig deeper to try to understand if the mismatch was intentional or test operation other than verify the compile errors no longer occur. --- Sprinter/Sprinter.pde | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Sprinter/Sprinter.pde') diff --git a/Sprinter/Sprinter.pde b/Sprinter/Sprinter.pde index 308ee19..61f895b 100644 --- a/Sprinter/Sprinter.pde +++ b/Sprinter/Sprinter.pde @@ -359,7 +359,7 @@ unsigned char manage_monitor = 255; #ifdef SD_FAST_XFER_AKTIV #ifdef PIDTEMP - extern int g_heater_pwm_val; + extern volatile unsigned char g_heater_pwm_val; #endif void fast_xfer() @@ -371,7 +371,9 @@ unsigned char manage_monitor = 255; if(HEATER_0_PIN > -1) WRITE(HEATER_0_PIN,LOW); if(HEATER_1_PIN > -1) WRITE(HEATER_1_PIN,LOW); + #ifdef PIDTEMP g_heater_pwm_val = 0; + #endif lastxferchar = 1; xferbytes = 0; -- cgit v1.2.1