diff --git a/Tools/LogAnalyzer/DataflashLog.py b/Tools/LogAnalyzer/DataflashLog.py index 9a6ed706ef..52364a43a4 100644 --- a/Tools/LogAnalyzer/DataflashLog.py +++ b/Tools/LogAnalyzer/DataflashLog.py @@ -609,7 +609,7 @@ class DataflashLog(object): try: self.set_vehicleType_from_MSG_vehicle(tokens[0]); except ValueError: - pass + return self.backPatchModeChanges() self.firmwareVersion = tokens[1] if len(tokens) == 3: diff --git a/Tools/LogAnalyzer/tests/TestBrownout.py b/Tools/LogAnalyzer/tests/TestBrownout.py index 56b4f2a76a..72c1c5d94c 100644 --- a/Tools/LogAnalyzer/tests/TestBrownout.py +++ b/Tools/LogAnalyzer/tests/TestBrownout.py @@ -30,11 +30,15 @@ class TestBrownout(Test): self.result.statusMessage = "No CTUN log data" return - # check for relative altitude at end - if "CTUN" in logdata.channels and "BarAlt" in logdata.channels["CTUN"]: - (finalAlt,finalAltLine) = logdata.channels["CTUN"]["BarAlt"].getNearestValue(logdata.lineCount, lookForwards=False) + if "BarAlt" in logdata.channels['CTUN']: + self.ctun_baralt_att = 'BarAlt' + else: + self.ctun_baralt_att = 'BAlt' - finalAltMax = 3.0 # max alt offset that we'll still consider to be on the ground - if isArmed and finalAlt > finalAltMax: - self.result.status = TestResult.StatusType.FAIL - self.result.statusMessage = "Truncated Log? Ends while armed at altitude %.2fm" % finalAlt + # check for relative altitude at end + (finalAlt,finalAltLine) = logdata.channels["CTUN"][self.ctun_baralt_att].getNearestValue(logdata.lineCount, lookForwards=False) + + finalAltMax = 3.0 # max alt offset that we'll still consider to be on the ground + if isArmed and finalAlt > finalAltMax: + self.result.status = TestResult.StatusType.FAIL + self.result.statusMessage = "Truncated Log? Ends while armed at altitude %.2fm" % finalAlt diff --git a/Tools/LogAnalyzer/tests/TestParams.py b/Tools/LogAnalyzer/tests/TestParams.py index 1c58021827..530cc64f73 100644 --- a/Tools/LogAnalyzer/tests/TestParams.py +++ b/Tools/LogAnalyzer/tests/TestParams.py @@ -46,9 +46,10 @@ class TestParams(Test): # if more complex checking or correlations are required you can access parameter values directly using the logdata.parameters[paramName] dict if logdata.vehicleType == VehicleType.Copter: self.__checkParamIsEqual ("MAG_ENABLE", 1, logdata) - self.__checkParamIsLessThan("THR_MIN", 200, logdata) - self.__checkParamIsLessThan("THR_MID", 701, logdata) - self.__checkParamIsMoreThan("THR_MID", 299, logdata) + if "THR_MIN" in logdata.parameters: + self.__checkParamIsLessThan("THR_MIN", 200, logdata) + self.__checkParamIsLessThan("THR_MID", 701, logdata) + self.__checkParamIsMoreThan("THR_MID", 299, logdata) # TODO: add more parameter tests, these are just an example... elif logdata.vehicleType == VehicleType.Plane: # TODO: add parameter checks for plane... diff --git a/Tools/LogAnalyzer/tests/TestPitchRollCoupling.py b/Tools/LogAnalyzer/tests/TestPitchRollCoupling.py index 8bc8e23113..611f50e7f4 100644 --- a/Tools/LogAnalyzer/tests/TestPitchRollCoupling.py +++ b/Tools/LogAnalyzer/tests/TestPitchRollCoupling.py @@ -27,6 +27,16 @@ class TestPitchRollCoupling(Test): self.result.statusMessage = "No ATT log data" return + if not "CTUN" in logdata.channels: + self.result.status = TestResult.StatusType.UNKNOWN + self.result.statusMessage = "No CTUN log data" + return + + if "BarAlt" in logdata.channels['CTUN']: + self.ctun_baralt_att = 'BarAlt' + else: + self.ctun_baralt_att = 'BAlt' + # figure out where each mode begins and ends, so we can treat auto and manual modes differently and ignore acro/tune modes autoModes = ["RTL", "AUTO", @@ -104,7 +114,7 @@ class TestPitchRollCoupling(Test): lit = DataflashLog.LogIterator(logdata, startLine) assert(lit.currentLine == startLine) while lit.currentLine <= endLine: - relativeAlt = lit["CTUN"]["BarAlt"] + relativeAlt = lit["CTUN"][self.ctun_baralt_att] if relativeAlt > minAltThreshold: roll = lit["ATT"]["Roll"] pitch = lit["ATT"]["Pitch"]