Skip to content

Commit 2944ef8

Browse files
committed
mission_item_protocol: correct range of items updated by eg 'wp changealt'
off-by-one error. This would fail if you tried to update the last item, otherwise it would just upload two items rather than just one
1 parent 36875b4 commit 2944ef8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: MAVProxy/modules/lib/mission_item_protocol.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,14 @@ def change_mission_item_range(self, args, desc, changer, newvalstr):
719719
self.upload_start = time.time()
720720
self.loading_waypoints = True
721721
self.loading_waypoint_lasttime = time.time()
722+
last_idx = idx + count - 1
722723
self.master.mav.mission_write_partial_list_send(
723724
self.target_system,
724725
self.target_component,
725726
self.item_num_to_offset(idx),
726-
self.item_num_to_offset(idx+count),
727+
self.item_num_to_offset(last_idx),
727728
mission_type=self.mav_mission_type())
728-
print(f"Changed {desc} for {self.itemstype()} {idx}:{idx+(count-1)} to {newvalstr}")
729+
print(f"Changed {desc} for {self.itemstype()} {idx}:{last_idx} to {newvalstr}")
729730

730731
def cmd_changealt(self, args):
731732
'''handle wp change target alt of multiple waypoints'''

0 commit comments

Comments
 (0)