Fix E2END and add EEPROM to Smart RAMPS

Reference #9983
This commit is contained in:
Scott Lahteine 2018-03-10 03:02:53 -06:00
parent ddce486360
commit 239902f861
8 changed files with 19 additions and 10 deletions

View File

@ -53,7 +53,6 @@ uint8_t eeprom_read_byte(uint8_t* pos) {
return v;
}
void eeprom_read_block(void* dest, const void* eeprom_address, size_t n) {
uint8_t eeprom_temp[3];

View File

@ -1167,7 +1167,7 @@
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("EEPROM Dump:");
for (uint16_t i = 0; i < E2END + 1; i += 16) {
for (uint16_t i = 0; i <= E2END; i += 16) {
if (!(i & 0x3)) idle();
print_hex_word(i);
SERIAL_ECHOPGM(": ");

View File

@ -1494,6 +1494,10 @@ void MarlinSettings::postprocess() {
return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
}
int MarlinSettings::mesh_slot_offset(const int8_t slot) {
return meshes_end - (slot + 1) * sizeof(ubl.z_values);
}
void MarlinSettings::store_mesh(const int8_t slot) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
@ -1509,8 +1513,8 @@ void MarlinSettings::postprocess() {
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values);
HAL::PersistentStore::access_start();
const bool status = HAL::PersistentStore::write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
@ -1546,8 +1550,8 @@ void MarlinSettings::postprocess() {
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values);
uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values;
HAL::PersistentStore::access_start();

View File

@ -73,6 +73,7 @@ class MarlinSettings {
static int16_t meshes_start_index();
FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
static uint16_t calc_num_meshes();
static int mesh_slot_offset(const int8_t slot);
static void store_mesh(const int8_t slot);
static void load_mesh(const int8_t slot, void * const into=NULL);
@ -104,7 +105,7 @@ class MarlinSettings {
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
// That can store is enabled
const static int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
static constexpr int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
// live at the very end of the eeprom
#endif

View File

@ -151,8 +151,9 @@
#define SDSS 4
#define PS_ON_PIN 40
// I2C EEPROM with 8K of space
#define I2C_EEPROM
#define E2END 0x2000
#define E2END 0x1FFF
//
// LCD / Controller

View File

@ -60,6 +60,10 @@
#define IS_RAMPS_SMART
#include "pins_RAMPS.h"
// I2C EEPROM with 4K of space
#define I2C_EEPROM
#define E2END 0xFFF
//
// Temperature Sensors
//

View File

@ -175,7 +175,7 @@
//
// EEPROM
//
#define E2END 0x8000 // 32Kb (24lc256)
#define E2END 0x7FFF // 32Kb (24lc256)
#define I2C_EEPROM // EEPROM on I2C-0
//#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0