1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

SDIO retry, hsd clock, etc.

This commit is contained in:
Scott Lahteine 2023-01-20 21:17:13 -06:00
parent 2c39f84888
commit 0ed083aba8
5 changed files with 22 additions and 17 deletions

View File

@ -286,6 +286,9 @@ void HAL_SD_MspInit(SD_HandleTypeDef *hsd) {
go_to_transfer_speed();
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_ENABLE;
hsd.Init.ClockDiv = 8;
#if PINS_EXIST(SDIO_D1, SDIO_D2, SDIO_D3) // go to 4 bit wide mode if pins are defined
retry_Cnt = retryCnt;
for (;;) {
@ -433,7 +436,10 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
#else
uint8_t retries = SDIO_READ_RETRIES;
while (retries--) if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true;
while (retries--) {
if (SDIO_ReadWriteBlock_DMA(block, src, nullptr)) return true;
delay(10);
}
return false;
#endif

View File

@ -43,7 +43,7 @@ void stepper_driver_backward_check() {
SET_INPUT(AXIS##_ENABLE_PIN); \
OUT_WRITE(AXIS##_STEP_PIN, false); \
delay(20); \
if (READ(AXIS##_ENABLE_PIN) == false) { \
if (READ(AXIS##_ENABLE_PIN) == LOW) { \
SBI(axis_plug_backward, BIT); \
stepper_driver_backward_error(F(STRINGIFY(AXIS))); \
} \

View File

@ -36,16 +36,15 @@
* R : Flag to restore the last-saved factor
*/
void GcodeSuite::M220() {
if (!parser.seen_any()) {
SERIAL_ECHOLNPGM("FR:", feedrate_percentage, "%");
return;
}
static int16_t backup_feedrate_percentage = 100;
if (parser.seen('B')) backup_feedrate_percentage = feedrate_percentage;
if (parser.seen('R')) feedrate_percentage = backup_feedrate_percentage;
const int16_t now_feedrate_perc = feedrate_percentage;
if (parser.seen_test('R')) feedrate_percentage = backup_feedrate_percentage;
if (parser.seen_test('B')) backup_feedrate_percentage = now_feedrate_perc;
if (parser.seenval('S')) feedrate_percentage = parser.value_int();
if (!parser.seen_any()) {
SERIAL_ECHOPGM("FR:", feedrate_percentage);
SERIAL_CHAR('%');
SERIAL_EOL();
}
}

View File

@ -65,13 +65,13 @@
* multiple serial ports are available.
* For example Serial3.
*/
#ifndef USB_HOST_SERIAL
#if ENABLED(USB_FLASH_DRIVE_SUPPORT)
#define USB_HOST_SERIAL MYSERIAL1
#endif
#ifndef USB_HOST_SERIAL
#else
#define USB_HOST_SERIAL Serial
#endif
#endif
////////////////////////////////////////////////////////////////////////////////
// Manual board activation

View File

@ -64,9 +64,9 @@ The following macros are defined (in `serial.h`) to output data to the serial po
| `SERIAL_ECHOLNPGM_P` | Same as `SERIAL_ECHOPGM_P` | Do `SERIAL_ECHOPGM_P`, adding a newline | `SERIAL_ECHOLNPGM_P(PSTR("Alice"), 78);` | `alice78\n` |
| `SERIAL_ECHOLIST` | String literal, values | Print a string literal and a list of values | `SERIAL_ECHOLIST(F("Key "), 1, 2, 3);` | `Key 1, 2, 3` |
| `SERIAL_ECHO_START` | None | Prefix an echo line | `SERIAL_ECHO_START();` | `echo:` |
| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` |
| `SERIAL_ECHO_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full echo line | `SERIAL_ECHO_MSG("Count is ", count);` | `echo:Count is 3` |
| `SERIAL_ERROR_START`| None | Prefix an error line | `SERIAL_ERROR_START();` | `Error:` |
| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLN_PAIR` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` |
| `SERIAL_ERROR_MSG` | Same as `SERIAL_ECHOLNPGM` | Print a full error line | `SERIAL_ERROR_MSG("Not found");` | `Error:Not found` |
| `SERIAL_ECHO_SP` | Number of spaces | Print one or more spaces | `SERIAL_ECHO_SP(3)` | ` ` |
| `SERIAL_EOL` | None | Print an end of line | `SERIAL_EOL();` | `\n` |
| `SERIAL_OUT` | `SERIAL_OUT(myMethod)` | Call a custom serial method | `SERIAL_OUT(msgDone);` | ... |