Commit 066529fc authored by Sigurd M. Albrektsen's avatar Sigurd M. Albrektsen
Browse files

Updated to new aeroprobe fw

parent 0ac0e582
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
import struct

class AeroprobePackage(object):
    def __init__(self, TOV, TOA, timestamp, S1, S2, V, Vin, AoA, AoS, A, Ps, Pt, TC, CS):
    def __init__(self, TOV, TOA, TOT, timestamp, S1, S2, V, Vin, AoA, AoS, A, Ps, Pt, TC, CS):
        self._tov = TOV
        self._toa = TOA
        self.V = V
@@ -14,7 +14,7 @@ class AeroprobePackage(object):
        self.Pt = Pt
        self.TC = TC

        self.dict = {'tov': TOV, 'toa': TOA, 'timestamp': timestamp,
        self.dict = {'tov': TOV, 'toa': TOA, 'tot': TOT, 'timestamp': timestamp,
                        'S1': S1, 'S2': S2, 'V': V,
                     'Vin': Vin, 'AoA': AoA, 'AoS': AoS, 'A': A, 'Ps': Ps,
                     'Pt': Pt, 'TC': TC, 'CS': CS}
@@ -31,20 +31,22 @@ class AeroprobeParser(object):
            #accel, 3x3 bytes, status
            #incl,  3x3 bytes, status
            #counter, lat, crc

            fmt = '>4B' + \
                  ' 3BH3B' + \
                  ' 4f' + \
                  ' i' + \
                  ' 3f B'
                  ' 2f B'
            aero_data = struct.unpack(fmt, buf[:])

            #print(alti_data)
            S1, S2, ID, L, \
                H, M, S, MS, MM, DD, YY, \
                V, Vin, AoA, AoS, \
                A, Ps, Pt, TC, \
                A, Ps, Pt, \
                CS = aero_data

            TC = 0
            '''
            print(buf.tov, buf.toa)
            print(ID)
@@ -53,7 +55,7 @@ class AeroprobeParser(object):
            print(H, M, S, MS)
            print(A, Ps, Pt, TC)
            '''
            return AeroprobePackage(buf.tov, buf.toa, buf.timestamp, S1, S2, V, Vin, AoA, AoS,
            return AeroprobePackage(buf.tov, buf.toa, buf.tot, buf.timestamp, S1, S2, V, Vin, AoA, AoS,
                                    A, Ps, Pt, TC, CS)
        except Exception:
            raise