tmp1075 temperature sensor

This commit is contained in:
Jakob Meier 2021-01-30 11:20:34 +01:00
parent 6b840eff43
commit 39e8ff7134
4 changed files with 15 additions and 8 deletions

View File

@ -32,7 +32,8 @@ class ServiceList(enum.Enum):
PDU1 = auto()
PDU2 = auto()
ACU = auto()
TMP1075 = auto()
TMP1075_1 = auto()
TMP1075_2 = auto()
class SerialConfig(enum.Enum):

View File

@ -154,8 +154,10 @@ def add_globals_post_args_parsing(args: argparse.Namespace):
service = ServiceList.PDU2
elif service == "acu":
service = ServiceList.ACU
elif service == "tmp1075":
service = ServiceList.TMP1075
elif service == "tmp1075_1":
service = ServiceList.TMP1075_1
elif service == "tmp1075_2":
service = ServiceList.TMP1075_2
else:
logger.warning("Service not known! Setting standard service 17")
service = ServiceList.SERVICE_17

View File

@ -41,9 +41,12 @@ def pack_service_queue_user(service: Union[int, str], op_code: int, service_queu
if service == ServiceList.ACU:
object_id = get_object_id(ObjectIds.ACU_HANDLER_ID)
return pack_acu_test_into(object_id, service_queue)
if service == ServiceList.TMP1075:
if service == ServiceList.TMP1075_1:
object_id = get_object_id(ObjectIds.TMP1075_1_HANDLER_ID)
return pack_tmp1075_test_into(object_id, service_queue)
if service == ServiceList.TMP1075_2:
object_id = get_object_id(ObjectIds.TMP1075_2_HANDLER_ID)
return pack_tmp1075_test_into(object_id, service_queue)
LOGGER.warning("Invalid Service !")

View File

@ -17,10 +17,10 @@ class Tmp1075TestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = True
all = False
start_adc_conversion = False
get_temp = False
set_mode_normal = False # Setting mode to normal starts continuous temperature reading
set_mode_normal = True # Setting mode to normal starts continuous temperature reading
set_mode_on = False # If mode is MODE_ON, temperature will only be read on command
@ -30,7 +30,8 @@ class Tmp1075ActionIds:
def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(("print", "Testing Tmp1075 Temperature Sensor Handler"))
tc_queue.appendleft(("print", "Testing Tmp1075 Temperature Sensor Handler with object id: 0x" +
object_id.hex()))
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
tc_queue.appendleft(("print", "TMP1075: Starting new temperature conversion"))
@ -45,7 +46,7 @@ def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT
tc_queue.appendleft(command.pack_command_tuple())
if Tmp1075TestProcedure.set_mode_normal:
tc_queue.appendleft(("print", "TMP1075:: Set Mode Normal"))
tc_queue.appendleft(("print", "TMP1075: Set Mode Normal"))
mode_data = pack_mode_data(object_id, 2, 0)
command = PusTelecommand(service=200, subservice=1, ssc=220, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())