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

Files at this revision

API Documentation at this revision

Comitter:
JamieB
Date:
Tue Aug 10 14:48:56 2021 +0000
Parent:
38:b5765588345d
Child:
40:dafa2b1a1630
Commit message:
Fix Canon Lens Changes and Merges

Changed in this revision

FIZ_readers/FIZCanon.cpp Show annotated file Show diff for this revision Revisions of this file
settings.txt Show annotated file Show diff for this revision Revisions of this file
--- a/FIZ_readers/FIZCanon.cpp	Mon Aug 09 10:37:51 2021 +0000
+++ b/FIZ_readers/FIZCanon.cpp	Tue Aug 10 14:48:56 2021 +0000
@@ -63,60 +63,60 @@
 
 void FIZCanon::parsePacket()
 {
-    //pc.puts("FIZ parse\r\n");
+//    pc.puts("FIZ parse\r\n");
+//    pc.putc('P');
     int read_pos = 0;
     bool valid = false;
 
-
     while (read_pos != inputPtr) {
-        switch(inputBuffer[read_pos]) {
-            case CANON_START:
+        if (!valid) {
+            if (inputBuffer[read_pos] == CANON_START) {
                 valid = true;
-                break;
-            case CANON_ZOOM:
-                if (valid) {
-                    _zoom = (((uint32_t)inputBuffer[read_pos+1])<<14 | inputBuffer[read_pos +2]<<7 | inputBuffer[read_pos +3]);
+            }
+        } else {
+            switch(inputBuffer[read_pos]) {
+                case CANON_ZOOM:
+//                    pc.putc('Z');
+                    _zoom = (((uint32_t)inputBuffer[read_pos+1])<<14 | inputBuffer[read_pos +2]<<7 | inputBuffer[read_pos +3])/60;
 //                pc.putc(0x01);
 //                pc.putc(inputBuffer[read_pos+1]);
 //                pc.putc(inputBuffer[read_pos+2]);
 //                pc.putc(inputBuffer[read_pos+3]);
-                    read_pos += 5; //START BYTE(0xC1), 3 BYTES OF DATA, END BYTE (0xBF)
-                    valid = false;
-                }
-                break;
-            case CANON_FOCUS:
-                if (valid) {
-                    _focus = (((uint32_t)inputBuffer[read_pos+1])<<14 | inputBuffer[read_pos +2]<<7 | inputBuffer[read_pos +3]);
+                    read_pos += 4; // type + 3 BYTES OF DATA
+                    break;
+                case CANON_FOCUS:
+//                    pc.putc('F');
+                    _focus = 1000 - (((uint32_t)inputBuffer[read_pos+1])<<14 | inputBuffer[read_pos +2]<<7 | inputBuffer[read_pos +3])/60;
 //                pc.putc(0x02);
 //                pc.putc(inputBuffer[read_pos+1]);
 //                pc.putc(inputBuffer[read_pos+2]);
 //                pc.putc(inputBuffer[read_pos+3]);
-                    read_pos += 5;
-                    valid = false;
-                }
-                break;
-            case CANON_IRIS:
-                if (valid) {
+                    read_pos += 4;
+                    break;
+                case CANON_IRIS:
+                    //IRIS NOT SCALED CORRECTLY -> 0x8000 - 0xD000, 0x1000 between FStops -> Fix Later
+//                    pc.putc('I');
                     _iris = (((uint32_t)inputBuffer[read_pos +1])<<14 | inputBuffer[read_pos +2]<<7 | inputBuffer[read_pos +3]);
 //                pc.putc(0x03);
 //                pc.putc(inputBuffer[read_pos+1]);
 //                pc.putc(inputBuffer[read_pos+2]);
 //                pc.putc(inputBuffer[read_pos+3]);
-                    read_pos += 5;
-                    valid = false;
-                }
-                break;
-            default:
-                read_pos++;
-                valid = false;
-                break;
-        }
+                    read_pos += 4;
+                    break;
+                default:
+                    //pc.putc('D');
+                    break;
+            }
+            valid = false;
+        } // if valid
+        read_pos++;
+    } // while
 
 //// MAY NEED TO SCALE THESE
 //        _focus = focus_Position;
 //        _iris = iris_Position;
 //        _zoom = zoom_Position;
 //
-    }
+
     newData = true;
-}
+}
\ No newline at end of file
--- a/settings.txt	Mon Aug 09 10:37:51 2021 +0000
+++ b/settings.txt	Tue Aug 10 14:48:56 2021 +0000
@@ -5,16 +5,17 @@
 --------------------------------
 Output_Format=0
 --------------------------------
-
+ 
 [Fiz Format]
 # Sets the FIZ reader to use
 # 0 - Preston (default)
 # 1 - Fuji passive listen mode (skycam)
 # 2 - Fuji active mode
+# 3 - Canon
 --------------------------------
-FIZ_Format=2
+FIZ_Format=3
 --------------------------------
-
+ 
 [Ethernet Port]
 # Sets the UDP port for FreeD network output.
 # Data is sent as a UDP broadcast on the select port number.
@@ -22,7 +23,7 @@
 --------------------------------
 FreeD_Port=12345
 --------------------------------
-
+ 
 [Network Settings]
 # Set the Static IPv4 address to use for the ethernet interface.
 # NOTE: All 3 values must be set for a static address to be used otherwise DHCP will be used.
@@ -33,7 +34,27 @@
 //Gateway=aaa.bbb.ccc.ddd
 --------------------------------
 
+[Filter_Settings]
+#Low pass filter settings for channels that have it enabled.
+#Filter is of order n with a cut off at m Hz assuming input data rate is at r Hz
+#Filter order must be set to enable filters.
+#Frequency default is 10Hz
+#Rate default is 100Hz
+//FilterOrder=1
+//FilterFreq=7
+//FilterRate=100
 
+//FilterXY=0
+//FilterZ=0
+//FilterRoll=0
+//FilterPitch=1
+//FilterYaw=0
+# Enable channels to low pass filter. All filters use the settings given above.
+# A value of 1 enables the filter. A value of 0 or skipping the line disables the filter.
+
+# NOTE-The filter will add latency so a filtered channel will be delayed relative to an unfiltered one.
+ 
+ 
 [NOTES]
 - All settings are case sensitive.
 - Do NOT include spaces in the options lines.