summaryrefslogtreecommitdiff
path: root/i/marvin
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin')
-rw-r--r--i/marvin/runtime/rc/config2
-rw-r--r--i/marvin/src/es/es.cc41
2 files changed, 35 insertions, 8 deletions
diff --git a/i/marvin/runtime/rc/config b/i/marvin/runtime/rc/config
index b420038..89752c9 100644
--- a/i/marvin/runtime/rc/config
+++ b/i/marvin/runtime/rc/config
@@ -49,7 +49,7 @@ es.rvb_sensor_stat = 0
es.rvb_sniff_mask_stat = 0xFFFF
es.rvb_sniff_stat = 0
# Stats of RVB Ball data
-es.rvb_ball_stat = 0
+es.rvb_ball_stat = 5
# Stats of others module (jack + colour selection)
es.others_stat = 0
# Stats for printing out key pressed onto the LCD keyboard
diff --git a/i/marvin/src/es/es.cc b/i/marvin/src/es/es.cc
index 534b136..83fd1dc 100644
--- a/i/marvin/src/es/es.cc
+++ b/i/marvin/src/es/es.cc
@@ -32,10 +32,9 @@
/// Constructeur
Es::Es (const Config & config)
: proto_ (*this), log_ ("Es"), lcdKeyPressed_ (-1), front_sensor_ (false),
- jackIn_ (false), colorModeBlue_ (false),frontTurbineIsFull_(false),
- unknownColor_ (-1), redColor_ (2), blueColor_ (1), greenColor_ (0),
- whiteColor_ (5), blackColor_ (4), leftFrontRVB_ (0), rightFrontRVB_ (1),
- holeRVB_ (2), frontBallRVB_ (3), rearBallRVB_ (4)
+ jackIn_ (false), colorModeBlue_ (false),positionBarillet_(avant0),frontTurbineIsFull_(false), unknownColor_ (-1), redColor_ (2), blueColor_ (1), greenColor_ (0), whiteColor_ (5),
+ blackColor_ (4), leftFrontRVB_ (0), rightFrontRVB_ (1), holeRVB_ (2),
+ frontBallRVB_ (3), rearBallRVB_ (4)
{
// Récupération des valeurs de configuration dans le fichier
loadConfig (config);
@@ -313,6 +312,8 @@ void
Es::deposeBalle(void)
{
proto_.send ('d');
+ barilletDebutLancement();
+ log_ ("Es::Barillet", Log::debug) << "DROP!! ";
frontTurbineIsFull_ = false;
}
@@ -323,29 +324,36 @@ Es::dropWhiteBall(void)
for(int i = 0; i < 5; i++)
if(stockBarillet[i] == white)
{
+ log_ ("Es::Barillet", Log::debug) << "Balle blanche detected en trou: " << i;
switch (i)
{
case 0:
rotationBarillet(arriere0);
positionBarillet_ = arriere0;
+ stockBarillet[0] = empty;
break;
case 1:
rotationBarillet(arriere1);
positionBarillet_ = arriere1;
+ stockBarillet[1] = empty;
break;
case 2:
rotationBarillet(arriere2);
positionBarillet_ = arriere2;
+ stockBarillet[2] = empty;
break;
case 3:
rotationBarillet(arriere3);
positionBarillet_ = arriere3;
+ stockBarillet[3] = empty;
break;
case 4:
rotationBarillet(arriere4);
positionBarillet_ = arriere4;
+ stockBarillet[4] = empty;
break;
}
+ //deposeBalle();
return true;
}
return false;
@@ -358,29 +366,36 @@ Es::dropBlackBall(void)
for(int i = 0; i < 5; i++)
if(stockBarillet[i] == black)
{
+ log_ ("Es::Barillet", Log::debug) << "Balle noire detected en trou: " << i;
switch (i)
{
case 0:
rotationBarillet(arriere0);
positionBarillet_ = arriere0;
+ stockBarillet[0] = empty;
break;
case 1:
rotationBarillet(arriere1);
positionBarillet_ = arriere1;
+ stockBarillet[1] = empty;
break;
case 2:
rotationBarillet(arriere2);
positionBarillet_ = arriere2;
+ stockBarillet[2] = empty;
break;
case 3:
rotationBarillet(arriere3);
positionBarillet_ = arriere3;
+ stockBarillet[3] = empty;
break;
case 4:
rotationBarillet(arriere4);
positionBarillet_ = arriere4;
+ stockBarillet[4] = empty;
break;
}
+ //deposeBalle();
return true;
}
return false;
@@ -395,6 +410,7 @@ Es::setEmptyHoleFront(void)
for(int i = 0; i < 5; i++)
if(stockBarillet[i] == empty)
{
+ log_ ("Es::Barillet", Log::debug) << "vide detected en trou: " << i;
switch (i)
{
case 0:
@@ -517,8 +533,8 @@ void Es::receive(char command, const Proto::Frame & frame)
case 'B':
if (proto_.decode (frame, "bb", stat1 /* Rear */, stat2 /* Front */))
{
- log_ ("Stats RVB Ball", Log::debug) << "[" << decodeColor
- (stat1) << "] [" << decodeColor (stat2) << "]";
+ //log_ ("Stats RVB Ball", Log::debug) << "[" << decodeColor
+ // (stat1) << "] [" << decodeColor (stat2) << "]";
updateAnalysisSensor (stat1, rearBallRVB_, thresholdBallSensors_);
updateAnalysisSensor (stat2, frontBallRVB_, thresholdBallSensors_);
}
@@ -604,24 +620,30 @@ Es::newBallFront(void)
case avant0:
stockBarillet[0] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = avant4;
+ log_ ("Es::Barillet", Log::debug) << "trou 0:" << ((stockBarillet[0] == white)?"white":"pas white");
break;
case avant1:
stockBarillet[1] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = avant0;
+ log_ ("Es::Barillet", Log::debug) << "trou 1:" << ((stockBarillet[1] == white)?"white":"pas white");
break;
case avant2:
stockBarillet[2] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = avant1;
+ log_ ("Es::Barillet", Log::debug) << "trou 2:" << ((stockBarillet[2] == white)?"white":"pas white");
break;
case avant3:
stockBarillet[3] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = avant2;
+ log_ ("Es::Barillet", Log::debug) << "trou 3:" << ((stockBarillet[3] == white)?"white":"pas white");
break;
case avant4:
stockBarillet[4] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = avant3;
+ log_ ("Es::Barillet", Log::debug) << "trou 4:" << ((stockBarillet[4] == white)?"white":"pas white");
break;
default:
+ log_ ("Es::Barillet", Log::debug) << "trou default...";
break;
}
/// On regarde si on redémarre la turbine
@@ -640,22 +662,27 @@ Es::newBallRear(void)
case arriere0:
stockBarillet[0] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = arriere4;
+ log_ ("Es::Barillet", Log::debug) << "trou 0";
break;
case arriere1:
stockBarillet[1] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = arriere0;
+ log_ ("Es::Barillet", Log::debug) << "trou 1";
break;
case arriere2:
stockBarillet[2] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = arriere1;
+ log_ ("Es::Barillet", Log::debug) << "trou 2";
break;
case arriere3:
stockBarillet[3] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = arriere2;
+ log_ ("Es::Barillet", Log::debug) << "trou 3";
break;
case arriere4:
stockBarillet[4] = colorSeen(frontBallRVB_)==whiteColor_?white:black;
positionBarillet_ = arriere3;
+ log_ ("Es::Barillet", Log::debug) << "trou 4";
break;
default:
break;
@@ -683,7 +710,7 @@ bool
Es::barilletIsFull(void)
{
for (int i = 0; i < 5; i++)
- if (stockBarillet[0] == empty)
+ if (stockBarillet[i] == empty)
return false;
return true;
}