From fac34c12d7b6e8e5b516cd24b50127129a1409c7 Mon Sep 17 00:00:00 2001 From: kliment Date: Wed, 6 Jul 2011 12:37:30 +0200 Subject: Refactored analog to temp and temp to analog to not make distinction between hotend and bed. Changed both to return integers rather than floats. --- Sprinter/Sprinter.h | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'Sprinter/Sprinter.h') diff --git a/Sprinter/Sprinter.h b/Sprinter/Sprinter.h index 4e3c7ea..1a324a0 100644 --- a/Sprinter/Sprinter.h +++ b/Sprinter/Sprinter.h @@ -8,10 +8,31 @@ void process_commands(); void manage_inactivity(byte debug); void manage_heater(); -float temp2analog(int celsius); -float temp2analogBed(int celsius); -float analog2temp(int raw); -float analog2tempBed(int raw); +int temp2analogu(int celsius, const short table[][2], int numtemps, int source); +int analog2tempu(int raw, const short table[][2], int numtemps, int source); +#ifdef HEATER_USES_THERMISTOR + #define HEATERSOURCE 1 +#endif +#ifdef HEATER_USES_AD595 + #define HEATERSOURCE 2 +#endif +#ifdef HEATER_USES_MAX6675 + #define HEATERSOURCE 3 +#endif +#ifdef BED_USES_THERMISTOR + #define BEDSOURCE 1 +#endif +#ifdef BED_USES_AD595 + #define BEDSOURCE 2 +#endif +#ifdef BED_USES_MAX6675 + #define BEDSOURCE 3 +#endif + +#define temp2analogh( c ) temp2analogu((c),temptable,NUMTEMPS,HEATERSOURCE) +#define temp2analogBed( c ) temp2analogu((c),bedtemptable,BNUMTEMPS,BEDSOURCE) +#define analog2temp( c ) analog2tempu((c),temptable,NUMTEMPS,HEATERSOURCE) +#define analog2tempBed( c ) analog2tempu((c),bedtemptable,BNUMTEMPS,BEDSOURCE) void FlushSerialRequestResend(); void ClearToSend(); -- cgit v1.2.1