Skip to content

Commit bb41812

Browse files
committed
Address copilot review comments
1 parent 105c2a6 commit bb41812

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

radio/app/controllers/paramsController.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,21 @@ def saveParam(self, param_name: str, param_value: Number, param_type: int) -> No
373373
}
374374
)
375375

376-
def getSingleParam(self, params: str) -> Union[CachedParam, dict]:
376+
def getSingleParam(self, param_id: str) -> Union[CachedParam, dict]:
377377
"""
378378
Get a single parameter from the cached params.
379379
380380
Args:
381-
params (Optional[str]): The name of the parameter to get
381+
param_id (str): The ID of the parameter to get
382382
"""
383-
if isinstance(params, str):
383+
if isinstance(param_id, str):
384384
try:
385-
return next((x for x in self.params if x["param_id"] == params))
385+
return next((x for x in self.params if x["param_id"] == param_id))
386386
except StopIteration:
387-
self.drone.logger.error(f"Param {params} not found in cached params")
387+
self.drone.logger.error(f"Param {param_id} not found in cached params")
388388
return {}
389389
else:
390-
self.drone.logger.error(f"Invalid params type, got {type(params)}")
390+
self.drone.logger.error(f"Invalid param_id type, got {type(param_id)}")
391391
return {}
392392

393393
def exportParamsToFile(self, file_path: str) -> Response:

radio/tests/test_gripper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run_once_after_all_tests():
3737

3838
# Ensure gripper is definitely re-enabled even if tests pass
3939
droneStatus.drone.paramsController.setParam(
40-
"GRIP_ENABLE", 1, mavutil.mavlink.MAV_PARAM_TYPE_REAL32
40+
"GRIP_ENABLE", 1, mavutil.mavlink.MAV_PARAM_TYPE_UINT8
4141
)
4242
droneStatus.drone.paramsController.saveParam(
4343
"GRIP_ENABLE", 1, mavutil.mavlink.MAV_PARAM_TYPE_UINT8
@@ -98,7 +98,7 @@ def test_setGripper(socketio_client: SocketIOTestClient, droneStatus):
9898

9999
def test_gripperDisabled(socketio_client: SocketIOTestClient, droneStatus) -> None:
100100
droneStatus.drone.paramsController.setParam(
101-
"GRIP_ENABLE", 0, mavutil.mavlink.MAV_PARAM_TYPE_REAL32
101+
"GRIP_ENABLE", 0, mavutil.mavlink.MAV_PARAM_TYPE_UINT8
102102
)
103103
# Allow time for gripper to be updated
104104
time.sleep(0.5)

0 commit comments

Comments
 (0)