Browse Source

Fix E2END and add EEPROM to Smart RAMPS

Reference #9983
pull/1/head
Scott Lahteine 6 years ago
parent
commit
239902f861
  1. 2
      Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp
  2. 1
      Marlin/src/HAL/SpiEeprom.cpp
  3. 4
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  4. 8
      Marlin/src/module/configuration_store.cpp
  5. 5
      Marlin/src/module/configuration_store.h
  6. 3
      Marlin/src/pins/pins_RADDS.h
  7. 4
      Marlin/src/pins/pins_RAMPS_SMART.h
  8. 2
      Marlin/src/pins/pins_RURAMPS4D.h

2
Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp

@ -132,7 +132,7 @@ bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const boo
UINT bytes_read = 0;
FRESULT s;
s = f_lseek(&eeprom_file, pos);
if ( s ) {
if (s) {
SERIAL_PROTOCOLPAIR(" read_data(", pos); // This extra chit-chat goes away soon. But it is helpful
SERIAL_PROTOCOLPAIR(",", (int)value); // right now to see errors that are happening in the
SERIAL_PROTOCOLPAIR(",", size); // read_data() and write_data() functions

1
Marlin/src/HAL/SpiEeprom.cpp

@ -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];

4
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp

@ -1167,13 +1167,13 @@
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(": ");
for (uint16_t j = 0; j < 16; j++) {
kkkk = i + j;
eeprom_read_block(&cccc, (const void *) kkkk, sizeof(unsigned char));
eeprom_read_block(&cccc, (const void *)kkkk, sizeof(unsigned char));
print_hex_byte(cccc);
SERIAL_ECHO(' ');
}

8
Marlin/src/module/configuration_store.cpp

@ -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();

5
Marlin/src/module/configuration_store.h

@ -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,8 +105,8 @@ 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
// live at the very end of the eeprom
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

3
Marlin/src/pins/pins_RADDS.h

@ -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

4
Marlin/src/pins/pins_RAMPS_SMART.h

@ -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
//

2
Marlin/src/pins/pins_RURAMPS4D.h

@ -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

Loading…
Cancel
Save