Merge pull request #7070 from thinkyhead/bf_cleanups_fixes

Thursday cleanup / bugfixes
This commit is contained in:
Scott Lahteine 2017-06-15 15:43:46 -05:00 committed by GitHub
commit 43c96eb31f
13 changed files with 124 additions and 122 deletions

View File

@ -752,7 +752,7 @@ void report_current_position_detail();
#endif #endif
#define DEBUG_POS(SUFFIX,VAR) do { \ #define DEBUG_POS(SUFFIX,VAR) do { \
print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); } while(0) print_xyz(PSTR(" " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
#endif #endif
/** /**
@ -3492,20 +3492,20 @@ inline void gcode_G4() {
SERIAL_ECHOPAIR("Probe Offset X:", X_PROBE_OFFSET_FROM_EXTRUDER); SERIAL_ECHOPAIR("Probe Offset X:", X_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Y:", Y_PROBE_OFFSET_FROM_EXTRUDER); SERIAL_ECHOPAIR(" Y:", Y_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Z:", zprobe_zoffset); SERIAL_ECHOPAIR(" Z:", zprobe_zoffset);
#if (X_PROBE_OFFSET_FROM_EXTRUDER > 0) #if X_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM(" (Right"); SERIAL_ECHOPGM(" (Right");
#elif (X_PROBE_OFFSET_FROM_EXTRUDER < 0) #elif X_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM(" (Left"); SERIAL_ECHOPGM(" (Left");
#elif (Y_PROBE_OFFSET_FROM_EXTRUDER != 0) #elif Y_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM(" (Middle"); SERIAL_ECHOPGM(" (Middle");
#else #else
SERIAL_ECHOPGM(" (Aligned With"); SERIAL_ECHOPGM(" (Aligned With");
#endif #endif
#if (Y_PROBE_OFFSET_FROM_EXTRUDER > 0) #if Y_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM("-Back"); SERIAL_ECHOPGM("-Back");
#elif (Y_PROBE_OFFSET_FROM_EXTRUDER < 0) #elif Y_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM("-Front"); SERIAL_ECHOPGM("-Front");
#elif (X_PROBE_OFFSET_FROM_EXTRUDER != 0) #elif X_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM("-Center"); SERIAL_ECHOPGM("-Center");
#endif #endif
if (zprobe_zoffset < 0) if (zprobe_zoffset < 0)
@ -11279,7 +11279,7 @@ void ok_to_send() {
delta[A_AXIS] = DELTA_Z(A_AXIS); \ delta[A_AXIS] = DELTA_Z(A_AXIS); \
delta[B_AXIS] = DELTA_Z(B_AXIS); \ delta[B_AXIS] = DELTA_Z(B_AXIS); \
delta[C_AXIS] = DELTA_Z(C_AXIS); \ delta[C_AXIS] = DELTA_Z(C_AXIS); \
} while(0) }while(0)
#define DELTA_LOGICAL_IK() do { \ #define DELTA_LOGICAL_IK() do { \
const float raw[XYZ] = { \ const float raw[XYZ] = { \
@ -11288,7 +11288,7 @@ void ok_to_send() {
RAW_Z_POSITION(logical[Z_AXIS]) \ RAW_Z_POSITION(logical[Z_AXIS]) \
}; \ }; \
DELTA_RAW_IK(); \ DELTA_RAW_IK(); \
} while(0) }while(0)
#define DELTA_DEBUG() do { \ #define DELTA_DEBUG() do { \
SERIAL_ECHOPAIR("cartesian X:", raw[X_AXIS]); \ SERIAL_ECHOPAIR("cartesian X:", raw[X_AXIS]); \
@ -11297,7 +11297,7 @@ void ok_to_send() {
SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]); \ SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]); \
SERIAL_ECHOPAIR(" B:", delta[B_AXIS]); \ SERIAL_ECHOPAIR(" B:", delta[B_AXIS]); \
SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]); \ SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]); \
} while(0) }while(0)
void inverse_kinematics(const float logical[XYZ]) { void inverse_kinematics(const float logical[XYZ]) {
DELTA_LOGICAL_IK(); DELTA_LOGICAL_IK();
@ -11847,7 +11847,7 @@ void prepare_move_to_destination() {
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
} }
#if ENABLED(PREVENT_LENGTHY_EXTRUDE) #if ENABLED(PREVENT_LENGTHY_EXTRUDE)
if (labs(destination[E_AXIS] - current_position[E_AXIS]) > EXTRUDE_MAXLENGTH) { if (destination[E_AXIS] - current_position[E_AXIS] > EXTRUDE_MAXLENGTH) {
current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part current_position[E_AXIS] = destination[E_AXIS]; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
@ -11859,16 +11859,12 @@ void prepare_move_to_destination() {
#endif #endif
if ( if (
#if IS_KINEMATIC #if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)
#if UBL_DELTA
ubl.prepare_segmented_line_to(destination, feedrate_mm_s) ubl.prepare_segmented_line_to(destination, feedrate_mm_s)
#else #elif IS_KINEMATIC
prepare_kinematic_move_to(destination) prepare_kinematic_move_to(destination)
#endif
#elif ENABLED(DUAL_X_CARRIAGE) #elif ENABLED(DUAL_X_CARRIAGE)
prepare_move_to_destination_dualx() prepare_move_to_destination_dualx()
#elif UBL_DELTA // will work for CARTESIAN too (smaller segments follow mesh more closely)
ubl.prepare_segmented_line_to(destination, feedrate_mm_s)
#else #else
prepare_move_to_destination_cartesian() prepare_move_to_destination_cartesian()
#endif #endif

View File

@ -215,10 +215,6 @@ typedef enum {
// Set Compare Mode bits // Set Compare Mode bits
#define _SET_COM(T,Q,V) (TCCR##T##Q = (TCCR##T##Q & ~(0x3 << COM##T##Q##0)) | (int(V) << COM##T##Q##0)) #define _SET_COM(T,Q,V) (TCCR##T##Q = (TCCR##T##Q & ~(0x3 << COM##T##Q##0)) | (int(V) << COM##T##Q##0))
#define _SET_COMA(T,V) _SET_COM(T,A,V)
#define _SET_COMB(T,V) _SET_COM(T,B,V)
#define _SET_COMC(T,V) _SET_COM(T,C,V)
#define _SET_COMS(T,V1,V2,V3) do{ _SET_COMA(T,V1); _SET_COMB(T,V2); _SET_COMC(T,V3); }while(0)
#define SET_COM(T,Q,V) _SET_COM(T,Q,COM_##V) #define SET_COM(T,Q,V) _SET_COM(T,Q,COM_##V)
#define SET_COMA(T,V) SET_COM(T,A,V) #define SET_COMA(T,V) SET_COM(T,A,V)
#define SET_COMB(T,V) SET_COM(T,B,V) #define SET_COMB(T,V) SET_COM(T,B,V)

View File

@ -25,8 +25,8 @@
* structurs for 2560 family boards that use morre than 70 pins * structurs for 2560 family boards that use morre than 70 pins
*/ */
#ifndef Plus_70_h #ifndef __PINSDEBUG_PLUS_70_H__
#define Plus_70_h #define __PINSDEBUG_PLUS_70_H__
#undef NUM_DIGITAL_PINS #undef NUM_DIGITAL_PINS
#if MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D #if MOTHERBOARD == BOARD_BQ_ZUM_MEGA_3D
@ -338,5 +338,4 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = {
*/ */
#endif #endif // __PINSDEBUG_PLUS_70_H__

View File

@ -99,7 +99,7 @@
#define HEATER_BED_PIN 3 #define HEATER_BED_PIN 3
#if (GEN7_VERSION >= 13) #if GEN7_VERSION >= 13
// Gen7 v1.3 removed the fan pin // Gen7 v1.3 removed the fan pin
#define FAN_PIN -1 #define FAN_PIN -1
#else #else

View File

@ -370,7 +370,7 @@ void Stepper::isr() {
ocr_val = (remainder < OCR_VAL_TOLERANCE) ? ENDSTOP_NOMINAL_OCR_VAL + remainder : ENDSTOP_NOMINAL_OCR_VAL; \ ocr_val = (remainder < OCR_VAL_TOLERANCE) ? ENDSTOP_NOMINAL_OCR_VAL + remainder : ENDSTOP_NOMINAL_OCR_VAL; \
step_remaining = (uint16_t)L - ocr_val; \ step_remaining = (uint16_t)L - ocr_val; \
} \ } \
} while(0) }while(0)
if (step_remaining && ENDSTOPS_ENABLED) { // Just check endstops - not yet time for a step if (step_remaining && ENDSTOPS_ENABLED) { // Just check endstops - not yet time for a step
endstops.update(); endstops.update();
@ -862,6 +862,9 @@ void Stepper::isr() {
SET_E_STEP_DIR(2); SET_E_STEP_DIR(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
SET_E_STEP_DIR(3); SET_E_STEP_DIR(3);
#if E_STEPPERS > 4
SET_E_STEP_DIR(4);
#endif
#endif #endif
#endif #endif
#endif #endif
@ -880,6 +883,9 @@ void Stepper::isr() {
START_E_PULSE(2); START_E_PULSE(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
START_E_PULSE(3); START_E_PULSE(3);
#if E_STEPPERS > 4
START_E_PULSE(4);
#endif
#endif #endif
#endif #endif
#endif #endif
@ -899,6 +905,9 @@ void Stepper::isr() {
STOP_E_PULSE(2); STOP_E_PULSE(2);
#if E_STEPPERS > 3 #if E_STEPPERS > 3
STOP_E_PULSE(3); STOP_E_PULSE(3);
#if E_STEPPERS > 4
STOP_E_PULSE(4);
#endif
#endif #endif
#endif #endif
#endif #endif

View File

@ -296,7 +296,7 @@
stepper##A.setMicroSteps(A##_MICROSTEPS); \ stepper##A.setMicroSteps(A##_MICROSTEPS); \
stepper##A.setOverCurrent(A##_OVERCURRENT); \ stepper##A.setOverCurrent(A##_OVERCURRENT); \
stepper##A.setStallCurrent(A##_STALLCURRENT); \ stepper##A.setStallCurrent(A##_STALLCURRENT); \
} while(0) }while(0)
void L6470_init() { void L6470_init() {
#if ENABLED(X_IS_L6470) #if ENABLED(X_IS_L6470)

View File

@ -421,13 +421,13 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
bedKp = workKp; \ bedKp = workKp; \
bedKi = scalePID_i(workKi); \ bedKi = scalePID_i(workKi); \
bedKd = scalePID_d(workKd); \ bedKd = scalePID_d(workKd); \
updatePID(); } while(0) updatePID(); }while(0)
#define _SET_EXTRUDER_PID() do { \ #define _SET_EXTRUDER_PID() do { \
PID_PARAM(Kp, hotend) = workKp; \ PID_PARAM(Kp, hotend) = workKp; \
PID_PARAM(Ki, hotend) = scalePID_i(workKi); \ PID_PARAM(Ki, hotend) = scalePID_i(workKi); \
PID_PARAM(Kd, hotend) = scalePID_d(workKd); \ PID_PARAM(Kd, hotend) = scalePID_d(workKd); \
updatePID(); } while(0) updatePID(); }while(0)
// Use the result? (As with "M303 U1") // Use the result? (As with "M303 U1")
if (set_result) { if (set_result) {
@ -505,7 +505,7 @@ int Temperature::getHeaterPower(int heater) {
// //
// Temperature Error Handlers // Temperature Error Handlers
// //
void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg) { void Temperature::_temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg) {
static bool killed = false; static bool killed = false;
if (IsRunning()) { if (IsRunning()) {
SERIAL_ERROR_START(); SERIAL_ERROR_START();
@ -524,7 +524,7 @@ void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg
#endif #endif
} }
void Temperature::max_temp_error(int8_t e) { void Temperature::max_temp_error(const int8_t e) {
#if HAS_TEMP_BED #if HAS_TEMP_BED
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED)); _temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
#else #else
@ -534,7 +534,7 @@ void Temperature::max_temp_error(int8_t e) {
#endif #endif
#endif #endif
} }
void Temperature::min_temp_error(int8_t e) { void Temperature::min_temp_error(const int8_t e) {
#if HAS_TEMP_BED #if HAS_TEMP_BED
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED)); _temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
#else #else
@ -545,7 +545,7 @@ void Temperature::min_temp_error(int8_t e) {
#endif #endif
} }
float Temperature::get_pid_output(int e) { float Temperature::get_pid_output(const int8_t e) {
#if HOTENDS == 1 #if HOTENDS == 1
UNUSED(e); UNUSED(e);
#define _HOTEND_TEST true #define _HOTEND_TEST true
@ -890,7 +890,7 @@ float Temperature::analog2temp(int raw, uint8_t e) {
// Derived from RepRap FiveD extruder::getTemperature() // Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement. // For bed temperature measurement.
float Temperature::analog2tempBed(int raw) { float Temperature::analog2tempBed(const int raw) {
#if ENABLED(BED_USES_THERMISTOR) #if ENABLED(BED_USES_THERMISTOR)
float celsius = 0; float celsius = 0;
byte i; byte i;
@ -1148,7 +1148,7 @@ void Temperature::init() {
#define TEMP_MIN_ROUTINE(NR) \ #define TEMP_MIN_ROUTINE(NR) \
minttemp[NR] = HEATER_ ##NR## _MINTEMP; \ minttemp[NR] = HEATER_ ##NR## _MINTEMP; \
while(analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \ while (analog2temp(minttemp_raw[NR], NR) < HEATER_ ##NR## _MINTEMP) { \
if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \ if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
minttemp_raw[NR] += OVERSAMPLENR; \ minttemp_raw[NR] += OVERSAMPLENR; \
else \ else \
@ -1156,7 +1156,7 @@ void Temperature::init() {
} }
#define TEMP_MAX_ROUTINE(NR) \ #define TEMP_MAX_ROUTINE(NR) \
maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \ maxttemp[NR] = HEATER_ ##NR## _MAXTEMP; \
while(analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \ while (analog2temp(maxttemp_raw[NR], NR) > HEATER_ ##NR## _MAXTEMP) { \
if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \ if (HEATER_ ##NR## _RAW_LO_TEMP < HEATER_ ##NR## _RAW_HI_TEMP) \
maxttemp_raw[NR] -= OVERSAMPLENR; \ maxttemp_raw[NR] -= OVERSAMPLENR; \
else \ else \
@ -1203,7 +1203,7 @@ void Temperature::init() {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#ifdef BED_MINTEMP #ifdef BED_MINTEMP
while(analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) { while (analog2tempBed(bed_minttemp_raw) < BED_MINTEMP) {
#if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP #if HEATER_BED_RAW_LO_TEMP < HEATER_BED_RAW_HI_TEMP
bed_minttemp_raw += OVERSAMPLENR; bed_minttemp_raw += OVERSAMPLENR;
#else #else
@ -1292,7 +1292,7 @@ void Temperature::init() {
SERIAL_EOL(); SERIAL_EOL();
*/ */
int heater_index = heater_id >= 0 ? heater_id : HOTENDS; const int heater_index = heater_id >= 0 ? heater_id : HOTENDS;
#if HEATER_IDLE_HANDLER #if HEATER_IDLE_HANDLER
// If the heater idle timeout expires, restart // If the heater idle timeout expires, restart
@ -1922,7 +1922,7 @@ void Temperature::isr() {
case SensorsReady: { case SensorsReady: {
// All sensors have been read. Stay in this state for a few // All sensors have been read. Stay in this state for a few
// ISRs to save on calls to temp update/checking code below. // ISRs to save on calls to temp update/checking code below.
constexpr int extra_loops = MIN_ADC_ISR_LOOPS - (int)SensorsReady; constexpr int8_t extra_loops = MIN_ADC_ISR_LOOPS - (int8_t)SensorsReady;
static uint8_t delay_count = 0; static uint8_t delay_count = 0;
if (extra_loops > 0) { if (extra_loops > 0) {
if (delay_count == 0) delay_count = extra_loops; // Init this delay if (delay_count == 0) delay_count = extra_loops; // Init this delay

View File

@ -535,15 +535,15 @@ class Temperature {
static void checkExtruderAutoFans(); static void checkExtruderAutoFans();
static float get_pid_output(int e); static float get_pid_output(const int8_t e);
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
static float get_pid_output_bed(); static float get_pid_output_bed();
#endif #endif
static void _temp_error(int e, const char* serial_msg, const char* lcd_msg); static void _temp_error(const int8_t e, const char * const serial_msg, const char * const lcd_msg);
static void min_temp_error(int8_t e); static void min_temp_error(const int8_t e);
static void max_temp_error(int8_t e); static void max_temp_error(const int8_t e);
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED

View File

@ -23,27 +23,27 @@
// PT100 with INA826 amp on Ultimaker v2.0 electronics // PT100 with INA826 amp on Ultimaker v2.0 electronics
// The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature. // The PT100 in the Ultimaker v2.0 electronics has a high sample value for a high temperature.
// This does not match the normal thermistor behaviour so we need to set the following defines // This does not match the normal thermistor behaviour so we need to set the following defines
#if (THERMISTORHEATER_0 == 20) #if THERMISTORHEATER_0 == 20
#define HEATER_0_RAW_HI_TEMP 16383 #define HEATER_0_RAW_HI_TEMP 16383
#define HEATER_0_RAW_LO_TEMP 0 #define HEATER_0_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_1 == 20) #if THERMISTORHEATER_1 == 20
#define HEATER_1_RAW_HI_TEMP 16383 #define HEATER_1_RAW_HI_TEMP 16383
#define HEATER_1_RAW_LO_TEMP 0 #define HEATER_1_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_2 == 20) #if THERMISTORHEATER_2 == 20
#define HEATER_2_RAW_HI_TEMP 16383 #define HEATER_2_RAW_HI_TEMP 16383
#define HEATER_2_RAW_LO_TEMP 0 #define HEATER_2_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_3 == 20) #if THERMISTORHEATER_3 == 20
#define HEATER_3_RAW_HI_TEMP 16383 #define HEATER_3_RAW_HI_TEMP 16383
#define HEATER_3_RAW_LO_TEMP 0 #define HEATER_3_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORHEATER_4 == 20) #if THERMISTORHEATER_4 == 20
#define HEATER_4_RAW_HI_TEMP 16383 #define HEATER_4_RAW_HI_TEMP 16383
#define HEATER_4_RAW_LO_TEMP 0 #define HEATER_4_RAW_LO_TEMP 0
#endif #endif
#if (THERMISTORBED == 20) #if THERMISTORBED == 20
#define HEATER_BED_RAW_HI_TEMP 16383 #define HEATER_BED_RAW_HI_TEMP 16383
#define HEATER_BED_RAW_LO_TEMP 0 #define HEATER_BED_RAW_LO_TEMP 0
#endif #endif

View File

@ -45,7 +45,7 @@
void lcd_mesh_edit_setup(float initial); void lcd_mesh_edit_setup(float initial);
float lcd_mesh_edit(); float lcd_mesh_edit();
void lcd_z_offset_edit_setup(float); void lcd_z_offset_edit_setup(float);
#ifdef DOGLCD #if ENABLED(DOGLCD)
extern void _lcd_ubl_output_map_lcd(); extern void _lcd_ubl_output_map_lcd();
#endif #endif
float lcd_z_offset_edit(); float lcd_z_offset_edit();
@ -1575,7 +1575,7 @@
SERIAL_ECHOLNPGM("Done Editing Mesh"); SERIAL_ECHOLNPGM("Done Editing Mesh");
if (ubl_lcd_map_control) { if (ubl_lcd_map_control) {
#ifdef DOGLCD #if ENABLED(DOGLCD)
lcd_goto_screen(_lcd_ubl_output_map_lcd); lcd_goto_screen(_lcd_ubl_output_map_lcd);
#endif #endif
} }

View File

@ -257,7 +257,7 @@ uint16_t max_display_update_time = 0;
_skipStatic = false; \ _skipStatic = false; \
_MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \ _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
_MENU_ITEM_PART_2(TYPE, LABEL, ## __VA_ARGS__); \ _MENU_ITEM_PART_2(TYPE, LABEL, ## __VA_ARGS__); \
} while(0) }while(0)
#define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0) #define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
@ -289,13 +289,13 @@ uint16_t max_display_update_time = 0;
encoderRateMultiplierEnabled = true; \ encoderRateMultiplierEnabled = true; \
lastEncoderMovementMillis = 0; \ lastEncoderMovementMillis = 0; \
_MENU_ITEM_PART_2(type, label, ## __VA_ARGS__); \ _MENU_ITEM_PART_2(type, label, ## __VA_ARGS__); \
} while(0) }while(0)
#else // !ENCODER_RATE_MULTIPLIER #else // !ENCODER_RATE_MULTIPLIER
#define ENCODER_RATE_MULTIPLY(F) NOOP #define ENCODER_RATE_MULTIPLY(F) NOOP
#endif // !ENCODER_RATE_MULTIPLIER #endif // !ENCODER_RATE_MULTIPLIER
#define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0) #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
#define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__) #define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
#define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__) #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
#if ENABLED(ENCODER_RATE_MULTIPLIER) #if ENABLED(ENCODER_RATE_MULTIPLIER)
@ -1098,9 +1098,11 @@ void kill_screen(const char* lcd_msg) {
#endif // HOTENDS > 1 #endif // HOTENDS > 1
#endif // HAS_TEMP_HOTEND #endif // HAS_TEMP_HOTEND
void watch_temp_callback_bed() {
#if WATCH_THE_BED #if WATCH_THE_BED
void watch_temp_callback_bed() { thermalManager.start_watching_bed(); } thermalManager.start_watching_bed();
#endif #endif
}
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -1162,7 +1164,7 @@ void kill_screen(const char* lcd_msg) {
// //
// Bed: // Bed:
// //
#if WATCH_THE_BED #if HAS_TEMP_BED
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
#endif #endif
@ -1810,7 +1812,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_custom_mesh() { void _lcd_ubl_build_custom_mesh() {
char UBL_LCD_GCODE[20]; char UBL_LCD_GCODE[20];
enqueue_and_echo_commands_P(PSTR("G28")); enqueue_and_echo_commands_P(PSTR("G28"));
#if WATCH_THE_BED #if HAS_TEMP_BED
sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp); sprintf_P(UBL_LCD_GCODE, PSTR("M190 S%i"), custom_bed_temp);
enqueue_and_echo_command(UBL_LCD_GCODE); enqueue_and_echo_command(UBL_LCD_GCODE);
#endif #endif
@ -1826,7 +1828,7 @@ void kill_screen(const char* lcd_msg) {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_BUILD_MESH_MENU); MENU_BACK(MSG_UBL_BUILD_MESH_MENU);
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10)); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_HOTEND_TEMP, &custom_hotend_temp, EXTRUDE_MINTEMP, (HEATER_0_MAXTEMP - 10));
#if WATCH_THE_BED #if HAS_TEMP_BED
MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 5)); MENU_ITEM_EDIT(int3, MSG_UBL_CUSTOM_BED_TEMP, &custom_bed_temp, BED_MINTEMP, (BED_MAXTEMP - 5));
#endif #endif
MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh); MENU_ITEM(function, MSG_UBL_BUILD_CUSTOM_MESH, _lcd_ubl_build_custom_mesh);
@ -1875,7 +1877,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_custom_mesh() { void _lcd_ubl_validate_custom_mesh() {
char UBL_LCD_GCODE[24]; char UBL_LCD_GCODE[24];
const int temp = const int temp =
#if WATCH_THE_BED #if HAS_TEMP_BED
custom_bed_temp custom_bed_temp
#else #else
0 0
@ -1891,7 +1893,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_mesh() { void _lcd_ubl_validate_mesh() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_TOOLS);
#if WATCH_THE_BED #if HAS_TEMP_BED
MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P")); MENU_ITEM(gcode, MSG_UBL_VALIDATE_PLA_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_1_TEMP_BED) " H" STRINGIFY(PREHEAT_1_TEMP_HOTEND) " P"));
MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P")); MENU_ITEM(gcode, MSG_UBL_VALIDATE_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else #else
@ -1978,7 +1980,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_mesh() { void _lcd_ubl_build_mesh() {
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_TOOLS); MENU_BACK(MSG_UBL_TOOLS);
#if WATCH_THE_BED #if HAS_TEMP_BED
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR( MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\n" "G28\n"
"M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n" "M190 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\n"
@ -2075,7 +2077,7 @@ void kill_screen(const char* lcd_msg) {
enqueue_and_echo_command(ubl_lcd_gcode); enqueue_and_echo_command(ubl_lcd_gcode);
} }
#ifdef DOGLCD #if ENABLED(DOGLCD)
/** /**
* UBL LCD "radar" map data * UBL LCD "radar" map data
@ -2086,8 +2088,8 @@ void kill_screen(const char* lcd_msg) {
#define MAP_MAX_PIXELS_Y 49 #define MAP_MAX_PIXELS_Y 49
void _lcd_ubl_plot_drawing_prep() { void _lcd_ubl_plot_drawing_prep() {
uint8_t i, j, x_offset, y_offset, x_map_pixels, y_map_pixels; uint8_t i, j, x_offset, y_offset, x_map_pixels, y_map_pixels,
uint8_t pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt, inverted_y; pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt, inverted_y;
/*********************************************************/ /*********************************************************/
/************ Scale the box pixels appropriately *********/ /************ Scale the box pixels appropriately *********/
@ -2098,15 +2100,15 @@ void kill_screen(const char* lcd_msg) {
pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X; pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X;
pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y; pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y;
x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X-x_map_pixels-2)/2; x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2;
y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y-y_map_pixels-2)/2; y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2;
/*********************************************************/ /*********************************************************/
/************ Clear the Mesh Map Box**********************/ /************ Clear the Mesh Map Box**********************/
/*********************************************************/ /*********************************************************/
u8g.setColorIndex(1); // First draw the bigger box in White so we have a border around the mesh map box u8g.setColorIndex(1); // First draw the bigger box in White so we have a border around the mesh map box
u8g.drawBox(x_offset-2, y_offset-2, x_map_pixels+4, y_map_pixels+4); u8g.drawBox(x_offset - 2, y_offset - 2, x_map_pixels + 4, y_map_pixels + 4);
u8g.setColorIndex(0); // Now actually clear the mesh map box u8g.setColorIndex(0); // Now actually clear the mesh map box
u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels); u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels);
@ -2118,8 +2120,8 @@ void kill_screen(const char* lcd_msg) {
u8g.setColorIndex(1); u8g.setColorIndex(1);
for (i = 0; i < GRID_MAX_POINTS_X; i++) { for (i = 0; i < GRID_MAX_POINTS_X; i++) {
for (j = 0; j < GRID_MAX_POINTS_Y; j++) { for (j = 0; j < GRID_MAX_POINTS_Y; j++) {
u8g.drawBox(x_offset+i*pixels_per_X_mesh_pnt+pixels_per_X_mesh_pnt/2, u8g.drawBox(x_offset + i * pixels_per_X_mesh_pnt + pixels_per_X_mesh_pnt / 2,
y_offset+j*pixels_per_Y_mesh_pnt+pixels_per_Y_mesh_pnt/2, 1, 1); y_offset + j * pixels_per_Y_mesh_pnt + pixels_per_Y_mesh_pnt / 2, 1, 1);
} }
} }
@ -2129,7 +2131,7 @@ void kill_screen(const char* lcd_msg) {
inverted_y = GRID_MAX_POINTS_Y - y_plot - 1; // The origin is typically in the lower right corner. We need to inverted_y = GRID_MAX_POINTS_Y - y_plot - 1; // The origin is typically in the lower right corner. We need to
// invert the Y to get it to plot in the right location. // invert the Y to get it to plot in the right location.
u8g.drawBox(x_offset+x_plot*pixels_per_X_mesh_pnt, y_offset+inverted_y*pixels_per_Y_mesh_pnt, u8g.drawBox(x_offset + x_plot * pixels_per_X_mesh_pnt, y_offset + inverted_y * pixels_per_Y_mesh_pnt,
pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt); pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt);
/*********************************************************/ /*********************************************************/
@ -2147,11 +2149,11 @@ void kill_screen(const char* lcd_msg) {
// Print plot position // Print plot position
u8g.setPrintPos(5, 64); u8g.setPrintPos(5, 64);
lcd_print("("); lcd_print('(');
u8g.print(x_plot); u8g.print(x_plot);
lcd_print(","); lcd_print(',');
u8g.print(y_plot); u8g.print(y_plot);
lcd_print(")"); lcd_print(')');
// Show the location value // Show the location value
u8g.setPrintPos(74, 64); u8g.setPrintPos(74, 64);
@ -2968,7 +2970,7 @@ void kill_screen(const char* lcd_msg) {
// //
// Bed: // Bed:
// //
#if WATCH_THE_BED #if HAS_TEMP_BED
MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed); MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_BED, &thermalManager.target_temperature_bed, 0, BED_MAXTEMP - 15, watch_temp_callback_bed);
#endif #endif
@ -3624,7 +3626,7 @@ void kill_screen(const char* lcd_msg) {
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
} \ } \
++_thisItemNr; \ ++_thisItemNr; \
} while(0) }while(0)
void lcd_advanced_pause_toocold_menu() { void lcd_advanced_pause_toocold_menu() {
START_MENU(); START_MENU();

View File

@ -424,10 +424,10 @@ inline void lcd_implementation_status_message() {
lcd_print_utf(stat); // The string leaves space lcd_print_utf(stat); // The string leaves space
chars -= slen - status_scroll_pos; // Amount of space left chars -= slen - status_scroll_pos; // Amount of space left
} }
lcd.print('.'); // Always at 1+ spaces left, draw a dot u8g.print('.'); // Always at 1+ spaces left, draw a dot
if (--chars) { if (--chars) {
if (status_scroll_pos < slen + 1) // Draw a second dot if there's space if (status_scroll_pos < slen + 1) // Draw a second dot if there's space
--chars, lcd.print('.'); --chars, u8g.print('.');
if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message
} }
} }

View File

@ -1012,7 +1012,7 @@ static void lcd_implementation_status_screen() {
#endif // SDSUPPORT #endif // SDSUPPORT
#define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR,LCD_UPLEVEL_CHAR) #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0]) #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')