mirror of https://github.com/ArduPilot/ardupilot
Desktop: enable the CLI in desktop build
this gives access to the CLI menus. You can start the SIL with the -s switch to set the slider position to CLI
This commit is contained in:
parent
b927e64440
commit
94f0e8a4a3
|
@ -12,7 +12,7 @@ nogps:
|
||||||
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DGPS_PROTOCOL=GPS_PROTOCOL_NONE -DLOGGING_ENABLED=DISABLED"
|
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DGPS_PROTOCOL=GPS_PROTOCOL_NONE -DLOGGING_ENABLED=DISABLED"
|
||||||
|
|
||||||
hil:
|
hil:
|
||||||
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DHIL_MODE=HIL_MODE_ATTITUDE -DCLI_ENABLED=DISABLED -DLOGGING_ENABLED=DISABLED"
|
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DHIL_MODE=HIL_MODE_ATTITUDE -DLOGGING_ENABLED=DISABLED"
|
||||||
|
|
||||||
hilsen:
|
hilsen:
|
||||||
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DHIL_MODE=HIL_MODE_SENSORS -DCLI_ENABLED=DISABLED -DLOGGING_ENABLED=DISABLED"
|
make -f $(DESKTOP)/Makefile.desktop EXTRAFLAGS="-DHIL_MODE=HIL_MODE_SENSORS -DCLI_ENABLED=DISABLED -DLOGGING_ENABLED=DISABLED"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "avr/pgmspace.h"
|
#include "avr/pgmspace.h"
|
||||||
#include <BetterStream.h>
|
#include <BetterStream.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include "desktop.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
@ -21,20 +22,20 @@ void pinMode(uint8_t pin, uint8_t mode)
|
||||||
|
|
||||||
long unsigned int millis(void)
|
long unsigned int millis(void)
|
||||||
{
|
{
|
||||||
extern struct timeval sketch_start_time;
|
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
gettimeofday(&tp,NULL);
|
gettimeofday(&tp,NULL);
|
||||||
return 1.0e3*((tp.tv_sec + (tp.tv_usec*1.0e-6)) -
|
return 1.0e3*((tp.tv_sec + (tp.tv_usec*1.0e-6)) -
|
||||||
(sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6)));
|
(desktop_state.sketch_start_time.tv_sec +
|
||||||
|
(desktop_state.sketch_start_time.tv_usec*1.0e-6)));
|
||||||
}
|
}
|
||||||
|
|
||||||
long unsigned int micros(void)
|
long unsigned int micros(void)
|
||||||
{
|
{
|
||||||
extern struct timeval sketch_start_time;
|
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
gettimeofday(&tp,NULL);
|
gettimeofday(&tp,NULL);
|
||||||
return 1.0e6*((tp.tv_sec + (tp.tv_usec*1.0e-6)) -
|
return 1.0e6*((tp.tv_sec + (tp.tv_usec*1.0e-6)) -
|
||||||
(sketch_start_time.tv_sec + (sketch_start_time.tv_usec*1.0e-6)));
|
(desktop_state.sketch_start_time.tv_sec +
|
||||||
|
(desktop_state.sketch_start_time.tv_usec*1.0e-6)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void delay(long unsigned msec)
|
void delay(long unsigned msec)
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
|
|
||||||
|
struct desktop_state {
|
||||||
|
bool slider; // slider switch state, True means CLI mode
|
||||||
|
struct timeval sketch_start_time;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct desktop_state desktop_state;
|
||||||
|
|
||||||
void desktop_serial_select_setup(fd_set *fds, int *fd_high);
|
void desktop_serial_select_setup(fd_set *fds, int *fd_high);
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,43 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <wiring.h>
|
#include <wiring.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include "desktop.h"
|
#include "desktop.h"
|
||||||
|
|
||||||
void setup(void);
|
void setup(void);
|
||||||
void loop(void);
|
void loop(void);
|
||||||
|
|
||||||
struct timeval sketch_start_time;
|
// the state of the desktop simulation
|
||||||
|
struct desktop_state desktop_state;
|
||||||
|
|
||||||
int main(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
gettimeofday(&sketch_start_time, NULL);
|
printf("Options:\n");
|
||||||
|
printf("\t-s enable CLI slider switch\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * const argv[])
|
||||||
|
{
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
// default state
|
||||||
|
desktop_state.slider = false;
|
||||||
|
gettimeofday(&desktop_state.sketch_start_time, NULL);
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "sh")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 's':
|
||||||
|
desktop_state.slider = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// run main setup() function from sketch
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
|
Loading…
Reference in New Issue