Skip to content

Commit

Permalink
fixes a bug with slot programming, validated working, also doesnt exi…
Browse files Browse the repository at this point in the history
…t when the user likely doesnt want to
  • Loading branch information
sphawes committed Jan 23, 2024
1 parent 6eb92ef commit 97aa457
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions feederBus.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ export class feederBus {
return false;
}

address = parseInt(address);

//program
let response = await this.sendPacket(commands.UNINITIALIZED_FEEDERS_RESPOND, 0xFF);
if(response == false){
resp = await this.modal.show("Programming Feeder Not Found","The feeder you inserted was not detected. Exiting.");
return false;
resp = await this.modal.show("Programming Feeder Not Found","The feeder you inserted was not detected.");
}
else{
//this line does the programming, but it fails because programming takes too long, rs-485 library has too short a timeout
Expand All @@ -472,15 +472,15 @@ export class feederBus {
//instead we confirm by just checking to see if the address has actually been updated
let currentAddress = await this.sendPacket(commands.GET_FEEDER_ADDRESS, 0xFF, response.slice(6))

if(currentAddress != false && currentAddress[1] == i){
if(currentAddress != false && currentAddress[1] == address){

resp = await this.modal.show("Success","Slot has been programmed with address " + address + "! Remove the feeder from the slot, then click OK to program another.");
if(!resp){
return false;
}
}
else{
resp = await this.modal.show("Failure","Programming Failed for slot " + i + ". Click OK to retry.");
resp = await this.modal.show("Failure","Programming Failed for slot " + address + ". Click OK to retry.");
if(!resp){
return false;
}
Expand Down

0 comments on commit 97aa457

Please sign in to comment.