mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-23 05:08:45 +00:00
[feat] add shell filesystem
This commit is contained in:
parent
a2fca7a36d
commit
8aed596527
6 changed files with 54 additions and 4 deletions
|
@ -326,7 +326,15 @@ static void shellWriteCommandLine(Shell *shell)
|
|||
{
|
||||
shellWriteString(shell, "\r\n");
|
||||
shellWriteString(shell, shell->info.user->data.user.name);
|
||||
shellWriteString(shell, "/> ");
|
||||
#if SHELL_FS == 1
|
||||
char path[SHELL_PRINT_BUFFER];
|
||||
shell->getcwd(path, SHELL_PRINT_BUFFER);
|
||||
shellWriteString(shell, ":/");
|
||||
shellWriteString(shell, path);
|
||||
shellWriteString(shell, "$ ");
|
||||
#else
|
||||
shellWriteString(shell, "/$ ");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1962,7 +1970,7 @@ static unsigned int shellExtParseNumber(char *string)
|
|||
if (type == NUM_TYPE_FLOAT && devide != 0)
|
||||
{
|
||||
valueFloat = (float)valueInt / devide * sign;
|
||||
return (uint32_t)valueFloat;
|
||||
return (unsigned int)valueFloat;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2083,3 +2091,5 @@ int shellExtRun(Shell *shell, ShellCommand *command, int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -316,6 +316,7 @@ typedef struct
|
|||
} status;
|
||||
signed char (*read)(char *); /**< shell读函数 */
|
||||
void (*write)(const char); /**< shell写函数 */
|
||||
int (*getcwd)(char *path, unsigned int len);
|
||||
} Shell;
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
/**
|
||||
* @brief 历史命令记录数量
|
||||
*/
|
||||
#define SHELL_HISTORY_MAX_NUMBER 30
|
||||
#define SHELL_HISTORY_MAX_NUMBER 5
|
||||
|
||||
/**
|
||||
* @brief 双击间隔(ms)
|
||||
|
@ -136,4 +136,10 @@
|
|||
*/
|
||||
#define SHELL_LOCK_TIMEOUT 0 * 60 * 1000
|
||||
|
||||
|
||||
/**
|
||||
* @brief shell是否在命令提示符输出路径,需要引用文件系统
|
||||
*/
|
||||
#define SHELL_FS 1
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue