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 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;
extern int bowden_length[4]; 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() 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->

View file

@ -41,6 +41,11 @@ bool eeprom_is_uninitialized<char>(char *address)
return (0xff == eeprom_read_byte(reinterpret_cast<uint8_t*>(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() void eeprom_init()
{ {
if (eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) == 0xff) eeprom_write_byte((uint8_t*)EEPROM_POWER_COUNT, 0); 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); static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_NOZZLE_DIAMETER - EEPROM_SHEETS_SIZEOF);
#ifdef __cplusplus #ifdef __cplusplus
extern bool is_sheet_initialized();
static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF."); static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEPROM_SHEETS_SIZEOF.");
#endif #endif

View file

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