Fix bugs in settings saving

This commit is contained in:
Mario Hüttel 2020-08-16 22:11:57 +02:00
parent 6c92048de5
commit 543127b187
3 changed files with 13 additions and 3 deletions

View File

@ -611,6 +611,15 @@ DRESULT sdio_disk_read(BYTE *buff, DWORD sector, UINT count){
uint32_t sdio_status;
uint32_t fifo;
uint32_t counter;
int err;
union sdio_status_conv status;
do {
err = sdio_check_status_register_cmd13(card_info.rca, &status.value);
if (err)
return RES_ERROR;
} while (status.statusstruct.CURRENT_STATE != CURRENT_STATE_TRAN);
addr = (card_info.type == SD_V2_HC ? (sector) : (sector*512));
for (; count > 0; count--) {
@ -633,7 +642,8 @@ DRESULT sdio_disk_read(BYTE *buff, DWORD sector, UINT count){
SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN;
/* Init Transfer */
if (sdio_send_read_block_cmd17(addr)) {
err = sdio_send_read_block_cmd17(addr);
if (err) {
return RES_ERROR;
}

View File

@ -14,7 +14,7 @@
//Initial Transfer CLK (ca. 400kHz)
#define INITCLK 140 //120
//Working CLK (Maximum)
#define WORKCLK 45 //0
#define WORKCLK 50 //0
//Data Timeout in CLK Cycles
#define DTIMEOUT 0x3000 //150
//DMA Stream used for TX and RX DMA2 Stream 3 or 6 possible

View File

@ -121,7 +121,7 @@ int sd_card_settings_save_calibration(float sens_deviation, float offset, bool a
int ret = 0;
status = create_controller_folder();
if (status)
if (status < 0)
return -2;
get_controller_settings_path(path, sizeof(path), "offset");