Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

make analog2tempBed return a precise celsius reading for BED_USES_THE…

…RMISTOR, complementing changes to analog2temp in d15f01e
  • Loading branch information...
commit 79a466ca26770c26f8581804ab0d37e486b35fd3 1 parent b4833d5
authored March 02, 2012

Showing 1 changed file with 4 additions and 6 deletions. Show diff stats Hide diff stats

  1. 10  Marlin/temperature.cpp
10  Marlin/temperature.cpp
@@ -397,7 +397,7 @@ float analog2temp(int raw, uint8_t e) {
397 397
 // For bed temperature measurement.
398 398
 float analog2tempBed(int raw) {
399 399
   #ifdef BED_USES_THERMISTOR
400  
-    int celsius = 0;
  400
+    float celsius = 0;
401 401
     byte i;
402 402
 
403 403
     raw = (1023 * OVERSAMPLENR) - raw;
@@ -408,9 +408,8 @@ float analog2tempBed(int raw) {
408 408
       {
409 409
         celsius  = PGM_RD_W(bedtemptable[i-1][1]) + 
410 410
           (raw - PGM_RD_W(bedtemptable[i-1][0])) * 
411  
-          (PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
412  
-          (PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
413  
-
  411
+          (float)(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
  412
+          (float)(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
414 413
         break;
415 414
       }
416 415
     }
@@ -419,13 +418,12 @@ float analog2tempBed(int raw) {
419 418
     if (i == bedtemptable_len) celsius = PGM_RD_W(bedtemptable[i-1][1]);
420 419
 
421 420
     return celsius;
422  
-    
423 421
   #elif defined BED_USES_AD595
424 422
     return ((raw * ((5.0 * 100.0) / 1024.0) / OVERSAMPLENR) * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET;
425 423
   #else
426 424
     #warning No heater-type defined for the bed.
  425
+    return 0;
427 426
   #endif
428  
-  return 0;
429 427
 }
430 428
 
431 429
 void tp_init()

0 notes on commit 79a466c

Please sign in to comment.
Something went wrong with that request. Please try again.