Commit fa734abf authored by MagoKimbra's avatar MagoKimbra

FIX ENABLED and DISABLED

parent 0fa71d48
......@@ -4,8 +4,8 @@
/*
* This configuration file contains mechanism settings for cartesian printer.
*
* - Core settings
* - Machine name
* - Core settings
* - Endstop pullup resistors
* - Endstops logic
* - Endstops min or max
......@@ -28,20 +28,6 @@
* Pins-settings can be found in "Configuration_Pins.h"
*/
/*****************************************************************************************
************************************* Core settings *************************************
/****************************************************************************************/
//This define the moltiplicator axis from X to Y or Z in COREXY or COREXZ.
//Example:
//COREXY set COREX_XZ_FACTOR 1
//The result is:
//X = dX + COREX_YZ_FACTOR * dY = dX + 1 * dY = dX + dY
//Y = dX - COREX_YZ_FACTOR * dY = dX - 1 * dY = dX - dY
//Z = dZ
#define COREX_YZ_FACTOR 1
/*****************************************************************************************/
/*****************************************************************************************
************************************* Machine name **************************************
*****************************************************************************************
......@@ -54,6 +40,27 @@
/*****************************************************************************************/
/*****************************************************************************************
************************************* Core settings *************************************
*****************************************************************************************
* This define the moltiplicator axis from X to Y or Z in COREXY or COREXZ. *
* Example: *
* COREXY set COREX_XZ_FACTOR 1 *
* The result is: *
* X = dX + COREX_YZ_FACTOR * dY = dX + 1 * dY = dX + dY *
* Y = dX - COREX_YZ_FACTOR * dY = dX - 1 * dY = dX - dY *
* Z = dZ *
* *
* COREXZ set COREX_XZ_FACTOR -3 *
* The result is: *
* X = dX + COREX_YZ_FACTOR * dZ = dX + -3 * dZ = dX - 3dZ *
* Y = dY *
* Z = dX - COREX_YZ_FACTOR * dZ = dX - -3 * dZ = dX + 3dZ *
******************************************************************************************/
#define COREX_YZ_FACTOR 1
/*****************************************************************************************/
/*****************************************************************************************
****************************** Endstop pullup resistors *********************************
*****************************************************************************************/
......
* Pins-settings can be found in "Configuration_Pins.h"#ifndef CONFIGURATION_MECHANISM
#ifndef CONFIGURATION_MECHANISM
#define CONFIGURATION_MECHANISM
#define KNOWN_MECH 1
/*
* This configuration file contains mechanism settings for cartesian printer.
*
* - Delta settings
* - Machine name
* - Delta settings
* - Endstop pullup resistors
* - Endstops logic
* - Endstops min or max
......@@ -29,6 +28,18 @@
* Pins-settings can be found in "Configuration_Pins.h"
*/
/*****************************************************************************************
************************************* Machine name **************************************
*****************************************************************************************
* *
* This to set a custom name for your generic Mendel. *
* Displayed in the LCD "Ready" message. *
* *
*****************************************************************************************/
#define CUSTOM_MACHINE_NAME "Prusa"
/*****************************************************************************************/
/*****************************************************************************************
******************************** Delta configuration ************************************
****************************************************************************************/
......@@ -96,18 +107,6 @@
/*****************************************************************************************/
/*****************************************************************************************
************************************* Machine name **************************************
*****************************************************************************************
* *
* This to set a custom name for your generic Mendel. *
* Displayed in the LCD "Ready" message. *
* *
*****************************************************************************************/
#define CUSTOM_MACHINE_NAME "Prusa"
/*****************************************************************************************/
/*****************************************************************************************
****************************** Endstop pullup resistors *********************************
*****************************************************************************************/
......@@ -228,6 +227,25 @@
/*****************************************************************************************/
/*****************************************************************************************
******************************** Manual home positions **********************************
/*****************************************************************************************
* *
* Manual Bed Leveling (MBL) or Auto Bed Leveling (ABL) settings *
* Set the rectangle in which to probe in MBL or ABL. *
* *
*****************************************************************************************/
// The position of the homing switches
#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 200 // Distance between nozzle and print surface after homing.
/*****************************************************************************************/
/*****************************************************************************************
************************************ Travel limits **************************************
*****************************************************************************************
......@@ -252,25 +270,6 @@
/*****************************************************************************************/
/*****************************************************************************************
******************************** Manual home positions **********************************
/*****************************************************************************************
* *
* Manual Bed Leveling (MBL) or Auto Bed Leveling (ABL) settings *
* Set the rectangle in which to probe in MBL or ABL. *
* *
*****************************************************************************************/
// The position of the homing switches
#define MANUAL_HOME_POSITIONS // If defined, MANUAL_*_HOME_POS below will be used
#define BED_CENTER_AT_0_0 // If defined, the center of the bed is at (X=0, Y=0)
//Manual homing switch locations:
#define MANUAL_X_HOME_POS 0
#define MANUAL_Y_HOME_POS 0
#define MANUAL_Z_HOME_POS 200 // Distance between nozzle and print surface after homing.
/*****************************************************************************************/
/*****************************************************************************************
******************************* Axis steps per unit *************************************
*****************************************************************************************/
......
......@@ -58,17 +58,17 @@
#define TEMP_BED_PIN ORIG_TEMP_BED_PIN
//FAN pin
#define FAN_PIN ORIG_FAN_PIN
#define FAN_PIN ORIG_FAN_PIN
//============================================================================
//==================================================================
//=========================== FEATURE ==============================
#if ENABLED(MKR4)
#define E0E1_CHOICE_PIN -1
#define E0E2_CHOICE_PIN -1
#define E0E3_CHOICE_PIN -1
#define E1E3_CHOICE_PIN -1
#define E0E1_CHOICE_PIN -1
#define E0E2_CHOICE_PIN -1
#define E0E3_CHOICE_PIN -1
#define E1E3_CHOICE_PIN -1
#endif //MKR4
#if ENABLED(NPR2)
......@@ -113,13 +113,17 @@
#if ENABLED(X2_IS_TMC)
#define X2_ENABLE_PIN -1
#define X2_STEP_PIN -1
#define X2_DIR_PIN -1
#define X2_STEP_PIN -1
#define X2_DIR_PIN -1
#endif
#if ENABLED(Z_PROBE_SLED)
#define SLED_PIN -1
#define SLED_PIN -1
#endif
//============================================================================
#if ENABLED(Z_PROBE_ENDSTOP)
#define Z_PROBE_PIN -1
#endif
//====================================================================
#endif
\ No newline at end of file
......@@ -5,8 +5,8 @@
/*
* This configuration file contains mechanism settings for cartesian printer.
*
* - Scara settings
* - Machine name
* - Scara settings
* - Endstop pullup resistors
* - Endstops logic
* - Endstops min or max
......@@ -29,6 +29,18 @@
* Pins-settings can be found in "Configuration_Pins.h"
*/
/*****************************************************************************************
************************************* Machine name **************************************
*****************************************************************************************
* *
* This to set a custom name for your generic Mendel. *
* Displayed in the LCD "Ready" message. *
* *
*****************************************************************************************/
#define CUSTOM_MACHINE_NAME "Scara"
/*****************************************************************************************/
/*****************************************************************************************
************************************* Scara settings *************************************
/****************************************************************************************/
......@@ -54,18 +66,6 @@
/*****************************************************************************************/
/*****************************************************************************************
************************************* Machine name **************************************
*****************************************************************************************
* *
* This to set a custom name for your generic Mendel. *
* Displayed in the LCD "Ready" message. *
* *
*****************************************************************************************/
#define CUSTOM_MACHINE_NAME "Scara"
/*****************************************************************************************/
/*****************************************************************************************
****************************** Endstop pullup resistors *********************************
*****************************************************************************************/
......
......@@ -816,7 +816,7 @@ void setup() {
ECHO_LM(DB, MSG_MARLIN " " BUILD_VERSION);
#if EXIST(STRING_DISTRIBUTION_DATE) && EXIST(STRING_CONFIG_H_AUTHOR)
#if ENABLED(STRING_DISTRIBUTION_DATE) && ENABLED(STRING_CONFIG_H_AUTHOR)
ECHO_LM(DB, MSG_CONFIGURATION_VER STRING_DISTRIBUTION_DATE MSG_AUTHOR STRING_CONFIG_H_AUTHOR);
ECHO_LM(DB, MSG_COMPILED __DATE__);
#endif // STRING_DISTRIBUTION_DATE
......@@ -946,7 +946,7 @@ void get_command() {
if (drain_queued_commands_P()) return; // priority is given to non-serial commands
#if EXIST(NO_TIMEOUTS)
#if ENABLED(NO_TIMEOUTS)
static millis_t last_command_time = 0;
millis_t ms = millis();
......@@ -961,7 +961,7 @@ void get_command() {
//
while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
#if EXIST(NO_TIMEOUTS)
#if ENABLED(NO_TIMEOUTS)
last_command_time = ms;
#endif
......@@ -3744,7 +3744,8 @@ inline void gcode_G28() {
clean_up_after_endstop_move();
// solve lsq problem
double *plane_equation_coefficients = qr_solve(abl2, 3, eqnAMatrix, eqnBVector);
double plane_equation_coefficients[3];
qr_solve(plane_equation_coefficients, abl2, 3, eqnAMatrix, eqnBVector);
if (verbose_level) {
ECHO_SMV(DB, "Eqn coefficients: a: ", plane_equation_coefficients[0], 8);
......@@ -3753,7 +3754,6 @@ inline void gcode_G28() {
}
if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
free(plane_equation_coefficients);
matrix_3x3 inverse_bed_level_matrix = matrix_3x3::transpose(plan_bed_level_matrix); // inverse bed level matrix
// In the special case of an rotation matrix "the inverse" = "the transposed" matrix.
......@@ -5157,14 +5157,14 @@ inline void gcode_M105() {
#endif
ECHO_M(" " MSG_AT);
#if EXIST(HOTEND_WATTS)
#if ENABLED(HOTEND_WATTS)
ECHO_VM((HOTEND_WATTS * getHeaterPower(target_extruder))/127, "W");
#else
ECHO_V(getHeaterPower(target_extruder));
#endif
ECHO_M(" " MSG_BAT);
#if EXIST(BED_WATTS)
#if ENABLED(BED_WATTS)
ECHO_VM((BED_WATTS * getHeaterPower(-1))/127, "W");
#else
ECHO_V(getHeaterPower(-1));
......@@ -6332,7 +6332,7 @@ inline void gcode_M503() {
//retract by E
if (code_seen('E')) destination[E_AXIS] += code_value();
#if EXIST(FILAMENTCHANGE_FIRSTRETRACT)
#if ENABLED(FILAMENTCHANGE_FIRSTRETRACT)
else destination[E_AXIS] += FILAMENTCHANGE_FIRSTRETRACT;
#endif
......@@ -6340,7 +6340,7 @@ inline void gcode_M503() {
//lift Z
if (code_seen('Z')) destination[Z_AXIS] += code_value();
#if EXIST(FILAMENTCHANGE_ZADD)
#if ENABLED(FILAMENTCHANGE_ZADD)
else destination[Z_AXIS] += FILAMENTCHANGE_ZADD;
#endif
......@@ -6348,19 +6348,19 @@ inline void gcode_M503() {
//move xy
if (code_seen('X')) destination[X_AXIS] = code_value();
#if EXIST(FILAMENTCHANGE_XPOS)
#if ENABLED(FILAMENTCHANGE_XPOS)
else destination[X_AXIS] = FILAMENTCHANGE_XPOS;
#endif
if (code_seen('Y')) destination[Y_AXIS] = code_value();
#if EXIST(FILAMENTCHANGE_YPOS)
#if ENABLED(FILAMENTCHANGE_YPOS)
else destination[Y_AXIS] = FILAMENTCHANGE_YPOS;
#endif
RUNPLAN
if (code_seen('L')) destination[E_AXIS] += code_value();
#if EXIST(FILAMENTCHANGE_FINALRETRACT)
#if ENABLED(FILAMENTCHANGE_FINALRETRACT)
else destination[E_AXIS] += FILAMENTCHANGE_FINALRETRACT;
#endif
......@@ -6425,7 +6425,7 @@ inline void gcode_M503() {
//return to normal
if (code_seen('L')) destination[E_AXIS] -= code_value();
#if EXIST(FILAMENTCHANGE_FINALRETRACT)
#if ENABLED(FILAMENTCHANGE_FINALRETRACT)
else destination[E_AXIS] -= FILAMENTCHANGE_FINALRETRACT;
#endif
......@@ -6613,13 +6613,13 @@ inline void gcode_M907() {
if (code_seen('B')) digipot_current(4, code_value());
if (code_seen('S')) for (int i=0; i<=4; i++) digipot_current(i, code_value());
#endif
#if EXIST(MOTOR_CURRENT_PWM_XY_PIN)
#if ENABLED(MOTOR_CURRENT_PWM_XY_PIN)
if (code_seen('X')) digipot_current(0, code_value());
#endif
#if EXIST(MOTOR_CURRENT_PWM_Z_PIN)
#if ENABLED(MOTOR_CURRENT_PWM_Z_PIN)
if (code_seen('Z')) digipot_current(1, code_value());
#endif
#if EXIST(MOTOR_CURRENT_PWM_E_PIN)
#if ENABLED(MOTOR_CURRENT_PWM_E_PIN)
if (code_seen('E')) digipot_current(2, code_value());
#endif
#if ENABLED(DIGIPOT_I2C)
......
......@@ -19,4 +19,4 @@ void SendColors(byte red, byte grn, byte blu) {
Wire.endTransmission();
}
#endif
\ No newline at end of file
#endif
......@@ -8,4 +8,4 @@
void SendColors(byte red, byte grn, byte blu);
#endif
\ No newline at end of file
#endif
......@@ -69,4 +69,4 @@
#define MB(board) (MOTHERBOARD==BOARD_##board)
#endif
\ No newline at end of file
#endif
#include "base.h"
#if HAS(BUZZER)
......@@ -35,4 +34,4 @@ void buzz(long duration, uint16_t freq) {
delay(duration);
}
}
#endif
\ No newline at end of file
#endif
#include "base.h"
#if ENABLED(SDSUPPORT)
......@@ -664,4 +663,4 @@ void CardReader::printingHasFinished() {
autotempShutdown();
}
}
#endif
\ No newline at end of file
#endif
......@@ -108,11 +108,11 @@
#define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
#define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
#if NOTEXIST(ENCODER_PULSES_PER_STEP)
#if DISABLED(ENCODER_PULSES_PER_STEP)
#define ENCODER_PULSES_PER_STEP 4
#endif
#if NOTEXIST(ENCODER_STEPS_PER_MENU_ITEM)
#if DISABLED(ENCODER_STEPS_PER_MENU_ITEM)
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
......@@ -204,7 +204,7 @@
/**
* Default LCD contrast for dogm-like LCD displays
*/
#if ENABLED(DOGLCD) && NOTEXIST(DEFAULT_LCD_CONTRAST)
#if ENABLED(DOGLCD) && DISABLED(DEFAULT_LCD_CONTRAST)
#define DEFAULT_LCD_CONTRAST 32
#endif
......@@ -429,7 +429,7 @@
* Power Signal Control Definitions
* By default use Normal definition
*/
#if NOTEXIST(POWER_SUPPLY)
#if DISABLED(POWER_SUPPLY)
#define POWER_SUPPLY 0
#endif
#if (POWER_SUPPLY == 1) // 1 = ATX
......@@ -580,7 +580,7 @@
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_PROBE (PIN_EXISTS(Z_PROBE))
#define HAS_Z_PROBE (ENABLED(Z_PROBE_ENDSTOP) && PIN_EXISTS(Z_PROBE))
#define HAS_E_MIN (PIN_EXISTS(E_MIN))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
......@@ -627,6 +627,7 @@
#define HAS_E1E3 (PIN_EXISTS(E1E3_CHOICE))
#define HAS_BTN_BACK (PIN_EXISTS(BTN_BACK))
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON))
#define HAS_MOTOR_CURRENT_PWM_XY (PIN_EXISTS(MOTOR_CURRENT_PWM_XY))
#define HAS_DIGIPOTSS (DIGIPOTSS_PIN >= 0)
......
......@@ -1327,7 +1327,7 @@
* *
***********************************************************************/
//#define STEPPER_HIGH_LOW
//#define STEPPER_HIGH_LOW_DELAY 1u // Delay in microseconds
#define STEPPER_HIGH_LOW_DELAY 1u // Delay in microseconds
/***********************************************************************/
......
......@@ -23,7 +23,7 @@
// 13 Basque-Euskera
// 14 Portuguese (Brazil)
#if NOTEXIST(LANGUAGE_CHOICE)
#if DISABLED(LANGUAGE_CHOICE)
#define LANGUAGE_CHOICE 7 // Pick your language from the list above
#endif
......@@ -45,20 +45,20 @@
#elif MB(SAV_MKI)
#define MACHINE_NAME "SAV MkI"
#define SOURCE_CODE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config"
#elif NOTEXIST(MACHINE_NAME)
#elif DISABLED(MACHINE_NAME)
#define MACHINE_NAME "3D Printer"
#endif
#if EXIST(CUSTOM_MACHINE_NAME)
#if ENABLED(CUSTOM_MACHINE_NAME)
#undef MACHINE_NAME
#define MACHINE_NAME CUSTOM_MACHINE_NAME
#endif
#if NOTEXIST(SOURCE_CODE_URL)
#if DISABLED(SOURCE_CODE_URL)
#define SOURCE_CODE_URL "https://github.com/MagoKimbra/MarlinKimbra"
#endif
#if NOTEXIST(BUILD_VERSION)
#if DISABLED(BUILD_VERSION)
#define BUILD_VERSION "V4; MarlinKimbra for 4 extruder"
#endif
......
......@@ -14,14 +14,8 @@
#define COS_60 0.5
// Macros to support option testing
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_0 0
#define SWITCH_ENABLED_1 1
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
#define EXIST defined
#define NOTEXIST !defined
#define ENABLED defined
#define DISABLED !defined
#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define HAS(FE) (HAS_##FE)
#define HASNT(FE) (!(HAS_##FE))
......
......@@ -258,7 +258,7 @@ double r8mat_amax ( int m, int n, double a[] )
return value;
}
double *r8mat_copy_new ( int m, int n, double a1[] )
void r8mat_copy( double a2[], int m, int n, double a1[] )
/******************************************************************************/
/*
......@@ -292,12 +292,9 @@ double *r8mat_copy_new ( int m, int n, double a1[] )
Output, double R8MAT_COPY_NEW[M*N], the copy of A1.
*/
{
double *a2;
int i;
int j;
a2 = ( double * ) malloc ( m * n * sizeof ( double ) );
for ( j = 0; j < n; j++ )
{
for ( i = 0; i < m; i++ )
......@@ -305,8 +302,6 @@ double *r8mat_copy_new ( int m, int n, double a1[] )
a2[i+j*m] = a1[i+j*m];
}
}
return a2;
}
/******************************************************************************/
......@@ -724,14 +719,13 @@ void dqrank ( double a[], int lda, int m, int n, double tol, int *kr,
int j;
int job;
int k;
double *work;
double work[n];
for ( i = 0; i < n; i++ )
{
jpvt[i] = 0;
}
work = ( double * ) malloc ( n * sizeof ( double ) );
job = 1;
dqrdc ( a, lda, m, n, qraux, jpvt, work, job );
......@@ -748,8 +742,6 @@ void dqrank ( double a[], int lda, int m, int n, double tol, int *kr,
*kr = j + 1;
}
free ( work );
return;
}
/******************************************************************************/
......@@ -1843,7 +1835,7 @@ void dswap ( int n, double x[], int incx, double y[], int incy )
/******************************************************************************/
double *qr_solve ( int m, int n, double a[], double b[] )
void qr_solve ( double x[], int m, int n, double a[], double b[] )
/******************************************************************************/
/*
......@@ -1893,34 +1885,22 @@ double *qr_solve ( int m, int n, double a[], double b[] )
Output, double QR_SOLVE[N], the least squares solution.
*/
{
double *a_qr;
double a_qr[n*m];
int ind;
int itask;
int *jpvt;
int jpvt[n];
int kr;
int lda;
double *qraux;
double *r;
double qraux[n];
double r[m];
double tol;
double *x;
a_qr = r8mat_copy_new ( m, n, a );
r8mat_copy( a_qr, m, n, a );
lda = m;
tol = r8_epsilon ( ) / r8mat_amax ( m, n, a_qr );
x = ( double * ) malloc ( n * sizeof ( double ) );
jpvt = ( int * ) malloc ( n * sizeof ( int ) );
qraux = ( double * ) malloc ( n * sizeof ( double ) );
r = ( double * ) malloc ( m * sizeof ( double ) );
itask = 1;
ind = dqrls ( a_qr, lda, m, n, tol, &kr, b, x, r, jpvt, qraux, itask );
free ( a_qr );
free ( jpvt );
free ( qraux );
free ( r );
return x;
}
/******************************************************************************/
......
#if ENABLED(AUTO_BED_LEVELING_GRID)
#ifndef QR_SOLVE_H
#define QR_SOLVE_H
......@@ -16,6 +18,7 @@ int dqrsl ( double a[], int lda, int n, int k, double qraux[], double y[],
double qy[], double qty[], double b[], double rsd[], double ab[], int job );
void dscal ( int n, double sa, double x[], int incx );
void dswap ( int n, double x[], int incx, double y[], int incy );
double *qr_solve ( int m, int n, double a[], double b[] );
void qr_solve ( double x[], int m, int n, double a[], double b[] );
#endif
#endif
\ No newline at end of file
This diff is collapsed.
......@@ -613,7 +613,7 @@ ISR(TIMER1_COMPA_vect) {
if (cleaning_buffer_counter) {
current_block = NULL;
plan_discard_current_block();
#if EXIST(SD_FINISHED_RELEASECOMMAND)
#if ENABLED(SD_FINISHED_RELEASECOMMAND)
if ((cleaning_buffer_counter == 1) && (SD_FINISHED_STEPPERRELEASE)) enqueuecommands_P(PSTR(SD_FINISHED_RELEASECOMMAND));
#endif
cleaning_buffer_counter--;
......@@ -1017,7 +1017,7 @@ void st_init() {
#endif
#endif
#if HAS(Z_PROBE) && ENABLED(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
#if HAS(Z_PROBE) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
SET_INPUT(Z_PROBE_PIN);
#if ENABLED(ENDSTOPPULLUP_ZPROBE)
WRITE(Z_PROBE_PIN,HIGH);
......@@ -1282,7 +1282,7 @@ void digipot_init() {
digipot_current(i,digipot_motor_current[i]);
}
#endif
#if ENABLED(MOTOR_CURRENT_PWM_XY_PIN)
#if HAS(MOTOR_CURRENT_PWM_XY)
pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT);
pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT);
pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT);
......@@ -1308,7 +1308,7 @@ void digipot_current(uint8_t driver, int current) {
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
digitalPotWrite(digipot_ch[driver], current);
#endif
#if ENABLED(MOTOR_CURRENT_PWM_XY_PIN)
#if HAS(MOTOR_CURRENT_PWM_XY)
switch(driver) {
case 0: analogWrite(MOTOR_CURRENT_PWM_XY_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
case 1: analogWrite(MOTOR_CURRENT_PWM_Z_PIN, 255L * current / MOTOR_CURRENT_PWM_RANGE); break;
......
......@@ -44,7 +44,7 @@
//================================== macros =================================
//===========================================================================
#if EXIST(K1) // Defined in Configuration.h in the PID settings
#if ENABLED(K1) // Defined in Configuration.h in the PID settings
#define K2 (1.0 - K1)
#endif
......@@ -168,10 +168,10 @@ static int minttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_LO_TEMP , HEAT
static int maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS( HEATER_0_RAW_HI_TEMP , HEATER_1_RAW_HI_TEMP , HEATER_2_RAW_HI_TEMP, HEATER_3_RAW_HI_TEMP);
static int minttemp[HOTENDS] = { 0 };
static int maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1( 16383 );
#if EXIST(BED_MINTEMP)
#if ENABLED(BED_MINTEMP)
static int bed_minttemp_raw = HEATER_BED_RAW_LO_TEMP;
#endif
#if EXIST(BED_MAXTEMP)
#if ENABLED(BED_MAXTEMP)
static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP;
#endif
......@@ -893,7 +893,7 @@ static void updateTemperaturesFromRawValues() {
float raw_analog2voltage() {
return (5.0 * current_raw_powconsumption) / (1023 * OVERSAMPLENR);
}
float analog2voltage() {
float power_zero_raw = (POWER_ZERO * 1023 * OVERSAMPLENR) / 5.0;
float rel_raw_power = (current_raw_powconsumption < power_zero_raw) ? (2 * power_zero_raw - current_raw_powconsumption) : (current_raw_powconsumption);
......@@ -907,7 +907,7 @@ static void updateTemperaturesFromRawValues() {
float analog2power() {
return (analog2current() * POWER_VOLTAGE * 100) / POWER_EFFICIENCY;
}
float analog2error(float current) {
float temp1 = (analog2voltage() / POWER_SENSITIVITY - POWER_OFFSET) * POWER_VOLTAGE;
if(temp1 <= 0) return 0.0;
......@@ -1156,6 +1156,7 @@ void tp_init() {
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED)
void thermal_runaway_protection(TRState *state, millis_t *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc) {
static float tr_last_temperature = 0.0;
static float tr_target_temperature[HOTENDS + 1] = { 0.0 };
/*
ECHO_SM(DB, "Thermal Thermal Runaway Running. Heater ID: ");
......@@ -1180,6 +1181,7 @@ void tp_init() {
// Inactive state waits for a target temperature to be set
case TRInactive: {
if (target_temperature > 0) {
tr_last_temperature = temperature;
tr_target_temperature[heater_index] = target_temperature;
*timer = millis();
*state = TRFirstHeating;
......@@ -1190,6 +1192,11 @@ void tp_init() {
// If the heater takes too long to reach the target temperature the sistem will be halt.
case TRFirstHeating: {
if (temperature >= tr_target_temperature[heater_index]) *state = TRStable;
else if (temperature == tr_last_temperature) {
if (millis() > *timer + period_seconds * 1000UL) {
*state = TRRunaway;
}
}
else {
*timer = millis();
}
......
......@@ -1080,7 +1080,7 @@ const short temptable_1047[][2] PROGMEM = {
#define _TT_NAME(_N) temptable_ ## _N
#define TT_NAME(_N) _TT_NAME(_N)
#if EXIST(THERMISTORHEATER_0)
#if ENABLED(THERMISTORHEATER_0)
#define HEATER_0_TEMPTABLE TT_NAME(THERMISTORHEATER_0)
#define HEATER_0_TEMPTABLE_LEN COUNT(HEATER_0_TEMPTABLE)
#else
......@@ -1093,7 +1093,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
//Set the high and low raw values for the heater,this indicates which raw value is a high or low temperature
#if NOTEXIST(HEATER_0_RAW_HI_TEMP)
#if DISABLED(HEATER_0_RAW_HI_TEMP)
#if ENABLED(HEATER_0_USES_THERMISTOR) //In case of a thermistor the highest temperature results in the lowest ADC value
#define HEATER_0_RAW_HI_TEMP 0
#define HEATER_0_RAW_LO_TEMP 16383
......@@ -1103,7 +1103,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
#endif
#if EXIST(THERMISTORHEATER_1)
#if ENABLED(THERMISTORHEATER_1)
#define HEATER_1_TEMPTABLE TT_NAME(THERMISTORHEATER_1)
#define HEATER_1_TEMPTABLE_LEN COUNT(HEATER_1_TEMPTABLE)
#else
......@@ -1116,7 +1116,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
//Set the high and low raw values for the heater,this indicates which raw value is a high or low temperature
#if NOTEXIST(HEATER_1_RAW_HI_TEMP)
#if DISABLED(HEATER_1_RAW_HI_TEMP)
#if ENABLED(HEATER_1_USES_THERMISTOR) //In case of a thermistor the highest temperature results in the lowest ADC value
#define HEATER_1_RAW_HI_TEMP 0
#define HEATER_1_RAW_LO_TEMP 16383
......@@ -1126,7 +1126,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
#endif
#if EXIST(THERMISTORHEATER_2)
#if ENABLED(THERMISTORHEATER_2)
#define HEATER_2_TEMPTABLE TT_NAME(THERMISTORHEATER_2)
#define HEATER_2_TEMPTABLE_LEN COUNT(HEATER_2_TEMPTABLE)
#else
......@@ -1139,7 +1139,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
//Set the high and low raw values for the heater,this indicates which raw value is a high or low temperature
#if NOTEXIST(HEATER_2_RAW_HI_TEMP)
#if DISABLED(HEATER_2_RAW_HI_TEMP)
#if ENABLED(HEATER_2_USES_THERMISTOR) //In case of a thermistor the highest temperature results in the lowest ADC value
#define HEATER_2_RAW_HI_TEMP 0
#define HEATER_2_RAW_LO_TEMP 16383
......@@ -1149,7 +1149,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
#endif
#if EXIST(THERMISTORHEATER_3)
#if ENABLED(THERMISTORHEATER_3)
#define HEATER_3_TEMPTABLE TT_NAME(THERMISTORHEATER_3)
#define HEATER_3_TEMPTABLE_LEN COUNT(HEATER_3_TEMPTABLE)
#else
......@@ -1162,7 +1162,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
//Set the high and low raw values for the heater,this indicates which raw value is a high or low temperature
#if NOTEXIST(HEATER_3_RAW_HI_TEMP)
#if DISABLED(HEATER_3_RAW_HI_TEMP)
#if ENABLED(HEATER_3_USES_THERMISTOR) //In case of a thermistor the highest temperature results in the lowest ADC value
#define HEATER_3_RAW_HI_TEMP 0
#define HEATER_3_RAW_LO_TEMP 16383
......@@ -1172,7 +1172,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
#endif
#if EXIST(THERMISTORBED)
#if ENABLED(THERMISTORBED)
#define BEDTEMPTABLE TT_NAME(THERMISTORBED)
#define BEDTEMPTABLE_LEN COUNT(BEDTEMPTABLE)
#else
......@@ -1182,7 +1182,7 @@ const short temptable_1047[][2] PROGMEM = {
#endif
//Set the high and low raw values for the heater,this indicates which raw value is a high or low temperature
#if NOTEXIST(HEATER_BED_RAW_HI_TEMP)
#if DISABLED(HEATER_BED_RAW_HI_TEMP)
#if ENABLED(BED_USES_THERMISTOR) //In case of a thermistor the highest temperature results in the lowest ADC value
#define HEATER_BED_RAW_HI_TEMP 0
#define HEATER_BED_RAW_LO_TEMP 16383
......
......@@ -2,19 +2,25 @@
#include "base.h"
#if ENABLED(ULTRA_LCD)
#include "Marlin_main.h"
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#endif
#include "temperature.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h"
#endif
#include "planner.h"
#include "stepper_indirection.h"
#include "stepper.h"
#include "configuration_store.h"
#include "ultralcd.h"
#if HAS(BUZZER)
#include "buzzer.h"
#endif
......@@ -130,17 +136,17 @@ static void lcd_status_screen();
#define ENCODER_FEEDRATE_DEADZONE 10
#if DISABLED(LCD_I2C_VIKI)
#if NOTEXIST(ENCODER_STEPS_PER_MENU_ITEM)
#if DISABLED(ENCODER_STEPS_PER_MENU_ITEM)
#define ENCODER_STEPS_PER_MENU_ITEM 5
#endif
#if NOTEXIST(ENCODER_PULSES_PER_STEP)
#if DISABLED(ENCODER_PULSES_PER_STEP)
#define ENCODER_PULSES_PER_STEP 1
#endif
#else
#if NOTEXIST(ENCODER_STEPS_PER_MENU_ITEM)
#if DISABLED(ENCODER_STEPS_PER_MENU_ITEM)
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
#endif
#if NOTEXIST(ENCODER_PULSES_PER_STEP)
#if DISABLED(ENCODER_PULSES_PER_STEP)
#define ENCODER_PULSES_PER_STEP 1
#endif
#endif
......@@ -151,7 +157,7 @@ static void lcd_status_screen();
/**
* START_MENU generates the init code for a menu function
*/
#if EXIST(BTN_BACK) && BTN_BACK > 0
#if ENABLED(BTN_BACK) && BTN_BACK > 0
#define START_MENU(last_menu) do { \
encoderRateMultiplierEnabled = false; \
if (encoderPosition > 0x8000) encoderPosition = 0; \
......@@ -1945,7 +1951,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
* These values are independent of which pins are used for EN_A and EN_B indications
* The rotary encoder part is also independent to the chipset used for the LCD
*/
#if EXIST(EN_A) && EXIST(EN_B)
#if ENABLED(EN_A) && ENABLED(EN_B)
#define encrot0 0
#define encrot1 2
#define encrot2 3
......@@ -1969,7 +1975,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#if BTN_ENC > 0
millis_t ms = millis();
if (ms > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
#if EXIST(BTN_BACK) && BTN_BACK > 0
#if ENABLED(BTN_BACK) && BTN_BACK > 0
if (ms > next_button_update_ms && READ(BTN_BACK) == 0) newbutton |= EN_D;
#endif
#endif
......
......@@ -45,7 +45,7 @@
#else
FORCE_INLINE void lcd_buttons_update() {}
#endif
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
extern void set_sd_dot();
extern void unset_sd_dot();
......@@ -62,7 +62,7 @@
extern int gumPreheatFanSpeed;
extern bool cancel_heatup;
#if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
extern millis_t previous_lcd_status_ms;
#endif
......@@ -77,7 +77,7 @@
#define EN_A BIT(BLEN_A)
#define LCD_CLICKED (buttons&EN_C)
#if EXIST(BTN_BACK) && BTN_BACK > 0
#if ENABLED(BTN_BACK) && BTN_BACK > 0
#define EN_D BIT(BLEN_D)
#define LCD_BACK_CLICKED (buttons&EN_D)
#endif
......
......@@ -26,7 +26,7 @@
#define EN_B BIT(BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A BIT(BLEN_A)
#if EXIST(BTN_ENC) && BTN_ENC > -1
#if ENABLED(BTN_ENC) && BTN_ENC > -1
// encoder click is directly connected
#define BLEN_C 2
#define EN_C BIT(BLEN_C)
......@@ -50,7 +50,7 @@
#define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
#define B_RI (BUTTON_RIGHT<<B_I2C_BTN_OFFSET)
#if EXIST(BTN_ENC) && BTN_ENC > -1
#if ENABLED(BTN_ENC) && BTN_ENC > -1
// the pause/stop/restart button is connected to BTN_ENC when used
#define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
#define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
......
......@@ -130,4 +130,5 @@ void matrix_3x3::debug(const char title[]) {
ECHO_E;
}
}
#endif
\ No newline at end of file
#endif // AUTO_BED_LEVELING_FEATURE
......@@ -56,4 +56,5 @@ struct matrix_3x3
void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z);
#endif // AUTO_BED_LEVELING_FEATURE
\ No newline at end of file
#endif // AUTO_BED_LEVELING_FEATURE
#include "base.h"
#if ENABLED(USE_WATCHDOG)
#include <avr/wdt.h>
#include "whatchdog.h"
......@@ -45,4 +46,4 @@ ISR(WDT_vect) {
}
#endif // RESET_MANUAL
#endif
#endif // USE_WATCHDOG
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment