information

조종기의 펌웨어 정보 요청

1
from time import sleep
2
3
from e_drone.drone import *
4
from e_drone.protocol import *
5
6
7
if __name__ == '__main__':
8
9
drone = Drone(False)
10
drone.open()
11
12
drone.sendRequest(DeviceType.Controller, DataType.Information)
13
14
timeStart = time.time()
15
16
while True:
17
sleep(0.01)
18
dataType = drone.check()
19
20
if dataType == DataType.Information:
21
information = drone.getData(DataType.Information)
22
print("ModeUpdate: {0}".format(information.modeUpdate))
23
print("ModelNumber: {0}".format(information.modelNumber))
24
print("Version: {0}.{1}.{2} / {3} / 0x{3:08X}".format(
25
information.version.major,
26
information.version.minor,
27
information.version.build,
28
information.version.v))
29
print("Release Date: {0}.{1}.{2}".format(
30
information.year,
31
information.month,
32
information.day))
33
break
34
35
if time.time() > timeStart + 1:
36
break
37
38
drone.close()
Copied!

조종기의 펌웨어 정보 요청(이벤트 함수 등록)

1
# 조종기의 펌웨어 정보를 요청하고, 이벤트 핸들러를 통해 응답을 출력하는 예제
2
from time import sleep
3
4
from e_drone.drone import *
5
from e_drone.protocol import *
6
7
8
def eventInformation(information):
9
print("eventInformation()")
10
print("ModeUpdate: {0}".format(information.modeUpdate))
11
print("ModelNumber: {0}".format(information.modelNumber))
12
print("Version: {0}.{1}.{2} / {3} / 0x{3:08X}".format(
13
information.version.major,
14
information.version.minor,
15
information.version.build,
16
information.version.v))
17
print("Release Date: {0}.{1}.{2}".format(
18
information.year,
19
information.month,
20
information.day))
21
22
23
if __name__ == '__main__':
24
25
drone = Drone()
26
drone.open()
27
28
# 이벤트 핸들링 함수 등록
29
drone.setEventHandler(DataType.Information, eventInformation)
30
31
# Information 정보 요청
32
drone.sendRequest(DeviceType.Controller, DataType.Information)
33
sleep(0.1)
34
35
drone.close()
Copied!
Last modified 1yr ago