Fix assignment

This commit is contained in:
2026-01-13 18:07:01 -08:00
parent 2301ac357e
commit 83b520d2e2
10 changed files with 55 additions and 22 deletions
+16 -9
View File
@@ -68,6 +68,10 @@ def main():
truck3LoadDebounce = True
while True:
# check for pause time
if globalTime >= pauseTime:
pauseTime = UserUI.TimePrompt(globalTime, truck1, truck2, truck3, package_hash)
# update global time
if globalTime >= datetime.time(10, 20): # If the time is correct for update
pkg9 = package_hash.getItem(9) # Handle the Package #9 address correction before Truck 3 starts
@@ -88,23 +92,26 @@ def main():
truck2.addPkg(package_hash.getItem(pkg_id))
# load packages for truck 3
if globalTime >= truck3.startTime and debounce3: # If its time to laod the packages, run once
debounce3 = False # set debounce for only one run
truck2.hasLoad = True # Set the truck load variable
for pkg_id in t2_load: # Load the packages in truck 2
truck2.addPkg(package_hash.getItem(pkg_id))
if type(truck3.startTime) is datetime.time: # Verify type corectness
if globalTime >= truck3.startTime and debounce3: # If its time to laod the packages, run once
debounce3 = False # set debounce for only one run
truck3.hasLoad = True # Set the truck load variable
for pkg_id in t3_load: # Load the packages in truck 2
truck3.addPkg(package_hash.getItem(pkg_id))
# deliver packages for truck 1
if truck1.hasLoad and globalTime >= truck1.getTimeOfDay(): # if there is more packages and the time has passed
packagesLeft = truck1.driveNextClosest(priority_hash) # deliver the next set of packages
if packagesLeft == 0 and truck3LoadDebounce: # if all the packages are delivered
truck1.driveNextClosest(priority_hash) # deliver the next set of packages
if len(truck1.packages) == 0 and truck3LoadDebounce: # if all the packages are delivered
truck1.driveNextClosest(priority_hash) # drive back to the HUB
truck3LoadDebounce = False # set the debouce
truck3.startTime = truck1.getTimeOfDay() # set truck3 start time
# deliver packages for truck 2
if truck2.hasLoad and globalTime >= truck2.getTimeOfDay(): # if there is more packages and the time has passed
packagesLeft = truck2.driveNextClosest(priority_hash) # deliver the next set of packages
if packagesLeft == 0 and truck3LoadDebounce: # if all the packages are delivered
truck2.driveNextClosest(priority_hash) # deliver the next set of packages
if len(truck2.packages) == 0 and truck3LoadDebounce: # if all the packages are delivered
truck2.driveNextClosest(priority_hash) # drive back to the HUB
truck3LoadDebounce = False # set the debouce
truck3.startTime = truck1.getTimeOfDay() # set truck3 start time