Skip to content

Commit

Permalink
Update 01-09-2021
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilouz committed Aug 31, 2021
1 parent 3f3d043 commit e2689ff
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
// @section info

// Author info of this build printed to the host during boot and M115
#define STRING_CONFIG_H_AUTHOR "(Cyril Guislain, Brandon Salahat, SuperRacer Nano V3)" // Who made the changes.
#define STRING_CONFIG_H_AUTHOR "(Cyril Guislain, Super Racer Nano V3)" // Who made the changes.
//#define CUSTOM_VERSION_FILE Version.h // Path from the root directory (no quotes)

/**
Expand Down
11 changes: 4 additions & 7 deletions Marlin/src/HAL/LPC1768/eeprom_wired.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,30 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }

bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
uint16_t written = 0;
while (size--) {
uint8_t v = *value;

// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
uint8_t * const p = (uint8_t * const)pos;
if (v != eeprom_read_byte(p)) {
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
}
}

crc16(crc, &v, 1);
pos++;
value++;
};

}
return false;
}

bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
// Read from external EEPROM
const uint8_t c = eeprom_read_byte((uint8_t*)pos);

if (writing) *value = c;
crc16(crc, &c, 1);
pos++;
Expand Down
9 changes: 2 additions & 7 deletions Marlin/src/HAL/STM32/eeprom_wired.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
uint16_t written = 0;
while (size--) {
uint8_t v = *value;


uint8_t * const p = (uint8_t * const)pos;
//SKS Nano V3 AT24C32D EEPROM has 1M erase/write cycles! (https://www.microchip.com/en-us/product/at24c32d)
if (v != eeprom_read_byte(p)) { // EEPROM has only ~100,000 write cycles, so only write bytes that have changed!
eeprom_write_byte(p, v);
if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
Expand All @@ -58,12 +55,10 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
return true;
}
}

crc16(crc, &v, 1);
pos++;
value++;
};

}
return false;
}

Expand All @@ -80,4 +75,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}

#endif // USE_WIRED_EEPROM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,4 +1368,4 @@ void loop() {
TERN_(HAS_TFT_LVGL_UI, printer_state_polling());

} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}
}
4 changes: 2 additions & 2 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ typedef struct SettingsDataStruct {
abc_float_t delta_endstop_adj; // M666 X Y Z
float delta_radius, // M665 R
delta_diagonal_rod, // M665 L
segments_per_second; // M665 S
delta_segments_per_second; // M665 S
abc_float_t delta_tower_angle_trim, // M665 X Y Z
delta_diagonal_rod_trim; // M665 A B C
#elif HAS_EXTRA_ENDSTOPS
Expand Down Expand Up @@ -3375,7 +3375,7 @@ void MarlinSettings::reset() {
CONFIG_ECHO_HEADING("SCARA settings: S<seg-per-sec> P<theta-psi-offset> T<theta-offset>");
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M665 S"), segments_per_second
PSTR(" M665 S"), delta_segments_per_second
, SP_P_STR, scara_home_offset.a
, SP_T_STR, scara_home_offset.b
, SP_Z_STR, LINEAR_UNIT(scara_home_offset.z)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3604,4 +3604,4 @@ void Temperature::tick() {

#endif // HAS_HEATED_CHAMBER

#endif // HAS_TEMP_SENSOR
#endif // HAS_TEMP_SENSOR
4 changes: 3 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ build_flags = ${stm32_flash_drive.build_flags}
[env:mks_robin_nano_v3]
platform = ${common_stm32.platform}
extends = common_stm32
build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED -DUSBCON -DUSBD_USE_CDC
build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED -DUSBCON -DUSBD_USE_CDC -DPIN_WIRE_SCL=PB6 -DPIN_WIRE_SDA=PB7
board = genericSTM32F407VGT6
board_build.core = stm32
board_build.variant = MARLIN_F4x7Vx
Expand All @@ -1180,6 +1180,7 @@ extra_scripts = ${common.extra_scripts}
extends = env:mks_robin_nano_v3
platform_packages = ${stm32_flash_drive.platform_packages}
build_flags = ${stm32_flash_drive.build_flags}
-DPIN_WIRE_SCL=PB6 -DPIN_WIRE_SDA=PB7
-DUSBCON
-DUSE_USBHOST_HS
-DUSBD_IRQ_PRIO=5
Expand All @@ -1192,6 +1193,7 @@ extends = env:mks_robin_nano_v3
platform_packages = framework-arduinoststm32@https://github.com/rhapsodyv/Arduino_Core_STM32/archive/usb-host-msc-cdc-msc.zip
build_unflags = ${common_stm32.build_unflags} -DUSBD_USE_CDC
build_flags = ${stm32_flash_drive.build_flags}
-DPIN_WIRE_SCL=PB6 -DPIN_WIRE_SDA=PB7
-DUSBCON
-DUSE_USBHOST_HS
-DUSBD_IRQ_PRIO=5
Expand Down

0 comments on commit e2689ff

Please sign in to comment.