1121
This commit is contained in:
@ -3,6 +3,7 @@ import unittest
|
||||
from unittest.mock import patch, MagicMock
|
||||
import sys
|
||||
import os
|
||||
from config.settings import app_set_config
|
||||
|
||||
# 添加项目根目录到Python路径
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
@ -40,13 +41,13 @@ class TestFeedingProcess(unittest.TestCase):
|
||||
patch('feeding.process.InverterController'), \
|
||||
patch('feeding.process.TransmitterController'):
|
||||
system = FeedingProcess()
|
||||
# 通过settings修改参数 system.settings.single_batch_weight = 1500
|
||||
system.settings.min_required_weight = 300
|
||||
system.settings.target_vehicle_weight = 3000
|
||||
#修改参数 app_set_config.single_batch_weight = 1500
|
||||
app_set_config.min_required_weight = 300
|
||||
app_set_config.target_vehicle_weight = 3000
|
||||
|
||||
self.assertEqual(system.settings.target_vehicle_weight, 3000)
|
||||
self.assertEqual(system.settings.min_required_weight, 300)
|
||||
self.assertEqual(system.settings.single_batch_weight, 1500)
|
||||
self.assertEqual(app_set_config.target_vehicle_weight, 3000)
|
||||
self.assertEqual(app_set_config.min_required_weight, 300)
|
||||
self.assertEqual(app_set_config.single_batch_weight, 1500)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -19,7 +19,7 @@ def test_rfid_functions():
|
||||
测试RFIDHardware的主要功能
|
||||
"""
|
||||
# 初始化RFID控制器
|
||||
rfid = rfid_service(host='192.168.1.190', port=6000)
|
||||
rfid = rfid_service(host='192.168.250.67', port=6000)
|
||||
|
||||
# print("=== RFID硬件测试开始 ===")
|
||||
|
||||
@ -41,6 +41,12 @@ def test_rfid_functions():
|
||||
# rfid.set_working_mode(address=0x00, mode_params={
|
||||
# 'word_num': 0x1E
|
||||
# })
|
||||
|
||||
# mode_data = rfid.read_working_mode(address=0x00)
|
||||
# if mode_data:
|
||||
# print("读取到工作模式参数:")
|
||||
# for key, value in mode_data.items():
|
||||
# print(f" {key}: {value:02X} ({value})")
|
||||
|
||||
# # 测试读取读写器信息
|
||||
# print("\n3. 测试读取读写器信息:")
|
||||
@ -54,7 +60,7 @@ def test_rfid_functions():
|
||||
|
||||
# 测试设置功率 (仅演示,实际使用时根据需要调整)
|
||||
# print("\n3. 测试设置功率 (演示,不实际执行):")
|
||||
# power_success = rfid.set_power(address=0x00, power_value=6)
|
||||
# power_success = rfid.set_power(address=0x00, power_value=16)
|
||||
# print(f"功率设置{'成功' if power_success else '失败'}")
|
||||
|
||||
# # 测试设置读卡间隔 (仅演示)
|
||||
@ -87,7 +93,7 @@ def test_rfid_functions():
|
||||
# rfid._process_collected_data()
|
||||
rfid.start_receiver(callback=test_data_callback)
|
||||
# print("接收线程已启动,等待接收数据...")
|
||||
# 等待5秒模拟接收过程
|
||||
# 等待5秒模拟接收过程1111111111111
|
||||
time.sleep(60*60)
|
||||
finally:
|
||||
# 确保停止接收线程
|
||||
|
||||
Reference in New Issue
Block a user