From 5ff5cee8cee0edd2f23c4900dada506c72f4e37b Mon Sep 17 00:00:00 2001 From: daid303 Date: Tue, 11 Dec 2012 14:53:53 +0100 Subject: [PATCH] Fix the sensitive pin definitions, there where analogue numbers in the digital pin list. Also made M42 without a P function on the LED_PIN (which was otherwise a useless pin definition) --- Marlin/Configuration.h | 2 +- Marlin/Marlin_main.cpp | 26 ++++++++++++-------------- Marlin/language.h | 2 ++ Marlin/pins.h | 4 ++-- Marlin/temperature.cpp | 18 +++++++++--------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 842b060640..9aa2e0d499 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -43,7 +43,7 @@ // 70 = Megatronics // 90 = Alpha OMCA board // 91 = Final OMCA board -// Rambo = 301 +// 301 = Rambo #ifndef MOTHERBOARD #define MOTHERBOARD 7 diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 03b7c49a32..1586ace080 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -956,25 +956,23 @@ void process_commands() if (code_seen('S')) { int pin_status = code_value(); + int pin_number = LED_PIN; if (code_seen('P') && pin_status >= 0 && pin_status <= 255) + pin_number = code_value(); + for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++) { - int pin_number = code_value(); - for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++) + if (sensitive_pins[i] == pin_number) { - if (sensitive_pins[i] == pin_number) - { - pin_number = -1; - break; - } - } - - if (pin_number > -1) - { - pinMode(pin_number, OUTPUT); - digitalWrite(pin_number, pin_status); - analogWrite(pin_number, pin_status); + pin_number = -1; + break; } } + if (pin_number > -1) + { + pinMode(pin_number, OUTPUT); + digitalWrite(pin_number, pin_status); + analogWrite(pin_number, pin_status); + } } break; case 104: // M104 diff --git a/Marlin/language.h b/Marlin/language.h index 4894121a31..44bd0f0c13 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -16,7 +16,9 @@ // 7 Italian // 8 Portuguese +#ifndef LANGUAGE_CHOICE #define LANGUAGE_CHOICE 1 // Pick your language from the list above +#endif #define PROTOCOL_VERSION "1.0" diff --git a/Marlin/pins.h b/Marlin/pins.h index 8e9680b725..480784bc06 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -1505,8 +1505,8 @@ #define Z_MAX_PIN -1 #endif -#define SENSITIVE_PINS {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, LED_PIN, PS_ON_PIN, \ +#define SENSITIVE_PINS {0, 1, X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, PS_ON_PIN, \ HEATER_BED_PIN, FAN_PIN, \ _E0_PINS _E1_PINS _E2_PINS \ - TEMP_0_PIN, TEMP_1_PIN, TEMP_2_PIN, TEMP_BED_PIN } + analogInputToDigitalPin(TEMP_0_PIN), analogInputToDigitalPin(TEMP_1_PIN), analogInputToDigitalPin(TEMP_2_PIN), analogInputToDigitalPin(TEMP_BED_PIN) } #endif diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index e925456a4b..663ea679ea 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -117,7 +117,7 @@ static int maxttemp[EXTRUDERS] = ARRAY_BY_EXTRUDERS( 16383, 16383, 16383 ); static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; #endif static void *heater_ttbl_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( (void *)HEATER_0_TEMPTABLE, (void *)HEATER_1_TEMPTABLE, (void *)HEATER_2_TEMPTABLE ); -static int heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN ); +static uint8_t heater_ttbllen_map[EXTRUDERS] = ARRAY_BY_EXTRUDERS( HEATER_0_TEMPTABLE_LEN, HEATER_1_TEMPTABLE_LEN, HEATER_2_TEMPTABLE_LEN ); static float analog2temp(int raw, uint8_t e); static float analog2tempBed(int raw); @@ -493,7 +493,7 @@ static float analog2temp(int raw, uint8_t e) { if(heater_ttbl_map[e] != NULL) { float celsius = 0; - byte i; + uint8_t i; short (*tt)[][2] = (short (*)[][2])(heater_ttbl_map[e]); for (i=1; i raw) + if (PGM_RD_W(BEDTEMPTABLE[i][0]) > raw) { - celsius = PGM_RD_W(bedtemptable[i-1][1]) + - (raw - PGM_RD_W(bedtemptable[i-1][0])) * - (float)(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) / - (float)(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0])); + celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]) + + (raw - PGM_RD_W(BEDTEMPTABLE[i-1][0])) * + (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i-1][1])) / + (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i-1][0])); break; } } // Overflow: Set to last value in the table - if (i == bedtemptable_len) celsius = PGM_RD_W(bedtemptable[i-1][1]); + if (i == BEDTEMPTABLE_LEN) celsius = PGM_RD_W(BEDTEMPTABLE[i-1][1]); return celsius; #elif defined BED_USES_AD595