diff --git a/Firmware/ConfigurationStore.cpp b/Firmware/ConfigurationStore.cpp index 264486b7c..388ded1a4 100644 --- a/Firmware/ConfigurationStore.cpp +++ b/Firmware/ConfigurationStore.cpp @@ -11,10 +11,11 @@ #ifdef DEBUG_EEPROM_WRITE #define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), #value) +static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) #else //DEBUG_EEPROM_WRITE -#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value), 0) +#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value)) +static void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) #endif //DEBUG_EEPROM_WRITE -void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) { #ifdef DEBUG_EEPROM_WRITE printf_P(PSTR("EEPROM_WRITE_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); @@ -39,10 +40,11 @@ void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size, char* name) #ifdef DEBUG_EEPROM_READ #define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), #value) +static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) #else //DEBUG_EEPROM_READ -#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value), 0) +#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value)) +static void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) #endif //DEBUG_EEPROM_READ -void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size, char* name) { #ifdef DEBUG_EEPROM_READ printf_P(PSTR("EEPROM_READ_VAR addr=0x%04x size=0x%02hhx name=%s\n"), pos, size, name); diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index d1ddc61ec..966e7af40 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -34,7 +34,6 @@ void print_eeprom(uint16_t address, uint16_t count, uint8_t countperline = 16) uint8_t count_line = countperline; while (count && count_line) { - uint8_t data = 0; putchar(' '); print_hex_byte(eeprom_read_byte((uint8_t*)address++)); count_line--; @@ -115,7 +114,7 @@ void dcode_3() count = parse_hex(strchr_pointer + 1, data, 16); if (count > 0) { - for (int i = 0; i < count; i++) + for (uint16_t i = 0; i < count; i++) eeprom_write_byte((uint8_t*)(address + i), data[i]); printf_P(_N("%d bytes written to EEPROM at address 0x%04x"), count, address); putchar('\n'); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 1c8683cfa..5c6fb75b3 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -146,6 +146,7 @@ #define FILAMENT_DEFAULT 0 #define FILAMENT_FLEX 1 #define FILAMENT_PVA 2 +#define FILAMENT_UNDEFINED 255 // look here for descriptions of G-codes: http://linuxcnc.org/handbook/gcode/g-code.html // http://objects.reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes @@ -919,7 +920,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) } -FILE _uartout = {0}; +FILE _uartout; //= {0}; Global variable is always zero initialized. No need to explicitly state this. int uart_putchar(char c, FILE *stream) { @@ -2964,15 +2965,6 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level) if (st_get_position_mm(Z_AXIS) == MESH_HOME_Z_SEARCH) { - - int8_t verbosity_level = 0; - if (code_seen('V')) - { - // Just 'V' without a number counts as V1. - char c = strchr_pointer[1]; - verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); - } - if (onlyZ) { clean_up_after_endstop_move(); @@ -3096,7 +3088,6 @@ void gcode_M600(bool automatic, float x_position, float y_position, float z_shif //First backup current position and settings feedmultiplyBckp=feedmultiply; - float HotendTempBckp = degTargetHotend(active_extruder); int fanSpeedBckp = fanSpeed; lastpos[X_AXIS]=current_position[X_AXIS]; lastpos[Y_AXIS]=current_position[Y_AXIS]; @@ -6302,8 +6293,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) //add storing this information for different load/unload profiles etc. in the future //firmware does not wait for "ok" from mmu - uint8_t extruder; - uint8_t filament; + uint8_t extruder = 255; + uint8_t filament = FILAMENT_UNDEFINED; if(code_seen('E')) extruder = code_value(); if(code_seen('F')) filament = code_value(); @@ -9056,9 +9047,7 @@ void M600_wait_for_user() { if (millis() > waiting_start_time + (unsigned long)M600_TIMEOUT * 1000) { lcd_display_message_fullscreen_P(_i("Press knob to preheat nozzle and continue."));////MSG_PRESS_TO_PREHEAT c=20 r=4 wait_for_user_state = 1; - setTargetHotend(0, 0); - setTargetHotend(0, 1); - setTargetHotend(0, 2); + setAllTargetHotends(0); st_synchronize(); disable_e0(); disable_e1(); @@ -9098,7 +9087,6 @@ void M600_wait_for_user() { void mmu_M600_load_filament(bool automatic) { //load filament for mmu v2 - bool response = false; bool yes = false; if (!automatic) { diff --git a/Firmware/fsensor.cpp b/Firmware/fsensor.cpp index c46572937..34fab48f9 100644 --- a/Firmware/fsensor.cpp +++ b/Firmware/fsensor.cpp @@ -101,9 +101,9 @@ uint16_t fsensor_oq_er_sum; //max error counter value durring meassurement uint8_t fsensor_oq_er_max; //minimum delta value -uint16_t fsensor_oq_yd_min; +int16_t fsensor_oq_yd_min; //maximum delta value -uint16_t fsensor_oq_yd_max; +int16_t fsensor_oq_yd_max; //sum of shutter value uint16_t fsensor_oq_sh_sum; @@ -218,7 +218,9 @@ bool fsensor_check_autoload(void) fsensor_autoload_check_start(); return false; } +#if 0 uint8_t fsensor_autoload_c_old = fsensor_autoload_c; +#endif if ((millis() - fsensor_autoload_last_millis) < 25) return false; fsensor_autoload_last_millis = millis(); if (!pat9125_update_y()) //update sensor @@ -243,9 +245,11 @@ bool fsensor_check_autoload(void) else if (fsensor_autoload_c > 0) fsensor_autoload_c--; if (fsensor_autoload_c == 0) fsensor_autoload_sum = 0; -// puts_P(_N("fsensor_check_autoload\n")); -// if (fsensor_autoload_c != fsensor_autoload_c_old) -// printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum); +#if 0 + puts_P(_N("fsensor_check_autoload\n")); + if (fsensor_autoload_c != fsensor_autoload_c_old) + printf_P(PSTR("fsensor_check_autoload dy=%d c=%d sum=%d\n"), dy, fsensor_autoload_c, fsensor_autoload_sum); +#endif // if ((fsensor_autoload_c >= 15) && (fsensor_autoload_sum > 30)) if ((fsensor_autoload_c >= 12) && (fsensor_autoload_sum > 20)) { diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 0d1e3840e..6def491e3 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -56,7 +56,7 @@ #define LCD_5x8DOTS 0x00 -FILE _lcdout = {0}; +FILE _lcdout; // = {0}; Global variable is always zero initialized, no need to explicitly state that. uint8_t lcd_rs_pin; // LOW: command. HIGH: character. @@ -157,7 +157,7 @@ uint8_t lcd_write(uint8_t value) return 1; // assume sucess } -void lcd_begin(uint8_t cols, uint8_t lines, uint8_t dotsize, uint8_t clear) +static void lcd_begin(uint8_t lines, uint8_t dotsize, uint8_t clear) { if (lines > 1) lcd_displayfunction |= LCD_2LINE; lcd_numlines = lines; @@ -247,20 +247,20 @@ void lcd_init(void) pinMode(lcd_enable_pin, OUTPUT); if (fourbitmode) lcd_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; else lcd_displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); //lcd_clear(); fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream } void lcd_refresh(void) { - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 1); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 1); lcd_set_custom_characters(); } void lcd_refresh_noclear(void) { - lcd_begin(LCD_WIDTH, LCD_HEIGHT, LCD_5x8DOTS, 0); + lcd_begin(LCD_HEIGHT, LCD_5x8DOTS, 0); lcd_set_custom_characters(); } @@ -506,7 +506,6 @@ uint8_t lcd_escape_write(uint8_t chr) break; } escape_cnt = 0; // reset escape -end: return 1; // assume sucess } diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index cc6c66cd4..d05ae59fc 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -272,7 +272,6 @@ void optiboot_w25x20cl_enter() /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { uint32_t addr = (((uint32_t)rampz) << 16) | address; - uint8_t desttype; register pagelen_t i; // Read the page length, with the length transferred each nibble separately to work around // the Prusa's USB to serial infamous semicolon issue. @@ -280,8 +279,8 @@ void optiboot_w25x20cl_enter() length |= ((pagelen_t)getch()) << 8; length |= getch(); length |= getch(); - // Read the destination type. It should always be 'F' as flash. - desttype = getch(); + // Read the destination type. It should always be 'F' as flash. It is not checked. + (void)getch(); verifySpace(); w25x20cl_wait_busy(); w25x20cl_rd_data(addr, buff, length); diff --git a/Firmware/sm4.c b/Firmware/sm4.c index 509ac23f8..34cf8a3c9 100644 --- a/Firmware/sm4.c +++ b/Firmware/sm4.c @@ -85,8 +85,8 @@ void sm4_set_dir(uint8_t axis, uint8_t dir) uint8_t sm4_get_dir_bits(void) { - uint8_t register dir_bits = 0; - uint8_t register portL = PORTL; + register uint8_t dir_bits = 0; + register uint8_t portL = PORTL; //TODO -optimize in asm #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) if (portL & 2) dir_bits |= 1; @@ -106,7 +106,7 @@ uint8_t sm4_get_dir_bits(void) void sm4_set_dir_bits(uint8_t dir_bits) { - uint8_t register portL = PORTL; + register uint8_t portL = PORTL; portL &= 0xb8; //set direction bits to zero //TODO -optimize in asm #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) @@ -129,7 +129,7 @@ void sm4_set_dir_bits(uint8_t dir_bits) void sm4_do_step(uint8_t axes_mask) { #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3) || (MOTHERBOARD == BOARD_EINSY_1_0a)) - uint8_t register portC = PORTC & 0xf0; + register uint8_t portC = PORTC & 0xf0; PORTC = portC | (axes_mask & 0x0f); //set step signals by mask asm("nop"); PORTC = portC; //set step signals to zero diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index b2d71e2a6..8f74ae6f6 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -1425,9 +1425,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef DEBUG_XSTEP_DUP_PIN WRITE(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN); #endif //DEBUG_XSTEP_DUP_PIN - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(1); WRITE(X_STEP_PIN, INVERT_X_STEP_PIN); #ifdef DEBUG_XSTEP_DUP_PIN WRITE(DEBUG_XSTEP_DUP_PIN,INVERT_X_STEP_PIN); @@ -1451,9 +1449,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef DEBUG_YSTEP_DUP_PIN WRITE(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN); #endif //DEBUG_YSTEP_DUP_PIN - { - volatile float x=1./float(axis+1)/float(axis+2); //wait a tiny bit - } + delayMicroseconds(1); WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN); #ifdef DEBUG_YSTEP_DUP_PIN WRITE(DEBUG_YSTEP_DUP_PIN,INVERT_Y_STEP_PIN); @@ -1480,10 +1476,7 @@ void babystep(const uint8_t axis,const bool direction) #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN); #endif - //wait a tiny bit - { - volatile float x=1./float(axis+1); //absolutely useless - } + delayMicroseconds(1); WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN); #ifdef Z_DUAL_STEPPER_DRIVERS WRITE(Z2_STEP_PIN, INVERT_Z_STEP_PIN); @@ -1568,7 +1561,6 @@ void st_current_set(uint8_t driver, int current) void microstep_init() { - const uint8_t microstep_modes[] = MICROSTEP_MODES; #if defined(E1_MS1_PIN) && E1_MS1_PIN > -1 pinMode(E1_MS1_PIN,OUTPUT); @@ -1576,6 +1568,7 @@ void microstep_init() #endif #if defined(X_MS1_PIN) && X_MS1_PIN > -1 + const uint8_t microstep_modes[] = MICROSTEP_MODES; pinMode(X_MS1_PIN,OUTPUT); pinMode(X_MS2_PIN,OUTPUT); pinMode(Y_MS1_PIN,OUTPUT); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 6a21b8250..34539483e 100644 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -183,7 +183,6 @@ static int bed_maxttemp_raw = HEATER_BED_RAW_HI_TEMP; static float analog2temp(int raw, uint8_t e); static float analog2tempBed(int raw); static float analog2tempAmbient(int raw); -static float analog2tempPINDA(int raw); static void updateTemperaturesFromRawValues(); enum TempRunawayStates @@ -936,35 +935,6 @@ static float analog2tempBed(int raw) { #endif } -#ifdef PINDA_THERMISTOR - -static float analog2tempPINDA(int raw) { - - float celsius = 0; - byte i; - - for (i = 1; i raw) - { - celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]) + - (raw - PGM_RD_W(BEDTEMPTABLE[i - 1][0])) * - (float)(PGM_RD_W(BEDTEMPTABLE[i][1]) - PGM_RD_W(BEDTEMPTABLE[i - 1][1])) / - (float)(PGM_RD_W(BEDTEMPTABLE[i][0]) - PGM_RD_W(BEDTEMPTABLE[i - 1][0])); - break; - } - } - - // Overflow: Set to last value in the table - if (i == BEDTEMPTABLE_LEN) celsius = PGM_RD_W(BEDTEMPTABLE[i - 1][1]); - - return celsius; -} - - -#endif //PINDA_THERMISTOR - - #ifdef AMBIENT_THERMISTOR static float analog2tempAmbient(int raw) { diff --git a/Firmware/tmc2130.cpp b/Firmware/tmc2130.cpp index d42957013..27600e928 100644 --- a/Firmware/tmc2130.cpp +++ b/Firmware/tmc2130.cpp @@ -792,7 +792,7 @@ void tmc2130_do_steps(uint8_t axis, uint16_t steps, uint8_t dir, uint16_t delay_ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_us, uint16_t microstep_resolution) { printf_P(PSTR("tmc2130_goto_step %d %d %d %d \n"), axis, step, dir, delay_us, microstep_resolution); - uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256 >> shift)) break; + uint8_t shift; for (shift = 0; shift < 8; shift++) if (microstep_resolution == (256u >> shift)) break; uint16_t cnt = 4 * (1 << (8 - shift)); uint16_t mscnt = tmc2130_rd_MSCNT(axis); if (dir == 2) @@ -804,7 +804,7 @@ void tmc2130_goto_step(uint8_t axis, uint8_t step, uint8_t dir, uint16_t delay_u dir ^= 1; steps = -steps; } - if (steps > (cnt / 2)) + if (steps > static_cast(cnt / 2)) { dir ^= 1; steps = cnt - steps; @@ -829,7 +829,7 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream) tmc2130_setup_chopper(axis, tmc2130_usteps2mres(256), tmc2130_current_h[axis], tmc2130_current_r[axis]); tmc2130_goto_step(axis, 0, 2, 100, 256); tmc2130_set_dir(axis, tmc2130_get_inv(axis)?0:1); - for (int i = 0; i <= 255; i++) + for (unsigned int i = 0; i <= 255; i++) { uint32_t val = tmc2130_rd_MSCURACT(axis); uint16_t mscnt = tmc2130_rd_MSCNT(axis); @@ -846,6 +846,7 @@ void tmc2130_get_wave(uint8_t axis, uint8_t* data, FILE* stream) delayMicroseconds(100); } tmc2130_setup_chopper(axis, tmc2130_mres[axis], tmc2130_current_h[axis], tmc2130_current_r[axis]); + tmc2130_set_pwr(axis, pwr); } void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000) @@ -868,7 +869,7 @@ void tmc2130_set_wave(uint8_t axis, uint8_t amp, uint8_t fac1000) int8_t b; //encoded bit value int8_t dA; //delta value int i; //microstep index - uint32_t reg; //tmc2130 register + uint32_t reg = 0; //tmc2130 register tmc2130_wr_MSLUTSTART(axis, 0, amp); for (i = 0; i < 256; i++) { diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c994aaae1..dd1e912d8 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -114,19 +114,15 @@ static const char* lcd_display_message_fullscreen_nonBlocking_P(const char *msg, static void lcd_status_screen(); static void lcd_language_menu(); -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_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(); +#ifdef LINEARITY_CORRECTION static void lcd_settings_menu_back(); +#endif //LINEARITY_CORRECTION static void prusa_stat_printerstatus(int _status); static void prusa_stat_farm_number(); @@ -142,11 +138,10 @@ static void lcd_menu_fails_stats(); #endif //TMC2130 or FILAMENT_SENSOR static void lcd_selftest_v(); -static bool lcd_selfcheck_endstops(); #ifdef TMC2130 -static void reset_crash_det(char axis); -static bool lcd_selfcheck_axis_sg(char axis); +static void reset_crash_det(unsigned char axis); +static bool lcd_selfcheck_axis_sg(unsigned char axis); static bool lcd_selfcheck_axis(int _axis, int _travel); #else static bool lcd_selfcheck_endstops(); @@ -162,8 +157,13 @@ static bool lcd_selftest_fan_dialog(int _fan); static bool lcd_selftest_fsensor(); static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2); static void lcd_colorprint_change(); +#ifdef SNMM +static int get_ext_nr(); +#endif //SNMM +#if defined (SNMM) || defined(SNMM_V2) static void fil_load_menu(); static void fil_unload_menu(); +#endif // SNMM || SNMM_V2 static void lcd_disable_farm_mode(); static void lcd_set_fan_check(); static char snmm_stop_print_menu(); @@ -173,11 +173,12 @@ static char snmm_stop_print_menu(); static float count_e(float layer_heigth, float extrusion_width, float extrusion_length); static void lcd_babystep_z(); static void lcd_send_status(); +#ifdef FARM_CONNECT_MESSAGE static void lcd_connect_printer(); +#endif //FARM_CONNECT_MESSAGE void lcd_finishstatus(); -static void lcd_control_retract_menu(); static void lcd_sdcard_menu(); #ifdef DELTA_CALIBRATION_MENU @@ -2514,7 +2515,6 @@ void lcd_menu_statistics() if (IS_SD_PRINTING) { float _met = ((float)total_filament_used) / (100000.f); - int _cm = (total_filament_used - (_met * 100000)) / 10; int _t = (millis() - starttime) / 1000; int _h = _t / 3600; int _m = (_t - (_h * 3600)) / 60; @@ -2838,12 +2838,6 @@ static void _lcd_babystep(int axis, const char *msg) if (LCD_CLICKED) menu_back(); } -static void lcd_babystep_x() { - _lcd_babystep(X_AXIS, (_i("Babystepping X")));////MSG_BABYSTEPPING_X c=0 r=0 -} -static void lcd_babystep_y() { - _lcd_babystep(Y_AXIS, (_i("Babystepping Y")));////MSG_BABYSTEPPING_Y c=0 r=0 -} static void lcd_babystep_z() { _lcd_babystep(Z_AXIS, (_i("Adjusting Z")));////MSG_BABYSTEPPING_Z c=20 r=0 } @@ -3565,17 +3559,18 @@ static void lcd_show_end_stops() { lcd_puts_P((READ(Z_MIN_PIN) ^ (bool)Z_MIN_ENDSTOP_INVERTING) ? (PSTR("Z1")) : (PSTR("Z0"))); } +#ifndef TMC2130 static void menu_show_end_stops() { lcd_show_end_stops(); if (LCD_CLICKED) menu_back(); } +#endif // not defined TMC2130 // Lets the user move the Z carriage up to the end stoppers. // When done, it sets the current Z to Z_MAX_POS and returns true. // Otherwise the Z calibration is not changed and false is returned. void lcd_diag_show_end_stops() { - int enc_dif = lcd_encoder_diff; lcd_clear(); for (;;) { manage_heater(); @@ -4528,7 +4523,7 @@ void lcd_wizard(int state) { lcd_return_to_status(); lcd_update(2); } -/* +#ifdef LINEARITY_CORRECTION void lcd_settings_linearity_correction_menu(void) { MENU_BEGIN(); @@ -4549,7 +4544,7 @@ void lcd_settings_linearity_correction_menu(void) MENU_ITEM_EDIT_int3_P(_i("E-correct"), &corr[E_AXIS], TMC2130_WAVE_FAC1000_MIN-TMC2130_WAVE_FAC1000_STP, TMC2130_WAVE_FAC1000_MAX);////MSG_EXTRUDER_CORRECTION c=9 r=0 MENU_END(); } -*/ +#endif //LINEARITY_CORRECTION static void lcd_settings_menu() { EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); @@ -4619,8 +4614,9 @@ static void lcd_settings_menu() } else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info); } - -// MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); +#ifdef LINEARITY_CORRECTION + MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu); +#endif //LINEARITY_CORRECTION #endif //TMC2130 if (temp_cal_active == false) @@ -4690,11 +4686,7 @@ switch(eSoundMode) MENU_END(); } -static void lcd_selftest_() -{ - lcd_selftest(); -} - +#ifdef LINEARITY_CORRECTION #ifdef TMC2130 static void lcd_ustep_linearity_menu_save() { @@ -4721,8 +4713,8 @@ static void lcd_settings_menu_back() if (changed) tmc2130_init(); #endif //TMC2130 menu_menu = lcd_main_menu; -// lcd_main_menu(); } +#endif //LINEARITY_CORRECTION static void lcd_calibration_menu() @@ -5125,7 +5117,6 @@ static void lcd_disable_farm_mode() } - static void fil_load_menu() { MENU_BEGIN(); @@ -5445,6 +5436,7 @@ void lcd_confirm_print() #include "w25x20cl.h" +#ifdef LCD_TEST static void lcd_test_menu() { W25X20CL_SPI_ENTER(); @@ -5452,6 +5444,7 @@ static void lcd_test_menu() w25x20cl_chip_erase(); w25x20cl_disable_wr(); } +#endif //LCD_TEST static void lcd_main_menu() { @@ -5625,8 +5618,9 @@ static void lcd_main_menu() #endif MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT c=0 r=0 - -// MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 +#ifdef LCD_TEST + MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT c=0 r=0 +#endif //LCD_TEST MENU_END(); @@ -5663,34 +5657,6 @@ void stepper_timer_overflow() { } #endif /* DEBUG_STEPPER_TIMER_MISSED */ -#ifdef SDSUPPORT -static void lcd_autostart_sd() -{ - card.lastnr = 0; - card.setroot(); - card.checkautostart(true); -} -#endif - - - -static void lcd_silent_mode_set_tune() { - switch (SilentModeMenu) { -#ifdef TMC2130 - case SILENT_MODE_NORMAL: SilentModeMenu = SILENT_MODE_STEALTH; break; - case SILENT_MODE_STEALTH: SilentModeMenu = SILENT_MODE_NORMAL; break; - default: SilentModeMenu = SILENT_MODE_NORMAL; break; // (probably) not needed -#else - case SILENT_MODE_POWER: SilentModeMenu = SILENT_MODE_SILENT; break; - case SILENT_MODE_SILENT: SilentModeMenu = SILENT_MODE_AUTO; break; - case SILENT_MODE_AUTO: SilentModeMenu = SILENT_MODE_POWER; break; - default: SilentModeMenu = SILENT_MODE_POWER; break; // (probably) not needed -#endif //TMC2130 - } - eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); - st_current_init(); - menu_back(); -} static void lcd_colorprint_change() { @@ -5786,12 +5752,6 @@ static void lcd_tune_menu() MENU_END(); } -static void lcd_move_menu_01mm() -{ - move_menu_scale = 0.1; - lcd_move_menu_axis(); -} - static void lcd_control_temperature_menu() { #ifdef PIDTEMP @@ -5908,7 +5868,7 @@ void lcd_sdcard_stop() 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(); @@ -6148,14 +6108,14 @@ bool lcd_selftest() #ifdef TMC2130 -static void reset_crash_det(char axis) { +static void reset_crash_det(unsigned char axis) { current_position[axis] += 10; 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 (eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET)) tmc2130_sg_stop_on_crash = true; } -static bool lcd_selfcheck_axis_sg(char axis) { +static bool lcd_selfcheck_axis_sg(unsigned char axis) { // each axis length is measured twice float axis_length, current_position_init, current_position_final; float measured_axis_length[2]; @@ -6442,7 +6402,6 @@ static bool lcd_selfcheck_pulleys(int axis) } return(true); } -#endif //TMC2130 static bool lcd_selfcheck_endstops() @@ -6475,7 +6434,7 @@ static bool lcd_selfcheck_endstops() manage_inactivity(true); return _result; } -//#endif //not defined TMC2130 +#endif //not defined TMC2130 static bool lcd_selfcheck_check_heater(bool _isbed) { @@ -7062,11 +7021,11 @@ static void lcd_send_status() { } } +#ifdef FARM_CONNECT_MESSAGE static void lcd_connect_printer() { lcd_update_enable(false); lcd_clear(); - bool pressed = false; int i = 0; int t = 0; lcd_set_custom_characters_progress(); @@ -7095,6 +7054,7 @@ static void lcd_connect_printer() { lcd_update_enable(true); lcd_update(2); } +#endif //FARM_CONNECT_MESSAGE void lcd_ping() { //chceck if printer is connected to monitoring when in farm mode if (farm_mode) { @@ -7158,19 +7118,6 @@ uint8_t get_message_level() } - - - - - - - - - - - - - void menu_lcd_longpress_func(void) { move_menu_scale = 1.0; diff --git a/Firmware/xyzcal.cpp b/Firmware/xyzcal.cpp index 027cfdfbc..3984a83d8 100644 --- a/Firmware/xyzcal.cpp +++ b/Firmware/xyzcal.cpp @@ -285,7 +285,7 @@ void xyzcal_scan_pixels_32x32(int16_t cx, int16_t cy, int16_t min_z, int16_t max xyzcal_lineXYZ_to(cx, cy, z, 2*delay_us, 0); for (uint8_t r = 0; r < 32; r++) { - int8_t _pinda = _PINDA; +// int8_t _pinda = _PINDA; xyzcal_lineXYZ_to((r&1)?(cx+1024):(cx-1024), cy - 1024 + r*64, z, 2*delay_us, 0); xyzcal_lineXYZ_to(_X, _Y, min_z, delay_us, 1); xyzcal_lineXYZ_to(_X, _Y, max_z, delay_us, -1); @@ -330,7 +330,7 @@ void xyzcal_scan_pixels_32x32(int16_t cx, int16_t cy, int16_t min_z, int16_t max } sm4_do_step(X_AXIS_MASK); delayMicroseconds(600); - _pinda = pinda; +// _pinda = pinda; } sum >>= 6; //div 64 if (z_sum < 0)