File tree Expand file tree Collapse file tree 3 files changed +22
-27
lines changed
Expand file tree Collapse file tree 3 files changed +22
-27
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ void loop(){
213213 case 1 :
214214 alvik.setBehaviour (LIFT_ILLUMINATOR, true );
215215 break ;
216+ case 2 :
217+ alvik.setBehaviour (BATTERY_ALERT, true );
218+ break ;
216219 default :
217220 alvik.setBehaviour (ALL_BEHAVIOURS, false );
218221 }
Original file line number Diff line number Diff line change @@ -973,39 +973,30 @@ void Arduino_AlvikCarrier::beginBehaviours(){
973973
974974
975975void Arduino_AlvikCarrier::updateBehaviours (){
976- if (behaviours|= 1 == 1 ){
977- /*
976+ if (( 1 <<(LIFT_ILLUMINATOR- 1 )) & behaviours ){
977+
978978 if (isLifted ()&&first_lift){
979- first_lift = false ;
980- prev_illuminator_state = illuminator_state ;
981- disableIlluminator() ;
979+ // disableIlluminator() ;
980+ setIlluminator (LOW) ;
981+ first_lift= false ;
982982 }
983- if (isLifted()&&!first_lift) {
984- if (prev_illuminator_state!=0 ){
985- disableIlluminator( );
983+ else {
984+ if (! isLifted () ){
985+ setIlluminator (prev_illuminator_state );
986986 }
987- }
988- if (!isLifted()&&!first_lift){
989- if (prev_illuminator_state!=0){
990- //first_lift = true;
991- enableIlluminator();
987+ if (!isLifted ()&&!first_lift){
988+ first_lift = true ;
992989 }
993990 }
994- */
995- if (isLifted ()&&first_lift){
996- // disableIlluminator();
997- setIlluminator (LOW);
998- first_lift=false ;
999- }
1000- else {
1001- if (!isLifted ()){
1002- setIlluminator (prev_illuminator_state);
1003- }
1004- if (!isLifted ()&&!first_lift){
1005- first_lift = true ;
1006- }
1007- }
1008991 }
992+
993+ if ((1 << (BATTERY_ALERT-1 )) & behaviours){
994+ led1->setRed (true );
995+ }
996+ else {
997+ led1->setRed (false );
998+ }
999+
10091000}
10101001
10111002void Arduino_AlvikCarrier::setBehaviour (const uint8_t behaviour, const bool enable){
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ const float MOTOR_RATIO = MOTOR_CPR*MOTOR_GEAR_RATIO;
6868
6969#define ALL_BEHAVIOURS 255
7070#define LIFT_ILLUMINATOR 1
71+ #define BATTERY_ALERT 2
7172
7273
7374
You can’t perform that action at this time.
0 commit comments