summaryrefslogtreecommitdiff
path: root/i/marvin/src/es/es.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/es/es.cc')
-rw-r--r--i/marvin/src/es/es.cc49
1 files changed, 42 insertions, 7 deletions
diff --git a/i/marvin/src/es/es.cc b/i/marvin/src/es/es.cc
index 567830f..8bc90ec 100644
--- a/i/marvin/src/es/es.cc
+++ b/i/marvin/src/es/es.cc
@@ -76,6 +76,7 @@ Es::loadConfig (const Config & config)
rvbSniffRefMask_ = config.get<int> ("es.rvb_sniff_ref_mask");
rvbSniffMaskStat_ = config.get<int> ("es.rvb_sniff_mask_stat");
rvbSniffStat_ = config.get<int> ("es.rvb_sniff_stat");
+ rvbSniffFrontStat_ = config.get<int> ("es.rvb_sniff_front_stat");
rvbBallStat_ = config.get<int> ("es.rvb_ball_stat");
othersStat_ = config.get<int> ("es.others_stat");
lcdKeyStat_ = config.get<int> ("es.lcd_key_stat");
@@ -100,6 +101,7 @@ Es::reset (void)
setRVBSniffStat (rvbSniffMaskStat_, rvbSniffStat_);
setRVBBallStat (rvbBallStat_);
setOthersStat (othersStat_);
+ setRVBSniffFrontStat (rvbSniffFrontStat_);
lcdGetKey (lcdKeyStat_);
// We want to reference some sensors
@@ -169,6 +171,13 @@ Es::setRVBBallStat (int freq)
proto_.send ('B', "b", freq);
}
+/// Set frequency of front sensor in analyse mode
+void
+Es::setRVBSniffFrontStat (int freq)
+{
+ proto_.send ('C', "b", freq);
+}
+
/// Enable all the sensors or just the 4 and 1 near the ground
void
Es::enableAllSensors (bool enable)
@@ -251,12 +260,18 @@ Es::barilletInit (void)
proto_.send ('i');
}
-// Init n2 of barillet
-void Es::init2Barillet(void)
+/// Init turbine to minimal speed
+void Es::barilletDebutLancement (void)
{
proto_.send ('g');
}
+/// Init front turbine to full speed
+void Es::barilletLancement (void)
+{
+ proto_.send ('h');
+}
+
/// Put barillet in sleep mode
void
Es::barilletSleep (void)
@@ -282,6 +297,11 @@ void Es::rotationBarillet(int posFinal)
proto_.send ('t', "b", posFinal);
}
+/// Empty everything in the barillet
+void Es::barilletEmpty (void)
+{
+ proto_.send ('n');
+}
void Es::receive(char command, const Proto::Frame & frame)
{
@@ -294,7 +314,7 @@ void Es::receive(char command, const Proto::Frame & frame)
case 'Z':
if (proto_.decode (frame, "bbbb", stat1, stat2, stat3, stat4))
{
- log_ ("Stats main : ", Log::debug) << stat1 << " " << stat2 << " "
+ log_ ("Stats main", Log::debug) << stat1 << " " << stat2 << " "
<< stat3 << " " << stat4;
}
break;
@@ -302,6 +322,7 @@ void Es::receive(char command, const Proto::Frame & frame)
case 'F':
if (proto_.decode (frame, "b", errCode))
{
+ log_ ("Ack", Log::debug) << "ErrCode :" << errCode;
switch (errCode)
{
case 1:
@@ -315,7 +336,7 @@ void Es::receive(char command, const Proto::Frame & frame)
case 'S':
if (proto_.decode (frame, "wwwww", compt, red, blue, clear, green))
{
- log_ ("Stats RVB Raw : ", Log::debug) << "[" << compt << "] = {"
+ log_ ("Stats RVB Raw", Log::debug) << "[" << compt << "] = {"
<< red << "," << blue << "," << clear << "," << green << "}";
}
break;
@@ -323,15 +344,22 @@ void Es::receive(char command, const Proto::Frame & frame)
case 'A':
if (proto_.decode (frame, "bb", compt, value))
{
- log_ ("Stats RVB Sniff : ", Log::debug) << "[" << compt << "] = "
+ log_ ("Stats RVB Sniff", Log::debug) << "[" << compt << "] = "
<< decodeColor (value);
}
break;
+ case 'C':
+ if (proto_.decode (frame, "bb", stat1, stat2))
+ {
+ log_ ("Stats RVB Front", Log::debug) << decodeColor (stat1)
+ << " - " << decodeColor (stat2);
+ }
+ break;
/* RVB Balls */
case 'B':
if (proto_.decode (frame, "bb", stat1, stat2))
{
- log_ ("Stats RVB Ball : ", Log::debug) << "[" << decodeColor
+ log_ ("Stats RVB Ball", Log::debug) << "[" << decodeColor
(stat1) << "] [" << decodeColor (stat2) << "]";
rvbBall_[0] = stat1;
rvbBall_[1] = stat2;
@@ -359,7 +387,7 @@ void Es::receive(char command, const Proto::Frame & frame)
jack_ = colorModeBlue_ = true;
break;
}
- log_ ("Colour mode : ", Log::debug) << (colorModeBlue_ ? "Blue" : "Red")
+ log_ ("Others", Log::debug) << "Color mode " << (colorModeBlue_ ? "Blue" : "Red")
<< (jack_ ? ", jack in..." : ", jack out !!!");
}
break;
@@ -376,6 +404,13 @@ void Es::receive(char command, const Proto::Frame & frame)
sharps_[compt] = value;
}
break;
+ /* Barillet */
+ case 'W':
+ if (proto_.decode (frame, "bb", stat1, stat2))
+ {
+ log_ ("Barillet", Log::debug) << stat1 << " " << stat2;
+ }
+ break;
}
}