Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 12090

Re: Fan configuration - what am I missing?

$
0
0
Well, my best theories are busted.

I don't know if this is something specific to 32bit or not.

In my pins configuration file, I have

#define FAN1_PIN PB3 // FAN1 header on board - PRINT FAN

in configuration_adv.h, I have
#define E0_AUTO_FAN_PIN PB8

Marlin thinks I have zero fans (I modified the output of M42 to spew a bunch of info).
I tracked it down the a macro in conditionals_post.h, and for the life of me, I don't understand what it's doing.

#define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLER_FAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN)

In english, this is "If fan1 is definied, and it's not the controller fan, E0, 1, 2, or 3 auto fan pins, we have FAN1"
So I level by level checked it, and the one that makes this macro return false is E0_AUTO_FAN_PIN != FAN1_PIN.

So I added in this file some code to spew a pragma with the values...and what I get is confusing.

// **********
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)

#if E0_AUTO_FAN_PIN != FAN1_PIN
#error "Not Equal!"
#else
#pragma message(VAR_NAME_VALUE(E0_AUTO_FAN_PIN))
#pragma message(VAR_NAME_VALUE(FAN1_PIN))
#error "E0AFPFP"
#endif
// *********

When I compile, I correctly get the spew from the pragmas -
Marlin/src/HAL/HAL_LPC1768/../../inc/Conditionals_post.h:650:52: note: #pragma message: E0_AUTO_FAN_PIN=PB8
#pragma message(VAR_NAME_VALUE(E0_AUTO_FAN_PIN))
^
Marlin/src/HAL/HAL_LPC1768/../../inc/Conditionals_post.h:651:45: note: #pragma message: FAN1_PIN=PB3
#pragma message(VAR_NAME_VALUE(FAN1_PIN))

So...PB3 has somehow evaluated equal to PB8? (PB3 is an enum with a value of 19, PB8 has a value of 24).

Is there something I'm doing wrong here thatI can change to fix this?

Viewing all articles
Browse latest Browse all 12090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>