Ver Fonte

Ambient thermistor - table and conversion function, extruder motor changed back to 200steps type, extruder resolution changed to 32usteps.

Robert Pelnar há 7 anos atrás
pai
commit
d9cdb1da60

+ 6 - 0
Firmware/Configuration_adv.h

@@ -413,6 +413,12 @@ const unsigned int dropsegments=5; //everything with less than this number of st
   #define THERMISTORBED TEMP_SENSOR_BED
   #define BED_USES_THERMISTOR
 #endif
+#if TEMP_SENSOR_PINDA > 0
+  #define THERMISTORPINDA TEMP_SENSOR_PINDA
+#endif
+#if TEMP_SENSOR_AMBIENT > 0
+  #define THERMISTORAMBIENT TEMP_SENSOR_AMBIENT
+#endif
 #if TEMP_SENSOR_0 == -1
   #define HEATER_0_USES_AD595
 #endif

+ 11 - 0
Firmware/Marlin_main.cpp

@@ -4523,6 +4523,17 @@ Sigma_Exit:
         SERIAL_PROTOCOL(getHeaterPower(-1));
       #endif
 
+#ifdef PINDA_THERMISTOR
+		SERIAL_PROTOCOLPGM(" P:");
+		SERIAL_PROTOCOL_F(current_temperature_pinda,1);
+#endif //PINDA_THERMISTOR
+
+#ifdef AMBIENT_THERMISTOR
+		SERIAL_PROTOCOLPGM(" A:");
+		SERIAL_PROTOCOL_F(current_temperature_ambient,1);
+#endif //AMBIENT_THERMISTOR
+
+
         #ifdef SHOW_TEMP_ADC_VALUES
           {float raw = 0.0;
 

+ 23 - 1
Firmware/temperature.cpp

@@ -183,6 +183,7 @@ static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
 
 static float analog2temp(int raw, uint8_t e);
 static float analog2tempBed(int raw);
+static float analog2tempAmbient(int raw);
 static void updateTemperaturesFromRawValues();
 
 enum TempRunawayStates
@@ -867,6 +868,27 @@ static float analog2tempBed(int raw) {
   #endif
 }
 
+static float analog2tempAmbient(int raw)
+{
+    float celsius = 0;
+    byte i;
+
+    for (i=1; i<AMBIENTTEMPTABLE_LEN; i++)
+    {
+      if (PGM_RD_W(AMBIENTTEMPTABLE[i][0]) > raw)
+      {
+        celsius  = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]) + 
+          (raw - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0])) * 
+          (float)(PGM_RD_W(AMBIENTTEMPTABLE[i][1]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][1])) /
+          (float)(PGM_RD_W(AMBIENTTEMPTABLE[i][0]) - PGM_RD_W(AMBIENTTEMPTABLE[i-1][0]));
+        break;
+      }
+    }
+    // Overflow: Set to last value in the table
+    if (i == AMBIENTTEMPTABLE_LEN) celsius = PGM_RD_W(AMBIENTTEMPTABLE[i-1][1]);
+    return celsius;
+}
+
 /* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
     and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */
 static void updateTemperaturesFromRawValues()
@@ -881,7 +903,7 @@ static void updateTemperaturesFromRawValues()
 #endif
 
 #ifdef AMBIENT_THERMISTOR
-	current_temperature_ambient = analog2tempBed(current_temperature_raw_ambient); //thermistor for ambient is the same as for bed
+	current_temperature_ambient = analog2tempAmbient(current_temperature_raw_ambient); //thermistor for ambient is NTCG104LH104JT1 (2000)
 #endif
    
 	current_temperature_bed = analog2tempBed(current_temperature_bed_raw);

+ 46 - 0
Firmware/thermistortables.h

@@ -1211,6 +1211,47 @@ const short temptable_1047[][2] PROGMEM = {
 };
 #endif
 
+#if (THERMISTORAMBIENT == 2000) //100k thermistor NTCG104LH104JT1
+const short temptable_2000[][2] PROGMEM = {
+// Source: https://product.tdk.com/info/en/catalog/datasheets/503021/tpd_ntc-thermistor_ntcg_en.pdf
+// Calculated using 4.7kohm pullup, voltage divider math, and manufacturer provided temp/resistance
+{305*OVERSAMPLENR, 125},
+{338*OVERSAMPLENR, 120},
+{374*OVERSAMPLENR, 115},
+{412*OVERSAMPLENR, 110},
+{452*OVERSAMPLENR, 105},
+{494*OVERSAMPLENR, 100},
+{536*OVERSAMPLENR, 95},
+{580*OVERSAMPLENR, 90},
+{623*OVERSAMPLENR, 85},
+{665*OVERSAMPLENR, 80},
+{706*OVERSAMPLENR, 75},
+{744*OVERSAMPLENR, 70},
+{780*OVERSAMPLENR, 65},
+{813*OVERSAMPLENR, 60},
+{843*OVERSAMPLENR, 55},
+{869*OVERSAMPLENR, 50},
+{892*OVERSAMPLENR, 45},
+{912*OVERSAMPLENR, 40},
+{929*OVERSAMPLENR, 35},
+{943*OVERSAMPLENR, 30},
+{955*OVERSAMPLENR, 25},
+{965*OVERSAMPLENR, 20},
+{973*OVERSAMPLENR, 15},
+{979*OVERSAMPLENR, 10},
+{984*OVERSAMPLENR, 5},
+{988*OVERSAMPLENR, 0},
+{991*OVERSAMPLENR, -5},
+{993*OVERSAMPLENR, -10},
+{995*OVERSAMPLENR, -15},
+{996*OVERSAMPLENR, -20},
+{997*OVERSAMPLENR, -25},
+{998*OVERSAMPLENR, -30},
+{999*OVERSAMPLENR, -35},
+{999*OVERSAMPLENR, -40},
+};
+#endif
+
 #define _TT_NAME(_N) temptable_ ## _N
 #define TT_NAME(_N) _TT_NAME(_N)
 
@@ -1292,6 +1333,11 @@ const short temptable_1047[][2] PROGMEM = {
 # endif // BED_USES_THERMISTOR
 #endif
 
+#ifdef THERMISTORAMBIENT
+# define AMBIENTTEMPTABLE TT_NAME(THERMISTORAMBIENT)
+# define AMBIENTTEMPTABLE_LEN (sizeof(AMBIENTTEMPTABLE)/sizeof(*AMBIENTTEMPTABLE))
+#endif
+
 //Set the high and low raw values for the heater, this indicates which raw value is a high or low temperature
 #ifndef HEATER_BED_RAW_HI_TEMP
 # ifdef BED_USES_THERMISTOR   //In case of a thermistor the highest temperature results in the lowest ADC value

+ 2 - 2
Firmware/variants/1_75mm_MK3-EINY03-E3Dv6full.h

@@ -32,7 +32,7 @@
 
 // Steps per unit {X,Y,Z,E}
 //#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,140}
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,280}
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,280} //Extruder motor changed back to 200step type
 
 // Endstop inverting
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -104,7 +104,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 
 #define TMC2130_USTEPS_XY   16        // microstep resolution for XY axes
 #define TMC2130_USTEPS_Z    16        // microstep resolution for Z axis
-#define TMC2130_USTEPS_E    16        // microstep resolution for E axis
+#define TMC2130_USTEPS_E    32        // microstep resolution for E axis (increased from 16 to 32)
 #define TMC2130_INTPOL_XY   1         // extrapolate 256 for XY axes
 #define TMC2130_INTPOL_Z    1         // extrapolate 256 for Z axis
 #define TMC2130_INTPOL_E    1         // extrapolate 256 for E axis

+ 2 - 2
Firmware/variants/1_75mm_MK3-EINY04-E3Dv6full.h

@@ -32,7 +32,7 @@
 
 // Steps per unit {X,Y,Z,E}
 //#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,140}
-#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,280}
+#define DEFAULT_AXIS_STEPS_PER_UNIT   {100,100,3200/8,280} //Extruder motor changed back to 200step type
 
 // Endstop inverting
 const bool X_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic of the endstop.
@@ -104,7 +104,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
 
 #define TMC2130_USTEPS_XY   16        // microstep resolution for XY axes
 #define TMC2130_USTEPS_Z    16        // microstep resolution for Z axis
-#define TMC2130_USTEPS_E    16        // microstep resolution for E axis
+#define TMC2130_USTEPS_E    32        // microstep resolution for E axis (increased from 16 to 32)
 #define TMC2130_INTPOL_XY   1         // extrapolate 256 for XY axes
 #define TMC2130_INTPOL_Z    1         // extrapolate 256 for Z axis
 #define TMC2130_INTPOL_E    1         // extrapolate 256 for E axis