2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Diff: main.cpp
- Revision:
- 35:c42e7e29c3bd
- Parent:
- 33:74c514aea0a1
- Child:
- 37:b8259500dbd3
--- a/main.cpp Sat Dec 29 15:24:47 2018 +0000 +++ b/main.cpp Mon Dec 31 23:34:28 2018 +0000 @@ -10,6 +10,7 @@ #include "stats_report.h" #include "SDBlockDevice.h" #include "FATFileSystem.h" +#include "Servo.h" #include "SimpleShell.h" #include "Config.h" #include "Updater.h" @@ -35,6 +36,8 @@ InterruptIn lbutton(LBUTTON, PullUp); // button interrupts InterruptIn cbutton(CBUTTON, PullUp); InterruptIn rbutton(RBUTTON, PullUp); +Servo steer(STEERING); +Servo esc(THROTTLE); /////////////////////////////////////////////////////////////////////////////// // Idle hook @@ -129,7 +132,15 @@ SimpleShell sh("/log"); void test(int argc, char **argv) { - printf("Hello world!\n"); + //printf("Hello world!\n"); + char file[32]; + + for (int i=30; i < 40; i++) { + sprintf(file, "/log/%04d.csv", i); + printf("removing <%s>\n", file); + int stat = remove(file); + printf("return: %d\n", stat); + } } void stats(int argc, char **argv) { @@ -228,6 +239,9 @@ printf("Bootup...\n"); fflush(stdout); + steer = 0.50; + esc = 0.00; + printf("Loading config...\n"); config.add("intercept_distance", Config::DOUBLE); config.add("waypoint_threshold", Config::DOUBLE); @@ -250,7 +264,7 @@ config.add("steer_scale", Config::DOUBLE); config.add("gyro_scale", Config::DOUBLE); config.add("gps_valid_speed", Config::DOUBLE); - + if (config.load("/etc/2018cfg.txt")) { printf("error loading config\n"); }