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

@ -3492,20 +3492,20 @@ inline void gcode_G4() {
SERIAL_ECHOPAIR("Probe Offset X:", X_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Y:", Y_PROBE_OFFSET_FROM_EXTRUDER);
SERIAL_ECHOPAIR(" Z:", zprobe_zoffset);
#if (X_PROBE_OFFSET_FROM_EXTRUDER > 0)
#if X_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM(" (Right");
#elif (X_PROBE_OFFSET_FROM_EXTRUDER < 0)
#elif X_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM(" (Left");
#elif (Y_PROBE_OFFSET_FROM_EXTRUDER != 0)
#elif Y_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM(" (Middle");
#else
SERIAL_ECHOPGM(" (Aligned With");
#endif
#if (Y_PROBE_OFFSET_FROM_EXTRUDER > 0)
#if Y_PROBE_OFFSET_FROM_EXTRUDER > 0
SERIAL_ECHOPGM("-Back");
#elif (Y_PROBE_OFFSET_FROM_EXTRUDER < 0)
#elif Y_PROBE_OFFSET_FROM_EXTRUDER < 0
SERIAL_ECHOPGM("-Front");
#elif (X_PROBE_OFFSET_FROM_EXTRUDER != 0)
#elif X_PROBE_OFFSET_FROM_EXTRUDER != 0
SERIAL_ECHOPGM("-Center");
#endif
if (zprobe_zoffset < 0)
@ -11847,7 +11847,7 @@ void prepare_move_to_destination() {
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#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
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
@ -11859,16 +11859,12 @@ void prepare_move_to_destination() {
#endif
if (
#if IS_KINEMATIC
#if UBL_DELTA
#if UBL_DELTA // Also works for CARTESIAN (smaller segments follow mesh more closely)
ubl.prepare_segmented_line_to(destination, feedrate_mm_s)
#else
#elif IS_KINEMATIC
prepare_kinematic_move_to(destination)
#endif
#elif ENABLED(DUAL_X_CARRIAGE)
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
prepare_move_to_destination_cartesian()
#endif

View file

@ -215,10 +215,6 @@ typedef enum {
// 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_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_COMA(T,V) SET_COM(T,A,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
*/
#ifndef Plus_70_h
#define Plus_70_h
#ifndef __PINSDEBUG_PLUS_70_H__
#define __PINSDEBUG_PLUS_70_H__
#undef NUM_DIGITAL_PINS
#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
#if (GEN7_VERSION >= 13)
#if GEN7_VERSION >= 13
// Gen7 v1.3 removed the fan pin
#define FAN_PIN -1
#else

View file

@ -862,6 +862,9 @@ void Stepper::isr() {
SET_E_STEP_DIR(2);
#if E_STEPPERS > 3
SET_E_STEP_DIR(3);
#if E_STEPPERS > 4
SET_E_STEP_DIR(4);
#endif
#endif
#endif
#endif
@ -880,6 +883,9 @@ void Stepper::isr() {
START_E_PULSE(2);
#if E_STEPPERS > 3
START_E_PULSE(3);
#if E_STEPPERS > 4
START_E_PULSE(4);
#endif
#endif
#endif
#endif
@ -899,6 +905,9 @@ void Stepper::isr() {
STOP_E_PULSE(2);
#if E_STEPPERS > 3
STOP_E_PULSE(3);
#if E_STEPPERS > 4
STOP_E_PULSE(4);
#endif
#endif
#endif
#endif

View file

@ -505,7 +505,7 @@ int Temperature::getHeaterPower(int heater) {
//
// 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;
if (IsRunning()) {
SERIAL_ERROR_START();
@ -524,7 +524,7 @@ void Temperature::_temp_error(int e, const char* serial_msg, const char* lcd_msg
#endif
}
void Temperature::max_temp_error(int8_t e) {
void Temperature::max_temp_error(const int8_t e) {
#if HAS_TEMP_BED
_temp_error(e, PSTR(MSG_T_MAXTEMP), e >= 0 ? PSTR(MSG_ERR_MAXTEMP) : PSTR(MSG_ERR_MAXTEMP_BED));
#else
@ -534,7 +534,7 @@ void Temperature::max_temp_error(int8_t e) {
#endif
#endif
}
void Temperature::min_temp_error(int8_t e) {
void Temperature::min_temp_error(const int8_t e) {
#if HAS_TEMP_BED
_temp_error(e, PSTR(MSG_T_MINTEMP), e >= 0 ? PSTR(MSG_ERR_MINTEMP) : PSTR(MSG_ERR_MINTEMP_BED));
#else
@ -545,7 +545,7 @@ void Temperature::min_temp_error(int8_t e) {
#endif
}
float Temperature::get_pid_output(int e) {
float Temperature::get_pid_output(const int8_t e) {
#if HOTENDS == 1
UNUSED(e);
#define _HOTEND_TEST true
@ -890,7 +890,7 @@ float Temperature::analog2temp(int raw, uint8_t e) {
// Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement.
float Temperature::analog2tempBed(int raw) {
float Temperature::analog2tempBed(const int raw) {
#if ENABLED(BED_USES_THERMISTOR)
float celsius = 0;
byte i;
@ -1292,7 +1292,7 @@ void Temperature::init() {
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 the heater idle timeout expires, restart
@ -1922,7 +1922,7 @@ void Temperature::isr() {
case SensorsReady: {
// All sensors have been read. Stay in this state for a few
// 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;
if (extra_loops > 0) {
if (delay_count == 0) delay_count = extra_loops; // Init this delay

View file

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

View file

@ -23,27 +23,27 @@
// 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.
// 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_LO_TEMP 0
#endif
#if (THERMISTORHEATER_1 == 20)
#if THERMISTORHEATER_1 == 20
#define HEATER_1_RAW_HI_TEMP 16383
#define HEATER_1_RAW_LO_TEMP 0
#endif
#if (THERMISTORHEATER_2 == 20)
#if THERMISTORHEATER_2 == 20
#define HEATER_2_RAW_HI_TEMP 16383
#define HEATER_2_RAW_LO_TEMP 0
#endif
#if (THERMISTORHEATER_3 == 20)
#if THERMISTORHEATER_3 == 20
#define HEATER_3_RAW_HI_TEMP 16383
#define HEATER_3_RAW_LO_TEMP 0
#endif
#if (THERMISTORHEATER_4 == 20)
#if THERMISTORHEATER_4 == 20
#define HEATER_4_RAW_HI_TEMP 16383
#define HEATER_4_RAW_LO_TEMP 0
#endif
#if (THERMISTORBED == 20)
#if THERMISTORBED == 20
#define HEATER_BED_RAW_HI_TEMP 16383
#define HEATER_BED_RAW_LO_TEMP 0
#endif

View file

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

View file

@ -1098,9 +1098,11 @@ void kill_screen(const char* lcd_msg) {
#endif // HOTENDS > 1
#endif // HAS_TEMP_HOTEND
void watch_temp_callback_bed() {
#if WATCH_THE_BED
void watch_temp_callback_bed() { thermalManager.start_watching_bed(); }
thermalManager.start_watching_bed();
#endif
}
#if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -1162,7 +1164,7 @@ void kill_screen(const char* lcd_msg) {
//
// 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);
#endif
@ -1810,7 +1812,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_custom_mesh() {
char UBL_LCD_GCODE[20];
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);
enqueue_and_echo_command(UBL_LCD_GCODE);
#endif
@ -1826,7 +1828,7 @@ void kill_screen(const char* lcd_msg) {
START_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));
#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));
#endif
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() {
char UBL_LCD_GCODE[24];
const int temp =
#if WATCH_THE_BED
#if HAS_TEMP_BED
custom_bed_temp
#else
0
@ -1891,7 +1893,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_validate_mesh() {
START_MENU();
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_ABS_MESH, PSTR("G28\nG26 C B" STRINGIFY(PREHEAT_2_TEMP_BED) " H" STRINGIFY(PREHEAT_2_TEMP_HOTEND) " P"));
#else
@ -1978,7 +1980,7 @@ void kill_screen(const char* lcd_msg) {
void _lcd_ubl_build_mesh() {
START_MENU();
MENU_BACK(MSG_UBL_TOOLS);
#if WATCH_THE_BED
#if HAS_TEMP_BED
MENU_ITEM(gcode, MSG_UBL_BUILD_PLA_MESH, PSTR(
"G28\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);
}
#ifdef DOGLCD
#if ENABLED(DOGLCD)
/**
* UBL LCD "radar" map data
@ -2086,8 +2088,8 @@ void kill_screen(const char* lcd_msg) {
#define MAP_MAX_PIXELS_Y 49
void _lcd_ubl_plot_drawing_prep() {
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;
uint8_t i, j, x_offset, y_offset, x_map_pixels, y_map_pixels,
pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt, inverted_y;
/*********************************************************/
/************ Scale the box pixels appropriately *********/
@ -2147,11 +2149,11 @@ void kill_screen(const char* lcd_msg) {
// Print plot position
u8g.setPrintPos(5, 64);
lcd_print("(");
lcd_print('(');
u8g.print(x_plot);
lcd_print(",");
lcd_print(',');
u8g.print(y_plot);
lcd_print(")");
lcd_print(')');
// Show the location value
u8g.setPrintPos(74, 64);
@ -2968,7 +2970,7 @@ void kill_screen(const char* lcd_msg) {
//
// 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);
#endif

View file

@ -424,10 +424,10 @@ inline void lcd_implementation_status_message() {
lcd_print_utf(stat); // The string leaves space
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 (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
}
}