Added SD error code in console mode

pull/34/head
erikkaashoek 4 years ago
parent a68b31c58a
commit 0b83a85a10

@ -834,7 +834,7 @@ VNA_SHELL_FUNCTION(cmd_capture)
static FRESULT cmd_sd_card_mount(void){ static FRESULT cmd_sd_card_mount(void){
const FRESULT res = f_mount(fs_volume, "", 1); const FRESULT res = f_mount(fs_volume, "", 1);
if (res != FR_OK) if (res != FR_OK)
shell_printf("err: no card\r\n"); shell_printf("err %d: no card\r\n",res);
return res; return res;
} }
@ -861,6 +861,8 @@ VNA_SHELL_FUNCTION(cmd_sd_list)
shell_printf("%s %u\r\n", fno.fname, fno.fsize); shell_printf("%s %u\r\n", fno.fname, fno.fsize);
res = f_findnext(&dj, &fno); res = f_findnext(&dj, &fno);
} }
if (res != FR_OK)
shell_printf("err %d\r\n",res);
f_closedir(&dj); f_closedir(&dj);
} }
@ -886,7 +888,7 @@ VNA_SHELL_FUNCTION(cmd_sd_read)
if (f_open(fs_file, fno.fname, FA_OPEN_EXISTING | FA_READ) != FR_OK){ if (f_open(fs_file, fno.fname, FA_OPEN_EXISTING | FA_READ) != FR_OK){
error: error:
shell_printf("err: no file\r\n"); shell_printf("err %d: no file\r\n",res);
return; return;
} }
// shell_printf("sd_read: %s\r\n", filename); // shell_printf("sd_read: %s\r\n", filename);
@ -899,9 +901,10 @@ error:
#endif #endif
UINT size = 0; UINT size = 0;
// file data (send all data from file) // file data (send all data from file)
while (f_read(fs_file, buf, 512, &size) == FR_OK && size > 0) while ((res=f_read(fs_file, buf, 512, &size)) == FR_OK && size > 0)
streamWrite(shell_stream, (void *)buf, size); streamWrite(shell_stream, (void *)buf, size);
if (res != FR_OK)
goto error;
f_close(fs_file); f_close(fs_file);
return; return;
} }

@ -3125,7 +3125,9 @@ static const menuitem_t menu_stimulus[] = {
const menuitem_t menu_mode[] = { const menuitem_t menu_mode[] = {
// { MT_FORM | MT_TITLE, 0, "tinySA MODE", NULL}, // { MT_FORM | MT_TITLE, 0, "tinySA MODE", NULL},
{ MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_LOW_INPUT+I_SA, "%s to LOW in", menu_mode_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_LOW_INPUT+I_SA, "%s to LOW in", menu_mode_acb},
#ifndef TINYSA4
{ MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_HIGH_INPUT+I_SA, "%s to HIGH in", menu_mode_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_HIGH_INPUT+I_SA, "%s to HIGH in", menu_mode_acb},
#endif
{ MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_LOW_OUTPUT+I_SINUS, "%s to LOW out", menu_mode_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_LOW_OUTPUT+I_SINUS, "%s to LOW out", menu_mode_acb},
{ MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_HIGH_OUTPUT+I_GEN, "%s to HIGH out", menu_mode_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_HIGH_OUTPUT+I_GEN, "%s to HIGH out", menu_mode_acb},
{ MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_CONNECT+I_GEN, "Cal. output: %s", menu_sreffer_acb}, { MT_FORM | MT_ADV_CALLBACK | MT_ICON, I_CONNECT+I_GEN, "Cal. output: %s", menu_sreffer_acb},

Loading…
Cancel
Save

Powered by TurnKey Linux.