From e2689ff52fe8c9231814224813218ea01de89725 Mon Sep 17 00:00:00 2001 From: Cyril Date: Wed, 1 Sep 2021 01:59:02 +0200 Subject: [PATCH] Update 01-09-2021 --- Marlin/Configuration.h | 2 +- Marlin/src/HAL/LPC1768/eeprom_wired.cpp | 11 ++++------- Marlin/src/HAL/STM32/eeprom_wired.cpp | 9 ++------- Marlin/src/MarlinCore.cpp | 2 +- Marlin/src/module/settings.cpp | 4 ++-- Marlin/src/module/temperature.cpp | 2 +- platformio.ini | 4 +++- 7 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 15221496..3a1a5766 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -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) /** diff --git a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp index d94aba61..dde1f498 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp @@ -42,25 +42,23 @@ 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; } @@ -68,7 +66,6 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t do { // Read from external EEPROM const uint8_t c = eeprom_read_byte((uint8_t*)pos); - if (writing) *value = c; crc16(crc, &c, 1); pos++; diff --git a/Marlin/src/HAL/STM32/eeprom_wired.cpp b/Marlin/src/HAL/STM32/eeprom_wired.cpp index d37c4394..cc9400e8 100644 --- a/Marlin/src/HAL/STM32/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32/eeprom_wired.cpp @@ -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 @@ -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; } @@ -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 \ No newline at end of file diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index cf389293..1dad3a07 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1368,4 +1368,4 @@ void loop() { TERN_(HAS_TFT_LVGL_UI, printer_state_polling()); } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards -} +} \ No newline at end of file diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 577e6362..88e20621 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -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 @@ -3375,7 +3375,7 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("SCARA settings: S P T"); 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) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 49d4c18b..1f1a8d66 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -3604,4 +3604,4 @@ void Temperature::tick() { #endif // HAS_HEATED_CHAMBER -#endif // HAS_TEMP_SENSOR +#endif // HAS_TEMP_SENSOR \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index ae3667bd..4d368d9a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 @@ -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 @@ -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