mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-04 13:15:08 +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:
+14
-6
@@ -38,7 +38,7 @@ builtins = glob.glob("builtin_commands/COMMAND*")
|
|||||||
|
|
||||||
apps = []
|
apps = []
|
||||||
for f in builtins:
|
for f in builtins:
|
||||||
apps.append(f.split(".")[-1])
|
apps.append(f.split(".")[-1].split("_main")[0])
|
||||||
|
|
||||||
print
|
print
|
||||||
print """
|
print """
|
||||||
@@ -49,10 +49,11 @@ using namespace std;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
"""
|
"""
|
||||||
for app in apps:
|
for app in apps:
|
||||||
print "extern int "+app+"(int argc, char *argv[]);"
|
print "extern int "+app+"_main(int argc, char *argv[]);"
|
||||||
|
|
||||||
print """
|
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;
|
map<string,px4_main_t> apps;
|
||||||
"""
|
"""
|
||||||
for app in 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 """
|
print """
|
||||||
return apps;
|
return apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
map<string,px4_main_t> apps = app_map();
|
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;
|
cout << "Builtin Commands:" << endl;
|
||||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int shutdown_main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
cout << "Shutting down" << endl;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
#endif
|
#endif
|
||||||
static const int ERROR = -1;
|
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 MAX_DATA_RATE 20000 ///< max data rate in bytes/s
|
||||||
#define MAIN_LOOP_DELAY 10000 ///< 100 Hz @ 1000 bytes/s data rate
|
#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.
|
#define FLOW_CONTROL_DISABLE_THRESHOLD 40 ///< picked so that some messages still would fit it.
|
||||||
|
|||||||
Reference in New Issue
Block a user