Parcourir la source

Use ADC resolution in AD595/8495 calculation (#17018)

Fixes thermocouple reading on LP1768 (which uses 12-bit resolution).
ManuelMcLure il y a 4 ans
Parent
révision
39c34e4992
Aucun compte lié à l'adresse e-mail de l'auteur
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2
    2
      Marlin/src/module/temperature.cpp

+ 2
- 2
Marlin/src/module/temperature.cpp Voir le fichier

@@ -1232,8 +1232,8 @@ void Temperature::manage_heater() {
1232 1232
   UNUSED(ms);
1233 1233
 }
1234 1234
 
1235
-#define TEMP_AD595(RAW)  ((RAW) * 5.0 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET)
1236
-#define TEMP_AD8495(RAW) ((RAW) * 6.6 * 100.0 / 1024.0 / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET)
1235
+#define TEMP_AD595(RAW)  ((RAW) * 5.0 * 100.0 / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET)
1236
+#define TEMP_AD8495(RAW) ((RAW) * 6.6 * 100.0 / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET)
1237 1237
 
1238 1238
 /**
1239 1239
  * Bisect search for the range of the 'raw' value, then interpolate

Chargement…
Annuler
Enregistrer