void setDefault_command() { command::add_homing[0] = command::add_homing[1] = command::add_homing[2] = 0; command::zprobe_zoffset = 0; EEPROM_WRITE_VAR(eeprom_offsets::ADD_HOMING, command::add_homing); EEPROM_WRITE_VAR(eeprom_offsets::ZPROBE_ZOFFSET,command::zprobe_zoffset); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first //EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); //EEPROM_WRITE_VAR(i,acceleration); char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_PGMLN("Settings Stored"); }
static void setDefaultPID(void) { float p = DEFAULT_P; uint16_t location = eeprom_offsets::HEATER_PID; EEPROM_WRITE_VAR(location, p); float i = DEFAULT_I; location += sizeof(float); EEPROM_WRITE_VAR(location, i); float d = DEFAULT_D; location += sizeof(float); EEPROM_WRITE_VAR(location, d); }
void resetUserEEPROM() { char ver[4] = "000"; EEPROM_WRITE_VAR(eeprom_offsets::EEPROM_VERSION, ver); // invalidate data first setDefault_plan(); setDefault_command(); setDefaultPID(); char ver2[4] = APP_EEPROM_VERSION; EEPROM_WRITE_VAR(eeprom_offsets::EEPROM_VERSION, ver2); }
void Config_StoreSettings() { float dummy = 0.0f; char ver[4] = "000"; int i = EEPROM_OFFSET; EEPROM_WRITE_VAR(i, ver); // invalidate data first EEPROM_WRITE_VAR(i, axis_steps_per_unit); EEPROM_WRITE_VAR(i, max_feedrate); EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i, acceleration); EEPROM_WRITE_VAR(i, retract_acceleration); EEPROM_WRITE_VAR(i, travel_acceleration); EEPROM_WRITE_VAR(i, minimumfeedrate); EEPROM_WRITE_VAR(i, mintravelfeedrate); EEPROM_WRITE_VAR(i, minsegmenttime); EEPROM_WRITE_VAR(i, max_xy_jerk); EEPROM_WRITE_VAR(i, max_z_jerk); EEPROM_WRITE_VAR(i, max_e_jerk); EEPROM_WRITE_VAR(i, home_offset); uint8_t mesh_num_x = 3; uint8_t mesh_num_y = 3; #if ENABLED(MESH_BED_LEVELING) // Compile time test that sizeof(mbl.z_values) is as expected typedef char c_assert[(sizeof(mbl.z_values) == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS * sizeof(dummy)) ? 1 : -1]; mesh_num_x = MESH_NUM_X_POINTS; mesh_num_y = MESH_NUM_Y_POINTS; EEPROM_WRITE_VAR(i, mbl.active); EEPROM_WRITE_VAR(i, mesh_num_x); EEPROM_WRITE_VAR(i, mesh_num_y); EEPROM_WRITE_VAR(i, mbl.z_values); #else uint8_t dummy_uint8 = 0; EEPROM_WRITE_VAR(i, dummy_uint8); EEPROM_WRITE_VAR(i, mesh_num_x); EEPROM_WRITE_VAR(i, mesh_num_y); dummy = 0.0f; for (uint8_t q = 0; q < mesh_num_x * mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy); #endif // MESH_BED_LEVELING #if DISABLED(AUTO_BED_LEVELING_FEATURE) float zprobe_zoffset = 0; #endif EEPROM_WRITE_VAR(i, zprobe_zoffset); #if ENABLED(DELTA) EEPROM_WRITE_VAR(i, endstop_adj); // 3 floats EEPROM_WRITE_VAR(i, delta_radius); // 1 float EEPROM_WRITE_VAR(i, delta_diagonal_rod); // 1 float EEPROM_WRITE_VAR(i, delta_segments_per_second); // 1 float #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_WRITE_VAR(i, z_endstop_adj); // 1 floats dummy = 0.0f; for (int q = 5; q--;) EEPROM_WRITE_VAR(i, dummy); #else dummy = 0.0f; for (int q = 6; q--;) EEPROM_WRITE_VAR(i, dummy); #endif #if DISABLED(ULTIPANEL) int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED, absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif // !ULTIPANEL EEPROM_WRITE_VAR(i, plaPreheatHotendTemp); EEPROM_WRITE_VAR(i, plaPreheatHPBTemp); EEPROM_WRITE_VAR(i, plaPreheatFanSpeed); EEPROM_WRITE_VAR(i, absPreheatHotendTemp); EEPROM_WRITE_VAR(i, absPreheatHPBTemp); EEPROM_WRITE_VAR(i, absPreheatFanSpeed); for (int e = 0; e < 4; e++) { #if ENABLED(PIDTEMP) if (e < EXTRUDERS) { EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Kd, e)); #if ENABLED(PID_ADD_EXTRUSION_RATE) EEPROM_WRITE_VAR(i, PID_PARAM(Kc, e)); #else dummy = 1.0f; // 1.0 = default kc EEPROM_WRITE_VAR(i, dummy); #endif } else #endif // !PIDTEMP { dummy = DUMMY_PID_VALUE; // When read, will not change the existing value EEPROM_WRITE_VAR(i, dummy); dummy = 0.0f; for (int q = 3; q--;) EEPROM_WRITE_VAR(i, dummy); } } // Extruders Loop #if DISABLED(PID_ADD_EXTRUSION_RATE) int lpq_len = 20; #endif EEPROM_WRITE_VAR(i, lpq_len); #if DISABLED(PIDTEMPBED) float bedKp = DUMMY_PID_VALUE, bedKi = DUMMY_PID_VALUE, bedKd = DUMMY_PID_VALUE; #endif EEPROM_WRITE_VAR(i, bedKp); EEPROM_WRITE_VAR(i, bedKi); EEPROM_WRITE_VAR(i, bedKd); #if DISABLED(HAS_LCD_CONTRAST) const int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i, lcd_contrast); #if ENABLED(SCARA) EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats #else dummy = 1.0f; EEPROM_WRITE_VAR(i, dummy); #endif #if ENABLED(FWRETRACT) EEPROM_WRITE_VAR(i, autoretract_enabled); EEPROM_WRITE_VAR(i, retract_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_feedrate); EEPROM_WRITE_VAR(i, retract_zlift); EEPROM_WRITE_VAR(i, retract_recover_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_recover_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_recover_feedrate); #endif // FWRETRACT EEPROM_WRITE_VAR(i, volumetric_enabled); // Save filament sizes for (int q = 0; q < 4; q++) { if (q < EXTRUDERS) dummy = filament_size[q]; EEPROM_WRITE_VAR(i, dummy); } char ver2[4] = EEPROM_VERSION; int j = EEPROM_OFFSET; EEPROM_WRITE_VAR(j, ver2); // validate data // Report storage size SERIAL_ECHO_START; SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i); SERIAL_ECHOLNPGM(" bytes)"); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homeing); #ifdef DELTA EEPROM_WRITE_VAR(i,endstop_adj); EEPROM_WRITE_VAR(i,delta_radius); EEPROM_WRITE_VAR(i,delta_diagonal_rod); EEPROM_WRITE_VAR(i,max_pos); EEPROM_WRITE_VAR(i,tower_adj); EEPROM_WRITE_VAR(i,z_probe_offset); EEPROM_WRITE_VAR(i,delta_segments_per_second); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); EEPROM_WRITE_VAR(i,zprobe_zoffset); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else float dummy = 3000.0f; EEPROM_WRITE_VAR(i,dummy); dummy = 0.0f; EEPROM_WRITE_VAR(i,dummy); EEPROM_WRITE_VAR(i,dummy); #endif #ifndef DOGLCD int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i,lcd_contrast); char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,e1_steps_per_unit); //EEPROM_WRITE_VAR(i,extruder_offset); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homeing); #ifdef DELTA EEPROM_WRITE_VAR(i,endstop_adj); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int hipsPreheatHotendTemp = HIPS_PREHEAT_HOTEND_TEMP, hipsPreheatHPBTemp = HIPS_PREHEAT_HPB_TEMP, hipsPreheatFanSpeed = HIPS_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; int bridgePreheatHotendTemp = BRIDGE_PREHEAT_HOTEND_TEMP, bridgePreheatHPBTemp = BRIDGE_PREHEAT_HPB_TEMP, bridgePreheatFanSpeed = BRIDGE_PREHEAT_FAN_SPEED; int pctpePreheatHotendTemp = PCTPE_PREHEAT_HOTEND_TEMP, pctpePreheatHPBTemp = PCTPE_PREHEAT_HPB_TEMP, pctpePreheatFanSpeed = PCTPE_PREHEAT_FAN_SPEED; int alloy_910PreheatHotendTemp = ALLOY_910_PREHEAT_HOTEND_TEMP, alloy_910PreheatHPBTemp = ALLOY_910_PREHEAT_HPB_TEMP, alloy_910PreheatFanSpeed = ALLOY_910_PREHEAT_FAN_SPEED; //~ int bambooPreheatHotendTemp = BAMBOO_PREHEAT_HOTEND_TEMP, bambooPreheatHPBTemp = BAMBO_PREHEAT_HPB_TEMP, bambooPreheatFanSpeed = BAMBOO_PREHEAT_FAN_SPEED; int n_ventPreheatHotendTemp = N_VENT_PREHEAT_HOTEND_TEMP, n_ventPreheatHPBTemp = N_VENT_PREHEAT_HPB_TEMP, n_ventPreheatFanSpeed = N_VENT_PREHEAT_FAN_SPEED; int laybrickPreheatHotendTemp = LAYBRICK_PREHEAT_HOTEND_TEMP, laybrickPreheatHPBTemp = LAYBRICK_PREHEAT_HPB_TEMP, laybrickPreheatFanSpeed = LAYBRICK_PREHEAT_FAN_SPEED; int laywoodPreheatHotendTemp = LAYWOOD_PREHEAT_HOTEND_TEMP, laywoodPreheatHPBTemp = LAYWOOD_PREHEAT_HPB_TEMP, laywoodPreheatFanSpeed = LAYWOOD_PREHEAT_FAN_SPEED; int polycarbonatePreheatHotendTemp = POLYCARBONATE_PREHEAT_HOTEND_TEMP, polycarbonatePreheatHPBTemp = POLYCARBONATE_PREHEAT_HPB_TEMP, polycarbonatePreheatFanSpeed = POLYCARBONATE_PREHEAT_FAN_SPEED; int tglasePreheatHotendTemp = TGLASE_PREHEAT_HOTEND_TEMP, tglasePreheatHPBTemp = TGLASE_PREHEAT_HPB_TEMP, tglasePreheatFanSpeed = TGLASE_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,hipsPreheatHotendTemp); EEPROM_WRITE_VAR(i,hipsPreheatHPBTemp); EEPROM_WRITE_VAR(i,hipsPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); EEPROM_WRITE_VAR(i,bridgePreheatHotendTemp); EEPROM_WRITE_VAR(i,bridgePreheatHPBTemp); EEPROM_WRITE_VAR(i,bridgePreheatFanSpeed); EEPROM_WRITE_VAR(i,pctpePreheatHotendTemp); EEPROM_WRITE_VAR(i,pctpePreheatHPBTemp); EEPROM_WRITE_VAR(i,pctpePreheatFanSpeed); EEPROM_WRITE_VAR(i,alloy_910PreheatHotendTemp); EEPROM_WRITE_VAR(i,alloy_910PreheatHPBTemp); EEPROM_WRITE_VAR(i,alloy_910PreheatFanSpeed); //~ EEPROM_WRITE_VAR(i,bambooPreheatHotendTemp); //~ EEPROM_WRITE_VAR(i,bambooPreheatHPBTemp); //~ EEPROM_WRITE_VAR(i,bambooPreheatFanSpeed); EEPROM_WRITE_VAR(i,n_ventPreheatHotendTemp); EEPROM_WRITE_VAR(i,n_ventPreheatHPBTemp); EEPROM_WRITE_VAR(i,n_ventPreheatFanSpeed); EEPROM_WRITE_VAR(i,laybrickPreheatHotendTemp); EEPROM_WRITE_VAR(i,laybrickPreheatHPBTemp); EEPROM_WRITE_VAR(i,laybrickPreheatFanSpeed); EEPROM_WRITE_VAR(i,laywoodPreheatHotendTemp); EEPROM_WRITE_VAR(i,laywoodPreheatHPBTemp); EEPROM_WRITE_VAR(i,laywoodPreheatFanSpeed); EEPROM_WRITE_VAR(i,polycarbonatePreheatHotendTemp); EEPROM_WRITE_VAR(i,polycarbonatePreheatHPBTemp); EEPROM_WRITE_VAR(i,polycarbonatePreheatFanSpeed); EEPROM_WRITE_VAR(i,tglasePreheatHotendTemp); EEPROM_WRITE_VAR(i,tglasePreheatHPBTemp); EEPROM_WRITE_VAR(i,tglasePreheatFanSpeed); EEPROM_WRITE_VAR(i,zprobe_zoffset); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else float dummy = 3000.0f; EEPROM_WRITE_VAR(i,dummy); dummy = 0.0f; EEPROM_WRITE_VAR(i,dummy); EEPROM_WRITE_VAR(i,dummy); #endif #ifndef DOGLCD int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i,lcd_contrast); char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
void Config_StoreSettings() { float dummy = 0.0f; char ver[4] = "000"; int i = EEPROM_OFFSET; EEPROM_WRITE_VAR(i, ver); // invalidate data first EEPROM_WRITE_VAR(i, axis_steps_per_unit); EEPROM_WRITE_VAR(i, max_feedrate); EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i, acceleration); EEPROM_WRITE_VAR(i, retract_acceleration); EEPROM_WRITE_VAR(i, minimumfeedrate); EEPROM_WRITE_VAR(i, mintravelfeedrate); EEPROM_WRITE_VAR(i, minsegmenttime); EEPROM_WRITE_VAR(i, max_xy_jerk); EEPROM_WRITE_VAR(i, max_z_jerk); EEPROM_WRITE_VAR(i, max_e_jerk); EEPROM_WRITE_VAR(i, add_homing); #ifdef DELTA EEPROM_WRITE_VAR(i, endstop_adj); // 3 floats EEPROM_WRITE_VAR(i, delta_radius); // 1 float EEPROM_WRITE_VAR(i, delta_diagonal_rod); // 1 float EEPROM_WRITE_VAR(i, delta_segments_per_second); // 1 float #else dummy = 0.0f; for (int q=6; q--;) EEPROM_WRITE_VAR(i, dummy); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED, absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif // !ULTIPANEL EEPROM_WRITE_VAR(i, plaPreheatHotendTemp); EEPROM_WRITE_VAR(i, plaPreheatHPBTemp); EEPROM_WRITE_VAR(i, plaPreheatFanSpeed); EEPROM_WRITE_VAR(i, absPreheatHotendTemp); EEPROM_WRITE_VAR(i, absPreheatHPBTemp); EEPROM_WRITE_VAR(i, absPreheatFanSpeed); EEPROM_WRITE_VAR(i, zprobe_zoffset); for (int e = 0; e < 4; e++) { #ifdef PIDTEMP if (e < EXTRUDERS) { EEPROM_WRITE_VAR(i, PID_PARAM(Kp, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Ki, e)); EEPROM_WRITE_VAR(i, PID_PARAM(Kd, e)); #ifdef PID_ADD_EXTRUSION_RATE EEPROM_WRITE_VAR(i, PID_PARAM(Kc, e)); #else dummy = 1.0f; // 1.0 = default kc EEPROM_WRITE_VAR(i, dummy); #endif } else { #else // !PIDTEMP { #endif // !PIDTEMP dummy = DUMMY_PID_VALUE; EEPROM_WRITE_VAR(i, dummy); dummy = 0.0f; for (int q = 3; q--;) EEPROM_WRITE_VAR(i, dummy); } } // Extruders Loop #ifndef DOGLCD int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i, lcd_contrast); #ifdef SCARA EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats #else dummy = 1.0f; EEPROM_WRITE_VAR(i, dummy); #endif #ifdef FWRETRACT EEPROM_WRITE_VAR(i, autoretract_enabled); EEPROM_WRITE_VAR(i, retract_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_feedrate); EEPROM_WRITE_VAR(i, retract_zlift); EEPROM_WRITE_VAR(i, retract_recover_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_recover_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_recover_feedrate); #endif // FWRETRACT EEPROM_WRITE_VAR(i, volumetric_enabled); // Save filament sizes for (int q = 0; q < 4; q++) { if (q < EXTRUDERS) dummy = filament_size[q]; EEPROM_WRITE_VAR(i, dummy); } int storageSize = i; char ver2[4] = EEPROM_VERSION; int j = EEPROM_OFFSET; EEPROM_WRITE_VAR(j, ver2); // validate data // Report storage size SERIAL_ECHO_START; SERIAL_ECHOPAIR("Settings Stored (", (unsigned long)i); SERIAL_ECHOLNPGM(" bytes)"); } void Config_RetrieveSettings() { int i = EEPROM_OFFSET; char stored_ver[4]; char ver[4] = EEPROM_VERSION; EEPROM_READ_VAR(i, stored_ver); //read stored version // SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]"); if (strncmp(ver, stored_ver, 3) != 0) { Config_ResetDefault(); } else { float dummy = 0; // version number match EEPROM_READ_VAR(i, axis_steps_per_unit); EEPROM_READ_VAR(i, max_feedrate); EEPROM_READ_VAR(i, max_acceleration_units_per_sq_second); // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) reset_acceleration_rates(); EEPROM_READ_VAR(i, acceleration); EEPROM_READ_VAR(i, retract_acceleration); EEPROM_READ_VAR(i, minimumfeedrate); EEPROM_READ_VAR(i, mintravelfeedrate); EEPROM_READ_VAR(i, minsegmenttime); EEPROM_READ_VAR(i, max_xy_jerk); EEPROM_READ_VAR(i, max_z_jerk); EEPROM_READ_VAR(i, max_e_jerk); EEPROM_READ_VAR(i, add_homing); #ifdef DELTA EEPROM_READ_VAR(i, endstop_adj); // 3 floats EEPROM_READ_VAR(i, delta_radius); // 1 float EEPROM_READ_VAR(i, delta_diagonal_rod); // 1 float EEPROM_READ_VAR(i, delta_segments_per_second); // 1 float #else for (int q=6; q--;) EEPROM_READ_VAR(i, dummy); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed; #endif EEPROM_READ_VAR(i, plaPreheatHotendTemp); EEPROM_READ_VAR(i, plaPreheatHPBTemp); EEPROM_READ_VAR(i, plaPreheatFanSpeed); EEPROM_READ_VAR(i, absPreheatHotendTemp); EEPROM_READ_VAR(i, absPreheatHPBTemp); EEPROM_READ_VAR(i, absPreheatFanSpeed); EEPROM_READ_VAR(i, zprobe_zoffset); #ifdef PIDTEMP for (int e = 0; e < 4; e++) { // 4 = max extruders currently supported by Marlin EEPROM_READ_VAR(i, dummy); if (e < EXTRUDERS && dummy != DUMMY_PID_VALUE) { // do not need to scale PID values as the values in EEPROM are already scaled PID_PARAM(Kp, e) = dummy; EEPROM_READ_VAR(i, PID_PARAM(Ki, e)); EEPROM_READ_VAR(i, PID_PARAM(Kd, e)); #ifdef PID_ADD_EXTRUSION_RATE EEPROM_READ_VAR(i, PID_PARAM(Kc, e)); #else EEPROM_READ_VAR(i, dummy); #endif } else { for (int q=3; q--;) EEPROM_READ_VAR(i, dummy); // Ki, Kd, Kc } } #else // !PIDTEMP // 4 x 4 = 16 slots for PID parameters for (int q=16; q--;) EEPROM_READ_VAR(i, dummy); // 4x Kp, Ki, Kd, Kc #endif // !PIDTEMP #ifndef DOGLCD int lcd_contrast; #endif EEPROM_READ_VAR(i, lcd_contrast); #ifdef SCARA EEPROM_READ_VAR(i, axis_scaling); // 3 floats #else EEPROM_READ_VAR(i, dummy); #endif #ifdef FWRETRACT EEPROM_READ_VAR(i, autoretract_enabled); EEPROM_READ_VAR(i, retract_length); #if EXTRUDERS > 1 EEPROM_READ_VAR(i, retract_length_swap); #else EEPROM_READ_VAR(i, dummy); #endif EEPROM_READ_VAR(i, retract_feedrate); EEPROM_READ_VAR(i, retract_zlift); EEPROM_READ_VAR(i, retract_recover_length); #if EXTRUDERS > 1 EEPROM_READ_VAR(i, retract_recover_length_swap); #else EEPROM_READ_VAR(i, dummy); #endif EEPROM_READ_VAR(i, retract_recover_feedrate); #endif // FWRETRACT EEPROM_READ_VAR(i, volumetric_enabled); for (int q = 0; q < 4; q++) { EEPROM_READ_VAR(i, dummy); if (q < EXTRUDERS) filament_size[q] = dummy; } calculate_volumetric_multipliers(); // Call updatePID (similar to when we have processed M301) updatePID(); // Report settings retrieved and length SERIAL_ECHO_START; SERIAL_ECHO(ver); SERIAL_ECHOPAIR(" stored settings retrieved (", (unsigned long)i); SERIAL_ECHOLNPGM(" bytes)"); } #ifdef EEPROM_CHITCHAT Config_PrintSettings(); #endif }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homeing); #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else float dummy = 3000.0f; EEPROM_WRITE_VAR(i,dummy); dummy = 0.0f; EEPROM_WRITE_VAR(i,dummy); EEPROM_WRITE_VAR(i,dummy); #endif EEPROM_WRITE_VAR(i,motor_current_setting); #ifdef ENABLE_ULTILCD2 EEPROM_WRITE_VAR(i,led_brightness_level); EEPROM_WRITE_VAR(i,led_mode); #else uint8_t dummyByte=0; EEPROM_WRITE_VAR(i,dummyByte); EEPROM_WRITE_VAR(i,dummyByte); #endif EEPROM_WRITE_VAR(i,retract_length); EEPROM_WRITE_VAR(i,retract_feedrate); char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homeing); //Changes Rapduch #ifdef HYSTERESIS_H EEPROM_WRITE_VAR(i,menu_hysteresis_X); EEPROM_WRITE_VAR(i,menu_hysteresis_Y); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; int nylonPreheatHotendTemp = NYLON_PREHEAT_HOTEND_TEMP, nylonPreheatHPBTemp = NYLON_PREHEAT_HPB_TEMP, nylonPreheatFanSpeed = NYLON_PREHEAT_FAN_SPEED; int pvaPreheatHotendTemp = PVA_PREHEAT_HOTEND_TEMP, pvaPreheatHPBTemp = PVA_PREHEAT_HPB_TEMP, pvaPreheatFanSpeed = PVA_PREHEAT_FAN_SPEED; //int laywoodPreheatHotendTemp = LAYWOOD_PREHEAT_HOTEND_TEMP, laywoodPreheatHPBTemp = LAYWOOD_PREHEAT_HPB_TEMP, laywoodPreheatFanSpeed = LAYWOOD_PREHEAT_FAN_SPEED; // int laybrickPreheatHotendTemp = LAYBRICK_PREHEAT_HOTEND_TEMP, laybrickPreheatHPBTemp = LAYBRICK_PREHEAT_HPB_TEMP, laybrickPreheatFanSpeed = LAYBRICK_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); EEPROM_WRITE_VAR(i,nylonPreheatHotendTemp); EEPROM_WRITE_VAR(i,nylonPreheatHPBTemp); EEPROM_WRITE_VAR(i,nylonPreheatFanSpeed); EEPROM_WRITE_VAR(i,pvaPreheatHotendTemp); EEPROM_WRITE_VAR(i,pvaPreheatHPBTemp); EEPROM_WRITE_VAR(i,pvaPreheatFanSpeed); EEPROM_WRITE_VAR(i,laywoodPreheatHotendTemp); EEPROM_WRITE_VAR(i,laywoodPreheatHPBTemp); EEPROM_WRITE_VAR(i,laywoodPreheatFanSpeed); EEPROM_WRITE_VAR(i,laybrickPreheatHotendTemp); EEPROM_WRITE_VAR(i,laybrickPreheatHPBTemp); EEPROM_WRITE_VAR(i,laybrickPreheatFanSpeed); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else float dummy = 3000.0f; EEPROM_WRITE_VAR(i,dummy); dummy = 0.0f; EEPROM_WRITE_VAR(i,dummy); EEPROM_WRITE_VAR(i,dummy); #endif char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
/** * M500 - Store Configuration */ void Config_StoreSettings() { float dummy = 0.0f; char ver[6] = "00000"; int i = EEPROM_OFFSET; EEPROM_WRITE_VAR(i, ver); // invalidate data first i += sizeof(eeprom_checksum); // Skip the checksum slot eeprom_checksum = 0; // clear before first "real data" EEPROM_WRITE_VAR(i, planner.axis_steps_per_mm); EEPROM_WRITE_VAR(i, planner.max_feedrate); EEPROM_WRITE_VAR(i, planner.max_acceleration_mm_per_s2); EEPROM_WRITE_VAR(i, planner.acceleration); EEPROM_WRITE_VAR(i, planner.retract_acceleration); EEPROM_WRITE_VAR(i, planner.travel_acceleration); EEPROM_WRITE_VAR(i, planner.min_feedrate); EEPROM_WRITE_VAR(i, planner.min_travel_feedrate); EEPROM_WRITE_VAR(i, planner.min_segment_time); EEPROM_WRITE_VAR(i, planner.max_xy_jerk); EEPROM_WRITE_VAR(i, planner.max_z_jerk); EEPROM_WRITE_VAR(i, planner.max_e_jerk); EEPROM_WRITE_VAR(i, home_offset); EEPROM_WRITE_VAR(i, hotend_offset); #if ENABLED(MESH_BED_LEVELING) // Compile time test that sizeof(mbl.z_values) is as expected typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1]; uint8_t mesh_num_x = MESH_NUM_X_POINTS, mesh_num_y = MESH_NUM_Y_POINTS, dummy_uint8 = mbl.status & _BV(MBL_STATUS_HAS_MESH_BIT); EEPROM_WRITE_VAR(i, dummy_uint8); EEPROM_WRITE_VAR(i, mbl.z_offset); EEPROM_WRITE_VAR(i, mesh_num_x); EEPROM_WRITE_VAR(i, mesh_num_y); EEPROM_WRITE_VAR(i, mbl.z_values); #endif #if HEATER_USES_AD595 EEPROM_WRITE_VAR(i, ad595_offset); EEPROM_WRITE_VAR(i, ad595_gain); #endif #if MECH(DELTA) EEPROM_WRITE_VAR(i, endstop_adj); EEPROM_WRITE_VAR(i, delta_radius); EEPROM_WRITE_VAR(i, delta_diagonal_rod); EEPROM_WRITE_VAR(i, sw_endstop_max); EEPROM_WRITE_VAR(i, tower_adj); EEPROM_WRITE_VAR(i, diagrod_adj); #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_WRITE_VAR(i, z_endstop_adj); #endif #if HASNT(BED_PROBE) float zprobe_zoffset = 0; #endif EEPROM_WRITE_VAR(i, zprobe_zoffset); #if DISABLED(ULTIPANEL) int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED, absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED, gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i, plaPreheatHotendTemp); EEPROM_WRITE_VAR(i, plaPreheatHPBTemp); EEPROM_WRITE_VAR(i, plaPreheatFanSpeed); EEPROM_WRITE_VAR(i, absPreheatHotendTemp); EEPROM_WRITE_VAR(i, absPreheatHPBTemp); EEPROM_WRITE_VAR(i, absPreheatFanSpeed); EEPROM_WRITE_VAR(i, gumPreheatHotendTemp); EEPROM_WRITE_VAR(i, gumPreheatHPBTemp); EEPROM_WRITE_VAR(i, gumPreheatFanSpeed); #if ENABLED(PIDTEMP) for (int h = 0; h < HOTENDS; h++) { EEPROM_WRITE_VAR(i, PID_PARAM(Kp, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Ki, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Kd, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Kc, h)); } #endif #if DISABLED(PID_ADD_EXTRUSION_RATE) int lpq_len = 20; #endif EEPROM_WRITE_VAR(i, lpq_len); #if ENABLED(PIDTEMPBED) EEPROM_WRITE_VAR(i, bedKp); EEPROM_WRITE_VAR(i, bedKi); EEPROM_WRITE_VAR(i, bedKd); #endif #if ENABLED(PIDTEMPCHAMBER) EEPROM_WRITE_VAR(i, chamberKp); EEPROM_WRITE_VAR(i, chamberKi); EEPROM_WRITE_VAR(i, chamberKd); #endif #if ENABLED(PIDTEMPCOOLER) EEPROM_WRITE_VAR(i, coolerKp); EEPROM_WRITE_VAR(i, coolerKi); EEPROM_WRITE_VAR(i, coolerKd); #endif #if HASNT(LCD_CONTRAST) const int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i, lcd_contrast); #if MECH(SCARA) EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats #endif #if ENABLED(FWRETRACT) EEPROM_WRITE_VAR(i, autoretract_enabled); EEPROM_WRITE_VAR(i, retract_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_feedrate); EEPROM_WRITE_VAR(i, retract_zlift); EEPROM_WRITE_VAR(i, retract_recover_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_recover_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_recover_feedrate); #endif // FWRETRACT EEPROM_WRITE_VAR(i, volumetric_enabled); // Save filament sizes for (int e = 0; e < EXTRUDERS; e++) EEPROM_WRITE_VAR(i, filament_size[e]); #if ENABLED(IDLE_OOZING_PREVENT) EEPROM_WRITE_VAR(i, IDLE_OOZING_enabled); #endif #if MB(ALLIGATOR) EEPROM_WRITE_VAR(i, motor_current); #endif uint16_t final_checksum = eeprom_checksum; int j = EEPROM_OFFSET; EEPROM_WRITE_VAR(j, version); EEPROM_WRITE_VAR(j, final_checksum); // Report storage size ECHO_SMV(DB, "Settings Stored (", i); ECHO_EM(" bytes)"); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homeing); #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else EEPROM_WRITE_VAR(i,3000); EEPROM_WRITE_VAR(i,0); EEPROM_WRITE_VAR(i,0); #endif char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
void setDefault_plan() { float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT; float tmp2[] = DEFAULT_MAX_FEEDRATE; long tmp3[] = DEFAULT_MAX_ACCELERATION; for (short i=0;i<4;i++){ axis_steps_per_unit[i] = tmp1[i]; max_feedrate[i] = tmp2[i]; max_acceleration_units_per_sq_second[i] = tmp3[i]; } // steps per sq second need to be updated to agree with the units per sq second reset_acceleration_rates(); acceleration = DEFAULT_ACCELERATION; retract_acceleration = DEFAULT_RETRACT_ACCELERATION; minimumfeedrate = DEFAULT_MINIMUMFEEDRATE; minsegmenttime = DEFAULT_MINSEGMENTTIME; mintravelfeedrate = DEFAULT_MINTRAVELFEEDRATE; max_xy_jerk = DEFAULT_XYJERK; max_z_jerk = DEFAULT_ZJERK; max_e_jerk = DEFAULT_EJERK; EEPROM_WRITE_VAR(eeprom_offsets::AXIS_STEPS_PER_UNIT, axis_steps_per_unit); EEPROM_WRITE_VAR(eeprom_offsets::MAX_FEEDRATE, max_feedrate); EEPROM_WRITE_VAR(eeprom_offsets::MAX_ACCELERATION, max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(eeprom_offsets::ACCELERATION, acceleration); EEPROM_WRITE_VAR(eeprom_offsets::RETRACT_ACCELERATION, retract_acceleration); EEPROM_WRITE_VAR(eeprom_offsets::MINIMUMFEEDRATE, minimumfeedrate); EEPROM_WRITE_VAR(eeprom_offsets::MINTRAVELFEEDRATE, mintravelfeedrate); EEPROM_WRITE_VAR(eeprom_offsets::MINSEGMENTTIME, minsegmenttime); EEPROM_WRITE_VAR(eeprom_offsets::MAX_XYJERK, max_xy_jerk); EEPROM_WRITE_VAR(eeprom_offsets::MAX_ZJERK, max_z_jerk); EEPROM_WRITE_VAR(eeprom_offsets::MAX_EJERK, max_e_jerk); }
void setCustom_addHoming(float* add_homing) { EEPROM_WRITE_VAR(eeprom_offsets::ADD_HOMING, command::add_homing); }
void Config_StoreSettings() { char ver[4]= "000"; int i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver); // invalidate data first EEPROM_WRITE_VAR(i,axis_steps_per_unit); EEPROM_WRITE_VAR(i,max_feedrate); EEPROM_WRITE_VAR(i,max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i,acceleration); EEPROM_WRITE_VAR(i,retract_acceleration); EEPROM_WRITE_VAR(i,minimumfeedrate); EEPROM_WRITE_VAR(i,mintravelfeedrate); EEPROM_WRITE_VAR(i,minsegmenttime); EEPROM_WRITE_VAR(i,max_xy_jerk); EEPROM_WRITE_VAR(i,max_z_jerk); EEPROM_WRITE_VAR(i,max_e_jerk); EEPROM_WRITE_VAR(i,add_homing); #ifdef DELTA EEPROM_WRITE_VAR(i,endstop_adj); EEPROM_WRITE_VAR(i,delta_radius); EEPROM_WRITE_VAR(i,delta_diagonal_rod); EEPROM_WRITE_VAR(i,delta_segments_per_second); #endif #ifndef ULTIPANEL int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED; int absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i,plaPreheatHotendTemp); EEPROM_WRITE_VAR(i,plaPreheatHPBTemp); EEPROM_WRITE_VAR(i,plaPreheatFanSpeed); EEPROM_WRITE_VAR(i,absPreheatHotendTemp); EEPROM_WRITE_VAR(i,absPreheatHPBTemp); EEPROM_WRITE_VAR(i,absPreheatFanSpeed); EEPROM_WRITE_VAR(i,zprobe_zoffset); #ifdef PIDTEMP EEPROM_WRITE_VAR(i,Kp); EEPROM_WRITE_VAR(i,Ki); EEPROM_WRITE_VAR(i,Kd); #else float dummy = 3000.0f; EEPROM_WRITE_VAR(i,dummy); dummy = 0.0f; EEPROM_WRITE_VAR(i,dummy); EEPROM_WRITE_VAR(i,dummy); #endif #ifndef DOGLCD int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i,lcd_contrast); #ifdef SCARA EEPROM_WRITE_VAR(i,axis_scaling); // Add scaling for SCARA #endif #ifdef FWRETRACT EEPROM_WRITE_VAR(i,autoretract_enabled); EEPROM_WRITE_VAR(i,retract_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i,retract_length_swap); #endif EEPROM_WRITE_VAR(i,retract_feedrate); EEPROM_WRITE_VAR(i,retract_zlift); EEPROM_WRITE_VAR(i,retract_recover_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i,retract_recover_length_swap); #endif EEPROM_WRITE_VAR(i,retract_recover_feedrate); #endif // Save filament sizes EEPROM_WRITE_VAR(i, volumetric_enabled); EEPROM_WRITE_VAR(i, filament_size[0]); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, filament_size[1]); #if EXTRUDERS > 2 EEPROM_WRITE_VAR(i, filament_size[2]); #endif #endif char ver2[4]=EEPROM_VERSION; i=EEPROM_OFFSET; EEPROM_WRITE_VAR(i,ver2); // validate data SERIAL_ECHO_START; SERIAL_ECHOLNPGM("Settings Stored"); }
void Config_StoreSettings() { float dummy = 0.0f; char ver[7] = "000000"; int i = EEPROM_OFFSET; EEPROM_WRITE_VAR(i, ver); // invalidate data first EEPROM_WRITE_VAR(i, axis_steps_per_unit); EEPROM_WRITE_VAR(i, max_feedrate); EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second); EEPROM_WRITE_VAR(i, acceleration); EEPROM_WRITE_VAR(i, retract_acceleration); EEPROM_WRITE_VAR(i, travel_acceleration); EEPROM_WRITE_VAR(i, minimumfeedrate); EEPROM_WRITE_VAR(i, mintravelfeedrate); EEPROM_WRITE_VAR(i, minsegmenttime); EEPROM_WRITE_VAR(i, max_xy_jerk); EEPROM_WRITE_VAR(i, max_z_jerk); EEPROM_WRITE_VAR(i, max_e_jerk); EEPROM_WRITE_VAR(i, home_offset); EEPROM_WRITE_VAR(i, hotend_offset); #if !MECH(DELTA) EEPROM_WRITE_VAR(i, zprobe_zoffset); #endif #if HEATER_USES_AD595 EEPROM_WRITE_VAR(i, ad595_offset); EEPROM_WRITE_VAR(i, ad595_gain); #endif #if MECH(DELTA) EEPROM_WRITE_VAR(i, endstop_adj); EEPROM_WRITE_VAR(i, delta_radius); EEPROM_WRITE_VAR(i, delta_diagonal_rod); EEPROM_WRITE_VAR(i, sw_endstop_max); EEPROM_WRITE_VAR(i, tower_adj); EEPROM_WRITE_VAR(i, diagrod_adj); EEPROM_WRITE_VAR(i, z_probe_offset); #elif ENABLED(Z_DUAL_ENDSTOPS) EEPROM_WRITE_VAR(i, z_endstop_adj); // 1 floats #endif #if DISABLED(ULTIPANEL) int plaPreheatHotendTemp = PLA_PREHEAT_HOTEND_TEMP, plaPreheatHPBTemp = PLA_PREHEAT_HPB_TEMP, plaPreheatFanSpeed = PLA_PREHEAT_FAN_SPEED, absPreheatHotendTemp = ABS_PREHEAT_HOTEND_TEMP, absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP, absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED, gumPreheatHotendTemp = GUM_PREHEAT_HOTEND_TEMP, gumPreheatHPBTemp = GUM_PREHEAT_HPB_TEMP, gumPreheatFanSpeed = GUM_PREHEAT_FAN_SPEED; #endif EEPROM_WRITE_VAR(i, plaPreheatHotendTemp); EEPROM_WRITE_VAR(i, plaPreheatHPBTemp); EEPROM_WRITE_VAR(i, plaPreheatFanSpeed); EEPROM_WRITE_VAR(i, absPreheatHotendTemp); EEPROM_WRITE_VAR(i, absPreheatHPBTemp); EEPROM_WRITE_VAR(i, absPreheatFanSpeed); EEPROM_WRITE_VAR(i, gumPreheatHotendTemp); EEPROM_WRITE_VAR(i, gumPreheatHPBTemp); EEPROM_WRITE_VAR(i, gumPreheatFanSpeed); #if ENABLED(PIDTEMP) for (int h = 0; h < HOTENDS; h++) { EEPROM_WRITE_VAR(i, PID_PARAM(Kp, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Ki, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Kd, h)); EEPROM_WRITE_VAR(i, PID_PARAM(Kc, h)); } #endif #if DISABLED(PID_ADD_EXTRUSION_RATE) int lpq_len = 20; #endif EEPROM_WRITE_VAR(i, lpq_len); #if ENABLED(PIDTEMPBED) EEPROM_WRITE_VAR(i, bedKp); EEPROM_WRITE_VAR(i, bedKi); EEPROM_WRITE_VAR(i, bedKd); #endif #if HASNT(LCD_CONTRAST) const int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i, lcd_contrast); #if MECH(SCARA) EEPROM_WRITE_VAR(i, axis_scaling); // 3 floats #endif #if ENABLED(FWRETRACT) EEPROM_WRITE_VAR(i, autoretract_enabled); EEPROM_WRITE_VAR(i, retract_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_feedrate); EEPROM_WRITE_VAR(i, retract_zlift); EEPROM_WRITE_VAR(i, retract_recover_length); #if EXTRUDERS > 1 EEPROM_WRITE_VAR(i, retract_recover_length_swap); #else dummy = 0.0f; EEPROM_WRITE_VAR(i, dummy); #endif EEPROM_WRITE_VAR(i, retract_recover_feedrate); #endif // FWRETRACT EEPROM_WRITE_VAR(i, volumetric_enabled); // Save filament sizes for (int e = 0; e < EXTRUDERS; e++) EEPROM_WRITE_VAR(i, filament_size[e]); #if ENABLED(IDLE_OOZING_PREVENT) EEPROM_WRITE_VAR(i, IDLE_OOZING_enabled); #endif #if MB(ALLIGATOR) EEPROM_WRITE_VAR(i, motor_current); #endif char ver2[7] = EEPROM_VERSION; int j = EEPROM_OFFSET; EEPROM_WRITE_VAR(j, ver2); // validate data // Report storage size ECHO_SMV(DB, "Settings Stored (", (unsigned long)i); ECHO_EM(" bytes)"); }