diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 00ab54ef..b900492b 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1496,7 +1496,9 @@ void setup() #ifdef SNMM if (eeprom_read_dword((uint32_t*)EEPROM_BOWDEN_LENGTH) == 0x0ffffffff) { //bowden length used for SNMM int _z = BOWDEN_LENGTH; - for(int i = 0; i<4; i++) EEPROM_save_B(EEPROM_BOWDEN_LENGTH + i * 2, &_z); + for(uint8_t i = 0; i < 4; i++) { + eeprom_update_word((uint16_t*)EEPROM_BOWDEN_LENGTH + i, _z); + } } #endif @@ -1541,7 +1543,9 @@ void setup() //eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 0); eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); int16_t z_shift = 0; - for (uint8_t i = 0; i < 5; i++) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); + for (uint8_t i = 0; i < 5; i++) { + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); + } eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); } if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 255) { @@ -1565,8 +1569,8 @@ void setup() #ifdef PAT9125 fsensor_setup_interrupt(); #endif //PAT9125 - for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); - + eeprom_update_block(bowden_length, (uint16_t*)EEPROM_BOWDEN_LENGTH, sizeof(bowden_length)); + #ifndef DEBUG_DISABLE_STARTMSGS KEEPALIVE_STATE(PAUSED_FOR_USER); @@ -2886,7 +2890,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon raise_z_above(Z_RAISE_BEFORE_HOMING); st_synchronize(); #endif // defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0) - #if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) // If Mesh bed leveling, move X&Y to safe position for home + #ifdef MESH_BED_LEVELING // If Mesh bed leveling, move X&Y to safe position for home raise_z_above(MESH_HOME_Z_SEARCH); st_synchronize(); if (!axis_known_position[X_AXIS]) homeaxis(X_AXIS); @@ -2994,7 +2998,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon // and correct the current_position XY axes to match the transformed coordinate system. world2machine_update_current(); -#if (defined(MESH_BED_LEVELING) && !defined(MK1BP)) +#ifdef MESH_BED_LEVELING if (home_x_axis || home_y_axis || without_mbl || home_z_axis) { if (! home_z && mbl_was_active) { @@ -5411,7 +5415,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) { float temp = (40 + i * 5); printf_P(_N("\nStep: %d/6 (skipped)\nPINDA temperature: %d Z shift (mm):0\n"), i + 2, (40 + i*5)); - if (i >= 0) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); + if (i >= 0) { + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); + } if (start_temp <= temp) break; } @@ -5450,7 +5456,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z); - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); } lcd_temp_cal_show_result(true); homing_flag = false; @@ -5535,7 +5541,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("\nTemperature: %d Z shift (mm): %.3f\n"), t_c, current_position[Z_AXIS] - zero_z); - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i*2, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); } @@ -5591,9 +5597,6 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) */ case 80: { -#ifdef MK1BP - break; -#endif //MK1BP gcode_G80(); } break; @@ -5657,7 +5660,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) }else{ // Save it to the eeprom babystepLoadZ = babystepz; - EEPROM_save_B(EEPROM_BABYSTEP_Z0+(BabyPosition*2),&babystepLoadZ); + eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z0 + BabyPosition, babystepLoadZ); // adjust the Z babystepsTodoZadd(babystepLoadZ); } @@ -6900,8 +6903,6 @@ Sigma_Exit: #endif } } - //in the end of print set estimated time to end of print and extruders used during print to default values for next print - print_time_remaining_init(); snmm_filaments_used = 0; break; @@ -8337,7 +8338,9 @@ Sigma_Exit: SERIAL_PROTOCOLLN("index, temp, ustep, um"); for (uint8_t i = 0; i < 6; i++) { - if(i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &usteps); + if(i > 0) { + usteps = eeprom_read_word((uint16_t*) EEPROM_PROBE_TEMP_SHIFT + (i - 1)); + } float mm = ((float)usteps) / cs.axis_steps_per_unit[Z_AXIS]; i == 0 ? SERIAL_PROTOCOLPGM("n/a") : SERIAL_PROTOCOL(i - 1); SERIAL_PROTOCOLPGM(", "); @@ -8352,21 +8355,23 @@ Sigma_Exit: else if (code_seen('!')) { // ! - Set factory default values eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); int16_t z_shift = 8; //40C - 20um - 8usteps - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT, z_shift); z_shift = 24; //45C - 60um - 24usteps - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + 2, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 1, z_shift); z_shift = 48; //50C - 120um - 48usteps - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + 4, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 2, z_shift); z_shift = 80; //55C - 200um - 80usteps - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + 6, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 3, z_shift); z_shift = 120; //60C - 300um - 120usteps - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + 8, &z_shift); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + 4, z_shift); SERIAL_PROTOCOLLN("factory restored"); } else if (code_seen('Z')) { // Z - Set all values to 0 (effectively disabling PINDA temperature compensation) eeprom_write_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA, 1); int16_t z_shift = 0; - for (uint8_t i = 0; i < 5; i++) EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); + for (uint8_t i = 0; i < 5; i++) { + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i, z_shift); + } SERIAL_PROTOCOLLN("zerorized"); } else if (code_seen('S')) { // Sxxx Iyyy - Set compensation ustep value S for compensation table index I @@ -8374,13 +8379,15 @@ Sigma_Exit: if (code_seen('I')) { uint8_t index = code_value_uint8(); if (index < 5) { - EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + index * 2, &usteps); + eeprom_update_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + index, usteps); SERIAL_PROTOCOLLN("OK"); SERIAL_PROTOCOLLN("index, temp, ustep, um"); for (uint8_t i = 0; i < 6; i++) { usteps = 0; - if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i - 1) * 2, &usteps); + if (i > 0) { + usteps = eeprom_read_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + (i - 1)); + } float mm = ((float)usteps) / cs.axis_steps_per_unit[Z_AXIS]; i == 0 ? SERIAL_PROTOCOLPGM("n/a") : SERIAL_PROTOCOL(i - 1); SERIAL_PROTOCOLPGM(", "); @@ -9609,10 +9616,6 @@ void get_coordinates() } if(code_seen('F')) { next_feedrate = code_value(); -#ifdef MAX_SILENT_FEEDRATE - if (tmc2130_mode == TMC2130_MODE_SILENT) - if (next_feedrate > MAX_SILENT_FEEDRATE) next_feedrate = MAX_SILENT_FEEDRATE; -#endif //MAX_SILENT_FEEDRATE if(next_feedrate > 0.0) feedrate = next_feedrate; if (!seen[0] && !seen[1] && !seen[2] && seen[3]) { @@ -10177,6 +10180,9 @@ void finishAndDisableSteppers() // state for the next print. la10c_reset(); #endif + + //in the end of print set estimated time to end of print and extruders used during print to default values for next print + print_time_remaining_init(); } #ifdef FAST_PWM_FAN @@ -10880,7 +10886,7 @@ static void temp_compensation_apply() { if (calibration_status() == CALIBRATION_STATUS_CALIBRATED) { if (target_temperature_bed % 10 == 0 && target_temperature_bed >= 60 && target_temperature_bed <= 100) { i_add = (target_temperature_bed - 60) / 10; - EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + i_add * 2, &z_shift); + z_shift = eeprom_read_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + i_add); z_shift_mm = z_shift / cs.axis_steps_per_unit[Z_AXIS]; }else { //interpolation @@ -10910,7 +10916,10 @@ float temp_comp_interpolation(float inp_temperature) { shift[0] = 0; for (i = 0; i < n; i++) { - if (i>0) EEPROM_read_B(EEPROM_PROBE_TEMP_SHIFT + (i-1) * 2, &shift[i]); //read shift in steps from EEPROM + if (i > 0) { + //read shift in steps from EEPROM + shift[i] = eeprom_read_word((uint16_t*)EEPROM_PROBE_TEMP_SHIFT + (i - 1)); + } temp_C[i] = 50 + i * 10; //temperature in C #ifdef PINDA_THERMISTOR constexpr int start_compensating_temp = 35; diff --git a/Firmware/sm4.c b/Firmware/sm4.c index dcd31408..0b6f2f50 100644 --- a/Firmware/sm4.c +++ b/Firmware/sm4.c @@ -36,6 +36,13 @@ //#define E0_STEP_PIN 34 //PC3 (+) +#define XDIR INVERT_X_DIR:!INVERT_X_DIR +#define YDIR INVERT_Y_DIR:!INVERT_Y_DIR +#define ZDIR INVERT_Z_DIR:!INVERT_Z_DIR +#define EDIR INVERT_E0_DIR:!INVERT_E0_DIR + +uint8_t dir_mask = 0x0F^(INVERT_X_DIR | (INVERT_Y_DIR << 1) | (INVERT_Z_DIR << 2) | (INVERT_E0_DIR << 3)); + sm4_stop_cb_t sm4_stop_cb = 0; sm4_update_pos_cb_t sm4_update_pos_cb = 0; @@ -50,15 +57,15 @@ uint8_t sm4_get_dir(uint8_t axis) switch (axis) { #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) - case 0: return (PORTL & 2)?0:1; - case 1: return (PORTL & 1)?0:1; - case 2: return (PORTL & 4)?0:1; - case 3: return (PORTL & 64)?1:0; + case 0: return (PORTL & 2)?XDIR; + case 1: return (PORTL & 1)?YDIR; + case 2: return (PORTL & 4)?ZDIR; + case 3: return (PORTL & 64)?EDIR; #elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) - case 0: return (PORTL & 1)?1:0; - case 1: return (PORTL & 2)?0:1; - case 2: return (PORTL & 4)?1:0; - case 3: return (PORTL & 64)?0:1; + case 0: return (PORTL & 1)?XDIR; + case 1: return (PORTL & 2)?YDIR; + case 2: return (PORTL & 4)?ZDIR; + case 3: return (PORTL & 64)?EDIR; #endif } return 0; @@ -69,15 +76,15 @@ void sm4_set_dir(uint8_t axis, uint8_t dir) switch (axis) { #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) - case 0: if (!dir) PORTL |= 2; else PORTL &= ~2; break; - case 1: if (!dir) PORTL |= 1; else PORTL &= ~1; break; - case 2: if (!dir) PORTL |= 4; else PORTL &= ~4; break; - case 3: if (dir) PORTL |= 64; else PORTL &= ~64; break; + case 0: if (dir == INVERT_X_DIR) PORTL |= 2; else PORTL &= ~2; break; + case 1: if (dir == INVERT_Y_DIR) PORTL |= 1; else PORTL &= ~1; break; + case 2: if (dir == INVERT_Z_DIR) PORTL |= 4; else PORTL &= ~4; break; + case 3: if (dir == INVERT_E0_DIR) PORTL |= 64; else PORTL &= ~64; break; #elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) - case 0: if (dir) PORTL |= 1; else PORTL &= ~1; break; - case 1: if (!dir) PORTL |= 2; else PORTL &= ~2; break; - case 2: if (dir) PORTL |= 4; else PORTL &= ~4; break; - case 3: if (!dir) PORTL |= 64; else PORTL &= ~64; break; + case 0: if (dir == INVERT_X_DIR) PORTL |= 1; else PORTL &= ~1; break; + case 1: if (dir == INVERT_Y_DIR) PORTL |= 2; else PORTL &= ~2; break; + case 2: if (dir == INVERT_Z_DIR) PORTL |= 4; else PORTL &= ~4; break; + case 3: if (dir == INVERT_E0_DIR) PORTL |= 64; else PORTL &= ~64; break; #endif } asm("nop"); @@ -93,13 +100,13 @@ uint8_t sm4_get_dir_bits(void) if (portL & 1) dir_bits |= 2; if (portL & 4) dir_bits |= 4; if (portL & 64) dir_bits |= 8; - dir_bits ^= 0x07; //invert XYZ, do not invert E + dir_bits ^= dir_mask; #elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) if (portL & 1) dir_bits |= 1; if (portL & 2) dir_bits |= 2; if (portL & 4) dir_bits |= 4; if (portL & 64) dir_bits |= 8; - dir_bits ^= 0x0a; //invert YE, do not invert XZ + dir_bits ^= dir_mask; #endif return dir_bits; } @@ -110,13 +117,13 @@ void sm4_set_dir_bits(uint8_t dir_bits) portL &= 0xb8; //set direction bits to zero //TODO -optimize in asm #if ((MOTHERBOARD == BOARD_RAMBO_MINI_1_0) || (MOTHERBOARD == BOARD_RAMBO_MINI_1_3)) - dir_bits ^= 0x07; //invert XYZ, do not invert E + dir_bits ^= dir_mask; if (dir_bits & 1) portL |= 2; //set X direction bit if (dir_bits & 2) portL |= 1; //set Y direction bit if (dir_bits & 4) portL |= 4; //set Z direction bit if (dir_bits & 8) portL |= 64; //set E direction bit #elif ((MOTHERBOARD == BOARD_EINSY_1_0a)) - dir_bits ^= 0x0a; //invert YE, do not invert XZ + dir_bits ^= dir_mask; if (dir_bits & 1) portL |= 1; //set X direction bit if (dir_bits & 2) portL |= 2; //set Y direction bit if (dir_bits & 4) portL |= 4; //set Z direction bit diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a28e11a0..a3ee0c45 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2010,7 +2010,6 @@ static void lcd_support_menu() } } - #ifndef MK1BP MENU_ITEM_BACK_P(STR_SEPARATOR); MENU_ITEM_SUBMENU_P(_i("XYZ cal. details"), lcd_menu_xyz_y_min);////MSG_XYZ_DETAILS c=18 MENU_ITEM_SUBMENU_P(_i("Extruder info"), lcd_menu_extruder_info);////MSG_INFO_EXTRUDER c=18 @@ -2043,8 +2042,6 @@ static void lcd_support_menu() MENU_ITEM_SUBMENU_P(PSTR("Debug"), lcd_menu_debug);////MSG_DEBUG c=18 #endif /* DEBUG_BUILD */ - #endif //MK1BP - MENU_END(); } @@ -2384,7 +2381,6 @@ static void mFilamentItem_PVB() void mFilamentBack() { - menu_back(); if (eFilamentAction == FilamentAction::AutoLoad || eFilamentAction == FilamentAction::Preheat || eFilamentAction == FilamentAction::Lay1Cal) @@ -2398,14 +2394,10 @@ void lcd_generic_preheat_menu() MENU_BEGIN(); if (!eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { - if (eFilamentAction == FilamentAction::Lay1Cal) - { - MENU_ITEM_FUNCTION_P(_T(MSG_BACK), mFilamentBack); - } - else - { - MENU_ITEM_FUNCTION_P(_T(MSG_MAIN), mFilamentBack); - } + ON_MENU_LEAVE( + mFilamentBack(); + ); + MENU_ITEM_BACK_P(_T(eFilamentAction == FilamentAction::Lay1Cal ? MSG_BACK : MSG_MAIN)); } if (farm_mode) { @@ -2905,20 +2897,6 @@ static void lcd_menu_xyz_offset() menu_back_if_clicked(); } -// Save a single axis babystep value. -void EEPROM_save_B(int pos, int* value) -{ - eeprom_update_byte((unsigned char*)pos, (unsigned char)((*value) & 0xff)); - eeprom_update_byte((unsigned char*)pos + 1, (unsigned char)((*value) >> 8)); -} - -// Read a single axis babystep value. -void EEPROM_read_B(int pos, int* value) -{ - *value = (int)eeprom_read_byte((unsigned char*)pos) | (int)(eeprom_read_byte((unsigned char*)pos + 1) << 8); -} - - // Note: the colon behind the text (X, Y, Z) is necessary to greatly shorten // the implementation of menu_draw_float31 static void lcd_move_x() { @@ -3188,15 +3166,15 @@ void lcd_adjust_z() { fsm = cursor_pos; if (fsm == 1) { int babystepLoadZ = 0; - EEPROM_read_B(EEPROM_BABYSTEP_Z, &babystepLoadZ); + babystepLoadZ = eeprom_read_word((uint16_t*)EEPROM_BABYSTEP_Z); CRITICAL_SECTION_START babystepsTodo[Z_AXIS] = babystepLoadZ; CRITICAL_SECTION_END } else { int zero = 0; - EEPROM_save_B(EEPROM_BABYSTEP_X, &zero); - EEPROM_save_B(EEPROM_BABYSTEP_Y, &zero); - EEPROM_save_B(EEPROM_BABYSTEP_Z, &zero); + eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_X, zero); + eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Y, zero); + eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, zero); } _delay(500); } @@ -3797,9 +3775,9 @@ static void lcd_print_state(uint8_t state) //! @code{.unparsed} //! |01234567890123456789| //! |PINDA N/A FINDA N/A| MSG_PINDA c=5 MSG_FINDA c=5 -//! |Fil. sensor N/A| MSG_FSENSOR -//! |Xd 000 Yd 000| MSG_XD -//! |Int 000 Shut 000| +//! |Fil. sensor N/A| MSG_FSENSOR +//! | Int: 000 Xd:+00000| +//! |Shut: 000 Yd:+00000| //! ---------------------- //! @endcode static void lcd_show_sensors_state() @@ -3843,26 +3821,18 @@ static void lcd_show_sensors_state() // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. - if (mmu_enabled == false) - { - //if (!fsensor_enabled) - // lcd_puts_P(_N("Filament sensor\n" "is disabled.")); - //else - //{ - if (!moves_planned() && !IS_SD_PRINTING && !usb_timer.running() && (lcd_commands_type != LcdCommands::Layer1Cal)) - pat9125_update(); - lcd_set_cursor(0, 2); - lcd_printf_P(_N( - "Xd: %3d " - "Yd: %3d\n" ////c=4 - "Int: %3d " ////c=4 - "Shut: %3d" ////c=4 - ), - pat9125_x, pat9125_y, - pat9125_b, pat9125_s - ); - //} - } + if (mmu_enabled == false) + { + // pat9125_update is already called while printing: only update manually when idling + if (!moves_planned() && !IS_SD_PRINTING && !usb_timer.running() && (lcd_commands_type != LcdCommands::Layer1Cal)) + pat9125_update(); + + lcd_set_cursor(0, 2); + lcd_printf_P(_N(" Int: %3d Xd:%6d\n" + "Shut: %3d Yd:%6d"), + pat9125_b, pat9125_x, + pat9125_s, pat9125_y); + } #endif //PAT9125 } @@ -4180,8 +4150,8 @@ void lcd_pick_babystep(){ if (lcd_clicked()) { fsm = cursor_pos; int babyStepZ; - EEPROM_read_B(EEPROM_BABYSTEP_Z0+((fsm-1)*2),&babyStepZ); - EEPROM_save_B(EEPROM_BABYSTEP_Z,&babyStepZ); + babyStepZ = eeprom_read_word((uint16_t*)EEPROM_BABYSTEP_Z0+(fsm-1)); + eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, babyStepZ); calibration_status_store(CALIBRATION_STATUS_CALIBRATED); _delay(500); @@ -4203,36 +4173,16 @@ void lcd_move_menu_axis() MENU_END(); } -void EEPROM_save(int pos, uint8_t* value, uint8_t size) -{ - do - { - eeprom_write_byte((unsigned char*)pos, *value); - pos++; - value++; - } while (--size); -} - -void EEPROM_read(int pos, uint8_t* value, uint8_t size) -{ - do - { - *value = eeprom_read_byte((unsigned char*)pos); - pos++; - value++; - } while (--size); -} - #ifdef SDCARD_SORT_ALPHA static void lcd_sort_type_set() { uint8_t sdSort; - EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort)); + sdSort = eeprom_read_byte((uint8_t*) EEPROM_SD_SORT); switch (sdSort) { case SD_SORT_TIME: sdSort = SD_SORT_ALPHA; break; case SD_SORT_ALPHA: sdSort = SD_SORT_NONE; break; default: sdSort = SD_SORT_TIME; } - eeprom_update_byte((unsigned char *)EEPROM_SD_SORT, sdSort); + eeprom_update_byte((uint8_t*)EEPROM_SD_SORT, sdSort); card.presort_flag = true; } #endif //SDCARD_SORT_ALPHA @@ -5226,7 +5176,7 @@ do\ MENU_ITEM_TOGGLE_P(_T(MSG_SD_CARD), _T(MSG_NORMAL), lcd_toshiba_flash_air_compatibility_toggle);\ \ uint8_t sdSort;\ - EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));\ + sdSort = eeprom_read_byte((uint8_t*) EEPROM_SD_SORT);\ switch (sdSort)\ {\ case SD_SORT_TIME: MENU_ITEM_TOGGLE_P(_T(MSG_SORT), _T(MSG_SORT_TIME), lcd_sort_type_set); break;\ @@ -5619,7 +5569,7 @@ void lcd_hw_setup_menu(void) // can not be "static" static void lcd_settings_menu() { - EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); + SilentModeMenu = eeprom_read_byte((uint8_t*) EEPROM_SILENT); MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5731,11 +5681,6 @@ static void lcd_calibration_menu() MENU_ITEM_FUNCTION_P(_i("Belt test"), lcd_belttest_v);////MSG_BELTTEST c=18 #endif //TMC2130 MENU_ITEM_FUNCTION_P(_i("Selftest"), lcd_selftest_v);////MSG_SELFTEST c=18 -#ifdef MK1BP - // MK1 - // "Calibrate Z" - MENU_ITEM_GCODE_P(_T(MSG_HOMEYZ), PSTR("G28 Z")); -#else //MK1BP // MK2 MENU_ITEM_FUNCTION_P(_i("Calibrate XYZ"), lcd_mesh_calibration);////MSG_CALIBRATE_BED c=18 // "Calibrate Z" with storing the reference values to EEPROM. @@ -5745,26 +5690,20 @@ static void lcd_calibration_menu() #endif // "Mesh Bed Leveling" MENU_ITEM_SUBMENU_P(_T(MSG_MESH_BED_LEVELING), lcd_mesh_bedleveling); - -#endif //MK1BP MENU_ITEM_SUBMENU_P(_i("Bed level correct"), lcd_adjust_bed);////MSG_BED_CORRECTION_MENU c=18 MENU_ITEM_SUBMENU_P(_i("PID calibration"), pid_extruder);////MSG_PID_EXTRUDER c=17 #ifndef TMC2130 MENU_ITEM_SUBMENU_P(_i("Show end stops"), menu_show_end_stops);////MSG_SHOW_END_STOPS c=18 #endif -#ifndef MK1BP MENU_ITEM_GCODE_P(_i("Reset XYZ calibr."), PSTR("M44"));////MSG_CALIBRATE_BED_RESET c=18 -#endif //MK1BP #ifndef SNMM //MENU_ITEM_FUNCTION_P(MSG_RESET_CALIBRATE_E, lcd_extr_cal_reset); #endif -#ifndef MK1BP if(has_temperature_compensation()) { MENU_ITEM_SUBMENU_P(_i("Temp. calibration"), lcd_pinda_calibration_menu);////MSG_CALIBRATION_PINDA_MENU c=17 } -#endif //MK1BP } MENU_END(); @@ -5779,7 +5718,7 @@ void bowden_menu() { lcd_puts_at_P(1, i, PSTR("Extruder ")); lcd_print(i); lcd_print(": "); - EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); + bowden_length[i] = eeprom_read_word((uint16_t*)EEPROM_BOWDEN_LENGTH + i); lcd_print(bowden_length[i] - 48); } @@ -5849,7 +5788,7 @@ void bowden_menu() { _delay(100); if (lcd_clicked()) { Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); - EEPROM_save_B(EEPROM_BOWDEN_LENGTH + cursor_pos * 2, &bowden_length[cursor_pos]); + eeprom_update_word((uint16_t*)EEPROM_BOWDEN_LENGTH + cursor_pos, bowden_length[cursor_pos]); if (lcd_show_fullscreen_message_yes_no_and_wait_P(PSTR("Continue with another bowden?"))) { lcd_update_enable(true); lcd_clear(); @@ -5859,7 +5798,7 @@ void bowden_menu() { lcd_puts_at_P(1, i, PSTR("Extruder ")); lcd_print(i); lcd_print(": "); - EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]); + bowden_length[i] = eeprom_read_word((uint16_t*)EEPROM_BOWDEN_LENGTH + i); lcd_print(bowden_length[i] - 48); } @@ -6747,9 +6686,7 @@ static void lcd_tune_menu() calculate_extruder_multipliers(); } - EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu)); - - + SilentModeMenu = eeprom_read_byte((uint8_t*) EEPROM_SILENT); MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); //1 diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index d61f7586..36fcad57 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -36,8 +36,6 @@ void lcd_adjust_z(); void lcd_pick_babystep(); void lcd_alright(); void show_preheat_nozzle_warning(); -void EEPROM_save_B(int pos, int* value); -void EEPROM_read_B(int pos, int* value); void lcd_wait_interact(); void lcd_loading_filament(); void lcd_change_success();