pymammotion 0.4.0a4__py3-none-any.whl → 0.4.0a5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pymammotion/data/model/device.py +28 -4
- pymammotion/data/model/device_info.py +12 -0
- pymammotion/data/state_manager.py +7 -1
- {pymammotion-0.4.0a4.dist-info → pymammotion-0.4.0a5.dist-info}/METADATA +1 -1
- {pymammotion-0.4.0a4.dist-info → pymammotion-0.4.0a5.dist-info}/RECORD +7 -7
- {pymammotion-0.4.0a4.dist-info → pymammotion-0.4.0a5.dist-info}/LICENSE +0 -0
- {pymammotion-0.4.0a4.dist-info → pymammotion-0.4.0a5.dist-info}/WHEEL +0 -0
pymammotion/data/model/device.py
CHANGED
@@ -7,7 +7,7 @@ import betterproto
|
|
7
7
|
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
8
8
|
|
9
9
|
from pymammotion.data.model import HashList, RapidState
|
10
|
-
from pymammotion.data.model.device_info import MowerInfo
|
10
|
+
from pymammotion.data.model.device_info import MowerInfo, DeviceFirmwares
|
11
11
|
from pymammotion.data.model.location import Location
|
12
12
|
from pymammotion.data.model.report_info import ReportData
|
13
13
|
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
|
@@ -16,7 +16,7 @@ from pymammotion.proto.mctrl_sys import (
|
|
16
16
|
MowToAppInfoT,
|
17
17
|
ReportInfoData,
|
18
18
|
SystemRapidStateTunnelMsg,
|
19
|
-
SystemUpdateBufMsg,
|
19
|
+
SystemUpdateBufMsg, DeviceFwInfo,
|
20
20
|
)
|
21
21
|
from pymammotion.utility.constant import WorkMode
|
22
22
|
from pymammotion.utility.conversions import parse_double
|
@@ -33,6 +33,7 @@ class MowingDevice(DataClassORJSONMixin):
|
|
33
33
|
location: Location = field(default_factory=Location)
|
34
34
|
mowing_state: RapidState = field(default_factory=RapidState)
|
35
35
|
report_data: ReportData = field(default_factory=ReportData)
|
36
|
+
device_firmwares: DeviceFirmwares = field(default_factory=DeviceFirmwares)
|
36
37
|
err_code_list: list = field(default_factory=list)
|
37
38
|
err_code_list_time: Optional[list] = field(default_factory=list)
|
38
39
|
error_codes: dict[str, ErrorInfo] = field(default_factory=dict)
|
@@ -84,7 +85,7 @@ class MowingDevice(DataClassORJSONMixin):
|
|
84
85
|
for index, location in enumerate(toapp_report_data.locations):
|
85
86
|
if index == 0 and location.real_pos_y != 0:
|
86
87
|
self.location.position_type = location.pos_type
|
87
|
-
self.location.orientation = location.real_toward / 10000
|
88
|
+
self.location.orientation = int(location.real_toward / 10000)
|
88
89
|
self.location.device = coordinate_converter.enu_to_lla(
|
89
90
|
parse_double(location.real_pos_y, 4.0), parse_double(location.real_pos_x, 4.0)
|
90
91
|
)
|
@@ -93,13 +94,16 @@ class MowingDevice(DataClassORJSONMixin):
|
|
93
94
|
location.zone_hash if self.report_data.dev.sys_status == WorkMode.MODE_WORKING else 0
|
94
95
|
)
|
95
96
|
|
97
|
+
if toapp_report_data.fw_info:
|
98
|
+
self.update_device_firmwares(toapp_report_data.fw_info)
|
99
|
+
|
96
100
|
self.report_data.update(toapp_report_data.to_dict(casing=betterproto.Casing.SNAKE))
|
97
101
|
|
98
102
|
def run_state_update(self, rapid_state: SystemRapidStateTunnelMsg) -> None:
|
99
103
|
coordinate_converter = CoordinateConverter(self.location.RTK.latitude, self.location.RTK.longitude)
|
100
104
|
self.mowing_state = RapidState().from_raw(rapid_state.rapid_state_data)
|
101
105
|
self.location.position_type = self.mowing_state.pos_type
|
102
|
-
self.location.orientation = self.mowing_state.toward / 10000
|
106
|
+
self.location.orientation = int(self.mowing_state.toward / 10000)
|
103
107
|
self.location.device = coordinate_converter.enu_to_lla(
|
104
108
|
parse_double(self.mowing_state.pos_y, 4.0), parse_double(self.mowing_state.pos_x, 4.0)
|
105
109
|
)
|
@@ -113,3 +117,23 @@ class MowingDevice(DataClassORJSONMixin):
|
|
113
117
|
|
114
118
|
def report_missing_data(self) -> None:
|
115
119
|
"""Report missing data so we can refetch it."""
|
120
|
+
|
121
|
+
def update_device_firmwares(self, fw_info: DeviceFwInfo) -> None:
|
122
|
+
"""Sets firmware versions on all parts of the robot or RTK."""
|
123
|
+
for mod in fw_info.mod:
|
124
|
+
match mod.type:
|
125
|
+
case 1:
|
126
|
+
self.device_firmwares.main_controller = mod.version
|
127
|
+
case 3:
|
128
|
+
self.device_firmwares.left_motor_driver = mod.version
|
129
|
+
case 4:
|
130
|
+
self.device_firmwares.right_motor_driver = mod.version
|
131
|
+
case 5:
|
132
|
+
self.device_firmwares.rtk_rover_station = mod.version
|
133
|
+
case 101:
|
134
|
+
# RTK main board
|
135
|
+
self.device_firmwares.main_controller = mod.version
|
136
|
+
case 102:
|
137
|
+
self.device_firmwares.rtk_version = mod.version
|
138
|
+
case 103:
|
139
|
+
self.device_firmwares.lora_version = mod.version
|
@@ -23,3 +23,15 @@ class MowerInfo(DataClassORJSONMixin):
|
|
23
23
|
swversion: str = ""
|
24
24
|
product_key: str = ""
|
25
25
|
model_id: str = ""
|
26
|
+
|
27
|
+
@dataclass
|
28
|
+
class DeviceFirmwares(DataClassORJSONMixin):
|
29
|
+
device_version: str = ""
|
30
|
+
left_motor_driver: str = ""
|
31
|
+
lora_version: str = ""
|
32
|
+
main_controller: str = ""
|
33
|
+
model_name: str = ""
|
34
|
+
right_motor_driver: str = ""
|
35
|
+
rtk_rover_station: str = ""
|
36
|
+
rtk_version: str = ""
|
37
|
+
version: str = ""
|
@@ -10,7 +10,7 @@ from pymammotion.data.model.device import MowingDevice
|
|
10
10
|
from pymammotion.data.model.device_info import SideLight
|
11
11
|
from pymammotion.data.model.hash_list import AreaHashNameList
|
12
12
|
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
|
13
|
-
from pymammotion.proto.dev_net import WifiIotStatusReport
|
13
|
+
from pymammotion.proto.dev_net import WifiIotStatusReport, DrvDevInfoResp
|
14
14
|
from pymammotion.proto.luba_msg import LubaMsg
|
15
15
|
from pymammotion.proto.mctrl_nav import AppGetAllAreaHashName, NavGetCommDataAck, NavGetHashListAck, SvgMessageAckT
|
16
16
|
from pymammotion.proto.mctrl_sys import DeviceProductTypeInfoT, TimeCtrlLight
|
@@ -121,6 +121,12 @@ class StateManager:
|
|
121
121
|
case "toapp_wifi_iot_status":
|
122
122
|
wifi_iot_status: WifiIotStatusReport = net_msg[1]
|
123
123
|
self._device.mower_state.product_key = wifi_iot_status.productkey
|
124
|
+
case "toapp_devinfo_resp":
|
125
|
+
toapp_devinfo_resp: DrvDevInfoResp = net_msg[1]
|
126
|
+
for resp in toapp_devinfo_resp.resp_ids:
|
127
|
+
if resp.res is "DRV_RESULT_SUC":
|
128
|
+
self._device.mower_state.swversion = resp.info
|
129
|
+
self._device.device_firmwares.device_version = resp.info
|
124
130
|
|
125
131
|
def _update_mul_data(self, message) -> None:
|
126
132
|
pass
|
@@ -24,9 +24,9 @@ pymammotion/const.py,sha256=lWRxvTVdXnNHuxqvRkjO5ziK0Ic-fZMM6J2dbe5M6Nc,385
|
|
24
24
|
pymammotion/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
25
|
pymammotion/data/model/__init__.py,sha256=aSyroxYQQS-WMRi6WmWm2js4wLa9nmsi160gx9tts4o,323
|
26
26
|
pymammotion/data/model/account.py,sha256=vJM-KTf2q6eBfVC-UlNHBSmJvqHiCawZ40vnuhXhaz8,140
|
27
|
-
pymammotion/data/model/device.py,sha256=
|
27
|
+
pymammotion/data/model/device.py,sha256=BXmpDdiJOJU1nenjNlQn_5ShPPjFlxPUMISBduCL11w,6770
|
28
28
|
pymammotion/data/model/device_config.py,sha256=wjayKnzoPDmBhqWZKTPDSueNEPCIWCB20tFEDSGIUsM,2602
|
29
|
-
pymammotion/data/model/device_info.py,sha256=
|
29
|
+
pymammotion/data/model/device_info.py,sha256=TuM6k0jDsG4x0BRXb1fi3UlpI-8CeKd4RgCfzEeHqqY,897
|
30
30
|
pymammotion/data/model/device_limits.py,sha256=saW3iUvGq8WEn6CASn5hS5tVJpSeak4FDy_gnHtYqTQ,1955
|
31
31
|
pymammotion/data/model/enums.py,sha256=EpKmO8yVUZyEnTY4yH0DMMVKYNQM42zpW1maUu0i3IE,1582
|
32
32
|
pymammotion/data/model/excute_boarder_params.py,sha256=9CpUqrygcle1C_1hDW-riLmm4map4ZbE842NXjcomEI,1394
|
@@ -44,7 +44,7 @@ pymammotion/data/mqtt/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdr
|
|
44
44
|
pymammotion/data/mqtt/event.py,sha256=pEOQcjnv5XKosSPD8UmVAgCAaI8vLuIhGECZcU4xKjk,5055
|
45
45
|
pymammotion/data/mqtt/properties.py,sha256=kvphcjrDuJHuX8Az98-wKeFv_rSmu2Fz9YKLGodGSj0,3759
|
46
46
|
pymammotion/data/mqtt/status.py,sha256=zqnlo-MzejEQZszl0i0Wucoc3E76x6UtI9JLxoBnu54,1067
|
47
|
-
pymammotion/data/state_manager.py,sha256=
|
47
|
+
pymammotion/data/state_manager.py,sha256=bY8sGj5k_bg_F6PemYZ6Y7P5HFjeDcDU-DIItuTTTBM,5763
|
48
48
|
pymammotion/event/__init__.py,sha256=mgATR6vPHACNQ-0zH5fi7NdzeTCDV1CZyaWPmtUusi8,115
|
49
49
|
pymammotion/event/event.py,sha256=bj2RirSIRyBs0QvkcrOtwZWUX_8F3m1sySuHVyKmZLs,2143
|
50
50
|
pymammotion/http/_init_.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -128,7 +128,7 @@ pymammotion/utility/map.py,sha256=GYscVMg2cX3IPlNpCBNHDW0S55yS1WGRf1iHnNZ7TfQ,22
|
|
128
128
|
pymammotion/utility/movement.py,sha256=N75oAoAgFydqoaOedYIxGUHmuTCtPzAOtb-d_29tpfI,615
|
129
129
|
pymammotion/utility/periodic.py,sha256=MbeSb9cfhxzYmdT_RiE0dZe3H9IfbQW_zSqhmSX2RUc,3321
|
130
130
|
pymammotion/utility/rocker_util.py,sha256=6tX7sS87qoQC_tsxbx3NLL-HgS08wtzXiZkhDiz7uo0,7179
|
131
|
-
pymammotion-0.4.
|
132
|
-
pymammotion-0.4.
|
133
|
-
pymammotion-0.4.
|
134
|
-
pymammotion-0.4.
|
131
|
+
pymammotion-0.4.0a5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
132
|
+
pymammotion-0.4.0a5.dist-info/METADATA,sha256=KhtqVKiDZloRq32jpBKqi2hbRs8y5pK-9HnswzWgiAc,3879
|
133
|
+
pymammotion-0.4.0a5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
134
|
+
pymammotion-0.4.0a5.dist-info/RECORD,,
|
File without changes
|
File without changes
|