Skip to content

Commit

Permalink
fix behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
gbr1 committed Oct 9, 2024
1 parent a7a796f commit 3979129
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
3 changes: 3 additions & 0 deletions examples/firmware/firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ void loop(){
case 1:
alvik.setBehaviour(LIFT_ILLUMINATOR, true);
break;
case 2:
alvik.setBehaviour(BATTERY_ALERT, true);
break;
default:
alvik.setBehaviour(ALL_BEHAVIOURS, false);
}
Expand Down
45 changes: 18 additions & 27 deletions src/Arduino_AlvikCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -973,39 +973,30 @@ void Arduino_AlvikCarrier::beginBehaviours(){


void Arduino_AlvikCarrier::updateBehaviours(){
if (behaviours|=1 == 1){
/*
if ((1<<(LIFT_ILLUMINATOR-1)) & behaviours){

if (isLifted()&&first_lift){
first_lift = false;
prev_illuminator_state = illuminator_state;
disableIlluminator();
//disableIlluminator();
setIlluminator(LOW);
first_lift=false;
}
if (isLifted()&&!first_lift) {
if (prev_illuminator_state!=0){
disableIlluminator();
else{
if (!isLifted()){
setIlluminator(prev_illuminator_state);
}
}
if (!isLifted()&&!first_lift){
if (prev_illuminator_state!=0){
//first_lift = true;
enableIlluminator();
if (!isLifted()&&!first_lift){
first_lift = true;
}
}
*/
if (isLifted()&&first_lift){
//disableIlluminator();
setIlluminator(LOW);
first_lift=false;
}
else{
if (!isLifted()){
setIlluminator(prev_illuminator_state);
}
if (!isLifted()&&!first_lift){
first_lift = true;
}
}
}

if ((1 << (BATTERY_ALERT-1)) & behaviours){
led1->setRed(true);
}
else{
led1->setRed(false);
}

}

void Arduino_AlvikCarrier::setBehaviour(const uint8_t behaviour, const bool enable){
Expand Down
1 change: 1 addition & 0 deletions src/definitions/robot_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const float MOTOR_RATIO = MOTOR_CPR*MOTOR_GEAR_RATIO;

#define ALL_BEHAVIOURS 255
#define LIFT_ILLUMINATOR 1
#define BATTERY_ALERT 2



Expand Down

0 comments on commit 3979129

Please sign in to comment.