EEPROM_BABYSTEP_Z using removal
This commit is contained in:
parent
12a0b229d3
commit
ed13788e0c
@ -1527,7 +1527,7 @@ void setup()
|
||||
calibration_status() == CALIBRATION_STATUS_UNKNOWN ||
|
||||
calibration_status() == CALIBRATION_STATUS_XYZ_CALIBRATION) {
|
||||
// Reset the babystepping values, so the printer will not move the Z axis up when the babystepping is enabled.
|
||||
eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
||||
// Show the message.
|
||||
lcd_show_fullscreen_message_and_wait_P(_T(MSG_FOLLOW_CALIBRATION_FLOW));
|
||||
}
|
||||
@ -2694,6 +2694,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon
|
||||
previous_millis_cmd = _millis();
|
||||
endstops_hit_on_purpose();
|
||||
#ifndef MESH_BED_LEVELING
|
||||
//-// Oct 2019 :: this part of code is (from) now probably un-compilable
|
||||
// If MESH_BED_LEVELING is not active, then it is the original Prusa i3.
|
||||
// Offer the user to load the baby step value, which has been adjusted at the previous print session.
|
||||
if(card.sdprinting && eeprom_read_word((uint16_t *)EEPROM_BABYSTEP_Z))
|
||||
@ -2886,7 +2887,7 @@ bool gcode_M45(bool onlyZ, int8_t verbosity_level)
|
||||
{
|
||||
// Reset the baby step value and the baby step applied flag.
|
||||
calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION);
|
||||
eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
||||
// Complete XYZ calibration.
|
||||
uint8_t point_too_far_mask = 0;
|
||||
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
|
||||
@ -3736,7 +3737,7 @@ void process_commands()
|
||||
lang_reset();
|
||||
|
||||
} else if(code_seen("Lz")) { // PRUSA Lz
|
||||
EEPROM_save_B(EEPROM_BABYSTEP_Z,0);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
||||
|
||||
} else if(code_seen("Beat")) { // PRUSA Beat
|
||||
// Kick farm link timer
|
||||
@ -5507,7 +5508,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
|
||||
|
||||
// Reset the baby step value and the baby step applied flag.
|
||||
calibration_status_store(CALIBRATION_STATUS_ASSEMBLED);
|
||||
eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
||||
|
||||
// Reset the skew and offset in both RAM and EEPROM.
|
||||
reset_bed_offset_and_skew();
|
||||
|
@ -62,7 +62,7 @@ void eeprom_init()
|
||||
if (eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) == 0xffff) eeprom_update_word((uint16_t *)EEPROM_MMU_LOAD_FAIL_TOT, 0);
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_FAIL, 0);
|
||||
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) == 0xff) eeprom_update_byte((uint8_t *)EEPROM_MMU_LOAD_FAIL, 0);
|
||||
if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == 0xff)
|
||||
if (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == EEPROM_EMPTY_VALUE)
|
||||
{
|
||||
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
|
||||
// When upgrading from version older version (before multiple sheets were implemented in v3.8.0)
|
||||
|
@ -3,9 +3,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_SHEETS 8
|
||||
#define MAX_SHEET_NAME_LENGTH 7
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[7]; //!< Can be null terminated, doesn't need to be null terminated
|
||||
char name[MAX_SHEET_NAME_LENGTH]; //!< Can be null terminated, doesn't need to be null terminated
|
||||
int16_t z_offset; //!< Z_BABYSTEP_MIN .. Z_BABYSTEP_MAX = Z_BABYSTEP_MIN*2/1000 [mm] .. Z_BABYSTEP_MAX*2/1000 [mm]
|
||||
uint8_t bed_temp; //!< 0 .. 254 [°C]
|
||||
uint8_t pinda_temp; //!< 0 .. 254 [°C]
|
||||
@ -13,7 +16,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Sheet s[8];
|
||||
Sheet s[MAX_SHEETS];
|
||||
uint8_t active_sheet;
|
||||
} Sheets;
|
||||
// sizeof(Sheets). Do not change it unless EEPROM_Sheets_base is last item in EEPROM.
|
||||
@ -25,6 +28,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
||||
#endif
|
||||
|
||||
#define EEPROM_EMPTY_VALUE 0xFF
|
||||
#define EEPROM_EMPTY_VALUE16 0xFFFF
|
||||
// The total size of the EEPROM is
|
||||
// 4096 for the Atmega2560
|
||||
#define EEPROM_TOP 4096
|
||||
|
@ -3211,15 +3211,10 @@ static void lcd_babystep_z()
|
||||
if (LCD_CLICKED || menu_leaving)
|
||||
{
|
||||
// Only update the EEPROM when leaving the menu.
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
||||
s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),
|
||||
_md->babystepMemZ);
|
||||
eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
|
||||
&(EEPROM_Sheets_base->active_sheet)))].bed_temp),
|
||||
target_temperature_bed);
|
||||
eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
|
||||
&(EEPROM_Sheets_base->active_sheet)))].pinda_temp),
|
||||
current_temperature_pinda);
|
||||
uint8_t active_sheet=eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[active_sheet].z_offset)),_md->babystepMemZ);
|
||||
eeprom_update_byte(&(EEPROM_Sheets_base->s[active_sheet].bed_temp),target_temperature_bed);
|
||||
eeprom_update_byte(&(EEPROM_Sheets_base->s[active_sheet].pinda_temp),current_temperature_pinda);
|
||||
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
||||
}
|
||||
if (LCD_CLICKED) menu_back();
|
||||
@ -6649,7 +6644,7 @@ static void lcd_reset_sheet()
|
||||
{
|
||||
SheetName sheetName;
|
||||
eeprom_default_sheet_name(selected_sheet, sheetName);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),0xffff);
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[selected_sheet].z_offset)),EEPROM_EMPTY_VALUE16);
|
||||
eeprom_update_block(sheetName.c,EEPROM_Sheets_base->s[selected_sheet].name,sizeof(Sheet::name));
|
||||
if (selected_sheet == eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user