From b9d790a63bd63b805460d04dd2e3140f8749f751 Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Fri, 30 Jun 2017 16:35:05 -0400 Subject: [PATCH] Remove build warnings (all) - fix spelling errors Updated to: 3.1.0-RC1 Some of the format changes introduced were done to improve readabilty and remove compiler warnings about needing parenthesis Some code restructuring has been done to eliminate unused code and variables Cleanup defined but unused functions --- Firmware/ConfigurationStore.h | 2 +- Firmware/MarlinSerial.cpp | 8 +- Firmware/MarlinSerial.h | 9 +- Firmware/Marlin_main.cpp | 157 ++++++------ Firmware/SdFatUtil.cpp | 2 +- Firmware/cardreader.cpp | 26 +- Firmware/language_all.cpp | 2 +- Firmware/language_de.h | 5 +- Firmware/mesh_bed_calibration.cpp | 20 +- Firmware/pins.h | 78 +++--- Firmware/planner.cpp | 12 +- Firmware/stepper.cpp | 27 +- Firmware/temperature.cpp | 14 +- Firmware/temperature.h | 5 - Firmware/ultralcd.cpp | 241 ++++++++---------- Firmware/ultralcd.h | 39 +-- .../ultralcd_implementation_hitachi_HD44780.h | 24 +- .../variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h | 2 +- ...5mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h | 2 +- ...5mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h | 2 +- .../variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h | 2 +- 23 files changed, 313 insertions(+), 370 deletions(-) diff --git a/Firmware/ConfigurationStore.h b/Firmware/ConfigurationStore.h index f3254318a..d0c609e7d 100644 --- a/Firmware/ConfigurationStore.h +++ b/Firmware/ConfigurationStore.h @@ -21,7 +21,7 @@ FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_Prin #endif inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); } -inline uint8_t calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); } +inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); } inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); } #endif//CONFIG_STORE_H diff --git a/Firmware/MarlinSerial.cpp b/Firmware/MarlinSerial.cpp index 8baab6dd3..a879b0648 100644 --- a/Firmware/MarlinSerial.cpp +++ b/Firmware/MarlinSerial.cpp @@ -56,8 +56,8 @@ FORCE_INLINE void store_char(unsigned char c) // Test for a framing error. if (M_UCSRxA & (1< 0 && millis()-_usb_timer > 1000) { is_usb_printing = true; @@ -1413,43 +1408,43 @@ void loop() get_command(); - #ifdef SDSUPPORT - card.checkautostart(false); - #endif - if(buflen) - { - #ifdef SDSUPPORT - if(card.saving) - { - // Saving a G-code file onto an SD-card is in progress. - // Saving starts with M28, saving until M29 is seen. - if(strstr_P(CMDBUFFER_CURRENT_STRING, PSTR("M29")) == NULL) { - card.write_command(CMDBUFFER_CURRENT_STRING); - if(card.logging) - process_commands(); - else - SERIAL_PROTOCOLLNRPGM(MSG_OK); - } else { - card.closefile(); - SERIAL_PROTOCOLLNRPGM(MSG_FILE_SAVED); - } - } else { - process_commands(); - } - #else - process_commands(); - #endif //SDSUPPORT - if (! cmdbuffer_front_already_processed) - cmdqueue_pop_front(); - cmdbuffer_front_already_processed = false; + #ifdef SDSUPPORT + card.checkautostart(false); + #endif + if(buflen) + { + #ifdef SDSUPPORT + if(card.saving) + { + // Saving a G-code file onto an SD-card is in progress. + // Saving starts with M28, saving until M29 is seen. + if(strstr_P(CMDBUFFER_CURRENT_STRING, PSTR("M29")) == NULL) { + card.write_command(CMDBUFFER_CURRENT_STRING); + if(card.logging) + process_commands(); + else + SERIAL_PROTOCOLLNRPGM(MSG_OK); + } else { + card.closefile(); + SERIAL_PROTOCOLLNRPGM(MSG_FILE_SAVED); + } + } else { + process_commands(); + } + #else + process_commands(); + #endif //SDSUPPORT + if (! cmdbuffer_front_already_processed) + cmdqueue_pop_front(); + cmdbuffer_front_already_processed = false; host_keepalive(); - } -} - //check heater every n milliseconds - manage_heater(); - isPrintPaused ? manage_inactivity(true) : manage_inactivity(false); - checkHitEndstops(); - lcd_update(); + } + } + //check heater every n milliseconds + manage_heater(); + isPrintPaused ? manage_inactivity(true) : manage_inactivity(false); + checkHitEndstops(); + lcd_update(); } void proc_commands() { @@ -2328,11 +2323,6 @@ void process_commands() // PRUSA GCODES -#ifdef SNMM - float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; - float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; - int8_t SilentMode; -#endif KEEPALIVE_STATE(IN_HANDLER); if (code_seen("M117")) { //moved to highest priority place to be able to to print strings which includes "G", "PRUSA" and "^" @@ -2646,10 +2636,10 @@ void process_commands() if( !(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) { float echange=destination[E_AXIS]-current_position[E_AXIS]; - if((echange<-MIN_RETRACT && !retracted) || (echange>MIN_RETRACT && retracted)) { //move appears to be an attempt to retract or recover + if((echange<-MIN_RETRACT && !retracted[active_extruder]) || (echange>MIN_RETRACT && retracted[active_extruder])) { //move appears to be an attempt to retract or recover current_position[E_AXIS] = destination[E_AXIS]; //hide the slicer-generated retract/recover from calculations plan_set_e_position(current_position[E_AXIS]); //AND from the planner - retract(!retracted); + retract(!retracted[active_extruder]); return; } @@ -3383,7 +3373,6 @@ void process_commands() int iy = 0; int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; - int Z_PROBE_FEEDRATE = homing_feedrate[Z_AXIS] / 60; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; bool has_z = is_bed_z_jitter_data_valid(); //checks if we have data from Z calibration (offsets of the Z heiths of the 8 calibration points from the first point) if (verbosity_level >= 1) { @@ -4771,7 +4760,6 @@ Sigma_Exit: } } - float area = .0; if(code_seen('D')) { float diameter = (float)code_value(); if (diameter == 0.0) { @@ -5353,7 +5341,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp } feedmultiplyBckp=feedmultiply; - int8_t TooLowZ = 0; target[X_AXIS]=current_position[X_AXIS]; target[Y_AXIS]=current_position[Y_AXIS]; @@ -5386,11 +5373,9 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp { #ifdef FILAMENTCHANGE_ZADD target[Z_AXIS]+= FILAMENTCHANGE_ZADD ; + // XXX: Removed unused var 'TooLowZ' if(target[Z_AXIS] < 10){ target[Z_AXIS]+= 10 ; - TooLowZ = 1; - }else{ - TooLowZ = 0; } #endif @@ -5842,6 +5827,14 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp SERIAL_ECHOLNRPGM(MSG_INVALID_EXTRUDER); } else { +#if EXTRUDERS == 1 + if (code_seen('F')) { + next_feedrate = code_value(); + if (next_feedrate > 0.0) { + feedrate = next_feedrate; + } + } +#else boolean make_move = false; if (code_seen('F')) { make_move = true; @@ -5850,7 +5843,6 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp feedrate = next_feedrate; } } -#if EXTRUDERS > 1 if (tmp_extruder != active_extruder) { // Save current position to return to after applying extruder offset memcpy(destination, current_position, sizeof(destination)); @@ -5964,7 +5956,7 @@ void ClearToSend() SERIAL_PROTOCOLLNRPGM(MSG_OK); } -update_currents() { +void update_currents() { float current_high[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; float current_low[3] = DEFAULT_PWM_MOTOR_CURRENT; float tmp_motor[3]; @@ -6003,12 +5995,13 @@ update_currents() { void get_coordinates() { - bool seen[4]={false,false,false,false}; + // XXX: Unused var (set but not ref) + // bool seen[4]={false,false,false,false}; for(int8_t i=0; i < NUM_AXIS; i++) { if(code_seen(axis_codes[i])) { destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; - seen[i]=true; + // seen[i]=true; if (i == Z_AXIS && SilentModeMenu == 2) update_currents(); } else destination[i] = current_position[i]; //Are these else lines really needed? @@ -6683,7 +6676,6 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder); int XY_AXIS_FEEDRATE = homing_feedrate[X_AXIS] / 20; - int Z_PROBE_FEEDRATE = homing_feedrate[Z_AXIS] / 60; int Z_LIFT_FEEDRATE = homing_feedrate[Z_AXIS] / 40; setup_for_endstop_move(false); @@ -6850,7 +6842,6 @@ void temp_compensation_start() { void temp_compensation_apply() { int i_add; - int compensation_value; int z_shift = 0; float z_shift_mm; @@ -6879,7 +6870,7 @@ float temp_comp_interpolation(float inp_temperature) { //cubic spline interpolation - int n, i, j, k; + int n, i, j; float h[10], a, b, c, d, sum, s[10] = { 0 }, x[10], F[10], f[10], m[10][10] = { 0 }, temp; int shift[10]; int temp_C[10]; diff --git a/Firmware/SdFatUtil.cpp b/Firmware/SdFatUtil.cpp index 371627f2d..2474b795e 100644 --- a/Firmware/SdFatUtil.cpp +++ b/Firmware/SdFatUtil.cpp @@ -46,7 +46,7 @@ int SdFatUtil::FreeRam() { void SdFatUtil::set_stack_guard() { - char i = 0; + //char i = 0; uint32_t *stack_guard; stack_guard = (uint32_t*)&__bss_end; diff --git a/Firmware/cardreader.cpp b/Firmware/cardreader.cpp index 5a676c3b0..1edcf9b22 100644 --- a/Firmware/cardreader.cpp +++ b/Firmware/cardreader.cpp @@ -61,7 +61,6 @@ char *createFilename(char *buffer,const dir_t &p) //buffer>12characters void CardReader::lsDive_pointer(const char *prepend, SdFile parent, const char * const match) { dir_t p; - uint8_t cnt = 0; //parent.seekSet = // Read the next entry from a directory @@ -73,17 +72,11 @@ void CardReader::lsDive_pointer(const char *prepend, SdFile parent, const char * //pom = parent.curPosition(); //MYSERIAL.println(pom, 10); - uint8_t pn0 = p.name[0]; + filenameIsDir = DIR_IS_SUBDIR(&p); - filenameIsDir = DIR_IS_SUBDIR(&p); - - - - - createFilename(filename, p); - creationDate = p.creationDate; - creationTime = p.creationTime; - + createFilename(filename, p); + creationDate = p.creationDate; + creationTime = p.creationTime; } /** @@ -363,12 +356,12 @@ void CardReader::openFile(char* name,bool read, bool replace_current/*=true*/) if(name[0]=='/') { dirname_start=strchr(name,'/')+1; - while(dirname_start>0) + while(dirname_start) { dirname_end=strchr(dirname_start,'/'); //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); - if(dirname_end>0 && dirname_end>dirname_start) + if(dirname_end && dirname_end>dirname_start) { char subdirname[13]; strncpy(subdirname, dirname_start, dirname_end-dirname_start); @@ -461,12 +454,12 @@ void CardReader::removeFile(char* name) if(name[0]=='/') { dirname_start=strchr(name,'/')+1; - while(dirname_start>0) + while(dirname_start) { dirname_end=strchr(dirname_start,'/'); //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name)); //SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); - if(dirname_end>0 && dirname_end>dirname_start) + if(dirname_end && dirname_end>dirname_start) { char subdirname[13]; strncpy(subdirname, dirname_start, dirname_end-dirname_start); @@ -710,8 +703,7 @@ void CardReader::updir() { --workDirDepth; workDir = workDirParents[0]; - int d; - for (int d = 0; d < workDirDepth; d++) + for (uint8_t d = 0; d < workDirDepth; d++) workDirParents[d] = workDirParents[d+1]; } } diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index 046a9ad7e..6535ecd24 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -2528,7 +2528,7 @@ const char MSG_SELFTEST_CHECK_BED_CZ[] PROGMEM = "Kontrola bed "; const char MSG_SELFTEST_CHECK_BED_IT[] PROGMEM = "Verifica letto"; const char MSG_SELFTEST_CHECK_BED_ES[] PROGMEM = "Control de cama"; const char MSG_SELFTEST_CHECK_BED_PL[] PROGMEM = "Kontrola bed "; -const char MSG_SELFTEST_CHECK_BED_DE[] PROGMEM = "Pr\x81fe Bed "; +const char MSG_SELFTEST_CHECK_BED_DE[] PROGMEM = "Pr\x81""fe Bed "; const char * const MSG_SELFTEST_CHECK_BED_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_SELFTEST_CHECK_BED_EN, MSG_SELFTEST_CHECK_BED_CZ, diff --git a/Firmware/language_de.h b/Firmware/language_de.h index aab7c91b9..4d6b860fd 100644 --- a/Firmware/language_de.h +++ b/Firmware/language_de.h @@ -181,7 +181,7 @@ + #define(length = 20) MSG_SELFTEST_CHECK_X "Pruefe X Achse " + #define(length = 20) MSG_SELFTEST_CHECK_Y "Pruefe Y Achse " + #define(length = 20) MSG_SELFTEST_CHECK_Z "Pruefe Z Achse " -+ #define(length = 20) MSG_SELFTEST_CHECK_BED "Pr\x81fe Bed " ++ #define(length = 20) MSG_SELFTEST_CHECK_BED "Pr\x81""fe Bed " + #define(length = 20) MSG_SELFTEST_CHECK_ALLCORRECT "Alles richtig " + #define MSG_SELFTEST "Selbsttest " + #define(length = 20) MSG_SELFTEST_FAILED "Selbsttest misslung." @@ -323,4 +323,5 @@ #define MSG_RIGHT "Rechts:" #define MSG_MEASURED_SKEW "Schraeglauf:" #define MSG_SLIGHT_SKEW "Leichter Schr.:" -#define MSG_SEVERE_SKEW "Schwerer Schr.:" \ No newline at end of file +#define MSG_SEVERE_SKEW "Schwerer Schr.:" + diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index e4888819d..98bf918f8 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -1599,7 +1599,6 @@ inline void scan_bed_induction_sensor_point() float x1 = center_old_x + IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS; float y0 = center_old_y - IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS; float y1 = center_old_y + IMPROVE_BED_INDUCTION_SENSOR_POINT3_SEARCH_RADIUS; - float y = y0; if (x0 < X_MIN_POS) x0 = X_MIN_POS; @@ -2271,11 +2270,11 @@ bool sample_mesh_and_store_reference() { // Verify the span of the Z values. float zmin = mbl.z_values[0][0]; - float zmax = zmax; + float zmax = zmin; for (int8_t j = 0; j < 3; ++ j) for (int8_t i = 0; i < 3; ++ i) { zmin = min(zmin, mbl.z_values[j][i]); - zmax = min(zmax, mbl.z_values[j][i]); + zmax = max(zmax, mbl.z_values[j][i]); } if (zmax - zmin > 3.f) { // The span of the Z offsets is extreme. Give up. @@ -2446,7 +2445,7 @@ void babystep_reset() } void count_xyz_details() { - float a1, a2; + //float a1, a2; float cntr[2] = { eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 0)), eeprom_read_float((float*)(EEPROM_BED_CALIBRATION_CENTER + 4)) @@ -2474,14 +2473,15 @@ void count_xyz_details() { SERIAL_ECHOPGM("Calibration status:"); MYSERIAL.println(int(calibration_status())); - a2 = -1 * asin(vec_y[0] / MACHINE_AXIS_SCALE_Y); -/* SERIAL_ECHOLNPGM("par:"); +/* a2 = -1 * asin(vec_y[0] / MACHINE_AXIS_SCALE_Y); + SERIAL_ECHOLNPGM("par:"); MYSERIAL.println(vec_y[0]); - MYSERIAL.println(a2);*/ + MYSERIAL.println(a2); a1 = asin(vec_x[1] / MACHINE_AXIS_SCALE_X); -/* MYSERIAL.println(vec_x[1]); - MYSERIAL.println(a1);*/ - //angleDiff = fabs(a2 - a1); + MYSERIAL.println(vec_x[1]); + MYSERIAL.println(a1); + angleDiff = fabs(a2 - a1); +*/ for (uint8_t mesh_point = 0; mesh_point < 3; ++mesh_point) { float y = vec_x[1] * pgm_read_float(bed_ref_points + mesh_point * 2) + vec_y[1] * pgm_read_float(bed_ref_points + mesh_point * 2 + 1) + cntr[1]; distance_from_min[mesh_point] = (y - Y_MIN_POS_CALIBRATION_POINT_OUT_OF_REACH); diff --git a/Firmware/pins.h b/Firmware/pins.h index 68375db79..cfd673397 100644 --- a/Firmware/pins.h +++ b/Firmware/pins.h @@ -3,20 +3,6 @@ #include "boards.h" -#if !MB(5DPRINT) -#define X_MS1_PIN -1 -#define X_MS2_PIN -1 -#define Y_MS1_PIN -1 -#define Y_MS2_PIN -1 -#define Z_MS1_PIN -1 -#define Z_MS2_PIN -1 -#define E0_MS1_PIN -1 -#define E0_MS2_PIN -1 -#define E1_MS1_PIN -1 -#define E1_MS2_PIN -1 -#define DIGIPOTSS_PIN -1 -#endif - #define LARGE_FLASH true /***************************************************************** @@ -38,22 +24,16 @@ #define X_STEP_PIN 37 #define X_DIR_PIN 48 - #define X_MIN_PIN 12 - #define X_MAX_PIN 30 #define X_ENABLE_PIN 29 #define X_MS1_PIN 40 #define X_MS2_PIN 41 #define Y_STEP_PIN 36 #define Y_DIR_PIN 49 - #define Y_MIN_PIN 11 - #define Y_MAX_PIN 24 #define Y_ENABLE_PIN 28 #define Y_MS1_PIN 69 #define Y_MS2_PIN 39 #define Z_STEP_PIN 35 #define Z_DIR_PIN 47 - #define Z_MIN_PIN 10 - #define Z_MAX_PIN 23 #define Z_ENABLE_PIN 27 #define Z_MS1_PIN 68 #define Z_MS2_PIN 67 @@ -63,6 +43,27 @@ #define TEMP_1_PIN 1 #define TEMP_2_PIN -1 +#ifndef DISABLE_MAX_ENDSTOPS + #define X_MAX_PIN 30 + #define Z_MAX_PIN 23 + #define Y_MAX_PIN 24 +#else + #define X_MAX_PIN -1 + #define Y_MAX_PIN -1 + #define Z_MAX_PIN -1 +#endif + +#ifndef DISABLE_MIN_ENDSTOPS + #define X_MIN_PIN 12 + #define Y_MIN_PIN 11 + #define Z_MIN_PIN 10 +#else + #define X_MIN_PIN -1 + #define Y_MIN_PIN -1 + #define Z_MIN_PIN -1 +#endif + + #ifdef SNMM #define E_MUX0_PIN 17 @@ -234,22 +235,16 @@ #define LARGE_FLASH true #define X_STEP_PIN 37 #define X_DIR_PIN 48 - #define X_MIN_PIN 12 - #define X_MAX_PIN 30 #define X_ENABLE_PIN 29 #define X_MS1_PIN 40 #define X_MS2_PIN 41 #define Y_STEP_PIN 36 #define Y_DIR_PIN 49 - #define Y_MIN_PIN 11 - #define Y_MAX_PIN 24 #define Y_ENABLE_PIN 28 #define Y_MS1_PIN 69 #define Y_MS2_PIN 39 #define Z_STEP_PIN 35 #define Z_DIR_PIN 47 - #define Z_MIN_PIN 10 - #define Z_MAX_PIN 23 #define Z_ENABLE_PIN 27 #define Z_MS1_PIN 68 #define Z_MS2_PIN 67 @@ -259,6 +254,26 @@ #define TEMP_1_PIN 1 #define TEMP_2_PIN -1 +#ifndef DISABLE_MAX_ENDSTOPS + #define X_MAX_PIN 30 + #define Z_MAX_PIN 23 + #define Y_MAX_PIN 24 +#else + #define X_MAX_PIN -1 + #define Y_MAX_PIN -1 + #define Z_MAX_PIN -1 +#endif + +#ifndef DISABLE_MIN_ENDSTOPS + #define X_MIN_PIN 12 + #define Y_MIN_PIN 11 + #define Z_MIN_PIN 10 +#else + #define X_MIN_PIN -1 + #define Y_MIN_PIN -1 + #define Z_MIN_PIN -1 +#endif + // The SDSS pin uses a different pin mapping from file Sd2PinMap.h #define SDSS 53 @@ -364,17 +379,6 @@ #endif #endif -#ifdef DISABLE_MAX_ENDSTOPS -#define X_MAX_PIN -1 -#define Y_MAX_PIN -1 -#define Z_MAX_PIN -1 -#endif - -#ifdef DISABLE_MIN_ENDSTOPS -#define X_MIN_PIN -1 -#define Y_MIN_PIN -1 -#define Z_MIN_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, PS_ON_PIN, \ HEATER_BED_PIN, FAN_PIN, \ diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index 2a6573fa9..d6d70fb4c 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -1029,16 +1029,20 @@ Having the real displacement of the head, we can calculate the total movement le // Acceleration of the segment, in mm/sec^2 block->acceleration = block->acceleration_st / steps_per_mm; -#if 1 +#if 0 // Oversample diagonal movements by a power of 2 up to 8x // to achieve more accurate diagonal movements. uint8_t bresenham_oversample = 1; for (uint8_t i = 0; i < 3; ++ i) { if (block->nominal_rate >= 5000) // 5kHz break; - block->nominal_rate << 1; - bresenham_oversample << 1; - block->step_event_count << 1; + // The following statements in their original form did nothing (missing =). + // In effect, this entire block under the conditional was doing nothing. + // Adding the syntax correction did not produce good movement results therefore + // it has been disabled (above) + block->nominal_rate <<= 1; + bresenham_oversample <<= 1; + block->step_event_count <<= 1; } if (bresenham_oversample > 1) // Lower the acceleration steps/sec^2 to account for the oversampling. diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 53bc7f5a5..0f3f65aaa 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -74,11 +74,18 @@ bool abort_on_endstop_hit = false; #endif static bool old_x_min_endstop=false; -static bool old_x_max_endstop=false; static bool old_y_min_endstop=false; -static bool old_y_max_endstop=false; static bool old_z_min_endstop=false; + +#if defined(X_MAX_PIN) && (X_MAX_PIN > -1) +static bool old_x_max_endstop=false; +#endif +#if defined(Y_MAX_PIN) && (Y_MAX_PIN > -1) +static bool old_y_max_endstop=false; +#endif +#if defined(Z_MAX_PIN) && (Z_MAX_PIN > -1) static bool old_z_max_endstop=false; +#endif static bool check_endstops = true; static bool check_z_endstop = false; @@ -1066,9 +1073,7 @@ void babystep(const uint8_t axis,const bool direction) //perform step WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN); - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(3); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); //get old pin state back. @@ -1085,9 +1090,7 @@ void babystep(const uint8_t axis,const bool direction) //perform step WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN); - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(3); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); //get old pin state back. @@ -1109,11 +1112,11 @@ void babystep(const uint8_t axis,const bool direction) WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN); #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN); + delayMicroseconds(2); + #else + delayMicroseconds(3); #endif - //wait a tiny bit - { - volatile float x=1./float(axis+1); //absolutely useless - } + WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 2d9c815e7..7c2037d03 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -182,6 +182,14 @@ unsigned long watchmillis[EXTRUDERS] = ARRAY_BY_EXTRUDERS(0,0,0); #ifdef FILAMENT_SENSOR static int meas_shift_index; //used to point to a delayed sample in buffer for filament width sensor #endif + +#if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) +static float temp_runaway_status[4]; +static float temp_runaway_target[4]; +static float temp_runaway_timer[4]; +static int temp_runaway_error_counter[4]; +#endif + //=========================================================================== //============================= functions ============================ //=========================================================================== @@ -1417,7 +1425,9 @@ ISR(TIMER0_COMPB_vect) static unsigned char temp_count = 0; static unsigned long raw_temp_0_value = 0; static unsigned long raw_temp_1_value = 0; +#if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1) static unsigned long raw_temp_2_value = 0; +#endif static unsigned long raw_temp_bed_value = 0; static unsigned char temp_state = 10; static unsigned char pwm_count = (1 << SOFT_PWM_SCALE); @@ -1857,7 +1867,7 @@ ISR(TIMER0_COMPB_vect) #ifdef TEMP_SENSOR_1_AS_REDUNDANT redundant_temperature_raw = raw_temp_1_value; #endif -#if EXTRUDERS > 2 +#if (EXTRUDERS > 2) && defined(TEMP_2_PIN) && (TEMP_2_PIN > -1) current_temperature_raw[2] = raw_temp_2_value; #endif current_temperature_bed_raw = raw_temp_bed_value; @@ -1873,7 +1883,9 @@ ISR(TIMER0_COMPB_vect) temp_count = 0; raw_temp_0_value = 0; raw_temp_1_value = 0; +#if defined(TEMP_2_PIN) && (TEMP_2_PIN > -1) raw_temp_2_value = 0; +#endif raw_temp_bed_value = 0; #if HEATER_0_RAW_LO_TEMP > HEATER_0_RAW_HI_TEMP diff --git a/Firmware/temperature.h b/Firmware/temperature.h index 4daae539d..5e80a0b39 100644 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -176,11 +176,6 @@ FORCE_INLINE bool isCoolingBed() { #endif #if (defined (TEMP_RUNAWAY_BED_HYSTERESIS) && TEMP_RUNAWAY_BED_TIMEOUT > 0) || (defined (TEMP_RUNAWAY_EXTRUDER_HYSTERESIS) && TEMP_RUNAWAY_EXTRUDER_TIMEOUT > 0) -static float temp_runaway_status[4]; -static float temp_runaway_target[4]; -static float temp_runaway_timer[4]; -static int temp_runaway_error_counter[4]; - void temp_runaway_check(int _heater_id, float _target_temperature, float _current_temperature, float _output, bool _isbed); void temp_runaway_stop(bool isPreheat, bool isBed); #endif diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 570baf481..180ab3eda 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -82,7 +82,7 @@ union MenuData // State of the currently active menu. // C Union manages sharing of the static memory by all the menus. -union MenuData menuData = { 0 }; +union MenuData menuData; union Data { @@ -111,7 +111,7 @@ uint8_t farm_mode = 0; int farm_no = 0; int farm_timer = 8; int farm_status = 0; -unsigned long allert_timer = millis(); +unsigned long alert_timer = millis(); bool printer_connected = true; unsigned long display_time; //just timer for showing pid finished message on lcd; @@ -119,7 +119,7 @@ float pid_temp = DEFAULT_PID_TEMP; bool long_press_active = false; long long_press_timer = millis(); -long button_blanking_time = millis(); +unsigned long button_blanking_time = millis(); bool button_pressed = false; bool menuExiting = false; @@ -139,6 +139,7 @@ char lcd_status_message[LCD_WIDTH + 1] = ""; //////WELCOME! unsigned char firstrun = 1; #ifdef DOGLCD +static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD #include "dogm_lcd_implementation.h" #else #include "ultralcd_implementation_hitachi_HD44780.h" @@ -155,16 +156,39 @@ static void lcd_status_screen(); extern bool powersupply; static void lcd_main_menu(); static void lcd_tune_menu(); -static void lcd_prepare_menu(); -static void lcd_move_menu(); static void lcd_settings_menu(); static void lcd_calibration_menu(); static void lcd_language_menu(); + static void lcd_control_temperature_menu(); -static void lcd_control_temperature_preheat_pla_settings_menu(); -static void lcd_control_temperature_preheat_abs_settings_menu(); -static void lcd_control_motion_menu(); -static void lcd_control_volumetric_menu(); + +static void lcd_babystep_z(); + +static bool lcd_selftest(); +static void lcd_selftest_v(); +static bool lcd_selfcheck_pulleys(int axis); +static bool lcd_selfcheck_endstops(); +static bool lcd_selfcheck_axis(int _axis, int _travel); +static bool lcd_selfcheck_check_heater(bool _isbed); +static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay); +static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); +static bool lcd_selftest_fan_dialog(int _fan); +static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); + +static void lcd_colorprint_change(); +#ifdef SNMM +static void extr_adj_0(); +static void extr_adj_1(); +static void extr_adj_2(); +static void extr_adj_3(); +static void fil_load_menu(); +static void fil_unload_menu(); +static void extr_unload_0(); +static void extr_unload_1(); +static void extr_unload_2(); +static void extr_unload_3(); +#endif +static void lcd_disable_farm_mode(); static void prusa_stat_printerstatus(int _status); static void prusa_stat_farm_number(); @@ -172,10 +196,16 @@ static void prusa_stat_temperatures(); static void prusa_stat_printinfo(); static void lcd_farm_no(); +static void lcd_send_status(); +static void lcd_connect_printer(); + +static char snmm_stop_print_menu(); + +static float count_e(float layer_heigth, float extrusion_width, float extrusion_length); + #ifdef DOGLCD static void lcd_set_contrast(); #endif -static void lcd_control_retract_menu(); static void lcd_sdcard_menu(); #ifdef DELTA_CALIBRATION_MENU @@ -193,8 +223,9 @@ static void menu_action_function(menuFunc_t data); static void menu_action_setlang(unsigned char lang); static void menu_action_sdfile(const char* filename, char* longFilename); static void menu_action_sddirectory(const char* filename, char* longFilename); -static void menu_action_setting_edit_bool(const char* pstr, bool* ptr); static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue); +#if 0 +static void menu_action_setting_edit_bool(const char* pstr, bool* ptr); static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue); static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue); static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue); @@ -202,8 +233,9 @@ static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue); static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue); static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue); +#endif -/* +#if 0 static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); @@ -213,7 +245,7 @@ static void menu_action_setting_edit_callback_float5(const char* pstr, float* pt static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc); static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc); -*/ +#endif #define ENCODER_FEEDRATE_DEADZONE 10 @@ -521,7 +553,6 @@ static void lcd_status_screen() void lcd_commands() { - char cmd1[25]; if (lcd_commands_type == LCD_COMMAND_LONG_PAUSE) { if(lcd_commands_step == 0) { @@ -1099,8 +1130,6 @@ void lcd_commands() if (lcd_commands_type == LCD_COMMAND_STOP_PRINT) /// stop print { - uint8_t stopped_extruder; - if (lcd_commands_step == 0) { lcd_commands_step = 6; @@ -2003,12 +2032,14 @@ static void _lcd_babystep(int axis, const char *msg) if (LCD_CLICKED) lcd_goto_menu(lcd_main_menu); } +#if 0 static void lcd_babystep_x() { _lcd_babystep(X_AXIS, (MSG_BABYSTEPPING_X)); } static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, (MSG_BABYSTEPPING_Y)); } +#endif static void lcd_babystep_z() { _lcd_babystep(Z_AXIS, (MSG_BABYSTEPPING_Z)); } @@ -2226,7 +2257,6 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) // Until confirmed by the confirmation dialog. for (;;) { - unsigned long previous_millis_cmd = millis(); const char *msg = only_z ? MSG_MOVE_CARRIAGE_TO_THE_TOP_Z : MSG_MOVE_CARRIAGE_TO_THE_TOP; const char *msg_next = lcd_display_message_fullscreen_P(msg); const bool multi_screen = msg_next != NULL; @@ -2235,13 +2265,10 @@ bool lcd_calibrate_z_end_stop_manual(bool only_z) encoderDiff = 0; encoderPosition = 0; for (;;) { -// if (millis() - previous_millis_cmd > LCD_TIMEOUT_TO_STATUS) -// goto canceled; manage_heater(); manage_inactivity(true); if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP) { delay(50); - previous_millis_cmd = millis(); encoderPosition += abs(encoderDiff / ENCODER_PULSES_PER_STEP); encoderDiff = 0; if (! planner_queue_full()) { @@ -2567,7 +2594,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui else if (point_too_far_mask == 2 || point_too_far_mask == 7) // Only the center point or all the three front points. msg = MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_BOTH_FAR; - else if (point_too_far_mask & 1 == 0) + else if ((point_too_far_mask & 1) == 0) // The right and maybe the center point out of reach. msg = MSG_BED_SKEW_OFFSET_DETECTION_FAILED_FRONT_RIGHT_FAR; else @@ -2579,7 +2606,7 @@ void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, ui if (point_too_far_mask == 2 || point_too_far_mask == 7) // Only the center point or all the three front points. msg = MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_BOTH_FAR; - else if (point_too_far_mask & 1 == 0) + else if ((point_too_far_mask & 1) == 0) // The right and maybe the center point out of reach. msg = MSG_BED_SKEW_OFFSET_DETECTION_WARNING_FRONT_RIGHT_FAR; else @@ -2612,11 +2639,11 @@ static void lcd_show_end_stops() { lcd.setCursor(0, 0); lcd_printPGM((PSTR("End stops diag"))); lcd.setCursor(0, 1); - lcd_printPGM((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? (PSTR("X1")) : (PSTR("X0"))); + lcd_printPGM(((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("X1")) : (PSTR("X0"))); lcd.setCursor(0, 2); - lcd_printPGM((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? (PSTR("Y1")) : (PSTR("Y0"))); + lcd_printPGM(((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Y1")) : (PSTR("Y0"))); lcd.setCursor(0, 3); - lcd_printPGM((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? (PSTR("Z1")) : (PSTR("Z0"))); + lcd_printPGM(((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Z1")) : (PSTR("Z0"))); } static void menu_show_end_stops() { @@ -2629,7 +2656,6 @@ static void menu_show_end_stops() { // Otherwise the Z calibration is not changed and false is returned. void lcd_diag_show_end_stops() { - int enc_dif = encoderDiff; lcd_implementation_clear(); for (;;) { manage_heater(); @@ -3475,7 +3501,7 @@ static void lcd_calibration_menu() if (!isPrintPaused) { MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28 W")); - MENU_ITEM(function, MSG_SELFTEST, lcd_selftest); + MENU_ITEM(function, MSG_SELFTEST, lcd_selftest_v); #ifdef MK1BP // MK1 // "Calibrate Z" @@ -3511,49 +3537,6 @@ static void lcd_calibration_menu() END_MENU(); } -/* -void lcd_mylang_top(int hlaska) { - lcd.setCursor(0,0); - lcd.print(" "); - lcd.setCursor(0,0); - lcd_printPGM(MSG_ALL[hlaska-1][LANGUAGE_SELECT]); -} - -void lcd_mylang_drawmenu(int cursor) { - int first = 0; - if (cursor>2) first = cursor-2; - if (cursor==LANG_NUM) first = LANG_NUM-3; - lcd.setCursor(0, 1); - lcd.print(" "); - lcd.setCursor(1, 1); - lcd_printPGM(MSG_ALL[first][LANGUAGE_NAME]); - - lcd.setCursor(0, 2); - lcd.print(" "); - lcd.setCursor(1, 2); - lcd_printPGM(MSG_ALL[first+1][LANGUAGE_NAME]); - - lcd.setCursor(0, 3); - lcd.print(" "); - lcd.setCursor(1, 3); - lcd_printPGM(MSG_ALL[first+2][LANGUAGE_NAME]); - - if (cursor==1) lcd.setCursor(0, 1); - if (cursor>1 && cursor"); - - if (cursor2) { - lcd.setCursor(19,1); - lcd.print("^"); - } -} -*/ void lcd_mylang_drawmenu(int cursor) { int first = 0; @@ -3618,13 +3601,11 @@ void lcd_mylang() { int enc_dif = 0; int cursor_pos = 1; lang_selected=255; - int hlaska=1; - int counter=0; + lcd_set_custom_characters_arrows(); lcd_implementation_clear(); - //lcd_mylang_top(hlaska); lcd_mylang_drawmenu(cursor_pos); @@ -3638,7 +3619,6 @@ void lcd_mylang() { if ( abs((enc_dif - encoderDiff)) > 4 ) { - //if ( (abs(enc_dif - encoderDiff)) > 1 ) { if (enc_dif > encoderDiff ) { cursor_pos --; } @@ -3658,7 +3638,6 @@ void lcd_mylang() { lcd_mylang_drawmenu(cursor_pos); enc_dif = encoderDiff; delay(100); - //} } else delay(20); @@ -3669,16 +3648,7 @@ void lcd_mylang() { delay(500); } - /* - if (++counter == 80) { - hlaska++; - if(hlaska>LANG_NUM) hlaska=1; - lcd_mylang_top(hlaska); - lcd_mylang_drawcursor(cursor_pos); - counter=0; - } - */ - }; + } if(MYSERIAL.available() > 1){ lang_selected = 0; @@ -4043,9 +4013,10 @@ static void lcd_disable_farm_mode() { } -static void lcd_ping_allert() { - if ((abs(millis() - allert_timer)*0.001) > PING_ALLERT_PERIOD) { - allert_timer = millis(); +#if 0 +static void lcd_ping_alert() { + if ((abs(millis() - alert_timer)*0.001) > PING_ALERT_PERIOD) { + alert_timer = millis(); SET_OUTPUT(BEEPER); for (int i = 0; i < 2; i++) { WRITE(BEEPER, HIGH); @@ -4056,7 +4027,7 @@ static void lcd_ping_allert() { } }; - +#endif #ifdef SNMM @@ -4076,9 +4047,7 @@ void change_extr(int extr) { //switches multiplexer for extruders disable_e1(); disable_e2(); -#ifdef SNMM snmm_extruder = extr; -#endif pinMode(E_MUX0_PIN, OUTPUT); pinMode(E_MUX1_PIN, OUTPUT); @@ -4106,7 +4075,7 @@ void change_extr(int extr) { //switches multiplexer for extruders delay(100); } -static int get_ext_nr() { //reads multiplexer input pins and return current extruder number (counted from 0) +int get_ext_nr() { //reads multiplexer input pins and return current extruder number (counted from 0) return(2 * READ(E_MUX1_PIN) + READ(E_MUX0_PIN)); } @@ -4122,10 +4091,10 @@ void display_loading() { void extr_adj(int extruder) //loading filament for SNMM { - bool correct; + //bool correct; max_feedrate[E_AXIS] =80; //max_feedrate[E_AXIS] = 50; - START: + //START: lcd_implementation_clear(); lcd.setCursor(0, 0); switch (extruder) { @@ -4625,8 +4594,6 @@ static void lcd_main_menu() MENU_ITEM(back, MSG_WATCH, lcd_status_screen); /* if (farm_mode && !IS_SD_PRINTING ) { - - int tempScrool = 0; if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) //delay(100); return; // nothing to do (so don't thrash the SD card) @@ -4765,15 +4732,14 @@ void stack_error() { while (1) delay_keep_alive(1000); } -#ifdef SDSUPPORT +#if 0 +//#ifdef SDSUPPORT static void lcd_autostart_sd() { card.lastnr = 0; card.setroot(); card.checkautostart(true); } -#endif - static void lcd_silent_mode_set_tune() { @@ -4787,6 +4753,7 @@ static void lcd_silent_mode_set_tune() { digipot_init(); lcd_goto_menu(lcd_tune_menu, 9); } +#endif static void lcd_colorprint_change() { @@ -4830,13 +4797,13 @@ static void lcd_tune_menu() } - - +#if 0 static void lcd_move_menu_01mm() { move_menu_scale = 0.1; lcd_move_menu_axis(); } +#endif static void lcd_control_temperature_menu() { @@ -4982,7 +4949,6 @@ void lcd_sdcard_menu() { uint8_t sdSort = eeprom_read_byte((uint8_t*)EEPROM_SD_SORT); - int tempScrool = 0; if (presort_flag == true) { presort_flag = false; card.presort(); @@ -5037,7 +5003,6 @@ void lcd_sdcard_menu() } //int j; //char description[31]; - int tempScrool = 0; if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) //delay(100); return; // nothing to do (so don't thrash the SD card) @@ -5132,13 +5097,22 @@ void lcd_sdcard_menu() */ menu_edit_type(int, int3, itostr3, 1) +#if defined(AUTOTEMP) menu_edit_type(float, float3, ftostr3, 1) menu_edit_type(float, float32, ftostr32, 100) +#endif +#if 0 menu_edit_type(float, float43, ftostr43, 1000) menu_edit_type(float, float5, ftostr5, 0.01) menu_edit_type(float, float51, ftostr51, 10) menu_edit_type(float, float52, ftostr52, 100) menu_edit_type(unsigned long, long5, ftostr5, 0.01) +#endif + +static void lcd_selftest_v() +{ + (void)lcd_selftest(); +} static bool lcd_selftest() { @@ -5254,24 +5228,26 @@ static bool lcd_selfcheck_axis(int _axis, int _travel) plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], manual_feedrate[0] / 60, active_extruder); st_synchronize(); - if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) + if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) { if (_axis == 0) { - _stepresult = (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? true : false; - _err_endstop = (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? 1 : 2; + _stepresult = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? true : false; + _err_endstop = ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? 1 : 2; } if (_axis == 1) { - _stepresult = (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? true : false; - _err_endstop = (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? 0 : 2; + _stepresult = ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? true : false; + _err_endstop = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? 0 : 2; } if (_axis == 2) { - _stepresult = (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? true : false; - _err_endstop = (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? 0 : 1; + _stepresult = ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) ? true : false; + _err_endstop = ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? 0 : 1; /*disable_x(); disable_y(); disable_z();*/ @@ -5334,7 +5310,6 @@ static bool lcd_selfcheck_pulleys(int axis) float current_position_init; float move; bool endstop_triggered = false; - bool result = true; int i; unsigned long timeout_counter; refresh_cmd_timeout(); @@ -5358,7 +5333,8 @@ static bool lcd_selfcheck_pulleys(int axis) current_position[axis] = current_position[axis] - move; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[3], 50, active_extruder); st_synchronize(); - if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) || (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1)) { + if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { lcd_selftest_error(8, (axis == 0) ? "X" : "Y", ""); return(false); } @@ -5367,7 +5343,8 @@ static bool lcd_selfcheck_pulleys(int axis) endstop_triggered = false; manage_inactivity(true); while (!endstop_triggered) { - if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) || (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1)) { + if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1)) { endstop_triggered = true; if (current_position_init - 1 <= current_position[axis] && current_position_init + 1 >= current_position[axis]) { current_position[axis] += 15; @@ -5390,28 +5367,33 @@ static bool lcd_selfcheck_pulleys(int axis) } } } + return(true); } static bool lcd_selfcheck_endstops() { bool _result = true; - if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) + if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) { - current_position[0] = (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) ? current_position[0] = current_position[0] + 10 : current_position[0]; - current_position[1] = (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) ? current_position[1] = current_position[1] + 10 : current_position[1]; - current_position[2] = (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) ? current_position[2] = current_position[2] + 10 : current_position[2]; + if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) current_position[0] += 10; + if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) current_position[1] += 10; + if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) current_position[2] += 10; } plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[0] / 60, active_extruder); delay(500); - if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1 || READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1 || READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) + if (((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) || + ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1)) { _result = false; char _error[4] = ""; - if (READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "X"); - if (READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Y"); - if (READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING == 1) strcat(_error, "Z"); + if ((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "X"); + if ((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Y"); + if ((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) strcat(_error, "Z"); lcd_selftest_error(3, _error, ""); } manage_heater(); @@ -5666,8 +5648,7 @@ static bool lcd_selftest_fan_dialog(int _fan) if (!_result) { - const char *_err; - lcd_selftest_error(_errno, _err, _err); + lcd_selftest_error(_errno, "", ""); } return _result; @@ -5677,7 +5658,7 @@ static bool lcd_selftest_fan_dialog(int _fan) static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay) { - lcd_next_update_millis = millis() + (LCD_UPDATE_INTERVAL * 10000); + lcd_next_update_millis = millis() + (LCD_UPDATE_INTERVAL * 10000L); int _step_block = 0; const char *_indicator = (_progress > _progress_scale) ? "-" : "|"; @@ -5778,7 +5759,7 @@ static void menu_action_function(menuFunc_t data) { static bool check_file(const char* filename) { bool result = false; uint32_t filesize; - card.openFile(filename, true); + card.openFile((char *)filename, true); filesize = card.getFileSize(); if (filesize > END_FILE_SECTION) { card.setIndex(filesize - END_FILE_SECTION); @@ -5818,17 +5799,18 @@ static void menu_action_sddirectory(const char* filename, char* longFilename) card.chdir(filename); encoderPosition = 0; } +#if 0 static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); } -/* + static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) { menu_action_setting_edit_bool(pstr, ptr); (*callback)(); } -*/ +#endif #endif//ULTIPANEL /** LCD API **/ @@ -6066,7 +6048,6 @@ static void lcd_connect_printer() { lcd_update_enable(false); lcd_implementation_clear(); - bool pressed = false; int i = 0; int t = 0; lcd_set_custom_characters_progress(); @@ -6103,7 +6084,7 @@ void lcd_ping() { //chceck if printer is connected to monitoring when in farm mo //if there are comamnds in buffer, some long gcodes can delay execution of ping command //therefore longer period is used printer_connected = false; - //lcd_ping_allert(); //acustic signals + //lcd_ping_alert(); //acustic signals } else { lcd_printer_connected(); @@ -6632,4 +6613,4 @@ void copy_and_scalePID_d() } */ -#endif //ULTRA_LCD \ No newline at end of file +#endif //ULTRA_LCD diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 8aad71932..511ba6ae1 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -29,20 +29,11 @@ void prusa_statistics(int _message, uint8_t _col_nr = 0); void lcd_confirm_print(); unsigned char lcd_choose_color(); -void lcd_mylang(); + void lcd_mylang(); bool lcd_detected(void); - static bool lcd_selftest(); - static bool lcd_selfcheck_endstops(); - static bool lcd_selfcheck_axis(int _axis, int _travel); - static bool lcd_selfcheck_check_heater(bool _isbed); - static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, bool _clear, int _delay); - static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator); - static bool lcd_selftest_fan_dialog(int _fan); - static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); void lcd_menu_statistics(); - static bool lcd_selfcheck_pulleys(int axis); extern const char* lcd_display_message_fullscreen_P(const char *msg, uint8_t &nlines); @@ -67,8 +58,6 @@ void lcd_mylang(); void lcd_setcontrast(uint8_t value); #endif - static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD - #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_MESSAGERPGM(x) lcd_setstatuspgm((x)) @@ -212,31 +201,12 @@ extern void lcd_implementation_print_at(uint8_t x, uint8_t y, const char *str); void change_extr(int extr); -static void lcd_colorprint_change(); -static int get_ext_nr(); +int get_ext_nr(); void extr_adj(int extruder); -static void extr_adj_0(); -static void extr_adj_1(); -static void extr_adj_2(); -static void extr_adj_3(); -static void fil_load_menu(); -static void fil_unload_menu(); -static void extr_unload_0(); -static void extr_unload_1(); -static void extr_unload_2(); -static void extr_unload_3(); -static void lcd_disable_farm_mode(); void extr_unload_all(); void extr_unload_used(); void extr_unload(); -static char snmm_stop_print_menu(); -static void lcd_babystep_z(); -#ifdef SDCARD_SORT_ALPHA -static void lcd_sort_type_set(); -#endif -static float count_e(float layer_heigth, float extrusion_width, float extrusion_length); void stack_error(); -static void lcd_ping_allert(); void lcd_printer_connected(); void lcd_ping(); @@ -271,10 +241,7 @@ void lcd_set_degree(); void lcd_set_progress(); #endif -static void lcd_send_status(); -static void lcd_connect_printer(); - void lcd_wizard(); void lcd_wizard(int state); -#endif //ULTRALCD_H \ No newline at end of file +#endif //ULTRALCD_H diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 4f91947cc..5699461f7 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -360,6 +360,7 @@ static void lcd_set_custom_characters( B00000 }; //thanks Sonny Mounicou +#if 0 // Unused byte arrup[8] = { B00100, B01110, @@ -381,7 +382,7 @@ static void lcd_set_custom_characters( B01010, B00100 }; - +#endif #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) static bool char_mode = false; @@ -603,16 +604,15 @@ static void lcd_implementation_init_noclear( } -static void lcd_implementation_nodisplay() +inline void lcd_implementation_nodisplay() { lcd.noDisplay(); } -static void lcd_implementation_display() +inline void lcd_implementation_display() { lcd.display(); } - -void lcd_implementation_clear() +inline void lcd_implementation_clear() { lcd.clear(); } @@ -901,7 +901,7 @@ static void lcd_implementation_status_screen() lcd.setCursor(7, 3); lcd_printPGM(PSTR(" ")); - for (int dots = 0; dots < heating_status_counter; dots++) + for (uint16_t dots = 0; dots < heating_status_counter; dots++) { lcd.setCursor(7 + dots, 3); lcd.print('.'); @@ -1103,6 +1103,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const lcd.print(' '); lcd.print(data); } +#if 0 static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data) { char c; @@ -1125,6 +1126,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, cons lcd.print(' '); lcd_printPGM(data); } +#endif #define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data))) #define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data))) #define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data))) @@ -1202,12 +1204,6 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* lcd.setCursor(0, row); lcd.print('>'); - if (longFilename[0] != '\0') - { - - filename = longFilename; - //longFilename[LCD_WIDTH-1] = '\0'; - } int i = 1; int j = 0; @@ -1229,8 +1225,8 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* if(LCD_CLICKED || ( enc_dif != encoderDiff )){ longFilenameTMP = longFilename; *(longFilenameTMP + LCD_WIDTH - 2) = '\0'; - int i = 1; - int j = 0; + i = 1; + j = 0; break; }else{ if (j == 1) delay(3); //wait around 1.2 s to start scrolling text diff --git a/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h index f0157dfe4..8b18e5a77 100644 --- a/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK1-RAMBo10a-E3Dv6full.h @@ -392,7 +392,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s diff --git a/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h index 03c99f601..28d3a1d6c 100644 --- a/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK1-RAMBo13a-E3Dv6full.h @@ -392,7 +392,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s diff --git a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h index b7475feaf..6be324ae1 100644 --- a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo10a-E3Dv6full.h @@ -387,7 +387,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s diff --git a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h index 4985099a8..42fa832c3 100644 --- a/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-MultiMaterial-RAMBo13a-E3Dv6full.h @@ -389,7 +389,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s diff --git a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h index 381a0b637..8779b7578 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo10a-E3Dv6full.h @@ -387,7 +387,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s diff --git a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h index bfa787d51..39b9ceace 100644 --- a/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK2-RAMBo13a-E3Dv6full.h @@ -389,7 +389,7 @@ THERMISTORS SETTINGS #define PING_TIME 60 //time in s #define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes -#define PING_ALLERT_PERIOD 60 //time in s +#define PING_ALERT_PERIOD 60 //time in s #define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring #define NC_BUTTON_LONG_PRESS 15 //time in s