Skip to content

Commit

Permalink
barman check weight
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetancollaud committed Sep 20, 2018
1 parent 63fbf70 commit 43cf7f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Arduino/CocktailJam/barman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ void Barman::run(unsigned long dtMs){
int positionMm = this->servos->getServoPosMm(this->currentItem.servo);
this->carrier->move(positionMm);
this->state = MOVING;
// Serial.print("moveTo ");
// Serial.println(this->currentItem.servo);

}else if(this->state == MOVING){
if(!this->carrier->isMoving()){
Expand All @@ -43,12 +41,13 @@ void Barman::run(unsigned long dtMs){
}

}else if(this->state == FILLING_START){
this->targetGramme = this->scale->getGramme() + this->currentItem.gramme;
this->servos->open(this->currentItem.servo);
this->state = FILLING_IN_PROGRESS;
this->delayUntilNextAction = 2000;
// this->delayUntilNextAction = 2000;

}else if(this->state == FILLING_IN_PROGRESS){
if(true){ // TODO if we have enough drink
if(this->scale->getGramme()>=this->targetGramme){
this->servos->close(this->currentItem.servo);
// wait for last drop
this->delayUntilNextAction = 2000;
Expand Down
1 change: 1 addition & 0 deletions Arduino/CocktailJam/barman.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Barman

QueueItem queue[QUEUE_SIZE];
int queueSize = 0;
int targetGramme = 0;

unsigned long delayUntilNextAction = 0;
QueueItem currentItem;
Expand Down
2 changes: 1 addition & 1 deletion Arduino/CocktailJam/servos.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Servos

private:
int servo_close[NBSERVOS] = { 0, 0, 0, 0, 0, 0}; //value set when close (in percent)
int servo_open[NBSERVOS] = { 40,50,100,100,100,100 }; // value set when open (in percent)
int servo_open[NBSERVOS] = { 60,70,100,100,100,100 }; // value set when open (in percent)
int servo_posMm[NBSERVOS] = {15, 35, 65, 95, 180, 200}; // in mm

int servo_pins[NBSERVOS] = { 3, 4, 5, 6, 7, 8};
Expand Down

0 comments on commit 43cf7f3

Please sign in to comment.