mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-30 23:44:06 +08:00
Linux: modified shell to not show _main suffix
The builtin commands all have _main suffix by convention so no need to show _main. Also nsh calls the commmands without the _main suffix. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
1f84c348fc
commit
526b0e68eb
@ -38,7 +38,7 @@ builtins = glob.glob("builtin_commands/COMMAND*")
|
||||
|
||||
apps = []
|
||||
for f in builtins:
|
||||
apps.append(f.split(".")[-1])
|
||||
apps.append(f.split(".")[-1].split("_main")[0])
|
||||
|
||||
print
|
||||
print """
|
||||
@ -49,10 +49,11 @@ using namespace std;
|
||||
extern "C" {
|
||||
"""
|
||||
for app in apps:
|
||||
print "extern int "+app+"(int argc, char *argv[]);"
|
||||
print "extern int "+app+"_main(int argc, char *argv[]);"
|
||||
|
||||
print """
|
||||
static int list_builtins(int argc, char *argv[]);
|
||||
static int list_builtins_main(int argc, char *argv[]);
|
||||
static int shutdown_main(int argc, char *argv[]);
|
||||
}
|
||||
|
||||
|
||||
@ -63,16 +64,17 @@ static map<string,px4_main_t> app_map(void)
|
||||
map<string,px4_main_t> apps;
|
||||
"""
|
||||
for app in apps:
|
||||
print '\tapps["'+app+'"] = '+app+';'
|
||||
print '\tapps["'+app+'"] = '+app+'_main;'
|
||||
|
||||
print '\tapps["list_builtins"] = list_builtins;'
|
||||
print '\tapps["list_builtins"] = list_builtins_main;'
|
||||
print '\tapps["shutdown"] = shutdown_main;'
|
||||
print """
|
||||
return apps;
|
||||
}
|
||||
|
||||
map<string,px4_main_t> apps = app_map();
|
||||
|
||||
static int list_builtins(int argc, char *argv[])
|
||||
static int list_builtins_main(int argc, char *argv[])
|
||||
{
|
||||
cout << "Builtin Commands:" << endl;
|
||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||
@ -80,5 +82,11 @@ static int list_builtins(int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int shutdown_main(int argc, char *argv[])
|
||||
{
|
||||
cout << "Shutting down" << endl;
|
||||
exit(0);
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
#endif
|
||||
static const int ERROR = -1;
|
||||
|
||||
#define DEFAULT_DEVICE_NAME "/dev/ttyS1"
|
||||
#define DEFAULT_DEVICE_NAME "/tmp/ttyS1"
|
||||
#define MAX_DATA_RATE 20000 ///< max data rate in bytes/s
|
||||
#define MAIN_LOOP_DELAY 10000 ///< 100 Hz @ 1000 bytes/s data rate
|
||||
#define FLOW_CONTROL_DISABLE_THRESHOLD 40 ///< picked so that some messages still would fit it.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user