MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / _load

Method _load

Marlin/src/module/settings.cpp:1883–3050  ·  view source on GitHub ↗

* M501 - Retrieve Configuration */

Source from the content-addressed store, hash-verified

1881 * M501 - Retrieve Configuration
1882 */
1883 EEPROM_Error MarlinSettings::_load() {
1884 EEPROM_Error eeprom_error = ERR_EEPROM_NOERR;
1885
1886 const EEPROM_Error check = check_version();
1887 if (check == ERR_EEPROM_NOPROM) return eeprom_error;
1888
1889 uint16_t stored_crc;
1890
1891 do { // A block to break out of on error
1892
1893 // Version has to match or defaults are used
1894 if (check == ERR_EEPROM_VERSION) {
1895 eeprom_error = check;
1896 break;
1897 }
1898
1899 //
1900 // Optionally reset on first boot after flashing
1901 //
1902 #if ENABLED(EEPROM_INIT_NOW)
1903 uint32_t stored_hash;
1904 EEPROM_READ_ALWAYS(stored_hash);
1905 if (stored_hash != build_hash) {
1906 eeprom_error = ERR_EEPROM_CORRUPT;
1907 break;
1908 }
1909 #endif
1910
1911 //
1912 // Get the stored CRC to compare at the end
1913 //
1914 EEPROM_READ_ALWAYS(stored_crc);
1915
1916 //
1917 // A temporary float for safe storage
1918 //
1919 float dummyf = 0;
1920
1921 //
1922 // Init to 0. Accumulated by EEPROM_READ
1923 //
1924 working_crc = 0;
1925
1926 //
1927 // Validate the stored size against the current data structure size
1928 //
1929 uint16_t stored_size;
1930 EEPROM_READ_ALWAYS(stored_size);
1931 if ((eeprom_error = size_error(stored_size))) break;
1932
1933 //
1934 // Extruder Parameter Count
1935 // Number of e_factors may change
1936 //
1937 _FIELD_TEST(e_factors);
1938 uint8_t e_factors;
1939 EEPROM_READ_ALWAYS(e_factors);
1940

Callers

nothing calls this directly

Calls 15

set_bed_leveling_enabledFunction · 0.85
reset_stepper_driversFunction · 0.85
DISTINCT_E_LOOPFunction · 0.85
IsRunningFunction · 0.85
set_runout_distanceMethod · 0.80
set_gridMethod · 0.80
reset_indexMethod · 0.80
set_advance_kMethod · 0.80
set_advance_tauMethod · 0.80
set_distance_mmMethod · 0.80
set_correction_uint8Method · 0.80

Tested by

no test coverage detected