I messed up the merge, so pushing it over to another repo so I don't lose it. Will tidy up and remove later
Dependencies: BufferedSerial FatFileSystemCpp mbed
Revision 27:498cce52fe5f, committed 2021-07-09
- Comitter:
- JamieB
- Date:
- Fri Jul 09 16:00:55 2021 +0000
- Parent:
- 26:7f66ac76cd5d
- Child:
- 28:7600b18ccb7a
- Commit message:
- Fixed 180-degree heading wrap-around issue in FreeD output
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jul 08 17:31:11 2021 +0000 +++ b/main.cpp Fri Jul 09 16:00:55 2021 +0000 @@ -83,6 +83,10 @@ #define LED_OFF 1 #define LED_ON 0 +#define setRED() ({GreenLED=LED_OFF;BlueLED = LED_OFF;RedLED = LED_ON;}) +#define setGREEN() ({GreenLED=LED_ON;BlueLED = LED_OFF;RedLED = LED_OFF;}) +#define setBLUE() ({GreenLED=LED_OFF;BlueLED = LED_ON;RedLED = LED_OFF;}) +#define setOFF() ({GreenLED=LED_OFF;BlueLED = LED_OFF;RedLED = LED_OFF;}) frameclock movieTime; @@ -322,7 +326,7 @@ if (posPtr) { fdPacket.header = 0xD1; fdPacket.id = 0xFF - posPtr->ID; - set24bitValue(fdPacket.yaw, (int)(posPtr->yaw *32768)); + set24bitValue(fdPacket.yaw, (int)(((posPtr->yaw > 180)? posPtr->yaw - 360 : posPtr->yaw) *32768)); ; set24bitValue(fdPacket.pitch, (int)(posPtr->pitch *32768)); set24bitValue(fdPacket.roll, (int)(posPtr->roll *32768)); // fdPacket.yaw = (int)(posPtr->yaw *32768); @@ -609,6 +613,7 @@ { pc.baud(115200); pc.printf("\r\n\r\nStartup - v0.7\r\n"); + setRED(); UserSettings.FIZmode = formatPreston; UserSettings.SerialOutMode = mode_VIPS; @@ -679,10 +684,6 @@ inputTimer.reset(); inputTimer.start(); - GreenLED = LED_ON; - RedLED = LED_OFF; - BlueLED = LED_OFF; - prepPacketOut(); LTCInput.enable(true); @@ -690,11 +691,13 @@ VIPS.run(); pc.printf("System init complete\r\n"); + setBLUE(); COM1.attach(&onOutputSerialRx); TimeSinceLastFrame.reset(); TimeSinceLastFrame.start(); + pc.printf("Waiting for sync input clock\r\n"); #ifdef enableFakePPF @@ -726,6 +729,7 @@ Syncin.rise(NULL); } + setGREEN(); pc.printf("Measuring frame rate\r\n"); int currentFrames = framesIn; @@ -765,6 +769,7 @@ pc.printf("Current time is %02d:%02d:%02d %02d\r\n",movieTime.hours(),movieTime.minutes(),movieTime.seconds(),movieTime.frame()); LTCInput.enable(false); + setOFF(); pc.printf("Running\r\n",framesPerSecond); @@ -772,6 +777,7 @@ getNextFileNumber(); COM1.attach(callback(onOutputSerialRx)); + while (true) { if (NewFramePulse) { // New frame. Output data. //framePulse(FramePulseTime);