autotest: add trivial test for MegaSquirt EFI system

This commit is contained in:
Peter Barker 2021-10-11 12:06:48 +11:00 committed by Peter Barker
parent 05c6a25e52
commit 0e6b0cbf35
2 changed files with 30 additions and 4 deletions

View File

@ -10,6 +10,7 @@ from __future__ import print_function
import math
import os
import signal
import sys
import time
from pymavlink import quaternion
@ -3172,6 +3173,24 @@ class AutoTestPlane(AutoTest):
self.fly_home_land_and_disarm()
def MegaSquirt(self):
self.assert_not_receiving_message('EFI_STATUS')
self.set_parameters({
'SIM_EFI_TYPE': 1,
'EFI_TYPE': 1,
'SERIAL5_PROTOCOL': 24,
})
self.customise_SITL_commandline(["--uartF=sim:megasquirt"])
self.delay_sim_time(5)
m = self.assert_receive_message('EFI_STATUS')
mavutil.dump_message_verbose(sys.stdout, m)
if m.throttle_out != 0:
raise NotAchievedException("Expected zero throttle")
if m.health != 1:
raise NotAchievedException("Not healthy")
if m.intake_manifold_temperature < 20:
raise NotAchievedException("Bad intake manifold temperature")
def tests(self):
'''return list of all tests'''
ret = super(AutoTestPlane, self).tests()
@ -3405,6 +3424,10 @@ class AutoTestPlane(AutoTest):
"Test AutoTune mode",
self.AUTOTUNE),
("MegaSquirt",
"Test MegaSquirt EFI",
self.MegaSquirt),
("LogUpload",
"Log upload",
self.log_upload),

View File

@ -9296,11 +9296,14 @@ switch value'''
want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED)
self.disarm_vehicle()
def test_pid_tuning(self):
self.progress("making sure we're not getting PID_TUNING messages")
m = self.mav.recv_match(type='PID_TUNING', blocking=True, timeout=5)
def assert_not_receiving_message(self, message, timeout=1):
self.progress("making sure we're not getting %s messages" % message)
m = self.mav.recv_match(type=message, blocking=True, timeout=timeout)
if m is not None:
raise PreconditionFailedException("Receiving PID_TUNING already")
raise PreconditionFailedException("Receiving %s messags" % message)
def test_pid_tuning(self):
self.assert_not_receiving_message('PID_TUNING', timeout=5)
self.set_parameter("GCS_PID_MASK", 1)
self.progress("making sure we are now getting PID_TUNING messages")
m = self.mav.recv_match(type='PID_TUNING', blocking=True, timeout=5)