HandsON-BuildHat-API 1.0.5__tar.gz → 1.0.7__tar.gz
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.
- {handson_buildhat_api-1.0.5/src/HandsON_BuildHat_API.egg-info → handson_buildhat_api-1.0.7}/PKG-INFO +3 -3
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/README.md +1 -1
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/pyproject.toml +2 -2
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API/SpikePI.py +27 -24
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7/src/HandsON_BuildHat_API.egg-info}/PKG-INFO +3 -3
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/LICENSE +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/setup.cfg +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API/__init__.py +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API.egg-info/SOURCES.txt +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API.egg-info/dependency_links.txt +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API.egg-info/requires.txt +0 -0
- {handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API.egg-info/top_level.txt +0 -0
{handson_buildhat_api-1.0.5/src/HandsON_BuildHat_API.egg-info → handson_buildhat_api-1.0.7}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: HandsON-BuildHat-API
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: A third-party API for controlling LEGO SPIKE devices
|
|
5
|
-
Author-email: HaNeul Jung <
|
|
5
|
+
Author-email: HaNeul Jung <hnjung@handsontech.co.kr>
|
|
6
6
|
License: Proprietary - Personal/Educational Use Only
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: License :: Other/Proprietary License
|
|
@@ -17,7 +17,7 @@ HandsON Build Hat API
|
|
|
17
17
|
=======
|
|
18
18
|
**Production** : HandsON Technology co., ltd.
|
|
19
19
|
**Author** : HaNeul Jung (hnjung@handsontech.co.kr)
|
|
20
|
-
**Last Update** : 2025-
|
|
20
|
+
**Last Update** : 2025-09-01
|
|
21
21
|
|
|
22
22
|
## 주의
|
|
23
23
|
2025-08-27 이전 판매된 빌드햇 제품의 경우 1.0.4 버전을 사용
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
[project]
|
|
3
3
|
name = "HandsON-BuildHat-API"
|
|
4
|
-
version = "1.0.
|
|
4
|
+
version = "1.0.7"
|
|
5
5
|
description = "A third-party API for controlling LEGO SPIKE devices"
|
|
6
6
|
authors = [
|
|
7
|
-
{ name="HaNeul Jung", email="
|
|
7
|
+
{ name="HaNeul Jung", email="hnjung@handsontech.co.kr" }
|
|
8
8
|
]
|
|
9
9
|
license = {text = "Proprietary - Personal/Educational Use Only"}
|
|
10
10
|
readme = "README.md"
|
{handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API/SpikePI.py
RENAMED
|
@@ -9,8 +9,8 @@ from serial import Serial
|
|
|
9
9
|
import time
|
|
10
10
|
|
|
11
11
|
class _ConstButtonID:
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
START = 0
|
|
13
|
+
STOP = 1
|
|
14
14
|
|
|
15
15
|
LEFT = 2
|
|
16
16
|
RIGHT = 3
|
|
@@ -37,9 +37,11 @@ class _ConstValue:
|
|
|
37
37
|
|
|
38
38
|
ALL_PORT = 0b1111
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
MOTOR_STOP = 0
|
|
41
|
+
MOTOR_PWM = 1
|
|
42
|
+
MOTOR_ABS = 2
|
|
43
|
+
MOTOR_REL = 3
|
|
44
|
+
MOTOR_BRAKE = 255
|
|
43
45
|
|
|
44
46
|
class _PORT:
|
|
45
47
|
PORT = {
|
|
@@ -91,7 +93,7 @@ class _SerialManager:
|
|
|
91
93
|
serial = None
|
|
92
94
|
|
|
93
95
|
for i in _serial_port:
|
|
94
|
-
try: serial = Serial(port=i, baudrate=115200, timeout=0.
|
|
96
|
+
try: serial = Serial(port=i, baudrate=115200, timeout=0.02)
|
|
95
97
|
except: pass
|
|
96
98
|
else: break
|
|
97
99
|
|
|
@@ -126,6 +128,7 @@ class _ModuleParent:
|
|
|
126
128
|
if data == b'': continue
|
|
127
129
|
|
|
128
130
|
if _Availability.checksum_check(data): return data
|
|
131
|
+
if ((len(data) == 1) and (data[0] == 0x04)): return data
|
|
129
132
|
|
|
130
133
|
def _send_data(self, byte:bytes) -> None:
|
|
131
134
|
com = byte
|
|
@@ -206,8 +209,8 @@ class Motor(_ModuleParent):
|
|
|
206
209
|
self._module_check(self._PORT, (_ConstModuleID.SMALL_MOTOR, _ConstModuleID.MEDIUM_MOTOR, _ConstModuleID.LARGE_MOTOR))
|
|
207
210
|
|
|
208
211
|
def stop(self) -> None:
|
|
209
|
-
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.
|
|
210
|
-
self.
|
|
212
|
+
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.MOTOR_STOP, 0, 0))
|
|
213
|
+
self._get_data(com)
|
|
211
214
|
|
|
212
215
|
def start(self, speed:int) -> None:
|
|
213
216
|
if not speed in range(-100, 101):
|
|
@@ -216,8 +219,8 @@ class Motor(_ModuleParent):
|
|
|
216
219
|
if speed > 0: sw = 1
|
|
217
220
|
else: sw = 0
|
|
218
221
|
|
|
219
|
-
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.
|
|
220
|
-
self.
|
|
222
|
+
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.MOTOR_PWM, abs(speed), sw))
|
|
223
|
+
self._get_data(com)
|
|
221
224
|
|
|
222
225
|
def run_to_position(self, degrees, speed) -> None:
|
|
223
226
|
if not speed in range(0, 101):
|
|
@@ -228,8 +231,8 @@ class Motor(_ModuleParent):
|
|
|
228
231
|
if degrees >= 0: target = degrees
|
|
229
232
|
else: target = degrees & 0xFFFF
|
|
230
233
|
|
|
231
|
-
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.
|
|
232
|
-
self.
|
|
234
|
+
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.MOTOR_ABS, speed, (target & 0xFF), (target >> 8)))
|
|
235
|
+
self._get_data(com)
|
|
233
236
|
|
|
234
237
|
def run_for_degrees(self, degrees, speed) -> None:
|
|
235
238
|
if not speed in range(0, 101):
|
|
@@ -241,8 +244,8 @@ class Motor(_ModuleParent):
|
|
|
241
244
|
if degrees >= 0: target = degrees
|
|
242
245
|
else: target = degrees & 0xFFFFFFFF
|
|
243
246
|
|
|
244
|
-
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.
|
|
245
|
-
self.
|
|
247
|
+
com = bytes((_ConstValue.TRA_DATA + self._PORT, _ConstValue.MOTOR_REL, speed, (target & 0xFF), (target >> 8) & 0xFF, (target >> 16) & 0xFF, (target >> 24) & 0xFF))
|
|
248
|
+
self._get_data(com)
|
|
246
249
|
|
|
247
250
|
def get_speed(self) -> int:
|
|
248
251
|
command = [_ConstValue.GET_DATA + self._PORT]
|
|
@@ -269,8 +272,8 @@ class MotorPair(_ModuleParent):
|
|
|
269
272
|
|
|
270
273
|
def stop(self) -> None:
|
|
271
274
|
for i in self._PORTs:
|
|
272
|
-
com = bytes((_ConstValue.TRA_DATA + i, _ConstValue.
|
|
273
|
-
self.
|
|
275
|
+
com = bytes((_ConstValue.TRA_DATA + i, _ConstValue.MOTOR_PWM, 0, 0))
|
|
276
|
+
self._get_data(com)
|
|
274
277
|
|
|
275
278
|
def start(self, steering, speed) -> None:
|
|
276
279
|
if not steering in range(-100, 101):
|
|
@@ -287,8 +290,8 @@ class MotorPair(_ModuleParent):
|
|
|
287
290
|
if speed > 0: sw = 1
|
|
288
291
|
else: sw = 0
|
|
289
292
|
|
|
290
|
-
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.
|
|
291
|
-
self.
|
|
293
|
+
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.MOTOR_PWM, abs(speed), sw))
|
|
294
|
+
self._get_data(com)
|
|
292
295
|
|
|
293
296
|
def move(self, degrees, steering, speed) -> None:
|
|
294
297
|
if not steering in range(-100, 101):
|
|
@@ -310,8 +313,8 @@ class MotorPair(_ModuleParent):
|
|
|
310
313
|
|
|
311
314
|
if count == 1: target = ~target
|
|
312
315
|
|
|
313
|
-
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.
|
|
314
|
-
self.
|
|
316
|
+
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.MOTOR_REL, speed, (target & 0xFF), (target >> 8) & 0xFF, (target >> 16) & 0xFF, (target >> 24) & 0xFF))
|
|
317
|
+
self._get_data(com)
|
|
315
318
|
|
|
316
319
|
|
|
317
320
|
def move_tank(self, degrees, left_speed, right_speed) -> None:
|
|
@@ -332,8 +335,8 @@ class MotorPair(_ModuleParent):
|
|
|
332
335
|
|
|
333
336
|
if count == 1: target = ~target
|
|
334
337
|
|
|
335
|
-
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.
|
|
336
|
-
self.
|
|
338
|
+
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.MOTOR_REL, speed, (target & 0xFF), (target >> 8) & 0xFF, (target >> 16) & 0xFF, (target >> 24) & 0xFF))
|
|
339
|
+
self._get_data(com)
|
|
337
340
|
|
|
338
341
|
def start_tank(self, left_speed, right_speed) -> None:
|
|
339
342
|
if not left_speed in range(-100, 101) or not right_speed in range(-100, 101):
|
|
@@ -348,5 +351,5 @@ class MotorPair(_ModuleParent):
|
|
|
348
351
|
if speed > 0: sw = 1
|
|
349
352
|
else: sw = 0
|
|
350
353
|
|
|
351
|
-
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.
|
|
352
|
-
self.
|
|
354
|
+
com = bytes((_ConstValue.TRA_DATA + motor, _ConstValue.MOTOR_PWM, abs(speed), sw))
|
|
355
|
+
self._get_data(com)
|
{handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7/src/HandsON_BuildHat_API.egg-info}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: HandsON-BuildHat-API
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: A third-party API for controlling LEGO SPIKE devices
|
|
5
|
-
Author-email: HaNeul Jung <
|
|
5
|
+
Author-email: HaNeul Jung <hnjung@handsontech.co.kr>
|
|
6
6
|
License: Proprietary - Personal/Educational Use Only
|
|
7
7
|
Classifier: Programming Language :: Python :: 3
|
|
8
8
|
Classifier: License :: Other/Proprietary License
|
|
@@ -17,7 +17,7 @@ HandsON Build Hat API
|
|
|
17
17
|
=======
|
|
18
18
|
**Production** : HandsON Technology co., ltd.
|
|
19
19
|
**Author** : HaNeul Jung (hnjung@handsontech.co.kr)
|
|
20
|
-
**Last Update** : 2025-
|
|
20
|
+
**Last Update** : 2025-09-01
|
|
21
21
|
|
|
22
22
|
## 주의
|
|
23
23
|
2025-08-27 이전 판매된 빌드햇 제품의 경우 1.0.4 버전을 사용
|
|
File without changes
|
|
File without changes
|
{handson_buildhat_api-1.0.5 → handson_buildhat_api-1.0.7}/src/HandsON_BuildHat_API/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|