Browse Source

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)

pull/1/head
daid303 12 years ago
parent
commit
5ff5cee8ce
  1. 2
      Marlin/Configuration.h
  2. 26
      Marlin/Marlin_main.cpp
  3. 2
      Marlin/language.h
  4. 4
      Marlin/pins.h
  5. 18
      Marlin/temperature.cpp

2
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

26
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

2
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"

4
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

18
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<heater_ttbllen_map[e]; i++)
@ -523,20 +523,20 @@ static float analog2tempBed(int raw) {
float celsius = 0;
byte i;
for (i=1; i<bedtemptable_len; i++)
for (i=1; i<BEDTEMPTABLE_LEN; i++)
{
if (PGM_RD_W(bedtemptable[i][0]) > 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

Loading…
Cancel
Save