check eeprom inicialization
This commit is contained in:
parent
d344e514c4
commit
81b3b71cca
6 changed files with 38 additions and 12 deletions
|
@ -323,6 +323,7 @@ extern float retract_recover_length_swap;
|
||||||
|
|
||||||
extern uint8_t host_keepalive_interval;
|
extern uint8_t host_keepalive_interval;
|
||||||
|
|
||||||
|
extern bool is_sheet_inicialized();
|
||||||
|
|
||||||
extern unsigned long starttime;
|
extern unsigned long starttime;
|
||||||
extern unsigned long stoptime;
|
extern unsigned long stoptime;
|
||||||
|
|
|
@ -8143,6 +8143,11 @@ static void wait_for_heater(long codenum, uint8_t extruder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_sheet_inicialized(){
|
||||||
|
return (0xffff != eeprom_read_word(reinterpret_cast<uint16_t*>(&(EEPROM_Sheets_base->
|
||||||
|
s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset))));
|
||||||
|
}
|
||||||
|
|
||||||
void check_babystep()
|
void check_babystep()
|
||||||
{
|
{
|
||||||
int babystep_z = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
int babystep_z = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "language.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static T eeprom_read(T *address);
|
static T eeprom_read(T *address);
|
||||||
|
@ -65,6 +68,7 @@ void eeprom_init()
|
||||||
{
|
{
|
||||||
eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast<char>(i + '1'));
|
eeprom_write(&(EEPROM_Sheets_base->s[i].name[0]), static_cast<char>(i + '1'));
|
||||||
eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0');
|
eeprom_write(&(EEPROM_Sheets_base->s[i].name[1]), '\0');
|
||||||
|
//eeprom_write_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[i].z_offset)),0); //TODO: nedavat dalsi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_babystep();
|
check_babystep();
|
||||||
|
|
|
@ -127,3 +127,4 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; ////
|
||||||
const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////
|
const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; ////
|
||||||
const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; ////
|
const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; ////
|
||||||
const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
|
const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; ////
|
||||||
|
const char MSG_V2_CALIBRATION[] PROGMEM_N1 = "First layer cal."; ////c=17 r=1
|
||||||
|
|
|
@ -128,6 +128,7 @@ extern const char MSG_ERR_STOPPED[];
|
||||||
extern const char MSG_ENDSTOP_HIT[];
|
extern const char MSG_ENDSTOP_HIT[];
|
||||||
extern const char MSG_EJECT_FILAMENT[];
|
extern const char MSG_EJECT_FILAMENT[];
|
||||||
extern const char MSG_CUT_FILAMENT[];
|
extern const char MSG_CUT_FILAMENT[];
|
||||||
|
extern const char MSG_V2_CALIBRATION[];
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3084,9 +3084,14 @@ static void lcd_babystep_z()
|
||||||
// Initialize its status.
|
// Initialize its status.
|
||||||
_md->status = 1;
|
_md->status = 1;
|
||||||
check_babystep();
|
check_babystep();
|
||||||
|
|
||||||
_md->babystepMemZ = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
if(!is_sheet_inicialized()){
|
||||||
s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)));
|
_md->babystepMemZ = 0;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
_md->babystepMemZ = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
||||||
|
s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)));
|
||||||
|
}
|
||||||
|
|
||||||
// same logic as in babystep_load
|
// same logic as in babystep_load
|
||||||
if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST)
|
if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST)
|
||||||
|
@ -6300,26 +6305,34 @@ void lcd_resume_print()
|
||||||
isPrintPaused = false;
|
isPrintPaused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sheet_check(uint8_t sheet_num)
|
||||||
|
{
|
||||||
|
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num);
|
||||||
|
if(is_sheet_inicialized())
|
||||||
|
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
||||||
|
else
|
||||||
|
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
||||||
|
|
||||||
|
menu_back(3);
|
||||||
|
}
|
||||||
|
|
||||||
static void lcd_select_sheet_0_menu()
|
static void lcd_select_sheet_0_menu()
|
||||||
{
|
{
|
||||||
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
|
sheet_check(0);
|
||||||
menu_back(3);
|
|
||||||
}
|
}
|
||||||
static void lcd_select_sheet_1_menu()
|
static void lcd_select_sheet_1_menu()
|
||||||
{
|
{
|
||||||
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 1);
|
sheet_check(1);
|
||||||
menu_back(3);
|
|
||||||
}
|
}
|
||||||
static void lcd_select_sheet_2_menu()
|
static void lcd_select_sheet_2_menu()
|
||||||
{
|
{
|
||||||
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 2);
|
sheet_check(2);
|
||||||
menu_back(3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lcd_select_sheet_menu()
|
static void lcd_select_sheet_menu()
|
||||||
{
|
{
|
||||||
MENU_BEGIN();
|
MENU_BEGIN();
|
||||||
MENU_ITEM_BACK_P(_T(MSG_SHEET));
|
MENU_ITEM_BACK_P(_T(MSG_BACK));
|
||||||
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu);
|
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu);
|
||||||
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu);
|
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu);
|
||||||
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu);
|
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu);
|
||||||
|
@ -6376,7 +6389,7 @@ static void lcd_sheet_menu()
|
||||||
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
||||||
MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18
|
MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu); //// c=18
|
||||||
MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18
|
MENU_ITEM_SUBMENU_P(_i("Rename"), lcd_rename_sheet_menu); //// c=18
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);
|
MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); ////MSG_V2_CALIBRATION c=17 r=1
|
||||||
|
|
||||||
MENU_END();
|
MENU_END();
|
||||||
}
|
}
|
||||||
|
@ -6415,7 +6428,6 @@ static void lcd_main_menu()
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT
|
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT
|
||||||
MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6510,6 +6522,8 @@ static void lcd_main_menu()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isPrintPaused)MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu);
|
||||||
|
|
||||||
if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal))
|
if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal))
|
||||||
{
|
{
|
||||||
MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS
|
MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS
|
||||||
|
|
Loading…
Reference in a new issue