triffid / FiveD_on_Arduino

Rewrite of reprap mendel firmware
http://forums.reprap.org/read.php?147,33082
GNU General Public License v2.0
30 stars 12 forks source link

Simplify config.h part 2 #22

Closed sw closed 13 years ago

sw commented 13 years ago

Hi,

Thanks for all your comments! I used John's (jgilmore) suggestion: heaters and sensors can now be linked by their names. Also, the bed heater is now selected by name.

The comments in config.h.dist should explain all the possibilities.

On top of that, defining ANALOG_MASK by hand is no longer necessary. I have only tested this code with one sensor and one heater, though.

As an aside note, I read up on Git and I hope I won't make a total mess of commits this time...

Cheers, Stephan

jgilmore commented 13 years ago

Looks good. It does look like you included the corrected thermistor logic, which is already in the repository. Wouldn't think that'd be too much of a problem though. I do like the analog mask stuff.

Funny thought, it's an error for an enum to redeclare a constant. So if you have more than one temp sensor that doesn't get a heater, you'd have to declare them as none, none1 etc. which would mean you'd have to jump through other hoops too.

It's still way better than what we have now.

jgilmore commented 13 years ago

Oh, and I think that it would be better to assume that the heater/sensor called "bed" is the bed. You can then simply test for "#defined HEATER_bed" for M104. (yay! Even simpler configuration!)

Oh, and realize that I don't have commit access, so to an extent I'm just heckling.

triffid commented 13 years ago

unfortunately, preprocessor doesn't see enum values as 'defined', nor can we define things it does understand from within macros, have been trying to find a way to automagically detect bed, fan etc based on name but no luck yet. Trying to use HEATER_bed from within code will end up with 'HEATER_bed not defined' errors if there isn't one. Apparently we need a smarter preprocessor... A precompilation step would lock out all the IDEs which others seem so fond of.

jgilmore commented 13 years ago

You mean to say that "#ifdef HEATER_bed" won't detect if a heater named "bed" exists? Odd. Let me test that... You're correct, the preprocessor doesn't know about enums. And we can't test for existance in code, as this isn't python or something.

Can't make pre-processor directives from the results of a #define. Post-expansion is recursive, but I don't see how that could be used. I'll keep thinking about it though.

triffid commented 13 years ago

hi, I like your analog stuff and the other simplifications, but since we've implemented bits and pieces in other ways there is a ton of merge conflicts and I don't understand all the new code well enough to sort them all out- could you possibly redo this pull with a series of different commits, or even easier for me vs current upstream master?

sw commented 13 years ago

Will make a new commit