Adding Room/Enclosure Temperature to Display

Since we don’t need to use the temperature display for marlin, unless using as a 3d printer. I thought I would use a 100k Thermistor on the ramps T0 (zero) pins to display the temperature of the room. In configuration.h I changed 2 lines so far.

#define TEMP_SENSOR_0 999 //MPCNC to this #define TEMP_SENSOR_0 1 //MPCNC

and #define EXTRUDE_MINTEMP 170 to #define EXTRUDE_MINTEMP 0

I’m not sure the second one is necessary, but i didn’t want it to trigger Min Temp.

Now instead of saying temp 170 on my screen, it shows the temp detected by the thermistor. I just have 1 small step left, and it’s because I’m in the USA and C doesn’t mean much to me. Anyone know how to get it to display the temp in F?

 

Thanks - Jake

 

 

 

 

 

 

Aargh, this website is fighting me! This is a great idea.

You are right, you don’t need EXTRUDE_MINTEMP, that just keeps you from running the extruder motor when the extruder temperature is below that value.

As for Fahrenheit, there are two ways I can see to do that, and they both suck. I don’t see a way to do that with the config, but I might just not see it, IDK.

  1. Edit the thermistortable_1.h. You’d have to change every value in there from C to F. Not so fun, really.

  2. Edit where it’s getting calculated in temperture.cpp:

if (heater_ttbl_map[e] != NULL) {
float celsius = 0;
uint8_t i;
short(tt)[][2] = (short()[][2])(heater_ttbl_map[e]);

for (i = 1; i < heater_ttbllen_map[e]; i++) {
  if (PGM_RD_W((*tt)[i][0]) > raw) {
    celsius = PGM_RD_W((*tt)[i - 1][1]) +
              (raw - PGM_RD_W((*tt)[i - 1][0])) *
              (float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i - 1][1])) /
              (float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i - 1][0]));
    break;
  }
}

// Overflow: Set to last value in the table
if (i == heater_ttbllen_map[e]) celsius = PGM_RD_W((*tt)[i - 1][1]);

return celsius;

}

    celsius = PGM_RD_W((*tt)[i - 1][1]) +
              (raw - PGM_RD_W((*tt)[i - 1][0])) *
              (float)(PGM_RD_W((*tt)[i][1]) - PGM_RD_W((*tt)[i - 1][1])) /
              (float)(PGM_RD_W((*tt)[i][0]) - PGM_RD_W((*tt)[i - 1][0]));

    celsius = celcius * 1.8 + 32.0;

    break;

You could also try to find where that’s being used in the lcd code, and just change it there.

There is a mm to inches setting now, I wonder if that also change the temps? I really havn’t looked.

i found where you were talking about and added these 6 lines.

celsius = PGM_RD_W((*tt)[1]) +

(raw – PGM_RD_W((*tt)[0])) *
(float)(PGM_RD_W((*tt)[1]) – PGM_RD_W((*tt)[1])) /
(float)(PGM_RD_W((*tt)[0]) – PGM_RD_W((*tt)[0]));

celsius = celcius * 1.8 + 32.0;

break;

 

will update with results when i get a chance to flash my firmware after work today.

I did see that M149 changes temp units. So i could do M149 [F] but i’m not sure where i would put that.

You should just have to add the one line.

If it supports M149, then there must be a better way. I’m not at my computer, but looking at what m149 does would be a good start.

so just add M149 [F] somewhere in marlin? or do i add it to the gcode somehow?

M149 is probably handled in Marlin_main.cpp somewhere, and whatever code its callling could get called somewhere on initialization to change the default. Thats the hack I would make… But I still havent been at my computer to look.

1 Like

ok i got it working. this is what i have now for lines 865 thru 868 of temperature.cpp

 

// Overflow: Set to last value in the table
if (i == heater_ttbllen_map[e]) celsius = PGM_RD_W((*tt)[i - 1][1]);
celsius = celsius * 1.8 + 32.0; // <— inserted this line
return celsius;

Great.