Browse Source

Fixed temperature reading bug.

(When using the lower and upper adc input bank)
Erik van der Zalm 13 years ago
parent
commit
dd5296ad4d
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      Marlin/temperature.cpp

+ 6
- 0
Marlin/temperature.cpp View File

464
       #if (TEMP_0_PIN > -1)
464
       #if (TEMP_0_PIN > -1)
465
         #if TEMP_0_PIN > 7
465
         #if TEMP_0_PIN > 7
466
           ADCSRB = 1<<MUX5;
466
           ADCSRB = 1<<MUX5;
467
+        #else
468
+          ADCSRB = 0;
467
         #endif
469
         #endif
468
         ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
470
         ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
469
         ADCSRA |= 1<<ADSC; // Start conversion
471
         ADCSRA |= 1<<ADSC; // Start conversion
483
       #if (TEMP_1_PIN > -1)
485
       #if (TEMP_1_PIN > -1)
484
         #if TEMP_1_PIN > 7
486
         #if TEMP_1_PIN > 7
485
           ADCSRB = 1<<MUX5;
487
           ADCSRB = 1<<MUX5;
488
+        #else
489
+          ADCSRB = 0;
486
         #endif
490
         #endif
487
         ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
491
         ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
488
         ADCSRA |= 1<<ADSC; // Start conversion
492
         ADCSRA |= 1<<ADSC; // Start conversion
502
       #if (TEMP_2_PIN > -1)
506
       #if (TEMP_2_PIN > -1)
503
         #if TEMP_2_PIN > 7
507
         #if TEMP_2_PIN > 7
504
           ADCSRB = 1<<MUX5;
508
           ADCSRB = 1<<MUX5;
509
+        #else
510
+          ADCSRB = 0;
505
         #endif
511
         #endif
506
         ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
512
         ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
507
         ADCSRA |= 1<<ADSC; // Start conversion
513
         ADCSRA |= 1<<ADSC; // Start conversion

Loading…
Cancel
Save