code edit

This commit is contained in:
NotaRobotexe 2019-07-04 13:21:27 +02:00
parent 81b3b71cca
commit e77898d5dc
5 changed files with 12 additions and 13 deletions

View File

@ -323,8 +323,6 @@ extern float retract_recover_length_swap;
extern uint8_t host_keepalive_interval;
extern bool is_sheet_inicialized();
extern unsigned long starttime;
extern unsigned long stoptime;
extern int bowden_length[4];

View File

@ -8143,11 +8143,6 @@ 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()
{
int babystep_z = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->

View File

@ -41,6 +41,11 @@ bool eeprom_is_uninitialized<char>(char *address)
return (0xff == eeprom_read_byte(reinterpret_cast<uint8_t*>(address)));
}
bool is_sheet_initialized(){
return (0xffff != eeprom_read_word(reinterpret_cast<uint16_t*>(&(EEPROM_Sheets_base->
s[eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))].z_offset))));
}
void eeprom_init()
{
if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0);

View File

@ -191,6 +191,7 @@ typedef struct
static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF);
#ifdef __cplusplus
extern bool is_sheet_initialized();
static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF.");
#endif

View File

@ -3085,7 +3085,7 @@ static void lcd_babystep_z()
_md->status = 1;
check_babystep();
if(!is_sheet_inicialized()){
if(!is_sheet_initialized()){
_md->babystepMemZ = 0;
}
else{
@ -6305,10 +6305,10 @@ void lcd_resume_print()
isPrintPaused = false;
}
static void sheet_check(uint8_t sheet_num)
static void change_sheet(uint8_t sheet_num)
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num);
if(is_sheet_inicialized())
if(is_sheet_initialized())
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
else
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
@ -6318,15 +6318,15 @@ static void sheet_check(uint8_t sheet_num)
static void lcd_select_sheet_0_menu()
{
sheet_check(0);
change_sheet(0);
}
static void lcd_select_sheet_1_menu()
{
sheet_check(1);
change_sheet(1);
}
static void lcd_select_sheet_2_menu()
{
sheet_check(2);
change_sheet(2);
}
static void lcd_select_sheet_menu()