From dd3086d3f22337fd144672b85344d40777073ade Mon Sep 17 00:00:00 2001 From: Alex Borro Date: Sat, 12 Oct 2013 10:41:23 -0300 Subject: [PATCH] Show Temperature ADC values If "SHOW_TEMP_ADC_VALUES" is defined in Configuration_adv.h, the M105 command will present, after tradicional temperatures, the ADC value read from temp sensors. This is great for adjusting thermistor tables with thermocouple. From Pronterface you can see the ADC value and compare with a thermocouple reading.. then you just need to create your own thermistor table. Since this merge doesnt change the original information, it doesnt mess with PC software parsing (tested under Pronterface and Repetier-Host). --- Marlin/Configuration_adv.h | 4 ++++ Marlin/Marlin_main.cpp | 17 +++++++++++++++++ Marlin/temperature.h | 14 ++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 23ca5efec8..220458d918 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -40,6 +40,10 @@ #define AUTOTEMP_OLDWEIGHT 0.98 #endif +//Show Temperature ADC value +//The M105 command return, besides traditional information, the ADC value read from temperature sensors. +//#define SHOW_TEMP_ADC_VALUES + // extruder run-out prevention. //if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded //#define EXTRUDER_RUNOUT_PREVENT diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 932af13552..dc7edd0a5c 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1570,6 +1570,23 @@ void process_commands() SERIAL_PROTOCOLPGM(" B@:"); SERIAL_PROTOCOL(getHeaterPower(-1)); + #ifdef SHOW_TEMP_ADC_VALUES + #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1 + SERIAL_PROTOCOLPGM(" ADC B:"); + SERIAL_PROTOCOL_F(degBed(),1); + SERIAL_PROTOCOLPGM("C->"); + SERIAL_PROTOCOL_F(rawBedTemp()/OVERSAMPLENR,0); + #endif + for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) { + SERIAL_PROTOCOLPGM(" T"); + SERIAL_PROTOCOL(cur_extruder); + SERIAL_PROTOCOLPGM(":"); + SERIAL_PROTOCOL_F(degHotend(cur_extruder),1); + SERIAL_PROTOCOLPGM("C->"); + SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0); + } + #endif + SERIAL_PROTOCOLLN(""); return; break; diff --git a/Marlin/temperature.h b/Marlin/temperature.h index a5974241c4..1bf47e02ed 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -35,6 +35,10 @@ void manage_heater(); //it is critical that this is called periodically. // do not use these routines and variables outside of temperature.cpp extern int target_temperature[EXTRUDERS]; extern float current_temperature[EXTRUDERS]; +#ifdef SHOW_TEMP_ADC_VALUES + extern int current_temperature_raw[EXTRUDERS]; + extern int current_temperature_bed_raw; +#endif extern int target_temperature_bed; extern float current_temperature_bed; #ifdef TEMP_SENSOR_1_AS_REDUNDANT @@ -66,6 +70,16 @@ FORCE_INLINE float degHotend(uint8_t extruder) { return current_temperature[extruder]; }; +#ifdef SHOW_TEMP_ADC_VALUES + FORCE_INLINE float rawHotendTemp(uint8_t extruder) { + return current_temperature_raw[extruder]; + }; + + FORCE_INLINE float rawBedTemp() { + return current_temperature_bed_raw; + }; +#endif + FORCE_INLINE float degBed() { return current_temperature_bed; };